diff options
| author | Eli Zaretskii | 2013-03-27 18:03:15 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-03-27 18:03:15 +0200 |
| commit | b59f639d99a4bb3f29d8700c084b2b4082eba877 (patch) | |
| tree | 657ddce741d5cba5e4ab768a79fcb8357af22fe2 | |
| parent | b1da29572e811d18ee5f200a28192ea2f58ff9bf (diff) | |
| download | emacs-b59f639d99a4bb3f29d8700c084b2b4082eba877.tar.gz emacs-b59f639d99a4bb3f29d8700c084b2b4082eba877.zip | |
Fix bug #14063 with reverting the *Colors* buffer.
lisp/facemenu.el (list-colors-callback): New defvar.
(list-colors-redisplay): New function.
(list-colors-display): Install list-colors-redisplay as the
revert-buffer-function.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/facemenu.el | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fecad470900..00a105b5142 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-03-27 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * facemenu.el (list-colors-callback): New defvar. | ||
| 4 | (list-colors-redisplay): New function. | ||
| 5 | (list-colors-display): Install list-colors-redisplay as the | ||
| 6 | revert-buffer-function. (Bug#14063) | ||
| 7 | |||
| 1 | 2013-03-27 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2013-03-27 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * minibuffer.el (completion-pcm--merge-completions): Make sure prefixes | 10 | * minibuffer.el (completion-pcm--merge-completions): Make sure prefixes |
diff --git a/lisp/facemenu.el b/lisp/facemenu.el index e86c1c23d66..9a66edd28fc 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el | |||
| @@ -513,12 +513,23 @@ filter out the color from the output." | |||
| 513 | (* (nth 1 c-rgb) 0.7151522) | 513 | (* (nth 1 c-rgb) 0.7151522) |
| 514 | (* (nth 2 c-rgb) 0.0721750)))))) | 514 | (* (nth 2 c-rgb) 0.0721750)))))) |
| 515 | 515 | ||
| 516 | (defvar list-colors-callback nil | ||
| 517 | "Value of CALLBACK arg passed to `list-colors-display'; internal use.") | ||
| 518 | |||
| 519 | (defun list-colors-redisplay (_ignore-auto _noconfirm) | ||
| 520 | "Redisplay the colors using `list-colors-sort'. | ||
| 521 | |||
| 522 | This is installed as a `revert-buffer-function' in the *Colors* buffer." | ||
| 523 | (list-colors-display nil (buffer-name) list-colors-callback)) | ||
| 524 | |||
| 516 | (defun list-colors-display (&optional list buffer-name callback) | 525 | (defun list-colors-display (&optional list buffer-name callback) |
| 517 | "Display names of defined colors, and show what they look like. | 526 | "Display names of defined colors, and show what they look like. |
| 518 | If the optional argument LIST is non-nil, it should be a list of | 527 | If the optional argument LIST is non-nil, it should be a list of |
| 519 | colors to display. Otherwise, this command computes a list of | 528 | colors to display. Otherwise, this command computes a list of |
| 520 | colors that the current display can handle. Customize | 529 | colors that the current display can handle. Customize |
| 521 | `list-colors-sort' to change the order in which colors are shown. | 530 | `list-colors-sort' to change the order in which colors are shown. |
| 531 | Type `g' or \\[revert-buffer] after customizing `list-colors-sort' | ||
| 532 | to redisplay colors in the new order. | ||
| 522 | 533 | ||
| 523 | If the optional argument BUFFER-NAME is nil, it defaults to *Colors*. | 534 | If the optional argument BUFFER-NAME is nil, it defaults to *Colors*. |
| 524 | 535 | ||
| @@ -566,7 +577,9 @@ color. The function should accept a single argument, the color name." | |||
| 566 | (erase-buffer) | 577 | (erase-buffer) |
| 567 | (list-colors-print list callback) | 578 | (list-colors-print list callback) |
| 568 | (set-buffer-modified-p nil) | 579 | (set-buffer-modified-p nil) |
| 569 | (setq truncate-lines t))) | 580 | (setq truncate-lines t) |
| 581 | (setq-local list-colors-callback callback) | ||
| 582 | (setq revert-buffer-function 'list-colors-redisplay))) | ||
| 570 | (when callback | 583 | (when callback |
| 571 | (pop-to-buffer buffer-name) | 584 | (pop-to-buffer buffer-name) |
| 572 | (message "Click on a color to select it."))) | 585 | (message "Click on a color to select it."))) |