emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 9d702b4 1/4: Don't hard-code the fill-column for di


From: Glenn Morris
Subject: [Emacs-diffs] master 9d702b4 1/4: Don't hard-code the fill-column for display-warning
Date: Sun, 16 Jun 2019 20:37:38 -0400 (EDT)

branch: master
commit 9d702b4cd8da1c1907b02869067a50933716631b
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Don't hard-code the fill-column for display-warning
    
    * lisp/emacs-lisp/warnings.el (warning-fill-column): New variable.
    (display-warning): Use warning-fill-column.
    * doc/lispref/display.texi (Warning Variables):
    Mention warning-fill-column.
---
 doc/lispref/display.texi    |  4 ++++
 etc/NEWS                    |  3 +++
 lisp/emacs-lisp/warnings.el | 12 +++++++++---
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 8e94063..7e8abb0 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -775,6 +775,10 @@ When this variable is non-@code{nil}, it specifies a fill 
prefix to
 use for filling each warning's text.
 @end defvar
 
+@defvar warning-fill-column
+The column at which to fill warnings.
+@end defvar
+
 @defvar warning-type-format
 This variable specifies the format for displaying the warning type
 in the warning message.  The result of formatting the type this way
diff --git a/etc/NEWS b/etc/NEWS
index 723f0a0..71052aa 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -515,6 +515,9 @@ In the current follow group of windows, "ghost" cursors are 
no longer
 displayed in the non-selected follow windows.  To get the old behavior
 back, customize 'follow-hide-ghost-cursors' to nil.
 
++++
+** New variable 'warning-fill-column' for 'display-warning'.
+
 ** Windmove
 
 *** 'windmove-create-window' when non-nil makes a new window on moving off
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 13ca605..1207353 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -153,6 +153,11 @@ also call that function before the next warning.")
 (defvar warning-fill-prefix nil
   "Non-nil means fill each warning text using this string as `fill-prefix'.")
 
+;; I don't see why it can't just use the buffer-local fill-column,
+;; but at least this is better than hard-coding 78.
+(defvar warning-fill-column 78
+  "Value to use for `fill-column' when filling warnings.")
+
 ;; The autoload cookie is so that programs can bind this variable
 ;; safely, testing the existing value, before they call one of the
 ;; warnings functions.
@@ -222,8 +227,9 @@ has to create the buffer, it disables undo in the buffer.
 
 See the `warnings' custom group for user customization features.
 
-See also `warning-series', `warning-prefix-function' and
-`warning-fill-prefix' for additional programming features."
+See also `warning-series', `warning-prefix-function',
+`warning-fill-prefix', and `warning-fill-column' for additional
+programming features."
   (if (not (or after-init-time noninteractive (daemonp)))
       ;; Ensure warnings that happen early in the startup sequence
       ;; are visible when startup completes (bug#20792).
@@ -271,7 +277,7 @@ See also `warning-series', `warning-prefix-function' and
               (funcall newline)
              (when (and warning-fill-prefix (not (string-match "\n" message)))
                (let ((fill-prefix warning-fill-prefix)
-                     (fill-column 78))
+                     (fill-column warning-fill-column))
                  (fill-region start (point))))
              (setq end (point)))
            (when (and (markerp warning-series)



reply via email to

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