/[emacs]/emacs/lisp/simple.el
ViewVC logotype

Diff of /emacs/lisp/simple.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.667 by rms, Sat Nov 20 19:08:45 2004 UTC revision 1.668 by tzz, Mon Nov 29 18:44:29 2004 UTC
# Line 123  to navigate in it.") Line 123  to navigate in it.")
123    
124  (make-variable-buffer-local 'next-error-function)  (make-variable-buffer-local 'next-error-function)
125    
126  (defsubst next-error-buffer-p (buffer &optional extra-test)  (defsubst next-error-buffer-p (buffer
127    "Test if BUFFER is a next-error capable buffer."                                 &optional
128                                   extra-test-inclusive
129                                   extra-test-exclusive)
130      "Test if BUFFER is a next-error capable buffer.
131    EXTRA-TEST-INCLUSIVE is called to allow extra buffers.
132    EXTRA-TEST-INCLUSIVE is called to disallow buffers."
133    (with-current-buffer buffer    (with-current-buffer buffer
134      (or (and extra-test (funcall extra-test))      (or (and extra-test-inclusive (funcall extra-test-inclusive))
135          next-error-function)))          (and (if extra-test-exclusive (funcall extra-test-exclusive) t)
136             next-error-function))))
137    
138  (defun next-error-find-buffer (&optional other-buffer extra-test)  (defun next-error-find-buffer (&optional other-buffer
139    "Return a next-error capable buffer."                                           extra-test-inclusive
140                                             extra-test-exclusive)
141      "Return a next-error capable buffer.
142    OTHER-BUFFER will disallow the current buffer.
143    EXTRA-TEST-INCLUSIVE is called to allow extra buffers.
144    EXTRA-TEST-INCLUSIVE is called to disallow buffers."
145    (or    (or
146     ;; 1. If one window on the selected frame displays such buffer, return it.     ;; 1. If one window on the selected frame displays such buffer, return it.
147     (let ((window-buffers     (let ((window-buffers
148            (delete-dups            (delete-dups
149             (delq nil (mapcar (lambda (w)             (delq nil (mapcar (lambda (w)
150                                 (if (next-error-buffer-p                                 (if (next-error-buffer-p
151                                      (window-buffer w) extra-test)                                      (window-buffer w)
152                                        extra-test-inclusive extra-test-exclusive)
153                                     (window-buffer w)))                                     (window-buffer w)))
154                               (window-list))))))                               (window-list))))))
155       (if other-buffer       (if other-buffer
# Line 147  to navigate in it.") Line 159  to navigate in it.")
159     ;; 2. If next-error-last-buffer is set to a live buffer, use that.     ;; 2. If next-error-last-buffer is set to a live buffer, use that.
160     (if (and next-error-last-buffer     (if (and next-error-last-buffer
161              (buffer-name next-error-last-buffer)              (buffer-name next-error-last-buffer)
162              (next-error-buffer-p next-error-last-buffer extra-test)              (next-error-buffer-p next-error-last-buffer
163                                     extra-test-inclusive extra-test-exclusive)
164              (or (not other-buffer)              (or (not other-buffer)
165                  (not (eq next-error-last-buffer (current-buffer)))))                  (not (eq next-error-last-buffer (current-buffer)))))
166         next-error-last-buffer)         next-error-last-buffer)
167     ;; 3. If the current buffer is a next-error capable buffer, return it.     ;; 3. If the current buffer is a next-error capable buffer, return it.
168     (if (and (not other-buffer)     (if (and (not other-buffer)
169              (next-error-buffer-p (current-buffer) extra-test))              (next-error-buffer-p (current-buffer)
170                                     extra-test-inclusive extra-test-exclusive))
171         (current-buffer))         (current-buffer))
172     ;; 4. Look for a next-error capable buffer in a buffer list.     ;; 4. Look for a next-error capable buffer in a buffer list.
173     (let ((buffers (buffer-list)))     (let ((buffers (buffer-list)))
174       (while (and buffers       (while (and buffers
175                   (or (not (next-error-buffer-p (car buffers) extra-test))                   (or (not (next-error-buffer-p
176                               (car buffers)
177                               extra-test-inclusive extra-test-exclusive))
178                       (and other-buffer (eq (car buffers) (current-buffer)))))                       (and other-buffer (eq (car buffers) (current-buffer)))))
179         (setq buffers (cdr buffers)))         (setq buffers (cdr buffers)))
180       (if buffers       (if buffers
181           (car buffers)           (car buffers)
182         (or (and other-buffer         (or (and other-buffer
183                  (next-error-buffer-p (current-buffer) extra-test)                  (next-error-buffer-p (current-buffer)
184                                         extra-test-inclusive extra-test-exclusive)
185                  ;; The current buffer is a next-error capable buffer.                  ;; The current buffer is a next-error capable buffer.
186                  (progn                  (progn
187                    (if other-buffer                    (if other-buffer

Legend:
Removed from v.1.667  
changed lines
  Added in v.1.668

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26