[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] hiding footnotes
From: |
Jambunathan K |
Subject: |
Re: [O] hiding footnotes |
Date: |
Thu, 29 Nov 2012 11:50:42 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Nick Dokos <address@hidden> writes:
> 42 147 <address@hidden> wrote:
>
>> Very nice.
>>
>> However, I'd like to write a function that toggles the color value (without
>> recourse to the customize menu), since it would be useful to highlight the
>> footnotes from time to time.
>>
>
> Anything that can be done interactively can also be done
> programatically. You know what face you are dealing with, you can get
> its foreground color with face-foreground, and you can set it with
> set-face-attribute. A crude implementation to show the basic outline:
>
>
> (setq org-footnote-fg-color (face-foreground 'org-footnote))
>
> (setq org-text-fg-color (face-foreground 'default))
>
> (defun my-toggle-footnote-fg-color ()
> "Toggle the org-footnote face foreground color."
> (interactive)
> (let ((fg (face-foreground 'org-footnote)))
> (if (string-equal fg org-footnote-fg-color)
> (set-face-attribute 'org-footnote nil :foreground org-text-fg-color)
> (set-face-attribute 'org-footnote nil :foreground
> org-footnote-fg-color))))
>
>
> The difficulties start (but do not end) with footnotes in all sorts of
> weird places (e.g. headlines) with all sorts of different
> fontifications. You'd want to blend the footnote with its immediate
> surroundings.
>
> Taking care of such situations (and various others that the above code
> mishandles) is left as an exercise...
Install the following defun, put the cursor on fontified text and do M-x
toggle-face.
(defun toggle-face (&optional face-from)
(interactive (list (read-face-name "Face" (face-at-point))))
(let ((f (assq face-from face-remapping-alist))
(face-to 'default))
(if f (setq face-remapping-alist (delq f face-remapping-alist))
(push (cons face-from face-to) face-remapping-alist))))
See also (info "(elisp) Face Remapping")
> Nick
>
>
--
- [O] hiding footnotes, 42 147, 2012/11/28
- Re: [O] hiding footnotes, John Hendy, 2012/11/28
- Re: [O] hiding footnotes, 42 147, 2012/11/28
- Re: [O] hiding footnotes, Jambunathan K, 2012/11/28
- Re: [O] hiding footnotes, Alan L Tyree, 2012/11/28
- Re: [O] hiding footnotes, 42 147, 2012/11/28
- Re: [O] hiding footnotes, 42 147, 2012/11/28
- Re: [O] hiding footnotes, Alan L Tyree, 2012/11/28
- Re: [O] hiding footnotes, Nick Dokos, 2012/11/29
- Re: [O] hiding footnotes,
Jambunathan K <=
- Re: [O] hiding footnotes, Jambunathan K, 2012/11/29
- Re: [O] hiding footnotes, 42 147, 2012/11/29