1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

627 Commits

Author SHA1 Message Date
Paul Eggert
acae275b27 ; Spelling fixes 2016-11-04 14:50:59 -07:00
Eli Zaretskii
197a6bcc20 Fix horizontal scrolling during Isearch
* lisp/isearch.el (isearch-update): Compute the window's body
width in a way that is correct when there are no fringes.
(Bug#24584)
2016-10-08 12:35:17 +03:00
Noam Postavsky
623401267a Don't require isearch-update before isearch-done
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)
2016-10-02 12:27:33 -04:00
Stephen Berman
069fc05bd5 Improve documentation of search functions
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.
2016-07-12 22:11:22 +02:00
Paul Eggert
869092c9ed Bring back xterm pasting with middle mouse
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.
2016-05-22 13:39:30 -07:00
Juri Linkov
1fe1e0a8e7 * lisp/char-fold.el: Rename from character-fold.el.
* lisp/replace.el (replace-char-fold): Rename from replace-character-fold.
* test/automated/char-fold-tests.el: Rename from character-fold-tests.el.
http://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00529.html
2016-05-17 23:55:38 +03:00
Juri Linkov
42fed3b8b9 * lisp/isearch.el (isearch-forward-symbol-at-point): Add isearch-push-state.
(Bug#23410)
2016-05-01 23:30:51 +03:00
Lars Ingebrigtsen
9f27bcf21a isearch-search-fun-function doc tweak
* lisp/isearch.el (isearch-search-fun-function): Mention what
the STRING parameter is (bug#21552).

(cherry picked from commit cafc2a5940)
2016-05-01 19:27:16 +02:00
Leo Liu
16e5e8e4ea Fix last change to isearch-update (bug#23406)
* lisp/isearch.el (isearch-update): Remove (setq cursor-sensor-inhibit
  nil) ie remove the original (unless (boundp 'cursor-sensor-inhibit)
  ...) form.
2016-05-01 11:03:59 +08:00
Leo Liu
b755d988b4 Autoload cursor-sensor-inhibit (bug#23406)
* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor-inhibit): Autoload.
* lisp/isearch.el (isearch-update): Remove boundp check.
2016-04-30 23:36:47 +08:00
Kaushal Modi
91e667692b Fix an Isearch var to be a string (Bug#23038)
* 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.
2016-03-22 01:05:24 +01:00
Kaushal Modi
0ce37eac45 Fix Isearch prompt when invoked with an argument
* 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)
2016-03-14 20:15:17 +02:00
John Wiegley
b417c5a3b3 Revert "Revert "Backport: * lisp/isearch.el: Turn char-folding off by default""
This reverts commit a91b4b51dd.
2016-03-09 15:29:59 -08:00
Artur Malabarba
2e78353fab * lisp/isearch.el (isearch-define-mode-toggle): Fix toggling logic 2016-03-03 19:03:16 -03:00
Eli Zaretskii
a91b4b51dd Revert "Backport: * lisp/isearch.el: Turn char-folding off by default"
* lisp/isearch.el: Turn char-folding back oon by default.

This reverts commit 12c50e82c9.
2016-02-11 05:37:20 +02:00
Artur Malabarba
12c50e82c9 Backport: * lisp/isearch.el: Turn char-folding off by default
(search-default-mode): Set default value to nil.
2016-02-10 07:45:02 +00:00
Artur Malabarba
9ffe7ddd5e * lisp/isearch.el (isearch-define-mode-toggle): Improve logic 2016-02-06 22:58:24 +00:00
Artur Malabarba
3db6adb174 * lisp/isearch.el (search-default-mode)
(isearch-regexp-function): Improve docstrings.
2016-02-06 22:48:32 +00:00
Artur Malabarba
4ea1ea7c73 * lisp/isearch.el: Rename search-default-regexp-mode to search-default-mode
(search-default-mode): New variable.
(isearch-mode, isearch-define-mode-toggle)
(isearch--describe-regexp-mode): Update accordingly.
* lisp/menu-bar.el (nonincremental-search-forward): Update accordingly.
* etc/NEWS: Update accordingly.
* doc/emacs/search.texi: Update accordingly.
2016-02-06 22:48:32 +00:00
Eli Zaretskii
65575c24aa Fix doc string of 'isearch-search-fun-function'
* lisp/isearch.el (isearch-search-fun-function)
(isearch-search-string): Doc fixes.  (Bug#22411)
2016-01-20 15:09:09 +02:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Alan Mackenzie
a72a9fbbbc Rename recenter-group' to recenter-window-group'
* doc/lispref/windows.texi (Textual Scrolling)
* lisp/window.el (top level, recenter-group)
* lisp/follow.el (follow-mode)
* lisp/isearch.el (isearch-back-into-window): Rename `recenter-group' to
`recenter-window-group' and `recenter-group-function' to
`recenter-window-group-function'.
2015-12-18 10:40:49 +00:00
Alan Mackenzie
e8937de554 Replace GROUP argument in six window primitives by new functions.
* 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.
2015-12-14 16:38:07 +00:00
Alan Mackenzie
3194f1ccd9 Further progress making Isearch, Ispell, Replace work with Follow Mode.
* 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.
2015-12-07 15:12:15 +00:00
Alan Mackenzie
bf510d8ab0 lisp/isearch.el: Eliminate macro isearch-call-message, replacing with funcall. 2015-12-04 18:15:27 +00:00
Alan Mackenzie
64c5730365 First commit to scratch/follow. Make Isearch work with Follow Mode, etc.
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.
2015-12-04 18:15:27 +00:00
Eli Zaretskii
cef6c89175 More accurate documentation of lax whitespace matching
* 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.
2015-12-01 21:29:14 +02:00
Eli Zaretskii
3e9ac80e01 Yet another doc improvement for search 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.
2015-11-30 19:30:29 +02:00
Artur Malabarba
d976561ba2 * lisp/isearch.el (isearch-search-fun-default): Nicer error
message when the search fails.
2015-11-29 22:09:39 +00:00
Artur Malabarba
1e010227bb * lisp/isearch.el (isearch-define-mode-toggle): Advertise binding 2015-11-29 21:26:47 +00:00
Artur Malabarba
60e1dfd820 * lisp/isearch.el: Ensure we still support `isearch-new-word'
(isearch-new-regexp-function): Define variable.
(isearch-new-word): Define as an obsolete alias. (Bug#22018)
2015-11-27 11:25:57 +00:00
Eli Zaretskii
8f2a5a8aa4 Improve and update documentation of search commands
* 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.
2015-11-25 21:09:29 +02:00
Juri Linkov
32845e3aad * lisp/replace.el (occur-regexp-descr): New function.
(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).
2015-11-20 02:00:48 +02:00
Artur Malabarba
4d82aa3abd * lisp/isearch.el (search-default-regexp-mode): change default value 2015-11-10 13:04:31 +00:00
Artur Malabarba
25be5df44a * lisp/isearch.el: Avoid an error that blocks isearch
(isearch-update): Don't error if `isearch--current-buffer' has
been killed.

* test/automated/isearch-tests.el (isearch--test-update): New
file.
2015-10-30 11:08:57 +00:00
Artur Malabarba
42eb249ebd * lisp/isearch.el: Delete some outdated comments 2015-10-29 00:22:50 +00:00
Artur Malabarba
faace42f8a * lisp/isearch.el: Refactor momentary messages
(isearch--momentary-message): New function.
(isearch-toggle-lax-whitespace, isearch-toggle-case-fold)
(isearch-toggle-invisible): Use it.
2015-10-28 15:10:08 +00:00
Artur Malabarba
12c0edb755 * lisp/isearch.el: Define all toggles with `isearch-define-mode-toggle'
(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'.
2015-10-28 15:10:08 +00:00
Artur Malabarba
3cdeda60c5 * lisp/isearch.el (search-default-regexp-mode): Revert to nil
Character-fold search _still_ doesn't play well with
lax-whitespace.  So disable it by default (again) for now.
2015-10-26 01:38:48 +00:00
Artur Malabarba
6b5fdca716 * lisp/isearch.el: No visual feedback for default search mode
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.
2015-10-26 00:51:02 +00:00
Artur Malabarba
816f78c2e8 * lisp/isearch.el: Make character-fold search the default again 2015-10-25 01:11:59 +00:00
Artur Malabarba
c5f9ccfce2 * lisp/isearch.el: Generalize definition of regexp-function toggles
(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'.
2015-10-25 01:11:59 +00:00
Artur Malabarba
cfd9ef52b2 * lisp/isearch.el (search-default-regexp-mode): New variable
(isearch-mode): Use it.
2015-10-25 01:11:21 +00:00
Artur Malabarba
fa647ecdf2 * lisp/isearch.el: Delete redundant :group entries
(search-exit-option, search-slow-window-lines)
(search-slow-speed, search-upper-case)
(search-nonincremental-instead, search-whitespace-regexp)
(search-invisible, isearch-hide-immediately)
(isearch-resume-in-command-history, search-ring-max)
(regexp-search-ring-max, search-ring-update, search-highlight)
(isearch-fail): Delete :group entries.
2015-10-25 01:53:46 +01:00
Artur Malabarba
e5ece3229d * lisp/isearch.el (isearch-search-fun-default): Simplify logic
(isearch--lax-regexp-function-p): New function.
2015-10-21 17:35:58 +01:00
Artur Malabarba
19fada58e2 * lisp/isearch.el: Support lax-whitespace in regexp-function searches
(isearch-search-fun-default): Let-bind `search-spaces-regexp'
around `isearch-regexp-function'.
2015-10-21 17:17:04 +01:00
Artur Malabarba
ab65b33f8c * lisp/isearch.el: Rename word search to regexp-function search
`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.
2015-10-21 17:11:09 +01:00
Rüdiger Sonderfeld
8307c06e1b isearch: Document character folding mode.
* isearch.el (isearch-forward): Mention `isearch-toggle-character-fold'
in docstring.
2015-08-31 23:51:46 +01:00
Artur Malabarba
7eed739935 * isearch.el (isearch-search-fun-default): Revert a5bdb87
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.
2015-08-19 11:45:49 +01:00
Artur Malabarba
a5bdb872ed * isearch.el (isearch-search-fun-default): (Bug#21164)
Respect `isearch-lax-whitespace' when searching through
`isearch-word'.
2015-08-09 09:57:05 +01:00