/[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.670 by jurta, Mon Dec 13 03:08:52 2004 UTC revision 1.671 by jurta, Tue Dec 14 00:51:02 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  (defsubst next-error-buffer-p (buffer
127                                 &optional                                 &optional
128                                 extra-test-inclusive                                 extra-test-inclusive
129                                 extra-test-exclusive)                                 extra-test-exclusive)
130    "Test if BUFFER is a next-error capable buffer.    "Test if BUFFER is a next-error capable buffer.
131  EXTRA-TEST-INCLUSIVE is called to allow extra buffers.  EXTRA-TEST-INCLUSIVE is called to allow extra buffers.
132  EXTRA-TEST-INCLUSIVE is called to disallow buffers."  EXTRA-TEST-EXCLUSIVE is called to disallow buffers."
133    (with-current-buffer buffer    (with-current-buffer buffer
134      (or (and extra-test-inclusive (funcall extra-test-inclusive))      (or (and extra-test-inclusive (funcall extra-test-inclusive))
135          (and (if extra-test-exclusive (funcall extra-test-exclusive) t)          (and (if extra-test-exclusive (funcall extra-test-exclusive) t)
136           next-error-function))))           next-error-function))))
137    
138  (defun next-error-find-buffer (&optional other-buffer  (defun next-error-find-buffer (&optional other-buffer
139                                           extra-test-inclusive                                           extra-test-inclusive
140                                           extra-test-exclusive)                                           extra-test-exclusive)
141    "Return a next-error capable buffer.    "Return a next-error capable buffer.
142  OTHER-BUFFER will disallow the current buffer.  OTHER-BUFFER will disallow the current buffer.
143  EXTRA-TEST-INCLUSIVE is called to allow extra buffers.  EXTRA-TEST-INCLUSIVE is called to allow extra buffers.
144  EXTRA-TEST-INCLUSIVE is called to disallow buffers."  EXTRA-TEST-EXCLUSIVE 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)                                      (window-buffer w)
152                                      extra-test-inclusive extra-test-exclusive)                                      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 159  EXTRA-TEST-INCLUSIVE is called to disall Line 159  EXTRA-TEST-INCLUSIVE is called to disall
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              (next-error-buffer-p next-error-last-buffer
163                                   extra-test-inclusive extra-test-exclusive)                                   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)              (next-error-buffer-p (current-buffer)
170                                   extra-test-inclusive extra-test-exclusive))                                   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                   (or (not (next-error-buffer-p
176                             (car buffers)                             (car buffers)
177                             extra-test-inclusive extra-test-exclusive))                             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)                  (next-error-buffer-p (current-buffer)
184                                       extra-test-inclusive extra-test-exclusive)                                       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
# Line 3247  Outline mode sets this." Line 3247  Outline mode sets this."
3247              (if (if forward              (if (if forward
3248                      ;; If going forward, don't accept the previous                      ;; If going forward, don't accept the previous
3249                      ;; allowable position if it is before the target line.                      ;; allowable position if it is before the target line.
3250                      (< line-beg (point))                      (< line-beg (point))
3251                    ;; If going backward, don't accept the previous                    ;; If going backward, don't accept the previous
3252                    ;; allowable position if it is still after the target line.                    ;; allowable position if it is still after the target line.
3253                    (<= (point) line-end))                    (<= (point) line-end))

Legend:
Removed from v.1.670  
changed lines
  Added in v.1.671

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