diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2019-07-30 20:31:38 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2019-07-30 20:31:38 +0200 |
commit | 66a328e1c6cdd1995bc9294809ed8982e772aea7 (patch) | |
tree | 080c0a82d6207a014a2e0928577b1fae7e15225b /helm-imenu.el | |
parent | 1d260aace8515a6e59e05330c1ca0a345a8013f1 (diff) |
Speed up helm-imenu-next-or-previous-section
* helm-imenu.el (helm-imenu-next-or-previous-section): Do it.
Diffstat (limited to 'helm-imenu.el')
-rw-r--r-- | helm-imenu.el | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/helm-imenu.el b/helm-imenu.el index b767e942..2ff19723 100644 --- a/helm-imenu.el +++ b/helm-imenu.el @@ -103,20 +103,21 @@ Each car is a regexp match pattern of the imenu type string." (define-key helm-imenu-map (kbd "<left>") nil)))) (defun helm-imenu-next-or-previous-section (n) - (with-helm-buffer + (with-helm-window (let* ((fn (lambda () - (car (split-string (helm-get-selection nil t) - helm-imenu-delimiter)))) + (car (split-string + (buffer-substring + (point-at-bol) (point-at-eol)) + helm-imenu-delimiter)))) (curtype (funcall fn)) - (move-fn (if (> n 0) #'helm-next-line #'helm-previous-line)) (stop-fn (if (> n 0) #'helm-end-of-source-p #'helm-beginning-of-source-p))) - (helm-without-follow - (while (and (not (funcall stop-fn)) - (string= curtype (funcall fn))) - (funcall move-fn))) - (helm-follow-execute-persistent-action-maybe 0.1)))) + (while (and (not (funcall stop-fn)) + (string= curtype (funcall fn))) + (forward-line n)) + (helm-mark-current-line) + (helm-follow-execute-persistent-action-maybe)))) (defun helm-imenu-next-section () (interactive) |