emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: 42 147 <aeuster@gmail.com>
Cc: emacs-orgmode@gnu.org, Jambunathan K <kjambunathan@gmail.com>
Subject: Re: hiding footnotes
Date: Thu, 29 Nov 2012 00:00:15 -0500	[thread overview]
Message-ID: <3483.1354165215@alphaville> (raw)
In-Reply-To: Message from 42 147 <aeuster@gmail.com> of "Wed, 28 Nov 2012 22:24:39 EST." <CAMgvimEc2=8mTcNuSCg+29eWgNG-ii01TWH0OzWUnC-y0VO2qA@mail.gmail.com>

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:

--8<---------------cut here---------------start------------->8---
(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))))
--8<---------------cut here---------------end--------------->8---

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...

Nick

  parent reply	other threads:[~2012-11-29  5:00 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 [this message]
2012-11-29  6:20           ` Jambunathan K
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=3483.1354165215@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=aeuster@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kjambunathan@gmail.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).