[OS X Emacs] Aquamacs 2.1 and Latex toolbar
Robert Goldman
rpgoldman at sift.info
Thu Feb 10 15:11:52 EST 2011
Caroline,
I had some similar problems changing over, and also because I typically
do NOT like the toolbar --- I can cut and paste perfectly well from the
keyboard, thank you very much. OTOH, I have never gotten the hang of
the latex commands. So I did the following in my emacs initialization.
It's actually a bit more tricky than one might like, because whether or
not you want the tool bar is (IMO) a function of the current BUFFER, but
the toolbar is a function of the FRAME. Hence the somewhat convoluted
structure below...
Hope this helps.
;;;---------------------------------------------------------------------------
;;; Controlling the tool bar
;;;---------------------------------------------------------------------------
(tool-bar-mode 0) ;in general, we want it /off/
(defun add-tool-bar-to-selected-frame ()
"Sometimes we'd like the toolbar only on specific frames."
(interactive)
(modify-frame-parameters (selected-frame) '((tool-bar-lines . 1)))
(run-hooks 'tool-bar-mode-on-hook)
)
(defun remove-tool-bar-from-selected-frame ()
"Sometimes we'd like the toolbar only on specific frames."
(interactive)
(modify-frame-parameters (selected-frame) '((tool-bar-lines . 0))))
(defun latex-frame-p ()
"Is this frame one that's displaying a buffer in latex mode?"
(eq
(buffer-local-value 'major-mode
(window-buffer (frame-selected-window
(selected-frame))))
'latex-mode))
(defun add-tool-bar-to-latex-frames ()
(if (latex-frame-p)
(add-tool-bar-to-selected-frame)
(remove-tool-bar-from-selected-frame)))
(add-hook 'window-configuration-change-hook
'add-tool-bar-to-latex-frames)
More information about the MacOSX-Emacs
mailing list