emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112161: Fix bug #14063 with revertin


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112161: Fix bug #14063 with reverting the *Colors* buffer.
Date: Wed, 27 Mar 2013 18:03:15 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112161
fixes bug: http://debbugs.gnu.org/14063
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2013-03-27 18:03:15 +0200
message:
  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.
modified:
  lisp/ChangeLog
  lisp/facemenu.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-27 14:41:06 +0000
+++ b/lisp/ChangeLog    2013-03-27 16:03:15 +0000
@@ -1,3 +1,10 @@
+2013-03-27  Eli Zaretskii  <address@hidden>
+
+       * facemenu.el (list-colors-callback): New defvar.
+       (list-colors-redisplay): New function.
+       (list-colors-display): Install list-colors-redisplay as the
+       revert-buffer-function.  (Bug#14063)
+
 2013-03-27  Stefan Monnier  <address@hidden>
 
        * minibuffer.el (completion-pcm--merge-completions): Make sure prefixes

=== modified file 'lisp/facemenu.el'
--- a/lisp/facemenu.el  2013-01-01 09:11:05 +0000
+++ b/lisp/facemenu.el  2013-03-27 16:03:15 +0000
@@ -513,12 +513,23 @@
         (* (nth 1 c-rgb) 0.7151522)
         (* (nth 2 c-rgb) 0.0721750))))))
 
+(defvar list-colors-callback nil
+  "Value of CALLBACK arg passed to `list-colors-display'; internal use.")
+
+(defun list-colors-redisplay (_ignore-auto _noconfirm)
+  "Redisplay the colors using `list-colors-sort'.
+
+This is installed as a `revert-buffer-function' in the *Colors* buffer."
+  (list-colors-display nil (buffer-name) list-colors-callback))
+
 (defun list-colors-display (&optional list buffer-name callback)
   "Display names of defined colors, and show what they look like.
 If the optional argument LIST is non-nil, it should be a list of
 colors to display.  Otherwise, this command computes a list of
 colors that the current display can handle.  Customize
 `list-colors-sort' to change the order in which colors are shown.
+Type `g' or \\[revert-buffer] after customizing `list-colors-sort'
+to redisplay colors in the new order.
 
 If the optional argument BUFFER-NAME is nil, it defaults to *Colors*.
 
@@ -566,7 +577,9 @@
       (erase-buffer)
       (list-colors-print list callback)
       (set-buffer-modified-p nil)
-      (setq truncate-lines t)))
+      (setq truncate-lines t)
+      (setq-local list-colors-callback callback)
+      (setq revert-buffer-function 'list-colors-redisplay)))
   (when callback
     (pop-to-buffer buffer-name)
     (message "Click on a color to select it.")))


reply via email to

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