1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-02 08:22:22 +00:00
Commit Graph

492 Commits

Author SHA1 Message Date
Glenn Morris
99a544c807 Merge from origin/emacs-27
0a3731feef Make memq etc. examples more like they were
ed25282b82 Document effect of 'search-upper-case' on replacement comm...
5a5d8a8ec0 * lisp/desktop.el (desktop-save): Doc fix.  (Bug#41007)
2020-05-03 07:50:21 -07:00
Eli Zaretskii
ed25282b82 Document effect of 'search-upper-case' on replacement commands
* doc/emacs/search.texi (Replacement and Lax Matches): Document
the role of 'search-upper-case' in replacement commands.
(Lax Search): Document the value 'not-yanks' of
'search-upper-case' where the variable itself is documented.

* lisp/replace.el (query-replace-regexp, query-replace): Mention
'search-upper-case' and its effect in doc strings.  (Bug#40940)
2020-05-02 10:54:01 +03:00
Stéphane Boucher
21ebfa1dd8 Update default-directory in occur buffer (bug#39608)
* lisp/replace.el (occur-1): Update default-directory in occur buffer.

Copyright-paperwork-exempt: yes
2020-03-04 02:05:55 +02:00
Juri Linkov
aff8bca77c * lisp/replace.el (occur-engine-line): Revert part of fb16313025 (bug#39597)
; Do not merge to master.
2020-02-23 02:34:45 +02:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Robert Pluim
0f397e8dd4 ; Fix typo in previous commit
* lisp/replace.el (query-replace-read-from): Fix typo in docstring.
2019-10-09 15:16:07 +02:00
Eli Zaretskii
8e0761c842 Improve doc strings in replace.el
* lisp/replace.el (query-replace-read-from)
(query-replace-compile-replacement, query-replace-read-to)
(replace-string, replace-regexp, occur-mode-goto-occurrence)
(occur-next-error, occur-rename-buffer, multi-occur)
(multi-occur-in-matching-buffers): Describe all arguments in
doc strings.  (Bug#31207)
2019-10-09 13:08:01 +03:00
Tino Calancha
cbc10ec71e Fix an assignment to free variable warning
It fixes a bug introduced by commit
'query-replace-regexp undo: Update next-replacement after undo'
(30c4f35a6f)

See https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00364.html
* lisp/replace.el(perform-replace): Rename variable
to next-replacement-replaced.
2019-09-17 18:12:45 +02:00
Glenn Morris
a625ca5c26 Merge from origin/emacs-26
30c4f35 (origin/emacs-26) query-replace-regexp undo: Update next-repl...
c596be0 Amend the menu caption for page "Display Property" in the Eli...
13b9510 Add description of chinese-sisheng
2019-09-15 16:38:23 -07:00
Tino Calancha
30c4f35a6f query-replace-regexp undo: Update next-replacement after undo
* lisp/replace.el (perform-replace):
Rename the local binding to not shadow next-replacement.
Update next-replacement after undo (Bug#37287).

* test/lisp/replace-tests.el (query-replace-undo-bug37287): Add test.
(query-replace-undo-bug37073): Tweak this test.
2019-09-09 08:21:18 +02:00
Glenn Morris
af103ef3c9 Merge from origin/emacs-26
615cff4 (origin/emacs-26) Fix process filter documentation (Bug#13400)
beb1d22 Fix query-replace-regexp undo feature

# Conflicts:
#	test/lisp/replace-tests.el
2019-08-20 09:04:53 -07:00
Tino Calancha
beb1d22260 Fix query-replace-regexp undo feature
Ensure that non-regexp strings used with `looking-at' are quoted.
* lisp/replace.el (perform-replace): Quote regexp (Bug#37073).
* test/lisp/replace-tests.el (replace-tests-perform-replace-regexp-flag):
New variable.
(replace-tests-with-undo): Use it.
(query-replace-undo-bug37073): Add tests.
2019-08-19 17:32:09 +02:00
Lars Ingebrigtsen
6cd3b7a62b Tweak mouse-face highlighting of Occur buffers
* lisp/replace.el (occur-engine): Ensure that the mouse highlight
is done over the entire line (bug#27846).
2019-07-15 20:13:48 +02:00
Juri Linkov
53fb021acc Better match-data handling in perform-replace
* lisp/replace.el (perform-replace): Don't wrap replace-highlight
in save-match-data.  Use `(nth 0 real-match-data)' instead of
`(match-beginning 0)' after replace-highlight.  (Bug#36328)
2019-07-12 00:35:21 +03:00
Juri Linkov
3bffc09d17 * lisp/replace.el (perform-replace): Move save-match-data here
from replace-highlight for isearch-lazy-highlight-new-loop (bug#36328).
2019-07-08 01:18:07 +03:00
Juri Linkov
dde0320020 * lisp/replace.el (replace-highlight): Add save-match-data (bug#36328)
* lisp/term/tty-colors.el (tty-color-canonicalize):
Replace string-match with string-match-p.

Thanks to Jayden Navarro <jayden@yugabyte.com> and Alan Mackenzie <acm@muc.de>
2019-07-05 22:11:34 +03:00
Paul Eggert
f744797af1 Go back to "Maintainer: emacs-devel@gnu.org"
Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is
no special maintainer for a file.  Although this wasn't documented
it was common practice and removing the lines didn't have consensus.
2019-05-25 14:25:18 -07:00
Paul Eggert
bef1be8730 Fixes for "Maintainer:" and related lines
Mostly, this just removes "Maintainer: emacs-devel@gnu.org" lines,
which are not that useful.  It also cleans up and regularizes a
few similar lines.
2019-05-19 21:34:27 -07:00
Juri Linkov
8ecce6af47 Inhibit displaying help buffer in main window in perform-replace
* lisp/replace.el (perform-replace): Use
display-buffer-overriding-action with inhibit-same-window to prevent
the help buffer from being displayed in the main window.  (Bug#34972)

Author: Michał Krzywkowski <k.michal@zoho.com>
Copyright-paperwork-exempt: yes
2019-04-10 23:48:13 +03:00
Juri Linkov
5fdf4fc07d i18n: Add function ngettext for pluralization.
* lisp/international/mule-cmds.el (ngettext): New function.
https://lists.gnu.org/archive/html/emacs-devel/2019-03/msg00586.html

* lisp/replace.el (flush-lines, how-many, occur-1, occur-engine)
(perform-replace): Use ngettext.

* lisp/progmodes/grep.el (grep-exit-message): Use ngettext.
(grep-mode-font-lock-keywords): Match both singular and plural form
of "matches".
2019-03-24 23:55:07 +02:00
Juri Linkov
44b7436d44 * lisp/replace.el (flush-lines): Return the number of deleted lines.
When called interactively, also print the number. (Bug#34520)

* doc/emacs/search.texi (Other Repeating Search): Update
flush-lines that prints the number of deleted lines.
2019-02-28 23:32:39 +02:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Juri Linkov
fb16313025 More font-lock improvements for diff-mode
* lisp/vc/diff-mode.el (diff-font-lock-keywords): Use diff-header face
for git index lines (like already used for bzr index lines).
Use diff-file-header face for binary file headers.
(diff-find-source-location): Use expand-file-name for vc-find-revision.
(diff--font-lock-prettify): Use diff-indicator-* faces for
left-fringe indicators.
(diff-syntax-fontify-props): Optimize to not use text-property-not-all
for font-lock-ensure.

* lisp/replace.el (occur-engine-line): Simplify to use font-lock-ensure
without text-property-not-all.
2018-12-19 01:10:09 +02:00
Juri Linkov
f8179cd366 Fix occur for non-nil list-matching-lines-jump-to-current-line (bug#33476)
* lisp/replace.el (occur-engine): Move orig-line let-binding higher.
Don't use start-line in forward-line.
2018-12-10 01:53:08 +02:00
Raimon Grau
ee1ebe8246 Guard occur against an undefined orig-line
; Not to be merged to master
* lisp/replace.el (occur-engine): Avoid inserting the current line if
orig-line is nil.  This happens, for example, when reverting an occur
buffer with `list-matching-lines-jump-to-current-line' set to t.
(Bug#33476)
2018-12-10 01:42:41 +02:00
Stefan Monnier
bd013a448b * lisp/replace.el (occur--garbage-collect-revert-args): New function
(occur-mode, occur-1): Use it.
(occur--region-start, occur--region-end, occur--region-start-line)
(occur--orig-line): Remove vars.
(occur-engine): Fix left over use of occur--region-start-line.
2018-10-09 11:57:22 -04:00
Eli Zaretskii
262f5c8099 Revert part of last commit
* lisp/replace.el (occur-revert-function): Revert last change,
as it's no longer needed.  (Bug#32987)
2018-10-09 17:55:15 +03:00
Eli Zaretskii
cbb6742878 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2018-10-09 17:49:59 +03:00
Stefan Monnier
5d1fbe25d4 * lisp/replace.el: Rework implementation of the occur region
Put the region info in the "list of buffers" used for multi-occur.

(occur--parse-occur-buffer): Remove.
(occur): Pass the region to occur-1 as an overlay.
(occur-1): 'bufs' is now a list of buffers or overlays.
(occur-engine): 'buffers' is now a list of buffers or overlays.
2018-10-09 10:47:13 -04:00
Eli Zaretskii
cd7caee630 Unbreak 'revert-buffer' in Occur buffers
* lisp/replace.el (occur-revert-function): Use the value of
occur-revert-function from the correct buffer.  (Bug#32987)

* test/lisp/replace-tests.el (replace-occur-revert-bug32543)
(replace-occur-revert-bug32987): New tests.
2018-10-09 17:46:31 +03:00
Tino Calancha
d6f3c2cf06 Fix a previous commit
Suggested by Stefan Monnier here:
https://lists.gnu.org/archive/html/emacs-devel/2018-09/msg00783.html
* lisp/replace.el (occur--parse-occur-buffer): Since point is at the
beginning of the buffer, use `point'.

(occur-revert-function): Prefer `pcase-let' and `point-min'.
Check whether `region-start' or `region-end' are non-nil.
2018-09-21 05:27:01 +09:00
Tino Calancha
75d9a55fae Fix bug 32543
Store the region and orig line into the *Occur* header line.
Retrieve this information in `occur-revert-function'.
* lisp/replace.el (occur--parse-occur-buffer): New defun.
(occur-revert-function): Use it.
(occur-engine): Store region and original position as text properties
into the *Occur* header line.
* lisp/replace.el (occur-engine): Add sensible default values for
(occur--orig-line and nlines.
2018-09-18 21:29:59 +09:00
Tino Calancha
5fa73a7d98 query-replace undo: Handle when user edits the replacement string
* lisp/replace.el (perform-replace): Update the replacement string
after the user edit it (Fix Bug#31538).

* test/lisp/replace-tests.el (query-replace-undo-bug31538): New test.

Backport: (cherry picked from commits
ea133e04f4
and
7dcfdf5b14)
2018-06-03 23:28:30 +09:00
Tino Calancha
031004e81b Backport: Fix corner case in query-replace-regexp undo
This commit fixes Bug#31492.
* lisp/replace.el (replace-match-maybe-edit): Preserve match data.

* test/lisp/replace-tests.el (query-replace-undo-bug31492): Add test.

(cherry picked from commit bab73230d1)
2018-06-03 23:28:24 +09:00
Tino Calancha
50c0624b2a Backport: Preserve case in query-replace undo
If the user query and replaces 'foo' with 'BAR', then
undo must comeback to 'foo', not to 'FOO' (Bug#31073).
* lisp/replace.el (perform-replace): Bind nocasify to non-nil
value during undo/undo-all actions.
* test/lisp/replace-tests.el (query-replace-undo-bug31073): Add test.

(cherry picked from commit 32dc0cb1b5)
2018-06-03 23:28:14 +09:00
Tino Calancha
ea133e04f4 query-replace undo: Handle when user edits the replacement string
* lisp/replace.el (perform-replace): Update the replacement string
after the user edit it (Fix Bug#31538).

* test/lisp/replace-tests.el (replace-tests-clauses): New function.
(replace-tests-bind-read-string): New variable.
(replace-tests-with-undo): Macro to create boilerplate code.
(query-replace-undo-bug31073): Use it.
(query-replace-undo-bug31538): New test.
2018-05-26 11:31:26 +09:00
Tino Calancha
bab73230d1 Fix corner case in query-replace-regexp undo
This commit fixes Bug#31492.
* lisp/replace.el (replace-match-maybe-edit): Preserve match data.

* test/lisp/replace-tests.el (query-replace-undo-bug31492): Add test.
2018-05-23 18:20:36 +09:00
Juri Linkov
7abd3f2dcf Improve Isearch error handling
* lisp/isearch.el (isearch--momentary-message): Propertize message
suffix with minibuffer-prompt face.
(isearch--describe-regexp-mode): Do not omit description in case
of error in default non-literal search.
(isearch-message-prefix): Display “case-sensitive” in case of error.
(isearch-message-suffix): Propertize message suffix with
minibuffer-prompt face.
(isearch-search-fun-default): Remove unused error handling.

* lisp/vc/add-log.el (change-log-next-buffer): Better handle
errors during wrapping.
2018-04-23 01:10:49 +03:00
Glenn Morris
3e233dd1c9 * lisp/replace.el (query-replace-descr): Silence compiler. 2018-04-20 13:35:20 -04:00
Juri Linkov
99de04e6a8 Use text properties to save search parameters. (Bug#22479)
* lisp/isearch.el (isearch-update-ring): Call isearch-string-propertize.
Delete duplicates with possibly different text properties.
(isearch-string-propertize)
(isearch-update-from-string-properties): New functions.
(with-isearch-suspended, isearch-ring-adjust1):
Call isearch-update-from-string-properties.
(isearch-edit-string): Let-bind minibuffer-allow-text-properties to t.
(isearch-query-replace): Use propertized isearch-string.
(isearch--lax-regexp-function-p): Simplify.

* lisp/replace.el (query-replace-descr): Rewrite to keep text properties
non-destructively in the replacement string.
(query-replace--split-string): Don't remove text properties
by substring-no-properties.
(query-replace-read-args): Try to get isearch-regexp-function
from text-properties.
(perform-replace): Display parameters in the replacement message.

* lisp/desktop.el (desktop--v2s): Check if text properties are unreadable.
(Bug#30786)
2018-04-19 23:30:46 +03:00
Juri Linkov
54f60fcad1 * lisp/isearch.el (isearch-mode-map): Restore advertised bindings.
Remove obsolete comments and code.

* lisp/replace.el (occur-find-match): Use user-error instead of error.
(Bug#14912)
2018-04-19 22:45:08 +03:00
Drew Adams
75a32f4874 Add REGION-NONCONTIGUOUS-P arg to other replace.el commands
* lisp/replace.el (query-replace, query-replace-regexp): Doc fix.
(query-replace-regexp-eval, map-query-replace-regexp)
(replace-string, replace-regexp): Add REGION-NONCONTIGUOUS-P arg.
(perform-replace): Doc fix.  (Bug#27897)
2018-04-19 22:36:23 +03:00
Juri Linkov
0c9e3df3c2 Use next-error-found to set next-error-last-buffer.
https://lists.gnu.org/archive/html/emacs-devel/2018-04/msg00207.html

* lisp/simple.el (next-error-buffer): New buffer-local variable
instead of making buffer-local next-error-last-buffer.  (Bug#20489)
(next-error-found-function): New defcustom.
(next-error-buffer-on-selected-frame): Use t for avoid-current arg
of next-error-buffer-p.
(next-error-find-buffer): Add second rule for using the current
next-error-buffer if it's not visited by other navigation.
(next-error, next-error-internal): Call next-error-found.
(next-error-found): New function with body extracted mostly from
next-error.

* lisp/vc/add-log.el (change-log-goto-source-internal): New function
with body from change-log-goto-source.
(change-log-goto-source): Call change-log-goto-source-internal and
next-error-found.
(change-log-next-error): Call change-log-goto-source-internal
instead of change-log-goto-source.
(change-log-mode): Don't set next-error-last-buffer.  (Bug#28864)

* lisp/vc/diff-mode.el (diff-goto-source): Call next-error-found.

* lisp/progmodes/xref.el (xref-goto-xref): Call next-error-found.

* lisp/replace.el (occur-mode-goto-occurrence)
(occur-mode-goto-occurrence-other-window)
(occur-mode-display-occurrence): Call next-error-found.
(occur-next-error): Remove unnecessary with-current-buffer.
(Bug#27362, bug#30646)
2018-04-17 22:27:48 +03:00
Tino Calancha
32dc0cb1b5 Preserve case in query-replace undo
If the user query and replaces 'foo' with 'BAR', then
undo must comeback to 'foo', not to 'FOO' (Bug#31073).
* lisp/replace.el (perform-replace): Bind nocasify to non-nil
value during undo/undo-all actions.
* test/lisp/replace-tests.el (query-replace-undo-bug31073): Add test.
2018-04-09 11:47:47 +09:00
Juri Linkov
109237e23a ; Small fixes and indentation 2018-02-06 23:24:42 +02:00
Juri Linkov
31350817ae Support occur command operating on the region from Isearch.
* lisp/isearch.el (isearch-occur): Use region-bounds as region arg of occur.
(isearch-query-replace): Use use-region-p.

* lisp/replace.el (occur--region-start-line): Rename from
occur--matches-threshold.
(occur): Use complete lines when region is active for line-oriented occur.
(occur-engine): Count lines either from occur--region-start-line or 1.
2018-02-06 23:20:10 +02:00
Juri Linkov
8e42b1bd3c Support list-matching-lines-jump-to-current-line for context lines.
* lisp/replace.el (occur--orig-line-str): Remove.
(occur): Remove occur--orig-line-str.
(occur-engine): Use add-face-text-property to add the face
list-matching-lines-current-line-face to the current line.
Use previous-single-property-change to find occur--final-pos.
(occur-context-lines): New args orig-line and multi-occur-p.
Find the current line in context lines and add face to it.
(Bug#30281)
2018-02-05 23:54:27 +02:00
Paul Eggert
bb267f17f9 Merge from origin/emacs-26
63b04c11d5 Fix copyright years by hand
5c7dd8a783 Update copyright year to 2018
220a9ecba1 Merge from Gnulib
312c565566 Don't add empty keyboard macro to macro ring (Bug#24992)
39ca289a7a Allow customization of decoding of "man" command
f8240815ea * etc/NEWS: Add security consideration note on passphrase ...
0c78822c70 Fix subtle problem with scroll-down when scroll-margin is ...
acd289c5a4 Fix problems with indexing in User manual
b240c7846b * lisp/help.el (describe-key): Only (copy-sequence elt) wh...
e879a5444a * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846
81b1028b63 Improve documentation of 'inhibit-modification-hooks' and ...
7175496d7a Fix doc string of 'enable-recursive-minibuffers'
5b38406491 Fix documentation of delsel and of killing text

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
2018-01-01 01:13:04 -08:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00