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

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

[nongnu] elpa/git-commit e38500b590 2/2: git-commit-header-line-format:


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit e38500b590 2/2: git-commit-header-line-format: New variable
Date: Wed, 17 May 2023 08:01:19 -0400 (EDT)

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

    git-commit-header-line-format: New variable
    
    Also see previous commit and #4942.
---
 lisp/git-commit.el | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index 98207f2484..8da55cac02 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -488,11 +488,13 @@ 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))
 
-(defvar git-commit-usage-message "\
+(defconst git-commit-default-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")
+
+(defvar git-commit-usage-message git-commit-default-usage-message
   "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
@@ -501,6 +503,14 @@ 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.")
 
+(defvar git-commit-header-line-format nil
+  "If non-nil, header line format used by `git-commit-mode'.
+Used as the local value of `header-line-format', in buffer using
+`git-commit-mode'.  If it is a string, then it is passed through
+`substitute-command-keys' first.  A useful setting may be:
+  (setq git-commit-header-line-format git-commit-default-usage-message)
+  (setq git-commit-usage-message nil) ; show a shorter message")
+
 (defun git-commit-setup ()
   (when (fboundp 'magit-toplevel)
     ;; `magit-toplevel' is autoloaded and defined in magit-git.el,
@@ -578,6 +588,9 @@ prevent the user from seeing it.")
   (when git-commit-usage-message
     (setq with-editor-usage-message git-commit-usage-message))
   (with-editor-usage-message)
+  (when-let ((format git-commit-header-line-format))
+    (setq header-line-format
+          (if (stringp format) (substitute-command-keys format) format)))
   (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]