emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Nick Dokos <nicholas.dokos@hp.com>
Cc: 42 147 <aeuster@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: hiding footnotes
Date: Thu, 29 Nov 2012 11:50:42 +0530	[thread overview]
Message-ID: <87zk217ww5.fsf@gmail.com> (raw)
In-Reply-To: <3483.1354165215@alphaville> (Nick Dokos's message of "Thu, 29 Nov 2012 00:00:15 -0500")

Nick Dokos <nicholas.dokos@hp.com> writes:

> 42 147 <aeuster@gmail.com> 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
>
>

-- 

  reply	other threads:[~2012-11-29  6:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28 13:03 hiding footnotes 42 147
2012-11-28 14:17 ` John Hendy
2012-11-28 15:19   ` 42 147
2012-11-28 17:26     ` Jambunathan K
2012-11-28 20:06       ` Alan L Tyree
2012-11-29  3:24       ` 42 147
2012-11-29  3:35         ` 42 147
2012-11-29  4:11           ` Alan L Tyree
2012-11-29  5:00         ` Nick Dokos
2012-11-29  6:20           ` Jambunathan K [this message]
2012-11-29  6:24             ` Jambunathan K
2012-11-29  7:40             ` 42 147
2013-02-26 18:18           ` 42 147
2013-02-26 18:19             ` 42 147

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zk217ww5.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=aeuster@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).