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

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

[nongnu] elpa/helm 45e2751cfb 3/3: Add a next-error revert buffer comman


From: ELPA Syncer
Subject: [nongnu] elpa/helm 45e2751cfb 3/3: Add a next-error revert buffer command
Date: Thu, 10 Feb 2022 03:02:33 -0500 (EST)

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

    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

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