[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa ba10cf0 04/35: New defcustom TeX-raise-frame-function
From: |
Tassilo Horn |
Subject: |
[elpa] elpa ba10cf0 04/35: New defcustom TeX-raise-frame-function |
Date: |
Thu, 1 Sep 2016 15:57:48 +0000 (UTC) |
branch: elpa
commit ba10cf083753bceb27923b6b80f5d2f7f78cd093
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
New defcustom TeX-raise-frame-function
* tex.el (TeX-raise-frame-function): New defcustom.
(TeX-source-correlate-sync-source): Use it.
---
tex.el | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/tex.el b/tex.el
index 923ce32..6ba3d60 100644
--- a/tex.el
+++ b/tex.el
@@ -1846,12 +1846,44 @@ file and LINE to (+ LINE offset-of-region). Else,
return nil."
(list (expand-file-name (buffer-file-name TeX-region-orig-buffer))
(+ line offset) col)))))))
+(defcustom TeX-raise-frame-function nil
+ "A function which will be called to raise the Emacs frame.
+The function is called after `TeX-source-correlate-sync-source'
+has processed an inverse search DBUS request from Evince or
+Atril in order to raise the Emacs frame.
+
+`TeX-source-correlate-sync-source' already calls `raise-frame',
+however, depending on window manager and focus stealing policies,
+it might very well be that Emacs doesn't pop into the foreground.
+So you can do whatever it takes here.
+
+For some users, `x-focus-frame' does the trick. For some
+users (on GNOME 3.20),
+
+ (lambda ()
+ (run-at-time 0.5 nil #'x-focus-frame))
+
+does the trick. Some other users use the external wmctrl tool to
+raise the Emacs frame like so:
+
+ (lambda ()
+ (call-process
+ \"wmctrl\" nil nil nil \"-i\" \"-R\"
+ (frame-parameter (selected-frame) 'outer-window-id)))"
+ :type 'function
+ :group 'TeX-view)
+
(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."
+or newer.
+
+Note that this function tries to raise the Emacs frame using
+`raise-frame'. However, that doesn't work reliably across window
+managers/operating systems. If the Emacs frame isn't raised,
+customize `TeX-raise-frame-function'."
;; 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.
@@ -1886,10 +1918,9 @@ or newer."
(> pos (point-max)))
(widen))
(goto-char pos))
- ;; Grab focus after inverse search (only if `x-focus-frame' function is
- ;; available).
- (when (fboundp 'x-focus-frame)
- (x-focus-frame (selected-frame))))))
+ (raise-frame)
+ (when TeX-raise-frame-function
+ (funcall TeX-raise-frame-function)))))
(define-minor-mode TeX-source-correlate-mode
"Minor mode for forward and inverse search.
- [elpa] elpa 4f15be6 15/35: ; Remove wrong entries for varioref.sty, (continued)
- [elpa] elpa 4f15be6 15/35: ; Remove wrong entries for varioref.sty, Tassilo Horn, 2016/09/01
- [elpa] elpa 7828a43 16/35: ; Remove wrong entries for cleveref.sty, Tassilo Horn, 2016/09/01
- [elpa] elpa bb9f427 01/35: Grab focus on Evince inverse search, Tassilo Horn, 2016/09/01
- [elpa] elpa dfe0937 12/35: Reset `LaTeX-auto-xcolor-definecolorset' before parsing, Tassilo Horn, 2016/09/01
- [elpa] elpa 8c57d38 11/35: Fix doc string for curve quoting style in Emacs 25, Tassilo Horn, 2016/09/01
- [elpa] elpa e259e40 26/35: Add a Japanese error message translation, Tassilo Horn, 2016/09/01
- [elpa] elpa ce347e6 03/35: Document how to disable filling for specific environments, Tassilo Horn, 2016/09/01
- [elpa] elpa b2ebbb3 29/35: Use `TeX-ispell-skip-setcdr' on user defined listing environments, Tassilo Horn, 2016/09/01
- [elpa] elpa 22f9450 30/35: Use `TeX-ispell-skip-setcar' on user defined index macros, Tassilo Horn, 2016/09/01
- [elpa] elpa 131c537 14/35: Document interaction with Ispell, Tassilo Horn, 2016/09/01
- [elpa] elpa ba10cf0 04/35: New defcustom TeX-raise-frame-function,
Tassilo Horn <=
- [elpa] elpa 40b3518 13/35: Add new spell checking dictionary tex-ispell.el, Tassilo Horn, 2016/09/01
- [elpa] elpa d0e8c1c 32/35: Add new style/paracol.el, Tassilo Horn, 2016/09/01
- [elpa] elpa fcb6424 27/35: Revise document for Japanese TeX, Tassilo Horn, 2016/09/01
- [elpa] elpa 12bfe80 33/35: Add new style/menukeys.el, Tassilo Horn, 2016/09/01
- [elpa] elpa 803894c 19/35: Add new style/empheq.el, Tassilo Horn, 2016/09/01
- [elpa] elpa 073b17a 23/35: Update style/mathtools.el to v1.18 of mathtools.sty, Tassilo Horn, 2016/09/01
- [elpa] elpa 5beae62 25/35: Set the right coding systems for Japanese TeX process, Tassilo Horn, 2016/09/01
- [elpa] elpa a474cb4 35/35: Release GNU AUCTeX 11.89.5, Tassilo Horn, 2016/09/01
- [elpa] elpa e2be637 34/35: Merge branch 'master' into elpa, Tassilo Horn, 2016/09/01