diff options
| author | Glenn Morris | 2019-06-16 17:31:49 -0700 |
|---|---|---|
| committer | Glenn Morris | 2019-06-16 17:37:21 -0700 |
| commit | 9d702b4cd8da1c1907b02869067a50933716631b (patch) | |
| tree | 303f0bd67411448281adf1dea9222573f0034980 | |
| parent | 309743b465b569e4954e9c03c16fd675af5efc52 (diff) | |
| download | emacs-9d702b4cd8da1c1907b02869067a50933716631b.tar.gz emacs-9d702b4cd8da1c1907b02869067a50933716631b.zip | |
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.
| -rw-r--r-- | doc/lispref/display.texi | 4 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | 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 8e94063725d..7e8abb04400 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 | |||
| 775 | use for filling each warning's text. | 775 | use for filling each warning's text. |
| 776 | @end defvar | 776 | @end defvar |
| 777 | 777 | ||
| 778 | @defvar warning-fill-column | ||
| 779 | The column at which to fill warnings. | ||
| 780 | @end defvar | ||
| 781 | |||
| 778 | @defvar warning-type-format | 782 | @defvar warning-type-format |
| 779 | This variable specifies the format for displaying the warning type | 783 | This variable specifies the format for displaying the warning type |
| 780 | in the warning message. The result of formatting the type this way | 784 | in the warning message. The result of formatting the type this way |
| @@ -515,6 +515,9 @@ In the current follow group of windows, "ghost" cursors are no longer | |||
| 515 | displayed in the non-selected follow windows. To get the old behavior | 515 | displayed in the non-selected follow windows. To get the old behavior |
| 516 | back, customize 'follow-hide-ghost-cursors' to nil. | 516 | back, customize 'follow-hide-ghost-cursors' to nil. |
| 517 | 517 | ||
| 518 | +++ | ||
| 519 | ** New variable 'warning-fill-column' for 'display-warning'. | ||
| 520 | |||
| 518 | ** Windmove | 521 | ** Windmove |
| 519 | 522 | ||
| 520 | *** 'windmove-create-window' when non-nil makes a new window on moving off | 523 | *** '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 13ca605dd00..1207353ba30 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.") | |||
| 153 | (defvar warning-fill-prefix nil | 153 | (defvar warning-fill-prefix nil |
| 154 | "Non-nil means fill each warning text using this string as `fill-prefix'.") | 154 | "Non-nil means fill each warning text using this string as `fill-prefix'.") |
| 155 | 155 | ||
| 156 | ;; I don't see why it can't just use the buffer-local fill-column, | ||
| 157 | ;; but at least this is better than hard-coding 78. | ||
| 158 | (defvar warning-fill-column 78 | ||
| 159 | "Value to use for `fill-column' when filling warnings.") | ||
| 160 | |||
| 156 | ;; The autoload cookie is so that programs can bind this variable | 161 | ;; The autoload cookie is so that programs can bind this variable |
| 157 | ;; safely, testing the existing value, before they call one of the | 162 | ;; safely, testing the existing value, before they call one of the |
| 158 | ;; warnings functions. | 163 | ;; warnings functions. |
| @@ -222,8 +227,9 @@ has to create the buffer, it disables undo in the buffer. | |||
| 222 | 227 | ||
| 223 | See the `warnings' custom group for user customization features. | 228 | See the `warnings' custom group for user customization features. |
| 224 | 229 | ||
| 225 | See also `warning-series', `warning-prefix-function' and | 230 | See also `warning-series', `warning-prefix-function', |
| 226 | `warning-fill-prefix' for additional programming features." | 231 | `warning-fill-prefix', and `warning-fill-column' for additional |
| 232 | programming features." | ||
| 227 | (if (not (or after-init-time noninteractive (daemonp))) | 233 | (if (not (or after-init-time noninteractive (daemonp))) |
| 228 | ;; Ensure warnings that happen early in the startup sequence | 234 | ;; Ensure warnings that happen early in the startup sequence |
| 229 | ;; are visible when startup completes (bug#20792). | 235 | ;; are visible when startup completes (bug#20792). |
| @@ -271,7 +277,7 @@ See also `warning-series', `warning-prefix-function' and | |||
| 271 | (funcall newline) | 277 | (funcall newline) |
| 272 | (when (and warning-fill-prefix (not (string-match "\n" message))) | 278 | (when (and warning-fill-prefix (not (string-match "\n" message))) |
| 273 | (let ((fill-prefix warning-fill-prefix) | 279 | (let ((fill-prefix warning-fill-prefix) |
| 274 | (fill-column 78)) | 280 | (fill-column warning-fill-column)) |
| 275 | (fill-region start (point)))) | 281 | (fill-region start (point)))) |
| 276 | (setq end (point))) | 282 | (setq end (point))) |
| 277 | (when (and (markerp warning-series) | 283 | (when (and (markerp warning-series) |