(define-key map [dc] (cons "Display Colors" 'list-colors-display))
(define-key map [df] (cons "Display Faces" 'list-faces-display))
(define-key map [dp] (cons "List Properties" 'list-text-properties-at))
- (define-key map [ra] (cons "Remove All" 'facemenu-remove-all))
- (define-key map [rm] (cons "Remove Properties" 'facemenu-remove-props))
+ (define-key map [ra] (cons "Remove Text Properties" 'facemenu-remove-all))
+ (define-key map [rm] (cons "Remove Face Properties" 'facemenu-remove-face-props))
(define-key map [s1] (list "-----------------")))
;;;###autoload
(let ((map facemenu-menu))
(add-text-properties start end '(read-only t)))
;;;###autoload
-(defun facemenu-remove-props (start end)
- "Remove all text properties that facemenu added to region."
+(defun facemenu-remove-face-props (start end)
+ "Remove `face' and `mouse-face' text properties."
(interactive "*r") ; error if buffer is read-only despite the next line.
(let ((inhibit-read-only t))
(remove-text-properties
- start end '(face nil invisible nil intangible nil
- read-only nil category nil))))
+ start end '(face nil mouse-face nil))))
;;;###autoload
(defun facemenu-remove-all (start end)
(defun facemenu-get-face (symbol)
"Make sure FACE exists.
-If not, it is created. If it is created and is of the form `fg:color', then
-set the foreground to that color. If of the form `bg:color', set the
-background. In any case, add it to the appropriate menu. Returns the face,
-or nil if given a bad color."
- (if (or (internal-find-face symbol)
- (let* ((face (make-face symbol))
- (name (symbol-name symbol))
+If not, create it and add it to the appropriate menu. Return the symbol.
+
+If a window system is in use, and this function creates a face named
+`fg:color', then it sets the foreground to that color. Likewise, `bg:color'
+means to set the background. In either case, if the color is undefined,
+no color is set and a warning is issued."
+ (let ((name (symbol-name symbol))
+ foreground)
+ (cond ((internal-find-face symbol))
+ ((and window-system
+ (or (setq foreground (string-match "^fg:" name))
+ (string-match "^bg:" name)))
+ (let ((face (make-face symbol))
(color (substring name 3)))
- (cond ((string-match "^fg:" name)
- (set-face-foreground face color)
- (and window-system
- (x-color-defined-p color)))
- ((string-match "^bg:" name)
- (set-face-background face color)
- (and window-system
- (x-color-defined-p color)))
- (t))))
- symbol))
+ (if (x-color-defined-p color)
+ (if foreground
+ (set-face-foreground face color)
+ (set-face-background face color))
+ (message "Color \"%s\" undefined" color))))
+ (t (make-face symbol))))
+ symbol)
(defun facemenu-add-new-face (face)
"Add a FACE to the appropriate Face menu.