1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-11 09:20:51 +00:00
Commit Graph

463 Commits

Author SHA1 Message Date
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
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
Charles A. Roelli
9f9b56b7da Fix highlighting in query-replace with non-nil replace-char-fold
* lisp/replace.el (replace-highlight): Bind
'isearch-regexp-function' in the same way that function
'replace-search' does, so as to respect the value of
'replace-char-fold'.  (Bug#24356)
2017-12-26 12:46:39 +01:00
Eli Zaretskii
cbd319a351 Fix case-folding in Occur
* lisp/replace.el (occur-engine): Bind case-fold-search in each
buffer we search.  (Bug#29254)
2017-11-18 13:06:22 +02:00
Stefan Monnier
57ca409111 Fix autoload of flymake from elisp-mode during bootstrap (bug#28994)
* lisp/loadup.el: add `progmodes` to load-path so we can find flymake.el.
* lisp/kmacro.el: Require `replace` since we use query-replace-map.
* lisp/replace.el: Require `text-mode` since we use text-mode-map.
2017-10-25 12:31:40 -04:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Tino Calancha
919ac3ae16 query-replace: Undo replacements performed with 'comma
During a `query-replace', the char ',' replaces the character
at point and doesn't move point;  right after, the char 'u'
must undo such replacement (Bug#27268).
* lisp/replace.el (replace--push-stack):
New macro extracted from `perform-replace'.
(perform-replace): Use it.
* test/lisp/replace-tests.el (query-replace--undo): Add test.
2017-08-08 10:25:27 +09:00
Eli Zaretskii
d3fcb92413 Improve documentation of 'occur'
* doc/emacs/search.texi (Other Repeating Search):
* lisp/replace.el (occur): Make the documentation of 'occur' be
more accurate when matches overlap.  (Bug#27818)
2017-07-29 11:25:29 +03:00
Eli Zaretskii
bb5c6614eb * lisp/replace.el (query-replace-regexp-eval): Doc fix. 2017-05-19 11:12:51 +03:00
Eli Zaretskii
ff315081a1 ; * lisp/replace.el (query-replace-regexp, replace-regexp): Doc fixes. 2017-05-06 11:06:38 +03:00
Tino Calancha
afabe53b56 ; * lisp/replace.el (how-many, flush-lines, keep-lines): Remove empty line. 2017-04-02 21:16:37 +09:00
Juri Linkov
61881d32ad Put text properties on query-replace separator string instead of "\0"
* lisp/replace.el (query-replace--split-string):
Split at a substring instead of just character.
(query-replace-read-from): Put text properties on the
separator string instead of "\0".  (Bug#25482)
2017-02-28 00:50:57 +02:00
Juri Linkov
d8cca4d8c5 * lisp/replace.el (query-replace-from-to-separator): Move propertize
and char-displayable-p test to query-replace-read-from.
Add choice nil to disable this feature.
(query-replace-read-from): Don't reevaluate custom setting.
Use char-displayable-p to test the first non-whitespace character
in query-replace-from-to-separator, use " -> " when fails.
Add prompt for the case when separator is nil but
query-replace-defaults is non-nil.
Remove unused test for regexp-flag.
Thanks to Thierry Volpiatto <thierry.volpiatto@gmail.com>
2017-02-13 02:37:52 +02:00
Tino Calancha
e280b94dcd Show current line highlighted in *Occur* buffer
* lisp/replace.el (list-matching-lines-current-line-face)
(list-matching-lines-jump-to-current-line): New user options.
(occur--orig-line, occur--orig-line-str): New variables.
(occur, occur-engine): Use them.
(occur--final-pos): New variable.
(occur-1): Use it.
(occur-engine): Idem.
Show the current line with 'list-matching-lines-current-line-face'.
Set point on the first matching line after the current one.
* etc/NEWS: Add entry for the new option.
2017-02-02 19:13:27 +09:00
Tino Calancha
8e871aef10 Allow occur command to operate on the region
See discussion in:
https://lists.gnu.org/archive/html/emacs-devel/2016-12/msg01084.html
* lisp/replace.el (occur--region-start, occur--region-end)
(occur--matches-threshold): New variables.
(occur-engine): Use them.
(occur): Idem.
Add optional arg REGION; if non-nil occur applies in that region.
* doc/lispintro/emacs-lisp-intro.texi (Keybindings): Update manual
* doc/emacs/search.texi (Other Repeating Search): Idem.
; etc/NEWS: Add entry for the new feature.
2017-02-02 19:13:05 +09:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Philippe Vaucher
f70f9a58c4 Add missing 'provide's in preloaded packages
* lisp/composite.el:
* lisp/replace.el:
* lisp/textmodes/text-mode.el: Add provide statement.  (Bug#24985)
2016-11-25 12:24:22 +02:00
Mark Oteiza
d3e22a1210 Prescribe history for read-regexp in query-replace
In the fix for bug#24580, the history argument for read-regexp was
removed erroneously; read-regexp's history argument defaults to
regexp-history, not minibuffer-history.
* lisp/replace.el (query-replace-read-from): Tell read-regexp to use
minibuffer-history.  Fixes bug#24873.
2016-11-07 22:11:39 -05:00
Mark Oteiza
6d6c93f4cc Avoid dynamic binding on a symbol
Instead, bind history in the default minibuffer-history.
Fixes bug#24580.
* lisp/replace.el (query-replace-read-from): Let-bind
minibuffer-history.  Change read-regexp and read-from-minibuffer's
HISTORY arguments to nil so that they use minibuffer-history.
2016-10-04 10:26:38 -04:00
Mark Oteiza
cbb2e84518 Turn on more lexical-binding
* lisp/dom.el:
* lisp/faces.el:
* lisp/htmlfontify.el: Turn on lexical-binding.
(htmlfontify-string): Use pushnew instead of add-to-list.
* lisp/info-xref.el:
* lisp/isearch.el:
* lisp/man.el:
* lisp/ps-def.el:
* lisp/ps-print.el:
* lisp/replace.el: Turn on lexical-binding.  Require cl-lib at compile
time.
(multi-occur): Use cl-pushnew instead of add-to-list.
(replace-match-string-symbols): Remove unused lexical variable.
(replace-search, replace-highlight): Fix argument shadowing.
* lisp/sort.el:
* lisp/xml.el: Turn on lexical-binding.
(xml--parse-buffer): Use push instead of add-to-list.
* lisp/xt-mouse.el: Turn on lexical-binding.
2016-09-28 13:08:12 -04:00
Paul Eggert
1a86b5d607 Merge from origin/emacs-25
d4c6774 Fix missing point information in undo
3a9d629 Avoid crashes when buffer modification hooks clobber match data
178b2f5 Note combine-and-quote-strings doesn't shell quote
dec7567 Explain when package-initialize isn't called
113d1e2 Fix escaping in sh-indent-after-continuation docstr
80e2044 ; * etc/NEWS: Improve previous change.
5bb9e6c ; * etc/NEWS: Document how to avoid horizontal scroll bars.
38f4b8e Clarify the documentation of back-references in replacements
2016-08-05 14:07:00 -07:00
Eli Zaretskii
38f4b8ea61 Clarify the documentation of back-references in replacements
* doc/emacs/search.texi (Regexp Replace): Clarify that \D starts
with \1, not \0.

* lisp/replace.el (query-replace-regexp)
(query-replace-regexp-eval, replace-regexp): Doc fix (Bug#23884)
2016-07-02 18:03:09 +03:00
Paul Eggert
0bf5739b77 Merge from origin/emacs-25
c3489d0 * lisp/w32-fns.el (set-message-beep, w32-get-locale-info) (w3...
a4d882c Correct old cell name unbinding when renaming cell.
6c12c53 Merge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into...
0be6725 Document problem: slow screen refresh on missing font.
853b9b9 * admin/admin.el (add-release-logs): Basic check of existing ...
5fa80cf * build-aux/gitlog-to-emacslog: Handle empty generated Change...
3c79e51 * admin/admin.el (add-release-logs): Generate ChangeLog if ne...
42275df * doc/misc/texinfo.tex: Revert previous change (Bug#23611).
3f4a9d9 * admin/authors.el (authors): First update the ChangeLog.
897fb6f ; 'Changes from the pre-25.1 API' copyedits
825ca25 Rename vc-stay-local back to vc-cvs-stay-local
4efb3e8 * doc/emacs/files.texi (Comparing Files): * doc/emacs/trouble...
b995d1e * doc/misc/eww.texi (Advanced): Fix xref.
2e589c0 Fix cross-references between manuals
f3d2ded * doc/misc/vhdl-mode.texi (Sample Init File): Rename node to ...
906c810 ; * admin/release-process: Move etc/HISTORY from here... ; * ...
bea1b65 * admin/admin.el (add-release-logs): Also update etc/HISTORY.
503e752 ; * CONTRIBUTE: Fix a typo.
fbfd478 Avoid aborting due to errors in arguments of 'set-face-attrib...
bdfbe6d ; * admin/release-process: Copyedits.
44a6aed ; * test/automated/data-tests.el: Standardize license notice.
c33ed39 ; * test/automated/viper-tests.el: Standardize license notice.
df4a14b Add automated test for viper-tests.el
c0139e3 Fix viper undo breakage from undo-boundary changes
920d76c Fix reference to obsolete fn ps-eval-switch
18a9bc1 Do not trash symlinks to init file
2671179 Don't print the "decomposition" line for control chars in wha...
869092c Bring back xterm pasting with middle mouse
5ab0830 Provide workaround for xftfont rendering problem
c9f7ec7 * lisp/desktop.el: Disable restore frameset if in non-graphic...
30989a0 Mention GTK+ problems in etc/PROBLEMS
421e3c4 * lisp/emacs-lisp/package.el (package-refresh-contents):
dadfc30 Revert "epg: Add a way to detect gpg1 executable for tests"
e41a5cb Avoid errors with Czech and Slovak input methods
d4ae6d7 epg: Add a way to detect gpg1 executable for tests
ebc3a94 * lisp/emacs-lisp/package.el: Fix free variable warnings.
6e71295 * lisp/emacs-lisp/package.el (package--with-response-buffer):
c45d9f6 Improve documentation of 'server-name'
3b5e38c Modernize ASLR advice in etc/PROBLEMS
1fe1e0a * lisp/char-fold.el: Rename from character-fold.el.
2016-05-26 12:55:06 -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
Paul Eggert
89ce83b202 Merge from origin/emacs-25
50650cb Doc fixes for fclist and grep
5e814e0 Minor doc fixes for quoting
3347a73 `nreverse' the marker pairs list
1a4127d Use save-excursion in xref-location-marker more
ab3ba91 shell-quote-argument DIR when appropriate
922c7a3 Rework xref-query-replace-in-results
3fe3510 * lisp/replace.el (query-replace-read-from): Use minibuffer-w...
0932b94 Fix todo-mode bug involving archived items (bug#23447)
e68ad1f ; * etc/NEWS: Tiny edit. (Bug#23432)
adc80b7 ; * test/automated/xref-tests.el: Add copyright and license.
4d8fd9c Handle "empty line" regexp in xref searches
f559b37 Add tests for xref-collect-matches
6428aa0 Use grep-find-ignored-directories instead of vc-directory-exc...
6f82d8e Clear buffer-undo-list when showing xrefs
c68a091 Note the quote translation in `message' in section "incompati...
52f86a7 * etc/NEWS: Mention (message "%s" (format ...)).
93703c5 (Common Keywords): Correct what missing :group means
79e5800 Improve documentation of Dired's 'A' and 'Q' commands
2ea2a2f Doc fixes for quoting
8544b98 posnp doc clarification
805204f Mention what a missing :group does
ec554d7 Fix documentation of dired-aux search/replace commands
2016-05-05 23:11:11 -07:00
Juri Linkov
3fe3510728 * lisp/replace.el (query-replace-read-from): Use minibuffer-with-setup-hook
to set minibuffer-local value of text-property-default-nonsticky.
(Bug#23418, bug#23127)
2016-05-04 23:05:33 +03:00
Lars Ingebrigtsen
ef32be609d Rearrange the doc of query-replace slightly
* lisp/replace.el (query-replace): Move the mention of the
interactive prefix arg earlier so that users can find it
(bug#20654).

(cherry picked from commit bcc10761c3)
2016-05-01 19:27:15 +02:00
Lars Ingebrigtsen
983ad8d7da replace-match-maybe-edit doc clarification
* lisp/replace.el (replace-match-maybe-edit): Say what
MATCH-DATA is (bug#20304).

(cherry picked from commit 139874ba53)
2016-05-01 19:27:14 +02:00
Lars Ingebrigtsen
bcc10761c3 Rearrange the doc of query-replace slightly
* lisp/replace.el (query-replace): Move the mention of the
interactive prefix arg earlier so that users can find it
(bug#20654).
2016-04-30 21:28:51 +02:00
Lars Ingebrigtsen
139874ba53 replace-match-maybe-edit doc clarification
* lisp/replace.el (replace-match-maybe-edit): Say what
MATCH-DATA is (bug#20304).
2016-04-30 20:32:56 +02:00