[Please, keep [email protected] in Cc if you reply.]

Hello developers,

here's a wishlist bug with enclosed patch submitted by a Debian user.

What do you think about it?

-- 
Thanks, Davide
--- Begin Message ---
Package: auctex
Version: 11.87-1
Severity: wishlist
Tags: patch


Dear Maintainer,

This may be at least partially window-manager-specific, I use gnome shell.

When performing forward search between a LaTeX buffer
and evince, one would usually expect the evince window to pop up -
which it does, but without focus.  On my system this even leads to 
inconsistent alt-tab behaviour, so there could be a window manager bug
here, but that's beside the point - evince should get focus on forward
search, which it doesn't.

Reverse search from evince to emacs does not even raise the emacs window.

This is counter-intuitive (why would I perform a serach if not in order to
see the result?)

I attach a patch I use on my system, which is fairly Linux specific
(using wmctrl).  Not sure that it is the best solution, but pls take a look.
If you apply this, maybe also Recommend wmctrl.

All the beat,
Itai.
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 auctex (11.87-1.2) unstable; urgency=low
 .
   * Raise windows on forward/reverse search.
Author: Itaï BEN YAACOV <[email protected]>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- auctex-11.87.orig/tex.el
+++ auctex-11.87/tex.el
@@ -1053,24 +1053,28 @@ the requirements are met."
 		 uri
 		 t)))
     (if owner
-	(dbus-call-method
-	 :session owner
-	 "/org/gnome/evince/Window/0"
-	 "org.gnome.evince.Window"
-	 "SyncView"
-	 (buffer-file-name)
-	 (list :struct :int32 (line-number-at-pos) :int32 (1+ (current-column)))
-	 :uint32 (let ((time (float-time)))
-		   ;; FIXME: Evince wants a timestamp as UInt32, but POSIX time
-		   ;; is too large for emacs integers on 32 bit systems.  Emacs
-		   ;; 24.2 will allow providing DBUS ints as floats, and this
-		   ;; dbus version will be identifiable by its new variables
-		   ;; `dbus-compiled-version' and `dbus-runtime-version'.  But
-		   ;; it seems providing just 1 as timestamp has no negative
-		   ;; consequences, anyway.
-		   (if (> most-positive-fixnum time)
-		       (round time)
-		     1)))
+	(progn
+	  (let ((wmctrl (executable-find "wmctrl")))
+	    (if wmctrl
+		(start-process "wmctrl" nil wmctrl "-R" (concat file "." (TeX-output-extension)))))
+	  (dbus-call-method
+	   :session owner
+	   "/org/gnome/evince/Window/0"
+	   "org.gnome.evince.Window"
+	   "SyncView"
+	   (buffer-file-name)
+	   (list :struct :int32 (line-number-at-pos) :int32 (1+ (current-column)))
+	   :uint32 (let ((time (float-time)))
+		     ;; FIXME: Evince wants a timestamp as UInt32, but POSIX time
+		     ;; is too large for emacs integers on 32 bit systems.  Emacs
+		     ;; 24.2 will allow providing DBUS ints as floats, and this
+		     ;; dbus version will be identifiable by its new variables
+		     ;; `dbus-compiled-version' and `dbus-runtime-version'.  But
+		     ;; it seems providing just 1 as timestamp has no negative
+		     ;; consequences, anyway.
+		     (if (> most-positive-fixnum time)
+			 (round time)
+		       1))))
       (error "Couldn't find the Evince instance for %s" uri))))
 
 (defvar TeX-view-program-list-builtin
@@ -1515,6 +1519,9 @@ or newer."
     (if (null buf)
         (message "No buffer for %s." file)
       (switch-to-buffer buf)
+      (let ((wmctrl (executable-find "wmctrl")))
+	(if wmctrl
+	    (start-process "wmctrl" nil wmctrl "-R" (frame-parameter nil 'name))))
       (push-mark (point) 'nomsg)
       (goto-char (point-min))
       (forward-line (1- line))

--- End Message ---
_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to