[Top][All Lists]

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

Swap two faces

From: João Távora
Subject: Swap two faces
Date: Wed, 17 Jul 2013 08:09:18 +0100

Does anyone know a good way to swap the attribute values of two emacs faces?
The following (naive) code doesn't seem to work:

(defun joaot/swap-faces (a b)
  (let* ((face-plist-fn (lambda (sym)
                          (loop for (prop val) on (symbol-plist sym) by #'cddr
                                when (string-match "^face\\($\\|-\\)"
(symbol-name prop))
                                append (list prop val))))
         (set-props-fn (lambda (props sym)
                         (loop for (prop val) on props by #'cddr
                               do (put sym prop val))))
         (a-props (funcall face-plist-fn a))
         (b-props (funcall face-plist-fn b)))
    (funcall set-props-fn a-props b)
    (funcall set-props-fn b-props a)))

the properties are swapped but the faces itself apparently remain
intact according
to `describe-face'.

João Távora

reply via email to

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