auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] binding a function key to toggle between 2 functions


From: Ralf Angeli
Subject: Re: [AUCTeX] binding a function key to toggle between 2 functions
Date: Thu, 24 Apr 2008 22:06:56 +0200

* Sivaram Neelakantan (2008-04-22) writes:

> While working on latex documents, I've enabled outline-minor-mode and
> have set the following keybindings.
>
> (local-set-key (quote [f7]) (quote show-all))
> (local-set-key (quote [S-f7]) (quote hide-body))
>
> This is slightly unsatisfactory as I'd prefer f7 to toggle between
> show-all and hide-body as that *seems* more logical.  Is it possible
> to do that?

You could use something like the following.

(defvar my-outline-toggle nil
  "Control variable for toggling outlines.")
(defun my-outline-toggle-all ()
  "Show or hide all depending on value of `my-outline-toggle'."
  (interactive)
  (if my-outline-toggle
      (show-all)
    (hide-body))
  (setq my-outline-toggle (not my-outline-toggle)))

And then
(local-set-key [f7] 'my-outline-toggle-all)

This is very primitive and does not try to figure out the current state.

You might also want to try `M-x reveal-mode <RET>'.

-- 
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]