[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/anzu b9bac0e2f8 178/288: Merge pull request #43 from syohe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/anzu b9bac0e2f8 178/288: Merge pull request #43 from syohex/fix-compile-regexp-error-case |
Date: |
Thu, 6 Jan 2022 03:58:50 -0500 (EST) |
branch: elpa/anzu
commit b9bac0e2f84ae9b71f7c1a4a7f163d9580a8a10c
Merge: c4a440af86 53db7f64b7
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>
Merge pull request #43 from syohex/fix-compile-regexp-error-case
Fix case if s-expression cannot be compiled.
---
anzu.el | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/anzu.el b/anzu.el
index 08d6e0801b..a552421625 100644
--- a/anzu.el
+++ b/anzu.el
@@ -438,27 +438,31 @@
from)))
(defun anzu--compile-replace-text (str)
- (let ((compiled (query-replace-compile-replacement str t)))
- (cond ((stringp compiled) compiled)
- ((and (consp compiled) (functionp (car compiled)))
- compiled)
- ((and (consp compiled) (stringp (car compiled)))
- (car compiled)))))
+ (let ((compiled (ignore-errors
+ (query-replace-compile-replacement str t))))
+ (when compiled
+ (cond ((stringp compiled) compiled)
+ ((and (consp compiled) (functionp (car compiled)))
+ compiled)
+ ((and (consp compiled) (stringp (car compiled)))
+ (car compiled))))))
(defun anzu--evaluate-occurrence (ov to-regexp replacements fixed-case
from-regexp)
(let ((from-string (overlay-get ov 'from-string))
(compiled (anzu--compile-replace-text to-regexp)))
- (with-temp-buffer
- (insert from-string)
- (goto-char (point-min))
- (when (re-search-forward from-regexp nil t)
- (or (ignore-errors
- (if (consp compiled)
- (replace-match (funcall (car compiled) (cdr compiled)
- replacements) fixed-case)
- (replace-match compiled fixed-case))
- (buffer-substring (point-min) (point-max)))
- "")))))
+ (if (not compiled)
+ ""
+ (with-temp-buffer
+ (insert from-string)
+ (goto-char (point-min))
+ (when (re-search-forward from-regexp nil t)
+ (or (ignore-errors
+ (if (consp compiled)
+ (replace-match (funcall (car compiled) (cdr compiled)
+ replacements) fixed-case)
+ (replace-match compiled fixed-case))
+ (buffer-substring (point-min) (point-max)))
+ ""))))))
(defun anzu--overlay-sort (a b)
(< (overlay-start a) (overlay-start b)))
- [nongnu] elpa/anzu 2a3d8d76d2 141/288: Bump up version and update Changes, (continued)
- [nongnu] elpa/anzu 2a3d8d76d2 141/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu e567375313 142/288: Improve case when bounds-og-thing-at-point returns nil, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 67b98d6103 146/288: Improve calculation of current replacement position, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu c8f3e7b651 150/288: Merge pull request #35 from syohex/better-migemo-checking, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 962c425d39 149/288: Better checking whether using migemo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu ffaf6b3c10 153/288: Add MELPA badges, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 5b2ce629b7 154/288: Update MELPA links, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu d3650160d7 161/288: Don't search if input regexp is not valid yet., ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu dcae136088 173/288: Fix displaying current replaced point, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu e3aab048b4 168/288: Disable blink-matching-paren in read 'to' string, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu b9bac0e2f8 178/288: Merge pull request #43 from syohex/fix-compile-regexp-error-case,
ELPA Syncer <=
- [nongnu] elpa/anzu 1f7ac26191 189/288: Just call isearch-symbol-regexp instead of constructing own regexp, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 10bc7c5fbd 171/288: Merge pull request #41 from syohex/refactoring, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu db9e990940 179/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 8930374775 176/288: Fix case if s-expression cannot be compiled., ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu ef39357f0a 188/288: Use variable instead of function call, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 95caf0f382 219/288: Merge pull request #63 from tarsius/master, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu e2cb45487d 213/288: Merge pull request #60 from kosh04/fix-literal-replace, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu b791609fe8 226/288: Update document, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 722ed9a52c 256/288: Merge pull request #84 from syohex/update-minimum-emacs-version, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 61cb32aa61 278/288: reapply #93 by hand, ELPA Syncer, 2022/01/06