[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] preview context menu
From: |
David Kastrup |
Subject: |
Re: [AUCTeX] preview context menu |
Date: |
Sat, 10 Dec 2005 01:59:15 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"Sebastian N. Fischmeister" <address@hidden> writes:
> Here is something, that saves a lot of my time. This can be
> generalized for sure, since it makes a lot of assumptions about the
> environment and the tex-ing style. Maybe it inspires someone here.
>
> (defun preview-open-xfig (ov)
> "Open the figure in question with xfig."
> (save-excursion
> (set-buffer (overlay-buffer ov))
> (re-search-forward "includegraphics\\[.*\\]" nil t)
> (re-search-forward "{.*}" nil t)
> (shell-command (concat "xfig -nosplash -startg 1 -specialtext -
> latexfonts -startlatexFont default " (substring (match-string 0) 1
> -1) ".fig"))
> ;;(message (concat "open: " (substring (match-string 0) 1 -1)))
> ))
>
> (defun preview-context-menu (ov ev)
> "Pop up a menu for OV at position EV."
> (popup-menu
> `("Preview"
> ["Toggle" (preview-toggle ,ov 'toggle ',ev)
> (preview-active-contents ,ov)]
> ["Regenerate" (preview-regenerate ,ov)]
> ["Remove" (preview-delete ,ov)]
> ["Copy text" (preview-copy-text ,ov)]
> ["Open xfig" (preview-open-xfig, ov)]
> ["Copy MIME" (preview-copy-mml ,ov)
> (preview-active-contents ,ov)])
> ev))
I don't really see a good way to generalize this at the moment. There
would be the vague idea to make a special "f" option instead of "!" or
"{}" for mandatory arguments in preview.sty, which would then output a
file name to the run buffer in a way preview-latex could pick it up.
But warping this to the program and input file responsible for the
buffer seems not easy to do.
I seem to remember that X-Symbol <URL:http://x-symbol.sourceforge.net>
does something like that with included graphics, but unless I am
mistaken, it pretty much just starts xfig unconditionally.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum