emacs-devel
[Top][All Lists]
Advanced

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

Re: C-M-x should reset defface forms


From: Juri Linkov
Subject: Re: C-M-x should reset defface forms
Date: Sat, 05 Jun 2004 04:03:34 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

address@hidden (Johan Bockgård) writes in bug-gnu-emacs:
> C-M-x (eval-defun/edebug-eval-defun) on a defface form should reset
> the face using the initial value expression, like it does with defvar
> and defcustom.

This would be very useful!  Since no one responded to this request,
I looked a bit, and it seems the following patch does it.  I don't know
if it is the right way to implement this.  I simply made things work.
So, specialists in face customization, please tell if it is wrong.

Index: lisp/cus-face.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/cus-face.el,v
retrieving revision 1.33
diff -u -r1.33 cus-face.el
--- lisp/cus-face.el    1 Sep 2003 15:45:09 -0000       1.33
+++ lisp/cus-face.el    5 Jun 2004 00:42:59 -0000
@@ -35,7 +35,16 @@
 ;;;###autoload
 (defun custom-declare-face (face spec doc &rest args)
   "Like `defface', but FACE is evaluated as a normal argument."
-  (unless (get face 'face-defface-spec)
+  (if (get face 'face-defface-spec)
+      (when (not (equal (get face 'face-defface-spec) spec))
+        (let ((frames (frame-list))
+             frame)
+         (while frames
+           (setq frame (car frames)
+                 frames (cdr frames))
+           (face-spec-set face spec frame)))
+        (put face 'saved-face spec)
+        (put face 'face-defface-spec spec))
     (when (fboundp 'facep)
       (unless (facep face)
        ;; If the user has already created the face, respect that.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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