From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: hiding footnotes Date: Thu, 29 Nov 2012 11:50:42 +0530 Message-ID: <87zk217ww5.fsf@gmail.com> References: <87sj7t4p0l.fsf@gmail.com> <3483.1354165215@alphaville> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdxRs-00041t-HX for emacs-orgmode@gnu.org; Thu, 29 Nov 2012 01:18:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TdxRr-0007Ow-HC for emacs-orgmode@gnu.org; Thu, 29 Nov 2012 01:18:12 -0500 Received: from mail-pb0-f41.google.com ([209.85.160.41]:48113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdxRr-0007Os-B3 for emacs-orgmode@gnu.org; Thu, 29 Nov 2012 01:18:11 -0500 Received: by mail-pb0-f41.google.com with SMTP id xa7so10569080pbc.0 for ; Wed, 28 Nov 2012 22:18:10 -0800 (PST) In-Reply-To: <3483.1354165215@alphaville> (Nick Dokos's message of "Thu, 29 Nov 2012 00:00:15 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nick Dokos Cc: 42 147 , emacs-orgmode@gnu.org Nick Dokos writes: > 42 147 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 > > --