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

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

[nongnu] elpa/git-commit 386d6c0345 1/2: git-commit-setup: Ensure mislea


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 386d6c0345 1/2: git-commit-setup: Ensure misleading message is shadowed
Date: Wed, 17 May 2023 08:01:18 -0400 (EDT)

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

    git-commit-setup: Ensure misleading message is shadowed
    
    `git-commit-usage-message' is long enough to
    potentially span more than one line.  Previously one had to remove
    `with-editor-usage-message' from `git-commit-setup-hook' to prevent
    that.  But then `with-editor-usage-message' wasn't displayed either
    and that meant that the user got to see the misleading message that
    `server-execute' insists on showing.
    
    Add a new mechanism for disabling showing the long message; setting
    `git-commit-usage-message' to nil.
---
 lisp/git-commit.el | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index ac670badd6..98207f2484 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -204,8 +204,7 @@ The major mode configured here is turned on by the minor 
mode
     git-commit-setup-changelog-support
     git-commit-turn-on-auto-fill
     git-commit-propertize-diff
-    bug-reference-mode
-    with-editor-usage-message)
+    bug-reference-mode)
   "Hook run at the end of `git-commit-setup'."
   :group 'git-commit
   :type 'hook
@@ -217,8 +216,7 @@ The major mode configured here is turned on by the minor 
mode
              git-commit-turn-on-orglink
              git-commit-turn-on-flyspell
              git-commit-propertize-diff
-             bug-reference-mode
-             with-editor-usage-message))
+             bug-reference-mode))
 
 (defcustom git-commit-post-finish-hook nil
   "Hook run after the user finished writing a commit message.
@@ -490,11 +488,18 @@ This is only used if Magit is available."
 (when (eq system-type 'windows-nt)
   (add-hook 'find-file-not-found-functions #'git-commit-file-not-found))
 
-(defconst git-commit-usage-message "\
+(defvar git-commit-usage-message "\
 Type \\[with-editor-finish] to finish, \
 \\[with-editor-cancel] to cancel, and \
 \\[git-commit-prev-message] and \\[git-commit-next-message] \
-to recover older messages")
+to recover older messages"
+  "Message displayed when editing a commit message.
+When this is nil, then `with-editor-usage-message' is displayed
+instead.  One of these messages has to be displayed; otherwise
+the users gets to see the message displayed by `server-execute'.
+That message is misleading and because we cannot prevent it from
+being displayed, we have to immediately show another message to
+prevent the user from seeing it.")
 
 (defun git-commit-setup ()
   (when (fboundp 'magit-toplevel)
@@ -529,9 +534,8 @@ to recover older messages")
           (git-commit-mode t)
           (with-editor-mode t))
       (normal-mode t)))
-  ;; Show our own message using our hook.
+  ;; Below we instead explicitly show a message.
   (setq with-editor-show-usage nil)
-  (setq with-editor-usage-message git-commit-usage-message)
   (unless with-editor-mode
     ;; Maybe already enabled when using `shell-command' or an Emacs shell.
     (with-editor-mode 1))
@@ -571,6 +575,9 @@ to recover older messages")
       (open-line 1)))
   (with-demoted-errors "Error running git-commit-setup-hook: %S"
     (run-hooks 'git-commit-setup-hook))
+  (when git-commit-usage-message
+    (setq with-editor-usage-message git-commit-usage-message))
+  (with-editor-usage-message)
   (set-buffer-modified-p nil))
 
 (defun git-commit-run-post-finish-hook (previous)



reply via email to

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