branch: elpa/helm
commit 45e2751cfb1a611d491b173bad85c02f7450126b
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Add a next-error revert buffer command
---
 helm-grep.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/helm-grep.el b/helm-grep.el
index 958e057daf..acc6f1178f 100644
--- a/helm-grep.el
+++ b/helm-grep.el
@@ -891,6 +891,22 @@ This is the `next-error-function' for `helm-grep-mode'."
       (user-error "No more matches"))))
 (put 'helm-grep-next-error 'helm-only t)
 
+;;;###autoload
+(defun helm-revert-next-error-last-buffer ()
+  "Revert last `next-error' buffer from `current-buffer'.
+
+Accept to revert only `helm-grep-mode' or `helm-occur-mode' buffers.
+Use this when you want to revert the `next-error' buffer after
+modifications in `current-buffer'."
+  (interactive)
+  (let ((buffer (next-error-find-buffer)))
+    (if buffer
+        (with-current-buffer buffer
+          (if (memq major-mode '(helm-grep-mode helm-occur-mode))
+              (revert-buffer)
+            (error "No suitable buffer to revert found")))
+      (error "No suitable buffer to revert found"))))
+
 (define-derived-mode helm-grep-mode
     special-mode "helm-grep"
     "Major mode to provide actions in helm grep saved buffer.

Reply via email to