[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/el-search 2366cda 107/332: Improve `change' and `change
From: |
Stefan Monnier |
Subject: |
[elpa] externals/el-search 2366cda 107/332: Improve `change' and `changed' |
Date: |
Tue, 1 Dec 2020 15:48:22 -0500 (EST) |
branch: externals/el-search
commit 2366cdaf396a37434feb57bf0b115aa56e348a6f
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>
Improve `change' and `changed'
- Renew cache when saved file version has changed.
- Use markers as region boundaries so that replacing inside changed
expressions works.
---
el-search-x.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/el-search-x.el b/el-search-x.el
index 8b8c10b..7c050cf 100644
--- a/el-search-x.el
+++ b/el-search-x.el
@@ -47,8 +47,10 @@
Use variable `el-search--cached-changes' for caching."
(if (and (consp el-search--cached-changes)
(equal (car el-search--cached-changes)
- revision))
+ (list revision (visited-file-modtime))))
(cdr el-search--cached-changes)
+ (when (buffer-modified-p)
+ (error "Buffer is modified - please save"))
(require 'diff-hl)
;; `diff-hl-changes' returns line numbers. We must convert them into
positions.
(save-restriction
@@ -58,20 +60,19 @@ Use variable `el-search--cached-changes' for caching."
(current-line-nbr 1) change-beg)
(goto-char 1)
(cdr (setq el-search--cached-changes
- (cons revision
+ (cons (list revision (visited-file-modtime))
(delq nil (mapcar (pcase-lambda (`(,start-line
,nbr-lines ,kind))
(if (eq kind 'delete) nil
(forward-line (- start-line
current-line-nbr))
(setq change-beg (point))
(forward-line (1- nbr-lines))
(setq current-line-nbr (+
start-line nbr-lines -1))
- (cons change-beg
(line-end-position))))
+ (cons (copy-marker change-beg)
+ (copy-marker
(line-end-position)))))
(diff-hl-changes)))))))))))
(defun el-search--change-p (posn &optional revision)
;; Non-nil when sexp after POSN is part of a change
- (when (buffer-modified-p)
- (error "Buffer is modified - please save"))
(save-restriction
(widen)
(let ((changes (el-search--changes-from-diff-hl revision))
- [elpa] externals/el-search a0b44dd 078/332: Improve documentation and argument names of el-search-query-replace, (continued)
- [elpa] externals/el-search a0b44dd 078/332: Improve documentation and argument names of el-search-query-replace, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 1864f4a 077/332: Comment and whitespace changes only, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search b5b6d83 089/332: Make query-replace accept FROM -> TO style input, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 68f10d7 091/332: Reduce duration of a `sit-for', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 29d6f46 090/332: Rename a local variable, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 5b608a1 094/332: Set initial input for replace when coming from el-search-pattern, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 9c3c04d 093/332: Clean up el-search-read-expression-map; add some doc, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search b4e79fb 081/332: Add patterns for character properties, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 2dd24a9 096/332: Factor out `el-search--replace-hunk', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 852643e 100/332: Fix some quoting problems in doc strings, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 2366cda 107/332: Improve `change' and `changed',
Stefan Monnier <=
- [elpa] externals/el-search 31b9e9d 122/332: Inhibit logging of some messages, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 35a0776 119/332: Add missing settings of some vars when restoring a previous search, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search c086990 129/332: Extend the heuristic matching approach; complete review, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 57ecb9a 128/332: Fix leaving behind helper buffers, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 10e596b 113/332: Add `el-search--macroexpand', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 70477a2 150/332: Explicitly require pcase, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 4b8780f 026/332: allow search wrapping, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 125d653 084/332: Fix el-search--ensure-sexp-start error at bob, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search ee096b0 092/332: Make sure not to lose the minibuffer-prompt face, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 80ff841 085/332: Make el-search-pattern accept an optional NO-ERROR arg, Stefan Monnier, 2020/12/01