It is useful to be able to call `isearch-done' unconditionally to
ensure a non-isearching state.
* lisp/isearch.el (isearch-done): Check that `isearch--current-buffer'
is a live buffer before using it (Bug #21091).
* test/lisp/isearch-tests.el (isearch--test-done): Test it.
(cherry picked from commit 68f4b52927)
Make the documentation of the search functions more accurate,
complete, and uniform; in particular, extend the description of
the effect when the 'count' parameter is a negative number to all
of these functions.
* src/search.c (Fsearch_backward, Fsearch_forward)
(Fre_search_backward, Fre_search_forward)
(Fposix_search_backward, Fposix_search_forward):
* lisp/isearch.el (word-search-backward, word-search-forward)
(word-search-backward-lax, word-search-forward-lax): Improve doc
strings as described above.
* doc/lispref/searching.texi (String Search, Regexp Search)
(POSIX Regexps): Use 'count' instead of 'repeat' as the name of
the fourth parameter of the *-search-{forward,backward} functions
and improve documentation as described above.
Problem reported by Jan Synáček.
Solution suggested by Stefan Monnier (Bug#23519).
* lisp/isearch.el (isearch-mode-map): Add a binding for xterm-paste.
(xterm--pasted-text): New decl.
(isearch-xterm-paste): New function.
* lisp/term/xterm.el (xterm--pasted-text): New function,
taken from xterm-paste internals.
(xterm-paste): Use it.
* isearch.el (isearch--describe-regexp-mode): The `description' var
needs to always be a string. Add the missing default case for the
cond form that ensures that.
Before this bug fix, for the events when `regexp-function' and
`search-default-mode' both were nil, `description' also stayed nil. So
when `space-before' was non-nil, the "non-string" `description'
(with a value of nil) got passed as an argument to
`replace-regexp-in-string' (where a string was expected). That caused
the error described in Bug#23038.
* lisp/isearch.el (isearch--describe-regexp-mode): With
`search-default-mode' set to nil, if user does C-u C-s, the minibuffer
now displays "Regexp I-search: " again. But if the user has set
`search-default-mode' to t, and then does C-s, the minibuffer now
displays "I-search: " because the default search mode is now regexp
mode. Comments have been added to explain the priority of conditions
in the `cond' form. (Bug#22991)
* doc/lispref/windows.texi (Window Start and End, Textual Scrolling)
* doc/lispref/positions.texi (Screen Lines): Remove optional GROUP argument
from description of six window functions. Add in description of new functions
window-group-start, window-group-end, set-window-group-start,
pos-visible-in-window-group-p, recenter-group and move-to-window-group-line,
together with the six variables indirecting to the pertinent group
functions.
* src/window.c
* src/keyboard.c: Revert the commit from 2015-11-11 12:02:48, in so far as it
applies to these two files, which added the GROUP argument to six window
primitives.
* lisp/follow.el (follow-mode): Use updated variable names for the indirected
functions.
* lisp/isearch.el (isearch-update, isearch-done, isearch-string-out-of-window)
(isearch-back-into-window, isearch-lazy-highlight-new-loop)
(isearch-lazy-highlight-search, isearch-lazy-highlight-update): Replace calls
to window primitives (e.g. window-start) with a GROUP argument by calls to
new functions (e.g. window-group-start).
* lisp/ispell.el (ispell-command-loop): Replace call to
pos-visible-in-window-p with pos-visible-in-window-group-p.
* lisp/window.el (window-group-start, window-group-end)
(set-window-group-start, recenter-group, pos-visible-in-window-group-p)
(selected-window-group, move-to-window-group-line): New functions.
(window-group-start-function, window-group-end-function)
(set-window-group-start-function, recenter-group-function)
(pos-visible-in-window-group-p-function, selected-window-group-function)
(move-to-window-group-line-function): New variables.
* lisp/follow.el: (follow-mode): Remove references to sit*-for-function, which
no longer exists. Add follow-post-command-hook to three special purpose
hooks at setup, and remove them at tear down.
* lisp/isearch.el: (isearch-update): invoke isearch-update-post-hook before
isearch-lazy-highlight-new-loop.
(isearch-lazy-highlight-new-loop): Restore this function to what it previously
was, merging the functionality of isearch-lazy-highlight-maybe-new-loop into
it.
(isearch-lazy-highlight-maybe-new-loop): function removed.
* lisp/replace.el: (replace-update-post-hook): New hook variable.
(perform-replace): Add second (nil) argument to looking-back. Invoke
replace-update-post-hook before calling replace-highlight.
* lisp/textmodes/ispell.el: (ispell-update-post-hook): New hook variable.
(ispell-command-loop): invoke ispell-update-post-hook. Add GROUP argument to
call of pos-visible-in-window-p.
(ispell-display-buffer): Place *Choices* window at the top of the last window
in a window group.
doc/lispref/window.texi (Basic Windows): Add paragraph defining "Group of
Windows" and new @defun selected-window-group.
(Window Start and End): Describe new &optional parameter GROUP and
...-group-function for window-start, window-end, set-window-start, and
pos-visible-in-window-p.
(Textual Scrolling) Describe the same for recenter.
doc/lispref/positions.texi (Screen Lines): Describe the same for
move-to-window-line.
src/window.c (Fwindow_start, Fwindow_end, Fset_window_start)
(Fpos_visible_in_window_p, Frecenter, Fmove_to_window_line): To each, add ar
new optional parameter "group". At the beginning of each, check whether the
corresponding ...-group-function is set to a function, and if so execute this
function in place of the normal processing.
(syms_of_window): Define symbols for the six new variables below.
(window-start-group-function, window-end-group-function)
(set-window-start-group-function, recenter-group-function)
(pos-visible-in-window-p-group-function, move-to-window-line-group-function):
New permanent local buffer local variables.
src/keyboard.c (Fposn_at_point): Add extra parameter in call to
Fpos_visible_in_window_p.
lisp/window.el (selected-window-group-function): New permanent local buffer
local variable.
(selected-window-group): New function.
lisp/follow.el (follow-mode): Set the ...-group-function variables at mode
enable, kill them at mode disable. Add/remove follow-after-change to/from
after-change-functions.
(follow-start-end-invalid): New variable.
(follow-redisplay): Manipulate follow-start-end-invalid.
(follow-after-change, follow-window-start, follow-window-end)
(follow-set-window-start, follow-pos-visible-in-window-p)
(follow-move-to-window-line, follow-sit-for): New functions.
lisp/isearch.el (isearch-call-message): New macro.
(isearch-update, with-isearch-suspended, isearch-del-char)
(isearch-search-and-update, isearch-ring-adjust): Invoke above new macro.
(with-isearch-suspended): Rearrange code such that isearch-call-message is
invoked before point is moved.
(isearch-message): Add comment about where point must be at function call.
(isearch-search): Remove call to isearch-message.
(isearch-lazy-highlight-window-group): New variable.
(isearch-lazy-highlight-new-loop): Unconditionally start idle timer. Move
the battery of tests to ...
(isearch-lazy-highlight-maybe-new-loop): New function, started by idle timer.
Note: (sit-for 0) is still called.
(isearch-lazy-highlight-update): Check membership of
isearch-lazy-highlight-window-group. Don't set the `window' overlay
property.
(isearch-update, isearch-done, isearch-string-out-of-window)
(isearch-back-into-window, isearch-lazy-highlight-maybe-new-loop)
(isearch-lazy-highlight-search, isearch-lazy-highlight-update)
(isearch-lazy-highlight-update): Call the six amended primitives (see
src/window.c above) with the new `group' argument set to t, to cooperate
with Follow Mode.
* lisp/isearch.el (isearch-forward-word, isearch-forward-symbol)
(word-search-backward, word-search-forward)
(word-search-backward-lax, word-search-forward-lax): Mention in
doc strings that toggling lax whitespace matching has no effect on
these commands.
* doc/emacs/search.texi (Word Search, Symbol Search): Clarify that
lax whitespace matching has no effect on these commands.
* doc/emacs/search.texi (Word Search, Symbol Search)
(Regexp Search): Document commands that don't support lax
whitespace matching or character folding.
(Nonincremental Search): Mention the search commands that can be
invoked from the menu bar.
* lisp/isearch.el (isearch-define-mode-toggle-word)
(isearch-define-mode-toggle-symbol)
(isearch-define-mode-toggle-character-fold): Note in the doc
string that turning these on exits the regexp mode.
(isearch-forward-regexp, isearch-forward-word)
(isearch-forward-symbol, isearch-backward-regexp)
(word-search-backward, word-search-forward)
(word-search-backward-lax, word-search-forward-lax): State in the
doc string which commands don't support character folding and/or
lax-whitespace matching.
* doc/emacs/search.texi (Lax Search): Renamed from "Search Case";
all references changed. Move the description of lax-whitespace
here. Add description of the new character folding features and
additional customizable options.
(Isearch Yank): Move before "Error in Search".
(Basic Isearch): Improve wording. Add index entries. Add short
description of how to abandon search, making this subsection a
complete introduction to search basics.
(Repeat Isearch): Add index entries. Describe additional
customizable options. Describe mouse clicks.
(Isearch Yank): Add index entries. Describe mouse-2 click in echo
area. Describe more customizable options.
(Error in Isearch): Add index entries.
(Special Isearch): Move actual description of some isearch
commands to other sections, leaving here just the summary of the
commands. Add command that toggles character folding. Describe
commands, like "C-h C-h", that were previously omitted for some
reason.
(Not Exiting Isearch): Describe search-exit-option. Add index
entries.
(Word Search): Describe eww-search-word and eww-search-prefix.
(Symbol Search): Add index entries.
(Regexp Search): Describe regexp-search-ring-max.
(Replacement and Lax Matches): Renamed from "Replacement and
Case"; all references changed. Describe lax-whitespace matching
in replace commands and related options. Describe character
folding in replace commands and related options.
(Query Replace): Describe query-replace-from-to-separator and the
new history features. Add index entries for highlighted text.
Describe query-replace-skip-read-only. Describe more keys
accepted by query-replace.
(Other Repeating Search): More index entries for Occur. Describe
list-matching-lines-default-context-lines.
(Search Customizations): New section, documents customizable
options that were not documented until now.
* doc/emacs/glossary.texi (Glossary): Add "Case Folding" and
"Character Folding".
* etc/NEWS: Move search- and replace-related entries to a single
parent section.
* lisp/replace.el (query-replace-show-replacement): Doc fix.
* lisp/isearch.el (search-nonincremental-instead)
(isearch-hide-immediately): Doc fixes.
(occur-1, occur-engine): Use it.
* lisp/isearch.el (isearch-occur): Propertize regexp with
isearch-string and isearch-regexp-function-descr for
occur-regexp-descr to display the correct description
message in the header (bug#21176, bug#21180).
(isearch-define-mode-toggle): New macro.
(isearch-toggle-invisible): Renamed to
`isearch-define-mode-toggle'.
(isearch-toggle-case-fold, isearch-toggle-invisible)
(isearch-toggle-regexp, isearch-toggle-lax-whitespace): Define
with `isearch-define-mode-toggle'.
During an isearch where character-folding is the default, we don't
want to take up minibuffer space just to tell the user that
"Char-fold " is on. The same goes for other modes, if the user
changes the default. In contrast, if the user toggles OFF the
default mode, they should see "Literal", to distinguish it from
the default mode.
(isearch--describe-regexp-mode): Return "" if describing the
default mode, and return "literal " if describing a plain search
and it is not default.
(isearch-specify-regexp-function): New macro for specifying
possible values of `isearch-regexp-function'.
(isearch-toggle-character-fold, isearch-toggle-symbol)
(isearch-toggle-word): Define with `isearch-specify-regexp-function'.
`isearch-word' went well beyond its original purpose, and the name
no longer makes sense. It is now called
`isearch-regexp-function', and it's value should always be a
function that converts a string to a regexp (though setting it to
t is still supported for now).
(isearch-word): Make obsolete.
(isearch-regexp-function): New variable.
(isearch-mode, isearch-done, isearch--state, isearch--set-state)
(with-isearch-suspended, isearch-toggle-regexp)
(isearch-toggle-word, isearch-toggle-symbol)
(isearch-toggle-character-fold, isearch-query-replace)
(isearch-occur, isearch-highlight-regexp)
(isearch-search-and-update, isearch-message-prefix)
(isearch-search-fun-default, isearch-search)
(isearch-lazy-highlight-new-loop, isearch-lazy-highlight-search):
Use it.
(isearch-lazy-highlight-regexp-function): New var.
(isearch-lazy-highlight-word): Make obsolete.
(isearch--describe-regexp-mode): New function.
(isearch--describe-word-mode): Make obsolete.
* lisp/info.el (Info-isearch-search): Use the new var.
* lisp/replace.el (replace-search, replace-highlight): Use the new
var.
* lisp/obsolete/longlines.el (longlines-search-function): Use the
new var.
* lisp/hexl.el (hexl-isearch-search-function): Use the new var.
* lisp/cedet/semantic/senator.el (senator-isearch-search-fun): Use
the new var.
Remove usage of `isearch-lax-whitespace' inside the `iearch-word'
clause of `isearch-search-fun-default'. That lax variable does not
refer to lax-whitespacing. Related to (bug#21777).
This reverts commit a5bdb872ed.
* character-fold.el (character-fold-search): Set to nil
Default to nil for now, until someone implements proper
lax-whitespacing with char-fold searching.