summaryrefslogtreecommitdiff
path: root/lisp/replace.el
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* ; Fix typo in previous commitRobert Pluim2019-10-091-1/+1
| | | | * lisp/replace.el (query-replace-read-from): Fix typo in docstring.
* Improve doc strings in replace.elEli Zaretskii2019-10-091-10/+26
| | | | | | | | | * 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)
* Fix an assignment to free variable warningTino Calancha2019-09-171-1/+1
| | | | | | | | | | It fixes a bug introduced by commit 'query-replace-regexp undo: Update next-replacement after undo' (30c4f35a6fc8a6507930923766c3126ac1c2063f) See https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00364.html * lisp/replace.el(perform-replace): Rename variable to next-replacement-replaced.
* Merge from origin/emacs-26Glenn Morris2019-09-151-6/+8
|\ | | | | | | | | | | 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
| * query-replace-regexp undo: Update next-replacement after undoTino Calancha2019-09-091-6/+8
| | | | | | | | | | | | | | | | | | * 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.
* | Merge from origin/emacs-26Glenn Morris2019-08-201-2/+5
|\ \ | |/ | | | | | | | | | | | | 615cff4 (origin/emacs-26) Fix process filter documentation (Bug#13400) beb1d22 Fix query-replace-regexp undo feature # Conflicts: # test/lisp/replace-tests.el
| * Fix query-replace-regexp undo featureTino Calancha2019-08-191-2/+5
| | | | | | | | | | | | | | | | | | 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.
* | Tweak mouse-face highlighting of Occur buffersLars Ingebrigtsen2019-07-151-7/+10
| | | | | | | | | | * lisp/replace.el (occur-engine): Ensure that the mouse highlight is done over the entire line (bug#27846).
* | Better match-data handling in perform-replaceJuri Linkov2019-07-121-19/+20
| | | | | | | | | | | | * 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)
* | * lisp/replace.el (perform-replace): Move save-match-data hereJuri Linkov2019-07-081-13/+14
| | | | | | | | from replace-highlight for isearch-lazy-highlight-new-loop (bug#36328).
* | * lisp/replace.el (replace-highlight): Add save-match-data (bug#36328)Juri Linkov2019-07-051-1/+5
| | | | | | | | | | | | | | * 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>
* | Go back to "Maintainer: emacs-devel@gnu.org"Paul Eggert2019-05-251-0/+1
| | | | | | | | | | | | 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.
* | Fixes for "Maintainer:" and related linesPaul Eggert2019-05-191-1/+0
| | | | | | | | | | | | 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.
* | Inhibit displaying help buffer in main window in perform-replaceJuri Linkov2019-04-101-16/+18
| | | | | | | | | | | | | | | | | | * 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
* | i18n: Add function ngettext for pluralization.Juri Linkov2019-03-241-21/+30
| | | | | | | | | | | | | | | | | | | | | | | | * 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".
* | * lisp/replace.el (flush-lines): Return the number of deleted lines.Juri Linkov2019-02-281-9/+12
| | | | | | | | | | | | | | 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.
* | Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ \ | |/ | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
| * Guard occur against an undefined orig-lineRaimon Grau2018-12-101-1/+3
| | | | | | | | | | | | | | | | ; 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)
| * query-replace undo: Handle when user edits the replacement stringTino Calancha2018-06-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | * 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 ea133e04f49afa7928e49a3ac4a85b47f6f13f01 and 7dcfdf5b14325ae7996f272f14c72810d7c84944)
| * Backport: Fix corner case in query-replace-regexp undoTino Calancha2018-06-031-0/+4
| | | | | | | | | | | | | | | | | | 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 bab73230d1be1fe394b7269c1365ef6fb1a5d9b3)
| * Backport: Preserve case in query-replace undoTino Calancha2018-06-031-0/+1
| | | | | | | | | | | | | | | | | | | | 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 32dc0cb1b5ae895d237c7118ccaeb084715934fd)
* | More font-lock improvements for diff-modeJuri Linkov2018-12-191-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Fix occur for non-nil list-matching-lines-jump-to-current-line (bug#33476)Juri Linkov2018-12-101-6/+6
| | | | | | | | | | * lisp/replace.el (occur-engine): Move orig-line let-binding higher. Don't use start-line in forward-line.
* | * lisp/replace.el (occur--garbage-collect-revert-args): New functionStefan Monnier2018-10-091-26/+30
| | | | | | | | | | | | | | (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.
* | Revert part of last commitEli Zaretskii2018-10-091-13/+1
| | | | | | | | | | * lisp/replace.el (occur-revert-function): Revert last change, as it's no longer needed. (Bug#32987)
* | Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacsEli Zaretskii2018-10-091-99/+91
|\ \
| * | * lisp/replace.el: Rework implementation of the occur regionStefan Monnier2018-10-091-112/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Unbreak 'revert-buffer' in Occur buffersEli Zaretskii2018-10-091-8/+8
|/ / | | | | | | | | | | | | | | * 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.
* | Fix a previous commitTino Calancha2018-09-211-13/+9
| | | | | | | | | | | | | | | | | | | | 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.
* | Fix bug 32543Tino Calancha2018-09-181-3/+36
| | | | | | | | | | | | | | | | | | | | | | 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.
* | query-replace undo: Handle when user edits the replacement stringTino Calancha2018-05-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | * 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.
* | Fix corner case in query-replace-regexp undoTino Calancha2018-05-231-0/+4
| | | | | | | | | | | | | | 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.
* | Improve Isearch error handlingJuri Linkov2018-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | * lisp/replace.el (query-replace-descr): Silence compiler.Glenn Morris2018-04-201-2/+3
| |
* | Use text properties to save search parameters. (Bug#22479)Juri Linkov2018-04-191-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* | * lisp/isearch.el (isearch-mode-map): Restore advertised bindings.Juri Linkov2018-04-191-1/+1
| | | | | | | | | | | | | | Remove obsolete comments and code. * lisp/replace.el (occur-find-match): Use user-error instead of error. (Bug#14912)
* | Add REGION-NONCONTIGUOUS-P arg to other replace.el commandsDrew Adams2018-04-191-16/+37
| | | | | | | | | | | | | | * 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)
* | Use next-error-found to set next-error-last-buffer.Juri Linkov2018-04-171-26/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | Preserve case in query-replace undoTino Calancha2018-04-091-0/+1
| | | | | | | | | | | | | | | | 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.
* | ; Small fixes and indentationJuri Linkov2018-02-061-20/+20
| |
* | Support occur command operating on the region from Isearch.Juri Linkov2018-02-061-6/+8
| | | | | | | | | | | | | | | | | | | | * 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.
* | Support list-matching-lines-jump-to-current-line for context lines.Juri Linkov2018-02-051-47/+85
| | | | | | | | | | | | | | | | | | | | | | * 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)
* | Merge from origin/emacs-26Paul Eggert2018-01-011-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | | | | | Run admin/update-copyright.
* | Fix highlighting in query-replace with non-nil replace-char-foldCharles A. Roelli2017-12-261-1/+4
|/ | | | | | | * 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)
* Fix case-folding in OccurEli Zaretskii2017-11-181-168/+178
| | | | | * lisp/replace.el (occur-engine): Bind case-fold-search in each buffer we search. (Bug#29254)
* Fix autoload of flymake from elisp-mode during bootstrap (bug#28994)Stefan Monnier2017-10-251-0/+1
| | | | | | * 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.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | 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.