[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 260/299: Improve selection of the forward/inverse search method.
From: |
Stefan Monnier |
Subject: |
[elpa] 260/299: Improve selection of the forward/inverse search method. |
Date: |
Sun, 02 Nov 2014 03:11:51 +0000 |
monnier pushed a commit to branch externals/auctex
in repository elpa.
commit fc05c8e6a4f72a278f7c70b389331ea4773ccbde
Author: Mosè Giordano <address@hidden>
Date: Wed Jul 2 00:22:14 2014 +0200
Improve selection of the forward/inverse search method.
* tex.el (TeX-expand-list): Set
`TeX-source-correlate-output-page-function' when necessary, in the
"%(outpage)" expander.
(TeX-source-correlate-method): Add an alist as a possible value
and change the default.
(TeX-source-correlate-method-active): Convert to a function.
(TeX-source-correlate-expand-options): Use the
`TeX-source-correlate-method-active' function.
(TeX-source-correlate-mode): Remove setting of the
`TeX-source-correlate-output-page-function' variable and of the
now deleted `TeX-source-correlate-method-active' variable.
(TeX-source-specials-view-expand-options): Use the
`TeX-source-correlate-method-active' function.
* context.el: Update copyright years.
(ConTeXt-expand-options): Use the
`TeX-source-correlate-method-active' function.
* doc/auctex.texi (I/O Correlation): Update documentation of
`TeX-source-correlate-method'.
* doc/changes.texi: Mention change to the default value of
`TeX-source-correlate-method'.
---
ChangeLog | 26 ++++++++++++++++
context.el | 4 +-
doc/auctex.texi | 26 +++++++++++-----
doc/changes.texi | 3 +-
tex.el | 84 ++++++++++++++++++++++++++++++++++++-----------------
5 files changed, 105 insertions(+), 38 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 683907d..265767b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2014-07-02 Mos� Giordano <address@hidden>
+
+ * tex.el (TeX-expand-list): Set
+ `TeX-source-correlate-output-page-function' when necessary, in the
+ "%(outpage)" expander.
+ (TeX-source-correlate-method): Add an alist as a possible value
+ and change the default.
+ (TeX-source-correlate-method-active): Convert to a function.
+ (TeX-source-correlate-expand-options): Use the
+ `TeX-source-correlate-method-active' function.
+ (TeX-source-correlate-mode): Remove setting of the
+ `TeX-source-correlate-output-page-function' variable and of the
+ now deleted `TeX-source-correlate-method-active' variable.
+ (TeX-source-specials-view-expand-options): Use the
+ `TeX-source-correlate-method-active' function.
+
+ * context.el: Update copyright years.
+ (ConTeXt-expand-options): Use the
+ `TeX-source-correlate-method-active' function.
+
+ * doc/auctex.texi (I/O Correlation): Update documentation of
+ `TeX-source-correlate-method'.
+
+ * doc/changes.texi: Mention change to the default value of
+ `TeX-source-correlate-method'.
+
2014-06-29 Mos� Giordano <address@hidden>
* doc/todo.texi (Mid-term Goals): Remove "More flexible option and
diff --git a/context.el b/context.el
index ea333e5..3cc890f 100644
--- a/context.el
+++ b/context.el
@@ -1,6 +1,6 @@
;;; context.el --- Support for ConTeXt documents.
-;; Copyright (C) 2003-2006, 2008, 2010, 2012
+;; Copyright (C) 2003-2006, 2008, 2010, 2012, 2014
;; Free Software Foundation, Inc.
;; Maintainer: Berend de Boer <address@hidden>
@@ -1586,7 +1586,7 @@ else. There might be text before point."
(format "--interface=%s " ConTeXt-current-interface))
(when TeX-source-correlate-mode
(format "--passon=\"%s\" "
- (if (eq TeX-source-correlate-method-active 'synctex)
+ (if (eq (TeX-source-correlate-method-active) 'synctex)
TeX-synctex-tex-flags
TeX-source-specials-tex-flags)))
(unless TeX-interactive-mode
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 85c19fe..48ffd0e 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -3041,16 +3041,26 @@ document parsing is enabled. Customize the variable
@defopt TeX-source-correlate-method
Method to use for enabling forward and inverse search. This can be
@samp{source-specials} if source specials should be used, @samp{synctex}
-if SyncTeX should be used, or @samp{auto} if @AUCTeX{} should decide,
-this is the default.
+if SyncTeX should be used, or @samp{auto} if @AUCTeX{} should decide.
-When the variable is set to @samp{auto}, @AUCTeX{} will use SyncTeX if
-your @code{latex} processor supports it, source specials otherwise. You
-must make sure your viewer supports the same method.
+When the variable is set to @samp{auto}, @AUCTeX{} will always use
+SyncTeX if your @code{latex} processor supports it, source specials
+otherwise. You must make sure your viewer supports the same method.
-Setting this variable does not take effect if
address@hidden has already been active. Restart Emacs
-in this case.
+It is also possible to specify a different method depending on the
+output, either DVI or PDF, by setting the variable to an alist of the
+kind
address@hidden
+((dvi . <source-specials or synctex>)
+ (pdf . <source-specials or synctex>))
address@hidden lisp
+in which the CDR of each entry is a symbol specifying the method to be
+used in the corresponding mode. The default value of the variable is
address@hidden
+((dvi . source-specials)
+ (pdf . synctex))
address@hidden lisp
+which is compatible with the majority of viewers.
@end defopt
@findex TeX-view
diff --git a/doc/changes.texi b/doc/changes.texi
index d421833..903d42e 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -57,7 +57,8 @@ New user options @code{LaTeX-default-author},
@code{TeX-insert-braces-alist}, @code{LaTeX-fontspec-arg-font-search},
and @code{LaTeX-fontspec-font-list-default}. A new possible value
(@code{show-all-optional-args}) for
address@hidden was added.
address@hidden was added. The default value of
address@hidden has been changed.
@item
@samp{biblatex} support was greatly expanded. If parsing is enabled,
diff --git a/tex.el b/tex.el
index 6ac829f..84d823b 100644
--- a/tex.el
+++ b/tex.el
@@ -418,15 +418,15 @@ string."
;; to handle .ps files.
(defcustom TeX-expand-list
- '(("%p" TeX-printer-query) ;%p must be the first entry
+ '(("%p" TeX-printer-query) ;%p must be the first entry
("%q" (lambda ()
(TeX-printer-query t)))
("%V" (lambda ()
(TeX-source-correlate-start-server-maybe)
(TeX-view-command-raw)))
("%vv" (lambda ()
- (TeX-source-correlate-start-server-maybe)
- (TeX-output-style-check TeX-output-view-style)))
+ (TeX-source-correlate-start-server-maybe)
+ (TeX-output-style-check TeX-output-view-style)))
("%v" (lambda ()
(TeX-source-correlate-start-server-maybe)
(TeX-style-check TeX-view-style)))
@@ -465,8 +465,16 @@ string."
("%dS" TeX-source-specials-view-expand-options)
("%cS" TeX-source-specials-view-expand-client)
("%(outpage)" (lambda ()
- (or (when TeX-source-correlate-output-page-function
- (funcall TeX-source-correlate-output-page-function))
+ ;; When `TeX-source-correlate-output-page-function' is nil
+ ;; and we are using synctex, fallback on
+ ;; `TeX-synctex-output-page'.
+ (and TeX-source-correlate-mode
+ (null TeX-source-correlate-output-page-function)
+ (eq (TeX-source-correlate-method-active) 'synctex)
+ (setq TeX-source-correlate-output-page-function
+ 'TeX-synctex-output-page))
+ (or (if TeX-source-correlate-output-page-function
+ (funcall TeX-source-correlate-output-page-function))
"1")))
;; `file' means to call `TeX-master-file' or `TeX-region-file'
("%s" file nil t)
@@ -502,7 +510,7 @@ string."
(setq pos (+ (length TeX-command-text) 9)
TeX-command-pos
(and (string-match " "
- (funcall file t t))
+ (funcall file t t))
"\""))
(concat TeX-command-text " \"\\input\""))
(setq TeX-command-pos nil)
@@ -1400,21 +1408,39 @@ For available TYPEs, see variable `TeX-engine'."
;;; Forward and inverse search
-(defcustom TeX-source-correlate-method 'auto
+(defcustom TeX-source-correlate-method
+ '((dvi . source-specials) (pdf . synctex))
"Method to use for enabling forward and inverse search.
This can be `source-specials' if source specials should be used,
-`synctex' if SyncTeX should be used, or`auto' if AUCTeX should
+`synctex' if SyncTeX should be used, or `auto' if AUCTeX should
decide.
-Setting this variable does not take effect if TeX Source
-Correlate mode has already been active. Restart Emacs in this
-case."
- :type '(choice (const auto) (const synctex) (const source-specials))
+The previous values determine the variable for both DVI and PDF
+mode. This variable can also be an alist of the kind
+
+ ((dvi . <source-specials or synctex>)
+ (pdf . <source-specials or synctex>))
+
+in which the CDR of each entry is a symbol specifying the method
+to be used in the corresponding mode.
+
+Programs should not use this variable directly but the function
+`TeX-source-correlate-method-active' which returns the method
+actually used for forward and inverse search."
+ :type '(choice (const auto)
+ (const synctex)
+ (const source-specials)
+ (list :tag "Different method for DVI and PDF"
+ (cons (const dvi)
+ (choice :tag "Method for DVI mode"
+ (const synctex)
+ (const source-specials)))
+ (cons (const pdf)
+ (choice :tag "Method for PDF mode"
+ (const synctex)
+ (const source-specials)))))
:group 'TeX-view)
-(defvar TeX-source-correlate-method-active nil
- "Method actually used for forward and inverse search.")
-
(defvar TeX-source-correlate-output-page-function nil
"Symbol of function returning an output page relating to buffer position.
The function should take no arguments and return the page numer
@@ -1487,12 +1513,24 @@ This is the case if
`TeX-source-correlate-start-server-flag' is non-nil."
'synctex
'source-specials)))
+(defun TeX-source-correlate-method-active ()
+ "Return the method actually used for forward and inverse search."
+ (cond
+ ((eq TeX-source-correlate-method 'auto)
+ (TeX-source-correlate-determine-method))
+ ((listp TeX-source-correlate-method)
+ (if TeX-PDF-mode
+ (cdr (assoc 'pdf TeX-source-correlate-method))
+ (cdr (assoc 'dvi TeX-source-correlate-method))))
+ (t
+ TeX-source-correlate-method)))
+
(defun TeX-source-correlate-expand-options ()
"Return TeX engine command line option for forward search facilities.
The return value depends on the value of `TeX-source-correlate-mode'.
If this is nil, an empty string will be returned."
(if TeX-source-correlate-mode
- (if (eq TeX-source-correlate-method-active 'source-specials)
+ (if (eq (TeX-source-correlate-method-active) 'source-specials)
(concat TeX-source-specials-tex-flags
(if TeX-source-specials-places
;; -src-specials=WHERE: insert source specials
@@ -1571,16 +1609,8 @@ SyncTeX are recognized."
(dbus-register-signal
:session nil "/org/gnome/evince/Window/0"
"org.gnome.evince.Window" "SyncSource"
- 'TeX-source-correlate-sync-source))
- (unless TeX-source-correlate-method-active
- (setq TeX-source-correlate-method-active
- (if (eq TeX-source-correlate-method 'auto)
- (TeX-source-correlate-determine-method)
- TeX-source-correlate-method)))
- (when (eq TeX-source-correlate-method-active 'synctex)
- (setq TeX-source-correlate-output-page-function
- (when TeX-source-correlate-mode
- 'TeX-synctex-output-page))))
+ 'TeX-source-correlate-sync-source)))
+
(defalias 'TeX-source-specials-mode 'TeX-source-correlate-mode)
(make-obsolete 'TeX-source-specials-mode 'TeX-source-correlate-mode "11.86")
(defalias 'tex-source-correlate-mode 'TeX-source-correlate-mode)
@@ -1668,7 +1698,7 @@ The return value depends on the values of
`source-specials' respectively, an empty string will be
returned."
(if (and TeX-source-correlate-mode
- (eq TeX-source-correlate-method-active 'source-specials))
+ (eq (TeX-source-correlate-method-active) 'source-specials))
(concat TeX-source-specials-view-position-flags
(when (TeX-source-correlate-server-enabled-p)
(concat " " TeX-source-specials-view-editor-flags)))
- [elpa] 249/299: Backport from ELPA repository., (continued)
- [elpa] 249/299: Backport from ELPA repository., Stefan Monnier, 2014/11/01
- [elpa] 245/299: Use TeX-esc as completion separator for units in siunitx.el., Stefan Monnier, 2014/11/01
- [elpa] 253/299: Cater for bad boxes in error descriptions., Stefan Monnier, 2014/11/01
- [elpa] 257/299: Fix TeX-find-display-help., Stefan Monnier, 2014/11/01
- [elpa] 251/299: Color TeX Help buffer., Stefan Monnier, 2014/11/01
- [elpa] 255/299: Better check for mgs., Stefan Monnier, 2014/11/01
- [elpa] 258/299: Prettify file names in error overview., Stefan Monnier, 2014/11/01
- [elpa] 259/299: Update Future Development section in manual., Stefan Monnier, 2014/11/01
- [elpa] 254/299: Simplify error finding and help displaying functions., Stefan Monnier, 2014/11/01
- [elpa] 263/299: Fix remaining XEmacs compilation issues., Stefan Monnier, 2014/11/01
- [elpa] 260/299: Improve selection of the forward/inverse search method.,
Stefan Monnier <=
- [elpa] 262/299: Fix some XEmacs compilation issues., Stefan Monnier, 2014/11/01
- [elpa] 264/299: Fix some runtime issues in XEmacs., Stefan Monnier, 2014/11/01
- [elpa] 248/299: Implement TeX-previous-error., Stefan Monnier, 2014/11/01
- [elpa] 267/299: Remove .cvsignore and tests from the release tarball., Stefan Monnier, 2014/11/01
- [elpa] 265/299: Fix other runtime issues in XEmacs and Emacs 21., Stefan Monnier, 2014/11/01
- [elpa] 269/299: Fix outline promotion/demotion., Stefan Monnier, 2014/11/01
- [elpa] 261/299: Hide some entries of the Command menu when not available., Stefan Monnier, 2014/11/01
- [elpa] 256/299: Implement error overview., Stefan Monnier, 2014/11/01
- [elpa] 271/299: Keep error overview window if View command is run., Stefan Monnier, 2014/11/01
- [elpa] 275/299: Font-lock fix for verbatim environment args., Stefan Monnier, 2014/11/01