X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/d80d54b289a971d7a98dc5fafebaa957082c8222..a2f5f4319321478cbfd4b26f9c6e7d4de776ae26:/lisp/facemenu.el diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 88b9ddc7f5..eb4554585a 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -1,6 +1,6 @@ ;;; facemenu.el --- create a face menu for interactively adding fonts to text -;; Copyright (C) 1994-1996, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1994-1996, 2001-2013 Free Software Foundation, Inc. ;; Author: Boris Goldowsky ;; Keywords: faces @@ -329,7 +329,7 @@ This command can also add FACE to the menu of faces, if `facemenu-listed-faces' says to do that." (interactive (list (progn (barf-if-buffer-read-only) - (read-face-name "Use face")) + (read-face-name "Use face" (face-at-point t))) (if (and mark-active (not current-prefix-arg)) (region-beginning)) (if (and mark-active (not current-prefix-arg)) @@ -513,12 +513,23 @@ filter out the color from the output." (* (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 @@ color. The function should accept a single argument, the color name." (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.")))