Now on revision 107690. ------------------------------------------------------------ revno: 107690 fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11077 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-03-27 16:43:09 -0400 message: * lisp/emacs-lisp/avl-tree.el (avl-tree--enter-balance): Fix paren typo. (avl-tree--check, avl-tree--check-node): New funs. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-27 09:22:01 +0000 +++ lisp/ChangeLog 2012-03-27 20:43:09 +0000 @@ -1,8 +1,14 @@ +2012-03-27 Stefan Monnier + + * emacs-lisp/avl-tree.el (avl-tree--enter-balance): Fix paren typo + (bug#11077). + (avl-tree--check, avl-tree--check-node): New funs. + 2012-03-27 Martin Rudalics * window.el (switch-to-visible-buffer): New option. - (switch-to-prev-buffer, switch-to-next-buffer): Observe - switch-to-visible-buffer. Make sure that checking for a window + (switch-to-prev-buffer, switch-to-next-buffer): + Observe switch-to-visible-buffer. Make sure that checking for a window showing a buffer already is done on the same frame. 2012-03-27 Glenn Morris @@ -28,8 +34,7 @@ 2012-03-25 Eli Zaretskii * makefile.w32-in (install): Use $(DIRNAME)_same-dir.tst instead - of same-dir.tst, to avoid stepping on other (parallel) Make job's - toes. + of same-dir.tst, to avoid stepping on other (parallel) Make job's toes. 2012-03-25 Chong Yidong === modified file 'lisp/emacs-lisp/avl-tree.el' --- lisp/emacs-lisp/avl-tree.el 2012-01-19 07:21:25 +0000 +++ lisp/emacs-lisp/avl-tree.el 2012-03-27 20:43:09 +0000 @@ -295,9 +295,9 @@ (if (> (* sgn b2) 0) (- sgn) 0) (avl-tree--node-balance p1) (if (< (* sgn b2) 0) sgn 0) - (avl-tree--node-branch node branch) p2 - (avl-tree--node-balance - (avl-tree--node-branch node branch)) 0)) + (avl-tree--node-branch node branch) p2)) + (setf (avl-tree--node-balance + (avl-tree--node-branch node branch)) 0) nil)))) (defun avl-tree--do-enter (cmpfun root branch data &optional updatefun) @@ -339,6 +339,16 @@ (cons nil newdata)) ; return value )))) +(defun avl-tree--check (tree) + "Check the tree's balance." + (avl-tree--check-node (avl-tree--root tree))) +(defun avl-tree--check-node (node) + (if (null node) 0 + (let ((dl (avl-tree--check-node (avl-tree--node-left node))) + (dr (avl-tree--check-node (avl-tree--node-right node)))) + (assert (= (- dr dl) (avl-tree--node-balance node))) + (1+ (max dl dr))))) + ;; ---------------------------------------------------------------- ------------------------------------------------------------ revno: 107689 committer: Glenn Morris branch nick: trunk timestamp: Tue 2012-03-27 16:24:48 -0400 message: NEWS pedantry diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-03-22 06:21:28 +0000 +++ etc/NEWS 2012-03-27 20:24:48 +0000 @@ -1121,7 +1121,8 @@ +++ ** The following obsolete (mostly since at least 21.1) functions and aliases -have been removed (the appropriate new function is given in parentheses): +have been removed (the appropriate new function is given in parentheses; +"not needed" means you can just remove all calls to the function in question): comint-kill-output (comint-delete-output), decompose-composite-char (char-to-string), outline-visible (outline-invisible-p), ------------------------------------------------------------ revno: 107688 committer: martin rudalics branch nick: trunk timestamp: Tue 2012-03-27 11:22:01 +0200 message: Optionally avoid that switching to previous or next buffer shows that buffer twice. * window.el (switch-to-visible-buffer): New option. (switch-to-prev-buffer, switch-to-next-buffer): Observe switch-to-visible-buffer. Make sure that checking for a window showing a buffer already is done on the same frame. * windows.texi (Window History): Describe new option switch-to-visible-buffer. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-03-27 06:46:42 +0000 +++ doc/lispref/ChangeLog 2012-03-27 09:22:01 +0000 @@ -1,3 +1,8 @@ +2012-03-27 Martin Rudalics + + * windows.texi (Window History): Describe new option + switch-to-visible-buffer. + 2012-03-27 Glenn Morris * searching.texi (String Search): Add xref to Emacs manual. === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2012-03-11 16:10:07 +0000 +++ doc/lispref/windows.texi 2012-03-27 09:22:01 +0000 @@ -2073,7 +2073,8 @@ If repeated invocations of this command have already shown all buffers previously shown in @var{window}, further invocations will show buffers from the buffer list of the frame @var{window} appears on (@pxref{The -Buffer List}). +Buffer List}) trying to skip buffers that are already shown in another +window on that frame. @end deffn @deffn Command switch-to-next-buffer &optional window @@ -2087,6 +2088,19 @@ of the frame @var{window} appears on (@pxref{The Buffer List}). @end deffn +By default @code{switch-to-prev-buffer} and @code{switch-to-next-buffer} +can switch to a buffer that is already shown in another window on the +same frame. The following option can be used to override that behavior. + +@defopt switch-to-visible-buffer +If this variable is non-@code{nil}, @code{switch-to-prev-buffer} and +@code{switch-to-next-buffer} may switch to a buffer that is already +visible on the same frame, provided the buffer was shown in the argument +window before. If it's @code{nil}, @code{switch-to-prev-buffer} and +@code{switch-to-next-buffer} always try to avoid switching to a buffer +that is already visible in another window on the same frame. +@end defopt + @node Dedicated Windows @section Dedicated Windows === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-27 06:45:12 +0000 +++ lisp/ChangeLog 2012-03-27 09:22:01 +0000 @@ -1,3 +1,10 @@ +2012-03-27 Martin Rudalics + + * window.el (switch-to-visible-buffer): New option. + (switch-to-prev-buffer, switch-to-next-buffer): Observe + switch-to-visible-buffer. Make sure that checking for a window + showing a buffer already is done on the same frame. + 2012-03-27 Glenn Morris * startup.el (mail-host-address): Doc fix. === modified file 'lisp/window.el' --- lisp/window.el 2012-03-22 20:49:04 +0000 +++ lisp/window.el 2012-03-27 09:22:01 +0000 @@ -2575,6 +2575,18 @@ (when point (set-window-point-1 window point)))) +(defcustom switch-to-visible-buffer t + "If non-nil, allow switching to an already visible buffer. +If this variable is non-nil, `switch-to-prev-buffer' and +`switch-to-next-buffer' may switch to an already visible buffer +provided the buffer was shown in the argument window before. If +this variable is nil, `switch-to-prev-buffer' and +`switch-to-next-buffer' always try to avoid switching to a buffer +that is already visible in another window on the same frame." + :type 'boolean + :version "24.1" + :group 'windows) + (defun switch-to-prev-buffer (&optional window bury-or-kill) "In WINDOW switch to previous buffer. WINDOW must be a live window and defaults to the selected one. @@ -2584,6 +2596,7 @@ shall not be switched to in future invocations of this command." (interactive) (let* ((window (window-normalize-window window t)) + (frame (window-frame window)) (old-buffer (window-buffer window)) ;; Save this since it's destroyed by `set-window-buffer'. (next-buffers (window-next-buffers window)) @@ -2602,14 +2615,13 @@ (not (eq new-buffer old-buffer)) (or bury-or-kill (not (memq new-buffer next-buffers)))) - ;; _DO_ show visible buffers as advertized in Elisp manual 28.14 - ;; on `switch-to-prev-buffer' & `switch-to-next-buffer' - ;;(if (get-buffer-window new-buffer) - ;; ;; Try to avoid showing a buffer visible in some other window. - ;; (setq visible new-buffer) + (if (and (not switch-to-visible-buffer) + (get-buffer-window new-buffer frame)) + ;; Try to avoid showing a buffer visible in some other window. + (setq visible new-buffer) (set-window-buffer-start-and-point window new-buffer (nth 1 entry) (nth 2 entry)) - (throw 'found t))) + (throw 'found t)))) ;; Scan reverted buffer list of WINDOW's frame next, skipping ;; entries of next buffers. Note that when we bury or kill a ;; buffer we don't reverse the global buffer list to avoid showing @@ -2617,15 +2629,16 @@ ;; buffer list in order to make sure that switching to the ;; previous/next buffer traverse it in opposite directions. (dolist (buffer (if bury-or-kill - (buffer-list (window-frame window)) - (nreverse (buffer-list (window-frame window))))) + (buffer-list frame) + (nreverse (buffer-list frame)))) (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) (or bury-or-kill (not (memq buffer next-buffers)))) - (if (get-buffer-window buffer) + (if (get-buffer-window buffer frame) ;; Try to avoid showing a buffer visible in some other window. - (setq visible buffer) + (unless visible + (setq visible buffer)) (setq new-buffer buffer) (set-window-buffer-start-and-point window new-buffer) (throw 'found t)))) @@ -2678,6 +2691,7 @@ WINDOW must be a live window and defaults to the selected one." (interactive) (let* ((window (window-normalize-window window t)) + (frame (window-frame window)) (old-buffer (window-buffer window)) (next-buffers (window-next-buffers window)) new-buffer entry killed-buffers visible) @@ -2698,11 +2712,11 @@ (throw 'found t))) ;; Scan the buffer list of WINDOW's frame next, skipping previous ;; buffers entries. - (dolist (buffer (buffer-list (window-frame window))) + (dolist (buffer (buffer-list frame)) (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) (not (assq buffer (window-prev-buffers window)))) - (if (get-buffer-window buffer) + (if (get-buffer-window buffer frame) ;; Try to avoid showing a buffer visible in some other window. (setq visible buffer) (setq new-buffer buffer) @@ -2716,9 +2730,14 @@ (not (setq killed-buffers (cons new-buffer killed-buffers)))) (not (eq new-buffer old-buffer))) - (set-window-buffer-start-and-point - window new-buffer (nth 1 entry) (nth 2 entry)) - (throw 'found t))) + (if (and (not switch-to-visible-buffer) + (get-buffer-window new-buffer frame)) + ;; Try to avoid showing a buffer visible in some other window. + (unless visible + (setq visible new-buffer)) + (set-window-buffer-start-and-point + window new-buffer (nth 1 entry) (nth 2 entry)) + (throw 'found t)))) ;; Show a buffer visible in another window. (when visible ------------------------------------------------------------ revno: 107687 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-03-26 23:46:42 -0700 message: Small doc and elisp manual fixes related to searching * doc/lispref/searching.texi (String Search): Add xref to Emacs manual. Copyedits. Mention the function word-search-regexp. (Searching and Case): Add xref to Emacs manual. Copyedits. * src/search.c (Fword_search_backward_lax, Fword_search_forward_lax): Doc fixes. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-03-27 00:50:49 +0000 +++ doc/lispref/ChangeLog 2012-03-27 06:46:42 +0000 @@ -1,5 +1,9 @@ 2012-03-27 Glenn Morris + * searching.texi (String Search): Add xref to Emacs manual. + Copyedits. Mention the function word-search-regexp. + (Searching and Case): Add xref to Emacs manual. Copyedits. + * processes.texi (Network Servers): Standardize apostrophe usage. * os.texi (System Environment): Copyedits. Remove some examples === modified file 'doc/lispref/searching.texi' --- doc/lispref/searching.texi 2012-02-25 04:03:43 +0000 +++ doc/lispref/searching.texi 2012-03-27 06:46:42 +0000 @@ -38,7 +38,8 @@ buffer. They are meant for use in programs, but you may call them interactively. If you do so, they prompt for the search string; the arguments @var{limit} and @var{noerror} are @code{nil}, and @var{repeat} -is 1. +is 1. For more details on interactive searching, @pxref{Search,, +Searching and Replacement, emacs, The GNU Emacs Manual}. These search functions convert the search string to multibyte if the buffer is multibyte; they convert the search string to unibyte if the @@ -71,8 +72,8 @@ @end group @end example -The argument @var{limit} specifies the upper bound to the search. (It -must be a position in the current buffer.) No match extending after +The argument @var{limit} specifies the bound to the search, and should +be a position in the current buffer. No match extending after that position is accepted. If @var{limit} is omitted or @code{nil}, it defaults to the end of the accessible portion of the buffer. @@ -82,9 +83,14 @@ error is signaled. If @var{noerror} is @code{t}, @code{search-forward} returns @code{nil} and does nothing. If @var{noerror} is neither @code{nil} nor @code{t}, then @code{search-forward} moves point to the -upper bound and returns @code{nil}. (It would be more consistent now to -return the new position of point in that case, but some existing -programs may depend on a value of @code{nil}.) +upper bound and returns @code{nil}. +@c I see no prospect of this ever changing, and frankly the current +@c behavior seems better, so there seems no need to mention this. +@ignore +(It would be more consistent now to return the new position of point +in that case, but some existing programs may depend on a value of +@code{nil}.) +@end ignore The argument @var{noerror} only affects valid searches which fail to find a match. Invalid arguments cause errors regardless of @@ -132,7 +138,7 @@ @group (word-search-forward "Please find the ball, boy.") - @result{} 35 + @result{} 36 ---------- Buffer: foo ---------- He said "Please! Find @@ -153,11 +159,16 @@ If @var{repeat} is non-@code{nil}, then the search is repeated that many times. Point is positioned at the end of the last match. + +@findex word-search-regexp +Internal, @code{word-search-forward} and related functions use the +function @code{word-search-regexp} to convert @var{string} to a +regular expression that ignores punctuation. @end deffn @deffn Command word-search-forward-lax string &optional limit noerror repeat This command is identical to @code{word-search-forward}, except that -the end of @code{string} need not match a word boundary unless it ends +the end of @var{string} need not match a word boundary, unless @var{string} ends in whitespace. For instance, searching for @samp{ball boy} matches @samp{ball boyee}, but does not match @samp{aball boy}. @end deffn @@ -171,7 +182,7 @@ @deffn Command word-search-backward-lax string &optional limit noerror repeat This command is identical to @code{word-search-backward}, except that -the end of @code{string} need not match a word boundary unless it ends +the end of @var{string} need not match a word boundary, unless @var{string} ends in whitespace. @end deffn @@ -189,24 +200,26 @@ @code{case-fold-search} to @code{nil}. Then all letters must match exactly, including case. This is a buffer-local variable; altering the variable affects only the current buffer. (@xref{Intro to -Buffer-Local}.) Alternatively, you may change the default value of -@code{case-fold-search}. +Buffer-Local}.) Alternatively, you may change the default value. +In Lisp code, you will more typically use @code{let} to bind +@code{case-fold-search} to the desired value. Note that the user-level incremental search feature handles case distinctions differently. When the search string contains only lower case letters, the search ignores case, but when the search string contains one or more upper case letters, the search becomes case-sensitive. But this has nothing to do with the searching -functions used in Lisp code. +functions used in Lisp code. @xref{Incremental Search,,, emacs, +The GNU Emacs Manual}. @defopt case-fold-search This buffer-local variable determines whether searches should ignore case. If the variable is @code{nil} they do not ignore case; otherwise -they do ignore case. +(and by default) they do ignore case. @end defopt @defopt case-replace -This variable determines whether the higher level replacement +This variable determines whether the higher-level replacement functions should preserve case. If the variable is @code{nil}, that means to use the replacement text verbatim. A non-@code{nil} value means to convert the case of the replacement text according to the === modified file 'src/ChangeLog' --- src/ChangeLog 2012-03-26 05:43:05 +0000 +++ src/ChangeLog 2012-03-27 06:46:42 +0000 @@ -1,3 +1,8 @@ +2012-03-27 Glenn Morris + + * search.c (Fword_search_backward_lax, Fword_search_forward_lax): + Doc fixes. + 2012-03-26 Kenichi Handa * dispextern.h (struct glyph): Fix previous change. Change the === modified file 'src/search.c' --- src/search.c 2012-01-26 15:48:27 +0000 +++ src/search.c 2012-03-27 06:46:42 +0000 @@ -1,6 +1,7 @@ /* String search routines for GNU Emacs. - Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2012 - Free Software Foundation, Inc. + +Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2012 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -2257,7 +2258,7 @@ Set point to the beginning of the occurrence found, and return point. Unlike `word-search-backward', the end of STRING need not match a word -boundary unless it ends in whitespace. +boundary, unless STRING ends in whitespace. An optional second argument bounds the search; it is a buffer position. The match found must not extend before that position. @@ -2279,7 +2280,7 @@ Set point to the end of the occurrence found, and return point. Unlike `word-search-forward', the end of STRING need not match a word -boundary unless it ends in whitespace. +boundary, unless STRING ends in whitespace. An optional second argument bounds the search; it is a buffer position. The match found must not extend after that position.