From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: tex-mode.el/`tex-view' (diff) Date: Mon, 18 Oct 2004 14:18:48 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1098109077 8378 80.91.229.6 (18 Oct 2004 14:17:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Oct 2004 14:17:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 18 16:17:52 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CJYKe-0004FL-00 for ; Mon, 18 Oct 2004 16:17:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJYRw-00065b-OO for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Oct 2004 10:25:24 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.sources,gnu.emacs.help Original-Followup-To: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:xdkdG0vTEQFebHEizBPuX/6ttBw= Original-Lines: 31 Original-NNTP-Posting-Host: 132.204.24.84 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1098109128 132.204.24.84 (Mon, 18 Oct 2004 10:18:48 EDT) Original-NNTP-Posting-Date: Mon, 18 Oct 2004 10:18:48 EDT Original-Xref: shelby.stanford.edu gnu.emacs.sources:10621 gnu.emacs.help:125930 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21301 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21301 > (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")))) Why not create a script like #!/bin/sh winnum=$(ratpoison -c windows | sed -n -e 's/\([0-9]+\)[-+*]gv.*/\1/p') if [ "$winnum" = "" ]; then gv -watch "$1" else ratpoison -c "select $winnum" fi and then use it in tex-dvi-view-command ? It has the advantage of also working in tex-compile-commands without having to additionally hack that code. Stefan