auctex-devel
[Top][All Lists]
Advanced

[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: Tue, 26 Jun 2007 18:59:25 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

On Thu, Sep 14 2006, David Kastrup wrote:
        ^^^^^^^^^^^^
        A similar issue in Gnus reminded me of this uncommitted patch.

> Reiner Steib <address@hidden> writes:
>> On Thu, Sep 14 2006, David Kastrup wrote:
>>> Reiner Steib <address@hidden> writes:
>>>> `TeX-record-buffer' is supposed to express the user's preference (in
>>>> fact, I will make it customizable before committing it) as also Emacs
>>>> users might prefer recording the buffers.  I thought using (featurep
>>>> 'xemacs) as default might be slightly better than nil, because in
>>>> XEmacs `TeX-pop-to-buffer' always behaves as if `TeX-record-buffer' is
>>>> t.  (But I don't have a strong opinion on this.)
>>>
>>> Why define it in the first place if XEmacs will ignore it?
>>
>> Either you missed the part "Emacs users might prefer recording the
>> buffers" or I don't understand your question.
>
> I don't see a point in
> (defcustom ignoredvariable (featurep 'xemacs) ...
>
> instead of
>
> (unless (featurep 'xemacs)
>   (defcustom ignoredvariable ...

Probably I thought that Emacs can't locate the defcustom then.  But it
does.  How about the attached patch?

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/
--- tex-buf.el  29 Apr 2007 14:40:20 -0000      1.260
+++ tex-buf.el  26 Jun 2007 16:46:08 -0000
@@ -193,6 +193,41 @@
        (TeX-command-region-end (point-max)))
     (TeX-command-region override-confirm)))
 
+(unless (featurep 'xemacs)
+  ;; This variable is not defined in XEmacs because XEmacs' version of
+  ;; `pop-to-buffer' doesn't have the optional NORECORD argument.
+  (defcustom TeX-record-buffer nil
+    "Whether to record buffer names of generated TeX buffers.
+When non-nil, these buffers are put at the front of the list of
+recently selected ones."
+    :group 'TeX-command
+    :type 'boolean))
+
+(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."
+  ;; Make sure not to use third arg in XEmacs.
+  (pop-to-buffer buffer other-window (and norecord
+                                         (boundp TeX-record-buffer)
+                                         TeX-record-buffer)))
+
 (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
@@ -201,13 +236,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 ()
@@ -1079,7 +1114,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)))
@@ -1326,7 +1361,7 @@
 already in an Emacs buffer) and the cursor is placed at the error."
   (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
        (TeX-parse-reset))
     (goto-char TeX-error-point)
@@ -1362,7 +1397,7 @@
          ;; No more errors.
          (message "No more errors.")
          (beep)
-         (pop-to-buffer old)
+         (TeX-pop-to-buffer old)
          nil)
         ;; TeX error
         ((match-beginning 1)
@@ -1572,7 +1607,7 @@
                              error))
       (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)
     (erase-buffer)
     (insert "ERROR: " error
            "\n\n--- TeX said ---"
@@ -1605,7 +1640,7 @@
                (cdr (nth TeX-error-pointer
                          TeX-error-description-list)))))
     (goto-char (point-min))
-    (pop-to-buffer old-buffer)))
+    (TeX-pop-to-buffer old-buffer nil t)))
 
 ;;; Error Messages
 

reply via email to

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