auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. a3f4cac866bce4784858c


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. a3f4cac866bce4784858cc1a2e8e3661576445f4
Date: Fri, 21 Nov 2014 10:04:22 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  a3f4cac866bce4784858cc1a2e8e3661576445f4 (commit)
      from  58bd866ebc92b34f1fe6f1129beece6bb091d7b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a3f4cac866bce4784858cc1a2e8e3661576445f4
Author: Tassilo Horn <address@hidden>
Date:   Fri Nov 21 11:03:11 2014 +0100

    Implement forward-search for View command on TeX-region.
    
    * tex.el (TeX-evince-sync-view): Use line/col information from the
    TeX-region buffer if the View command is made on a region.
    
    * tex-buf.el (TeX-region-create): Position point in the same
    line/col as in the original buffer to make forward search work.

diff --git a/ChangeLog b/ChangeLog
index d83ac0f..59a020f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-11-21  Tassilo Horn  <address@hidden>
+
+       * tex.el (TeX-evince-sync-view): Use line/col information from the
+       TeX-region buffer if the View command is made on a region.
+
+       * tex-buf.el (TeX-region-create): Position point in the same
+       line/col as in the original buffer to make forward search work.
+
 2014-11-20  Mosè Giordano  <address@hidden>
 
        * latex.el (LaTeX-env-figure): Fix indentation when there is the
diff --git a/tex-buf.el b/tex-buf.el
index 7b6905b..27a4b5c 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -365,9 +365,9 @@ asked if it is positive, and suppressed if it is not."
     ;; the command, but keep them if the command to be run is View.
     (unless (string= name "View")
       (if (frame-live-p TeX-error-overview-frame)
-                  (delete-frame TeX-error-overview-frame))
-     (if (get-buffer TeX-error-overview-buffer-name)
-        (kill-buffer TeX-error-overview-buffer-name)))
+         (delete-frame TeX-error-overview-frame))
+      (if (get-buffer TeX-error-overview-buffer-name)
+         (kill-buffer TeX-error-overview-buffer-name)))
 
     ;; Now start the process
     (setq file (funcall file))
@@ -1447,7 +1447,7 @@ original file."
                               ""
                             (re-search-forward "[\r\n]" nil t)
                             (buffer-substring (point-min) (point)))))))))
-
+        (header-offset 0)
         ;; We search for the trailer from the master file, if it is
         ;; not present in the region.
         (trailer-offset 0)
@@ -1485,8 +1485,9 @@ original file."
                header
                TeX-region-extra
                "\n\\message{ !name(" original ") !offset(")
-       (insert (int-to-string (- offset
-                                 (1+ (TeX-current-offset))))
+       (setq header-offset (- offset
+                              (1+ (TeX-current-offset))))
+       (insert (int-to-string header-offset)
                ") }\n"
                region
                "\n\\message{ !name("  master-name ") !offset(")
@@ -1495,6 +1496,13 @@ original file."
                ") }\n"
                trailer)
        (setq TeX-region-orig-buffer orig-buffer)
+       ;; Position point at the line/col that corresponds to point's line in
+       ;; orig-buffer in order to make forward search work.
+       (let ((line-col (with-current-buffer orig-buffer
+                         (cons (line-number-at-pos)
+                               (current-column)))))
+         (goto-line (abs (- header-offset (car line-col))))
+         (forward-char (cdr line-col)))
        (run-hooks 'TeX-region-hook)
        (if (string-equal (buffer-string) original-content)
            (set-buffer-modified-p nil)
diff --git a/tex.el b/tex.el
index ffd0ecf..3b530cb 100644
--- a/tex.el
+++ b/tex.el
@@ -1112,14 +1112,17 @@ 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 0)
+       (with-current-buffer (or (when TeX-current-process-region-p
+                                  (get-file-buffer (TeX-region-file t)))
+                                (current-buffer))
+         (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 0))
       (error "Couldn't find the Evince instance for %s" uri))))
 
 (defvar TeX-view-program-list-builtin

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

Summary of changes:
 ChangeLog  |    8 ++++++++
 tex-buf.el |   20 ++++++++++++++------
 tex.el     |   19 +++++++++++--------
 3 files changed, 33 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]