[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tex-mode.el/`tex-view' (diff)
From: |
Joe Corneli |
Subject: |
tex-mode.el/`tex-view' (diff) |
Date: |
Sun, 17 Oct 2004 18:45:24 -0500 |
I'm appending a simple diff against the tex-mode.el from todays CVS.
The purpose of the diff is to enable `tex-dvi-view-command' to be
redefined "on the fly". For example, I use the function
`set-tex-dvi-view-command' to set `tex-dvi-view-command' to be
"dvips -o tex-output.ps * && gv -watch tex-output.ps"
if there is no gv open, and
"dvips -o tex-output.ps * && ratpoison -c \"select <window number>\""
if gv is open. (Here <window number> is ratpoison's number for the
gv window, whatever that might happen to be.)
The net effect is that focus shifts to the gv window if it exists,
and because of the '-watch' flag to gv, the content there will be
refreshed, whereas if no gv window exists, a new one is created.
(defun set-tex-dvi-view-command ()
(setq tex-dvi-view-command
(concat "dvips -o tex-output.ps * && "
(if (with-temp-buffer (insert (shell-command-to-string "ps -a"))
(goto-char (point-min))
(search-forward-regexp "gv$" nil t))
(concat "ratpoison -c \"select "
(with-temp-buffer (insert (shell-command-to-string
"ratpoison -c windows"))
(goto-char (point-min))
(search-forward-regexp
"\\([0-9]+\\)[-+*]gv.*" nil t)
(let ((matched (match-string 1)))
matched))
"\"")
"gv -watch tex-output.ps"))))
The patch would enable other similar tricks. (Arguably, switching to
the gv window with ratpoison is just extra flourish on the basic
"don't start another gv if one isn't needed", relevant for users of
any window manager.)
cd /home/jcorneli/
diff -c /home/jcorneli/old-tex-mode.el /home/jcorneli/tex-mode.el
*** /home/jcorneli/old-tex-mode.el Sun Oct 17 18:31:44 2004
--- /home/jcorneli/tex-mode.el Sun Oct 17 18:31:25 2004
***************
*** 2226,2234 ****
You must set that variable yourself before using this command,
because there is no standard value that would generally work."
(interactive)
! (or tex-dvi-view-command
(error "You must set `tex-dvi-view-command'"))
! (let ((tex-dvi-print-command (eval tex-dvi-view-command)))
(tex-print)))
(defun tex-append (file-name suffix)
--- 2226,2237 ----
You must set that variable yourself before using this command,
because there is no standard value that would generally work."
(interactive)
! (or (or tex-dvi-view-command
! (functionp 'set-tex-dvi-view-command))
(error "You must set `tex-dvi-view-command'"))
! (let ((tex-dvi-print-command (progn (when (functionp
'set-tex-dvi-view-command)
! (funcall 'set-tex-dvi-view-command))
! tex-dvi-view-command)))
(tex-print)))
(defun tex-append (file-name suffix)
- tex-mode.el/`tex-view' (diff),
Joe Corneli <=