* Swap two faces
@ 2013-07-17 7:09 João Távora
0 siblings, 0 replies; 3+ messages in thread
From: João Távora @ 2013-07-17 7:09 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org List
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'.
Thanks,
--
João Távora
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Swap two faces
[not found] <mailman.1222.1374044983.12400.help-gnu-emacs@gnu.org>
@ 2013-07-17 7:45 ` Emanuel Berg
2013-07-18 20:53 ` João Távora
0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2013-07-17 7:45 UTC (permalink / raw)
To: help-gnu-emacs
Mr. Távora <joaotavora@gmail.com> writes:
> Does anyone know a good way to swap the attribute values of two
> Emacs faces?
Check out this function:
(copy-face OLD-FACE NEW-FACE &optional FRAME NEW-FRAME)
Perhaps you need a temporary face to make the switch, as well.
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Swap two faces
2013-07-17 7:45 ` Emanuel Berg
@ 2013-07-18 20:53 ` João Távora
0 siblings, 0 replies; 3+ messages in thread
From: João Távora @ 2013-07-18 20:53 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
Thanks,
I'll try it out. According to the docstring though, it seems this
function shouldn't won't swap the customization options.
But maybe combined with my plist-swapping code it will,
I'll try it out.
Bye,
Joao
On Wed, Jul 17, 2013 at 8:45 AM, Emanuel Berg <embe8573@student.uu.se> wrote:
> Mr. Távora <joaotavora@gmail.com> writes:
>
>> Does anyone know a good way to swap the attribute values of two
>> Emacs faces?
>
> Check out this function:
>
> (copy-face OLD-FACE NEW-FACE &optional FRAME NEW-FRAME)
>
> Perhaps you need a temporary face to make the switch, as well.
>
> --
> Emanuel Berg - programmer (hire me! CV below)
> computer projects: http://user.it.uu.se/~embe8573
> internet activity: http://home.student.uu.se/embe8573
--
João Távora
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-18 20:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-17 7:09 Swap two faces João Távora
[not found] <mailman.1222.1374044983.12400.help-gnu-emacs@gnu.org>
2013-07-17 7:45 ` Emanuel Berg
2013-07-18 20:53 ` João Távora
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.