emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/helm 4684fffbaa 2/5: Add next-error-function for helm-occu


From: ELPA Syncer
Subject: [nongnu] elpa/helm 4684fffbaa 2/5: Add next-error-function for helm-occur-mode buffers #2065
Date: Wed, 9 Feb 2022 09:06:23 -0500 (EST)

branch: elpa/helm
commit 4684fffbaad1ee4c4ee765674993460ecf48b296
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Add next-error-function for helm-occur-mode buffers #2065
---
 helm-occur.el | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/helm-occur.el b/helm-occur.el
index 53e666b725..b0abd13163 100644
--- a/helm-occur.el
+++ b/helm-occur.el
@@ -684,9 +684,28 @@ Special commands:
     (set (make-local-variable 'revert-buffer-function)
          #'helm-occur-mode--revert-buffer-function)
     (set (make-local-variable 'helm-occur-mode--last-pattern)
-         helm-input))
+         helm-input)
+    (set (make-local-variable 'next-error-function)
+         #'helm-occur-next-error))
 (put 'helm-moccur-mode 'helm-only t)
 
+(defun helm-occur-next-error (&optional argp reset)
+  "Goto ARGP position from a `helm-occur-mode' buffer.
+This is the `next-error-function' for `helm-occur-mode'."
+  (interactive "p")
+  (goto-char (cond (reset (point-min))
+                  ((< argp 0) (line-beginning-position))
+                  ((> argp 0) (line-end-position))
+                  ((point))))
+  (let ((fun (if (> argp 0)
+                 #'next-single-property-change
+               #'previous-single-property-change)))
+    (helm-aif (funcall fun (point) 'buffer-name)
+        (progn
+          (goto-char it)
+          (forward-line 0)
+          (helm-occur-mode-goto-line))
+      (user-error "No more matches"))))
 
 ;;; Resume
 ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]