Subject: bug#20340: closed (Re: bug#20340: 11.88; Evince reverse search opens buffer in all frames)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 17 Apr 2015 18:55:03 +0000

Your bug report

#20340: 11.88; Evince reverse search opens buffer in all frames

which was filed against the auctex package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
20340: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20340
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#20340: 11.88; Evince reverse search opens buffer in all frames
From: Tassilo Horn <[email-masked]>
To: Iñaki García Etxebarria <[email-masked]>
Cc: [email-masked]
Date: Fri, 17 Apr 2015 20:54:45 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Iñaki García Etxebarria <[email-masked]> writes:

Hi Iñaki,

>> Wow, quite complex.  But I think this is the value you want:
>> 
>>   (setq display-buffer-alist
>>         '((".*" . (display-buffer-reuse-window . ((reusable-frames . visible))))))
>> 
>> Tested only briefly, though.
> This seems to work perfectly, thank you very much!

Great to hear, and you're welcome!

Bye,
Tassilo

Subject: 11.88; Evince reverse search opens buffer in all frames
From: Iñaki García Etxebarria <[email-masked]>
To: [email-masked]
Date: Wed, 15 Apr 2015 23:20:20 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

I am often editing various TeX files at the same time, and try to use
evince reverse search from evince, with "Ctrl+Click", in order to
make a change to a specific file. Currently
TeX-source-correlate-sync-source uses "find-file" in order to load the
file. This is very frustrating, since it makes *all* emacs windows switch
to that buffer, including those in which you are editing unrelated
documents.

Observed behavior: All emacs windows editing TeX files jump to the
source position for the file associated to the pdf in evince.

Expected behavior: Only the window in which you are editing the relevant file
reacts.

I have replaced TeX-source-correlate-sync-source by the following code
in my local instalation, and it is working well. It only reacts to the
DBus signal if the current buffer contains the file in the signal (see
the (if (string= ...)) part).

(defun TeX-source-correlate-sync-source (file linecol &rest ignored)
  "Show TeX FILE with point at LINECOL.
This function is called when emacs receives a SyncSource signal
emitted from the Evince document viewer.  IGNORED absorbs an
unused id field accompanying the DBUS signal sent by Evince-3.0.0
or newer."
  ;; FILE may be given as relative path to the TeX-master root document or as
  ;; absolute file:// URL.  In the former case, the tex file has to be already
  ;; opened.
  (let ((buf (let ((f (condition-case nil
			  (progn
			    (require 'url-parse)
			    (require 'url-util)
			    (url-unhex-string (aref (url-generic-parse-url file) 6)))
			;; For Emacs 21 compatibility, which doesn't have the
			;; url package.
			(file-error (replace-regexp-in-string "^file://" "" file)))))
	       (if (string= f (buffer-file-name))
		   (current-buffer)
		 nil)))
	(line (car linecol))
	(col (cadr linecol)))
    (when (not (null buf))
      (switch-to-buffer buf)
      (push-mark (point) 'nomsg)
      (goto-char (point-min))
      (forward-line (1- line))
      (unless (= col -1)
	(move-to-column col))
      (raise-frame))))

------------------------------------------------------------------------

Emacs  : GNU Emacs 24.4.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.14.5)
 of 2014-11-19 on buildvm-03.phx2.fedoraproject.org
Package: 11.88

current state:
==============
(setq
 AUCTeX-date "2014-10-29"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("/var/auctex" "/usr/share/emacs/site-lisp/auctex/style"
                  "/home/inaki/.emacs.d/auctex/auto"
                  "/home/inaki/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save nil
 TeX-parse-self nil
 TeX-master t
 TeX-command-list '(("TeX"
                     "%(PDF)%(tex) %(extraopts) %`%S%(PDFout)%(mode)%' %t"
                     TeX-run-TeX nil
                     (plain-tex-mode ams-tex-mode texinfo-mode) :help
                     "Run plain TeX")
                    ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil
                     (latex-mode doctex-mode) :help "Run LaTeX")
                    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
                     (texinfo-mode) :help "Run Makeinfo with Info output")
                    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t"
                     TeX-run-compile nil (texinfo-mode) :help
                     "Run Makeinfo with HTML output")
                    ("AmSTeX"
                     "%(PDF)amstex %(extraopts) %`%S%(PDFout)%(mode)%' %t"
                     TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
                    ("ConTeXt"
                     "texexec --once --texutil %(extraopts) %(execopts)%t"
                     TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
                    ("ConTeXt Full" "texexec %(extraopts) %(execopts)%t"
                     TeX-run-TeX nil (context-mode) :help
                     "Run ConTeXt until completion")
                    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help
                     "Run BibTeX")
                    ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
                    ("View" "%V" TeX-run-discard-or-function t t :help
                     "Run Viewer")
                    ("Print" "%p" TeX-run-command t t :help "Print the file")
                    ("Queue" "%q" TeX-run-background nil t :help
                     "View the printer queue" :visible TeX-queue-command)
                    ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help
                     "Generate PostScript file")
                    ("Index" "makeindex %s" TeX-run-command nil t :help
                     "Create index file")
                    ("Xindy" "texindy %s" TeX-run-command nil t :help
                     "Run xindy to create index file")
                    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode)
                     :help "Check LaTeX file for correctness")
                    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode)
                     :help "Check LaTeX file for common mistakes")
                    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil
                     t :help "Spell-check the document")
                    ("Clean" "TeX-clean" TeX-run-function nil t :help
                     "Delete generated intermediate files")
                    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
                     "Delete generated intermediate and output files")
                    ("Other" "" TeX-run-command t t :help
                     "Run an arbitrary command")
                    )
 )

Thanks,
Iñaki