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

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

[nongnu] elpa/git-commit fa0997797b 2/3: magit-process-filter: Suppress


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit fa0997797b 2/3: magit-process-filter: Suppress bogus error when aborting emacsclient
Date: Fri, 20 Jan 2023 11:59:11 -0500 (EST)

branch: elpa/git-commit
commit fa0997797bb0965763f416a17415ec2d23a955ea
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-process-filter: Suppress bogus error when aborting emacsclient
    
    Re https://github.com/magit/with-editor/issues/118.
---
 lisp/magit-process.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lisp/magit-process.el b/lisp/magit-process.el
index 7cd7b71679..d4392b2fe7 100644
--- a/lisp/magit-process.el
+++ b/lisp/magit-process.el
@@ -755,6 +755,7 @@ Magit status buffer."
       (when-let ((ret-pos (cl-position ?\r string :from-end t)))
         (cl-callf substring string (1+ ret-pos))
         (delete-region (line-beginning-position) (point)))
+      (setq string (magit-process-remove-bogus-errors string))
       (insert (propertize string 'magit-section
                           (process-get proc 'section)))
       (set-marker (process-mark proc) (point))
@@ -780,6 +781,17 @@ Magit status buffer."
        (let ((minibuffer-local-map ,map))
          ,@body))))
 
+(defun magit-process-remove-bogus-errors (str)
+  (save-match-data
+    (when (string-match "^\\(\\*ERROR\\*: \\)Canceled by user" str)
+      (setq str (replace-match "" nil nil str 1)))
+    (when (string-match "^error: There was a problem with the editor.*\n" str)
+      (setq str (replace-match "" nil nil str)))
+    (when (string-match
+           "^Please supply the message using either -m or -F option\\.\n" str)
+      (setq str (replace-match "" nil nil str))))
+  str)
+
 (defun magit-process-yes-or-no-prompt (process string)
   "Forward Yes-or-No prompts to the user."
   (when-let ((beg (string-match magit-process-yes-or-no-prompt-regexp string)))



reply via email to

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