(follow-mode): Don't run hooks twice. Use `when'.
[bpt/emacs.git] / lisp / facemenu.el
index eaaf4da..26a0231 100644 (file)
@@ -1,7 +1,7 @@
 ;;; facemenu.el --- create a face menu for interactively adding fonts to text
 
 ;; Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004,
-;;   2005, 2006 Free Software Foundation, Inc.
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: faces
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -132,6 +132,15 @@ just before \"Other\" at the end."
   :type 'boolean
   :group 'facemenu)
 
+(defvar facemenu-unlisted-faces
+  `(modeline region secondary-selection highlight scratch-face
+    ,(purecopy "^font-lock-") ,(purecopy "^gnus-") ,(purecopy "^message-")
+    ,(purecopy "^ediff-") ,(purecopy "^term-") ,(purecopy "^vc-")
+    ,(purecopy "^widget-") ,(purecopy "^custom-") ,(purecopy "^vm-"))
+  "*List of faces that are of no interest to the user.")
+(make-obsolete-variable 'facemenu-unlisted-faces 'facemenu-listed-faces
+                       "since 22.1,\nand has no effect on the Face menu")
+
 (defcustom facemenu-listed-faces nil
   "*List of faces to include in the Face menu.
 Each element should be a symbol, the name of a face.
@@ -685,11 +694,17 @@ This is called whenever you create a new face, and at other times."
            symbol (intern name)))
     (setq menu 'facemenu-face-menu)
     (setq docstring
-         (format "Select face `%s' for subsequent insertion."
-                 name))
+         (format "Select face `%s' for subsequent insertion.
+If the mark is active and there is no prefix argument,
+apply face `%s' to the region instead.
+This command was defined by `facemenu-add-new-face'."
+                 name name))
     (cond ((facemenu-iterate ; check if equivalent face is already in the menu
            (lambda (m) (and (listp m)
                             (symbolp (car m))
+                            ;; Avoid error in face-equal
+                            ;; when a non-face is erroneously present.
+                            (facep (car m))
                             (face-equal (car m) symbol)))
            (cdr (symbol-function menu))))
          ;; Faces with a keyboard equivalent.  These go at the front.