[Top][All Lists]

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

[AUCTeX-devel] Re: switch-to-buffer should not record output buffer

From: Reiner Steib
Subject: [AUCTeX-devel] Re: switch-to-buffer should not record output buffer
Date: Thu, 14 Sep 2006 14:42:42 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

On Wed, Sep 13 2006, Miguel V. S. Frasson wrote:

>> AFAICS, `switch-to-buffer' in the AUCTeX sources is not relevant
>> here.  Probably `pop-to-buffer':
> Yes, `switch-to-buffer' was just my guess. If this code works, very
> nice.  Thanks.

Does this patch give the result you'd like to have?

--- tex-buf.el  25 May 2006 07:50:57 -0000      1.252
+++ tex-buf.el  14 Sep 2006 12:39:18 -0000
@@ -194,6 +194,41 @@
        (TeX-command-region-end (point-max)))
     (TeX-command-region override-confirm)))
+(defvar TeX-record-buffer (featurep 'xemacs)
+  "Whether to record buffer names of genearated TeX buffers.
+When non-nil, these buffers are put at the front of the list of
+recently selected ones.
+This variable has no effect in XEmacs because XEmacs' version of
+`pop-to-buffer' doesn't have the optional NORECORD argument.")
+(defun TeX-pop-to-buffer (buffer &optional other-window norecord)
+  "Compatibility wrapper for `pop-to-buffer'.
+Select buffer BUFFER in some window, preferably a different one.
+BUFFER may be a buffer, a string (a buffer name), or nil.
+If BUFFER is a string which is not the name of an existing buffer,
+then this function creates a buffer with that name.
+If BUFFER is nil, then it chooses some other buffer.
+If `pop-up-windows' is non-nil, windows can be split to do this.
+If optional second arg OTHER-WINDOW is non-nil, insist on finding another
+window even if BUFFER is already visible in the selected window,
+and ignore `same-window-regexps' and `same-window-buffer-names'.
+This function returns the buffer it switched to.
+This uses the function `display-buffer' as a subroutine; see the documentation
+of `display-buffer' for additional customization information.
+Optional third arg NORECORD non-nil means do not put this buffer
+at the front of the list of recently selected ones.
+NORECORD is ignored in XEmacs.  See `TeX-record-buffer'."
+  (if (or TeX-record-buffer
+         ;; Make sure not to use third arg in XEmacs, even if
+         ;; `TeX-record-buffer' is nil.
+         (featurep 'xemacs))
+      (pop-to-buffer buffer other-window)
+    (pop-to-buffer buffer other-window norecord)))
 (defun TeX-recenter-output-buffer (line)
   "Redisplay buffer of TeX job output so that most recent output can be seen.
 The last line of the buffer is displayed on line LINE of the window, or
@@ -202,13 +237,13 @@
   (let ((buffer (TeX-active-buffer)))
     (if buffer
        (let ((old-buffer (current-buffer)))
-         (pop-to-buffer buffer t)
+         (TeX-pop-to-buffer buffer t t)
          (bury-buffer buffer)
          (goto-char (point-max))
          (recenter (if line
                        (prefix-numeric-value line)
                      (/ (window-height) 2)))
-         (pop-to-buffer old-buffer))
+         (TeX-pop-to-buffer old-buffer nil t))
       (message "No process for this document."))))
 (defun TeX-kill-job ()
@@ -1073,7 +1108,7 @@
   "Filter to process background output."
   (let ((old-window (selected-window))
        (pop-up-windows t))
-    (pop-to-buffer "*TeX background*")
+    (TeX-pop-to-buffer "*TeX background*" nil t)
     (goto-char (point-max))
     (insert string)
     (select-window old-window)))
@@ -1320,7 +1355,7 @@
   (let ((old-buffer (current-buffer))
        (default-major-mode major-mode))
-    (pop-to-buffer (TeX-active-buffer))
+    (TeX-pop-to-buffer (TeX-active-buffer) nil t)
     (if reparse
     (goto-char TeX-error-point)
@@ -1407,7 +1442,7 @@
                   (message "No more errors.")
-                  (pop-to-buffer old)
+                  (TeX-pop-to-buffer old nil t)
 (defun TeX-error ()
@@ -1561,7 +1596,7 @@
       (setq TeX-error-pointer (+ TeX-error-pointer 1)))
-    (pop-to-buffer (get-buffer-create "*TeX Help*"))
+    (TeX-pop-to-buffer (get-buffer-create "*TeX Help*") nil t)
     (insert "ERROR: " error
            "\n\n--- TeX said ---"
@@ -1594,7 +1629,7 @@
                (cdr (nth TeX-error-pointer
     (goto-char (point-min))
-    (pop-to-buffer old-buffer)))
+    (TeX-pop-to-buffer old-buffer nil t)))
 ;;; Error Messages
Bye, Reiner.

P.S.: No need to Cc me, I read the list.
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |

reply via email to

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