From 675254bc4b3ccb7931dda00969a08277d3967e3d Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 23 May 2004 21:05:08 +0000 Subject: [PATCH] (next-error-find-buffer): Add a rule to return next-error capable buffer if one window on the selected frame displays such buffer. --- lisp/ChangeLog | 49 ++++++++++++++++++++++++++++++++++++--- lisp/simple.el | 63 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 84 insertions(+), 28 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 957e52e2b2..1533d3aae1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,46 @@ +2004-05-23 Juri Linkov + + * info.el (Info-index-nodes): New var and fun. + (Info-goto-index, Info-index, info-apropos) + (Info-find-emacs-command-nodes): Rewrite to use Info-index-nodes. + (Info-index): Fix docstring. Store and restore Info-history-list. + (Info-complete-nodes): New var. + (Info-complete-menu-item): Use it. + (Info-index-node): New fun. + (Info-final-node, Info-forward-node, Info-backward-node) + (Info-build-toc, Info-try-follow-nearest-node, Info-fontify-node): + Use Info-index-node. + (Info-extract-menu-item, Info-extract-menu-counting): Set second + arg of `Info-extract-menu-node-name' to non-nil for index nodes. + (Info-find-node-2): If a node with period in its name not found, + try to find a node without the name part after period. + (Info-select-node): Call Info-fontify-node only if + Info-fontify-maximum-menu-size is not nil. + (info-apropos): Set Info-fontify-maximum-menu-size to nil. + (Info-find-emacs-command-nodes, Info-goto-emacs-command-node): + Preserve Info-history-list. + (Info-toc): Set Info-current-file. + (Info-build-toc): Move point to the beginning of the buffer. + Add main-file variable. + (Info-dir-remove-duplicates, Info-history, Info-toc, info-apropos): + Use backslashed representation of the control character ^_. + + * textmodes/texinfmt.el (texinfo-print-index): Print index line + numbers in the new Texinfo 4.7 format. + + * add-log.el (change-log-font-lock-keywords): Remove `:' from + regexps for function and variable names. + + * descr-text.el (describe-property-list): Add [show] button for + `syntax-table' property with action to pp to a separate buffer. + (describe-char): Replace search-forward by re-search-forward with + whitespace regexp after "character:" to not fail in too narrow + windows. + + * simple.el (next-error-find-buffer): Add a rule to return + next-error capable buffer if one window on the selected frame + displays such buffer. + 2004-05-23 Nick Roberts * progmodes/gdb-ui.el (gdb-server-prefix): New variable. @@ -42,9 +85,9 @@ * textmodes/bibtex.el: Use assoc-string, not assoc-ignore-case. - * progmodes/idlw-shell.el (idlwave-shell-get-object-class): + * progmodes/idlw-shell.el (idlwave-shell-get-object-class): Use assoc-string, not assoc-ignore-case. - + * progmodes/ada-mode.el: Use assoc-string, not assoc-ignore-case. * emacs-lisp/lisp.el (mark-defun, narrow-to-defun): @@ -2794,7 +2837,7 @@ 2004-03-21 Andre Spiegel - * vc.el Add new optional BUFFER argument to vc-BACKEND-print-log + * vc.el: Add new optional BUFFER argument to vc-BACKEND-print-log and vc-BACKEND-diff. (vc-print-log): If the print-log implementation supports it, use the new BUFFER argument to direct output to *vc-change-log*, not *vc*. diff --git a/lisp/simple.el b/lisp/simple.el index f76c666272..1cf3601b5b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -91,36 +91,49 @@ to navigate in it.") (or (and extra-test (funcall extra-test)) next-error-function))) -;; Return a next-error capable buffer. -;; If the current buffer is such, return it. -;; If next-error-last-buffer is set to a live buffer, use that. -;; Otherwise, look for a next-error capable buffer and signal an error -;; if there are none. +;; Return a next-error capable buffer according to the following rules: +;; 1. If the current buffer is a next-error capable buffer, return it. +;; 2. If one window on the selected frame displays such buffer, return it. +;; 3. If next-error-last-buffer is set to a live buffer, use that. +;; 4. Otherwise, look for a next-error capable buffer in a buffer list. +;; 5. Signal an error if there are none. (defun next-error-find-buffer (&optional other-buffer extra-test) (if (and (not other-buffer) (next-error-buffer-p (current-buffer) extra-test)) ;; The current buffer is a next-error capable buffer. (current-buffer) - (if (and next-error-last-buffer (buffer-name next-error-last-buffer) - (next-error-buffer-p next-error-last-buffer extra-test) - (or (not other-buffer) (not (eq next-error-last-buffer - (current-buffer))))) - next-error-last-buffer - (let ((buffers (buffer-list))) - (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test)) - (and other-buffer - (eq (car buffers) (current-buffer))))) - (setq buffers (cdr buffers))) - (if buffers - (car buffers) - (or (and other-buffer - (next-error-buffer-p (current-buffer) extra-test) - ;; The current buffer is a next-error capable buffer. - (progn - (if other-buffer - (message "This is the only next-error capable buffer.")) - (current-buffer))) - (error "No next-error capable buffer found!"))))))) + (or + (let ((window-buffers + (delete-dups + (delq nil + (mapcar (lambda (w) + (and (next-error-buffer-p (window-buffer w) extra-test) + (window-buffer w))) + (window-list)))))) + (if other-buffer + (setq window-buffers (delq (current-buffer) window-buffers))) + (if (eq (length window-buffers) 1) + (car window-buffers))) + (if (and next-error-last-buffer (buffer-name next-error-last-buffer) + (next-error-buffer-p next-error-last-buffer extra-test) + (or (not other-buffer) (not (eq next-error-last-buffer + (current-buffer))))) + next-error-last-buffer + (let ((buffers (buffer-list))) + (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test)) + (and other-buffer + (eq (car buffers) (current-buffer))))) + (setq buffers (cdr buffers))) + (if buffers + (car buffers) + (or (and other-buffer + (next-error-buffer-p (current-buffer) extra-test) + ;; The current buffer is a next-error capable buffer. + (progn + (if other-buffer + (message "This is the only next-error capable buffer.")) + (current-buffer))) + (error "No next-error capable buffer found!")))))))) (defun next-error (arg &optional reset) "Visit next next-error message and corresponding source code. -- 2.39.2