branch: elpa/magit commit cf0ff53222a76ccc4cd6a6dbe8f80421b55fdbb4 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-show-process-buffer-hint: New option --- docs/magit.org | 7 +++++-- docs/magit.texi | 7 +++++-- lisp/magit-process.el | 36 +++++++++++++++++++++++++++++++----- lisp/magit-status.el | 3 ++- 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/docs/magit.org b/docs/magit.org index 41bc1d7773..e889ad2ef9 100644 --- a/docs/magit.org +++ b/docs/magit.org @@ -1894,8 +1894,11 @@ line until the next magit buffer refresh. If you do not wish process errors to be indicated in the mode line, set ~magit-process-display-mode-line-error~ to ~nil~. -Process errors are additionally displayed at the top of the status -buffer and in the echo area. +Process errors are displayed at the top of the status buffer and in +the echo area. In both places a hint is appended, which informs users +that they can see the full output in the process buffer and how to +display that buffer. However, once you are aware of that, you might +want to set ~magit-show-process-buffer-hint~ to ~nil~. *** Running Git Manually diff --git a/docs/magit.texi b/docs/magit.texi index 65a5551731..dde258b7ee 100644 --- a/docs/magit.texi +++ b/docs/magit.texi @@ -2218,8 +2218,11 @@ line until the next magit buffer refresh. If you do not wish process errors to be indicated in the mode line, set @code{magit-process-display-mode-line-error} to @code{nil}. -Process errors are additionally displayed at the top of the status -buffer and in the echo area. +Process errors are displayed at the top of the status buffer and in +the echo area. In both places a hint is appended, which informs users +that they can see the full output in the process buffer and how to +display that buffer. However, once you are aware of that, you might +want to set @code{magit-show-process-buffer-hint} to @code{nil}. @anchor{Running Git Manually} @subsection Running Git Manually diff --git a/lisp/magit-process.el b/lisp/magit-process.el index bc5d37125e..fcc4b30370 100644 --- a/lisp/magit-process.el +++ b/lisp/magit-process.el @@ -249,11 +249,36 @@ implement such functions." :type 'boolean) (defcustom magit-process-display-mode-line-error t - "Whether Magit should retain and highlight process errors in the mode line." + "Whether Magit should retain and highlight process errors in the mode line. + +See `magit-show-process-buffer-hint' for another way to display the +complete output on demand." :package-version '(magit . "2.12.0") :group 'magit-process :type 'boolean) +(defcustom magit-show-process-buffer-hint t + "Whether to append hint about process buffer to Git error messages. + +When Magit runs Git for side-effects, the output is always logged to +a per-repository process buffer. If Git exits with a non-zero status, +then a single line of its error output is shown in the repositories +status buffer and in the echo area. + +When a user want to learn more about the error, they can switch to that +process buffer, to see the complete output, but initially users are not +aware of this, so Magit appends a usage hint to the error message in +both of these places. + +Once you are aware of this, you probably won't need the reminder and can +set this option to nil. + +See `magit-process-display-mode-line-error' for another way to display +the complete output on demand." + :package-version '(magit . "4.3.7") + :group 'magit-process + :type 'boolean) + (defcustom magit-process-apply-ansi-colors nil "Whether and when to apply color escapes in the process buffer. @@ -1237,10 +1262,11 @@ Limited by `magit-process-error-tooltip-max-lines'." (with-current-buffer status-buf (setq magit-this-error msg))))) (let ((usage - (if-let ((keys (where-is-internal 'magit-process-buffer))) - (format "Type %s to see %S for details" - (key-description (car keys)) process-buf) - (format "See %S for details" process-buf)))) + (and magit-show-process-buffer-hint + (if-let ((keys (where-is-internal 'magit-process-buffer))) + (format "Type %s to see %S for details" + (key-description (car keys)) process-buf) + (format "See %S for details" process-buf))))) (if magit-process-raise-error (signal 'magit-git-error (list msg (or usage (list 'in default-dir)))) diff --git a/lisp/magit-status.el b/lisp/magit-status.el index 68c7ce050a..f4d70d1099 100644 --- a/lisp/magit-status.el +++ b/lisp/magit-status.el @@ -547,7 +547,8 @@ the status buffer causes this section to disappear again." (insert (propertize (format "%-10s" "GitError! ") 'font-lock-face 'magit-section-heading)) (insert (propertize magit-this-error 'font-lock-face 'error)) - (when-let ((key (car (where-is-internal 'magit-process-buffer)))) + (when-let ((magit-show-process-buffer-hint) + (key (car (where-is-internal 'magit-process-buffer)))) (insert (format " [Type `%s' for details]" (key-description key)))) (insert ?\n)) (setq magit-this-error nil)))