Test for lazy-lock-mode before swapping hooks.
[bpt/emacs.git] / lisp / facemenu.el
index 3e85ada..4e0d293 100644 (file)
@@ -1,5 +1,6 @@
 ;;; facemenu.el --- create a face menu for interactively adding fonts to text
-;; Copyright (c) 1994, 1995 Free Software Foundation, Inc.
+
+;; Copyright (c) 1994, 1995, 1996 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.ai.mit.edu>
 ;; Keywords: faces
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
+
 ;; This file defines a menu of faces (bold, italic, etc) which allows you to
 ;; set the face used for a region of the buffer.  Some faces also have
 ;; keybindings, which are shown in the menu.  Faces with names beginning with
@@ -405,20 +408,34 @@ These special properties include `invisible', `intangible' and `read-only'."
   "Pop up a buffer listing text-properties at LOCATION."
   (interactive "d")
   (let ((props (text-properties-at p))
+       category
        str)
     (if (null props)
        (message "None")
       (if (and (not (cdr (cdr props)))
+              (not (eq (car props) 'category))
               (< (length (setq str (format "Text property at %d:  %s  %S"
                                            p (car props) (car (cdr props)))))
                  (frame-width)))
-         (message str)
+         (message "%s" str)
        (with-output-to-temp-buffer "*Text Properties*"
          (princ (format "Text properties at %d:\n\n" p))
          (while props
+           (if (eq (car props) 'category)
+               (setq category (car (cdr props))))
            (princ (format "%-20s %S\n"
                           (car props) (car (cdr props))))
-           (setq props (cdr (cdr props)))))))))
+           (setq props (cdr (cdr props))))
+         (if category
+             (progn
+               (setq props (symbol-plist category))
+               (princ (format "\nCategory %s:\n\n" category))
+               (while props
+                 (princ (format "%-20s %S\n"
+                                (car props) (car (cdr props))))
+                 (if (eq (car props) 'category)
+                     (setq category (car (cdr props))))
+                 (setq props (cdr (cdr props)))))))))))
 
 ;;;###autoload
 (defun facemenu-read-color (&optional prompt)
@@ -497,7 +514,10 @@ effect.  See `facemenu-remove-face-function'."
           (not (eq facemenu-remove-face-function t)))
       (if facemenu-remove-face-function
          (funcall facemenu-remove-face-function start end)
-       (remove-text-properties start end '(face default)))
+       (if (and start (< start end))
+           (remove-text-properties start end '(face default))
+         (setq self-insert-face 'default
+               self-insert-face-command this-command)))
     (if facemenu-add-face-function
        (save-excursion
          (if end (goto-char end))
@@ -612,7 +632,7 @@ Automatically called when a new face is created."
   nil) ; Return nil for facemenu-iterate
 
 (defun facemenu-complete-face-list (&optional oldlist)
-  "Return list of all faces that are look different.
+  "Return list of all faces that look different.
 Starts with given ALIST of faces, and adds elements only if they display 
 differently from any face already on the list.
 The faces on ALIST will end up at the end of the returned list, in reverse