diff options
| author | Glenn Morris | 2007-03-31 19:41:46 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-03-31 19:41:46 +0000 |
| commit | 0eae9f3ba9eaec9a8693cf113059c52907956e88 (patch) | |
| tree | 7dda7d7221ce925c29621b6418478f23dbc5f298 | |
| parent | c581350323814167f6f14e9b865175e121b51081 (diff) | |
| download | emacs-0eae9f3ba9eaec9a8693cf113059c52907956e88.tar.gz emacs-0eae9f3ba9eaec9a8693cf113059c52907956e88.zip | |
(display-warning): If we create the buffer displaying the warning,
disable undo there.
| -rw-r--r-- | lisp/emacs-lisp/warnings.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index b75f0fd242f..99b0b3f3448 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el | |||
| @@ -218,8 +218,9 @@ Default is :warning. | |||
| 218 | but raise suspicion of a possible problem. | 218 | but raise suspicion of a possible problem. |
| 219 | :debug -- info for debugging only. | 219 | :debug -- info for debugging only. |
| 220 | 220 | ||
| 221 | BUFFER-NAME, if specified, is the name of the buffer for logging the | 221 | BUFFER-NAME, if specified, is the name of the buffer for logging |
| 222 | warning. By default, it is `*Warnings*'. | 222 | the warning. By default, it is `*Warnings*'. If this function |
| 223 | has to create the buffer, it disables undo in the buffer. | ||
| 223 | 224 | ||
| 224 | See the `warnings' custom group for user customization features. | 225 | See the `warnings' custom group for user customization features. |
| 225 | 226 | ||
| @@ -227,16 +228,22 @@ See also `warning-series', `warning-prefix-function' and | |||
| 227 | `warning-fill-prefix' for additional programming features." | 228 | `warning-fill-prefix' for additional programming features." |
| 228 | (unless level | 229 | (unless level |
| 229 | (setq level :warning)) | 230 | (setq level :warning)) |
| 231 | (unless buffer-name | ||
| 232 | (setq buffer-name "*Warnings*")) | ||
| 230 | (if (assq level warning-level-aliases) | 233 | (if (assq level warning-level-aliases) |
| 231 | (setq level (cdr (assq level warning-level-aliases)))) | 234 | (setq level (cdr (assq level warning-level-aliases)))) |
| 232 | (or (< (warning-numeric-level level) | 235 | (or (< (warning-numeric-level level) |
| 233 | (warning-numeric-level warning-minimum-log-level)) | 236 | (warning-numeric-level warning-minimum-log-level)) |
| 234 | (warning-suppress-p type warning-suppress-log-types) | 237 | (warning-suppress-p type warning-suppress-log-types) |
| 235 | (let* ((typename (if (consp type) (car type) type)) | 238 | (let* ((typename (if (consp type) (car type) type)) |
| 236 | (buffer (get-buffer-create (or buffer-name "*Warnings*"))) | 239 | (old (get-buffer buffer-name)) |
| 240 | (buffer (get-buffer-create buffer-name)) | ||
| 237 | (level-info (assq level warning-levels)) | 241 | (level-info (assq level warning-levels)) |
| 238 | start end) | 242 | start end) |
| 239 | (with-current-buffer buffer | 243 | (with-current-buffer buffer |
| 244 | ;; If we created the buffer, disable undo. | ||
| 245 | (unless old | ||
| 246 | (setq buffer-undo-list t)) | ||
| 240 | (goto-char (point-max)) | 247 | (goto-char (point-max)) |
| 241 | (when (and warning-series (symbolp warning-series)) | 248 | (when (and warning-series (symbolp warning-series)) |
| 242 | (setq warning-series | 249 | (setq warning-series |