summaryrefslogtreecommitdiff
path: root/helm-imenu.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2019-11-12 20:43:27 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2019-11-12 20:43:27 +0100
commitf5c486119bd69b80e9536426ebc44194a481f774 (patch)
tree20f4d45a368334c3f01c947b06d091fbfe245b0a /helm-imenu.el
parente447abdf4dec07835cf47a50ff0905ea17a6b713 (diff)
Fix again preselection in imenu
* helm-imenu.el (helm-imenu): Do it. (helm-imenu-in-all-buffers): Do it.
Diffstat (limited to 'helm-imenu.el')
-rw-r--r--helm-imenu.el44
1 files changed, 22 insertions, 22 deletions
diff --git a/helm-imenu.el b/helm-imenu.el
index 6a33c314..d680c35e 100644
--- a/helm-imenu.el
+++ b/helm-imenu.el
@@ -317,16 +317,16 @@ Each car is a regexp match pattern of the imenu type string."
(setq helm-source-imenu
(helm-make-source "Imenu" 'helm-imenu-source
:fuzzy-match helm-imenu-fuzzy-match)))
- (let ((imenu-auto-rescan t)
- (str (thing-at-point 'symbol))
- (helm-execute-action-at-once-if-one
- helm-imenu-execute-action-at-once-if-one))
+ (let* ((imenu-auto-rescan t)
+ (str (thing-at-point 'symbol))
+ (init-reg (and str (concat "\\_<" (regexp-quote str) "\\_>")))
+ (helm-execute-action-at-once-if-one
+ helm-imenu-execute-action-at-once-if-one))
(helm :sources 'helm-source-imenu
- :default (and str (list (concat "\\_<" (and str (regexp-quote str)) "\\_>") str))
+ :default (and str (list init-reg str))
:preselect (helm-aif (which-function)
- (concat "\\_<" it "\\_>")
- (unless helm--maybe-use-default-as-input
- (and str str)))
+ (concat "\\_<" (regexp-quote it) "\\_>")
+ init-reg)
:buffer "*helm imenu*")))
;;;###autoload
@@ -348,22 +348,22 @@ or it have an association in `helm-imenu-all-buffer-assoc'."
(helm-imenu-candidates-in-all-buffers)))
:candidates 'helm-imenu--in-all-buffers-cache
:fuzzy-match helm-imenu-fuzzy-match))))
- (let ((imenu-auto-rescan t)
- (str (thing-at-point 'symbol))
- (helm-execute-action-at-once-if-one
- helm-imenu-execute-action-at-once-if-one)
- (helm--maybe-use-default-as-input
- (not (null (memq 'helm-source-imenu-all
- helm-sources-using-default-as-input))))
- (sources (if helm-imenu-in-all-buffers-separate-sources
- (helm-imenu-candidates-in-all-buffers 'build-sources)
- '(helm-source-imenu-all))))
+ (let* ((imenu-auto-rescan t)
+ (str (thing-at-point 'symbol))
+ (init-reg (and str (concat "\\_<" (regexp-quote str) "\\_>")))
+ (helm-execute-action-at-once-if-one
+ helm-imenu-execute-action-at-once-if-one)
+ (helm--maybe-use-default-as-input
+ (not (null (memq 'helm-source-imenu-all
+ helm-sources-using-default-as-input))))
+ (sources (if helm-imenu-in-all-buffers-separate-sources
+ (helm-imenu-candidates-in-all-buffers 'build-sources)
+ '(helm-source-imenu-all))))
(helm :sources sources
- :default (and str (list (concat "\\_<" (and str (regexp-quote str)) "\\_>") str))
+ :default (and str (list init-reg str))
:preselect (helm-aif (which-function)
- (concat "\\_<" it "\\_>")
- (unless helm--maybe-use-default-as-input
- (and str str)))
+ (concat "\\_<" (regexp-quote it) "\\_>")
+ init-reg)
:buffer "*helm imenu all*")))
(provide 'helm-imenu)