summaryrefslogtreecommitdiff
path: root/lisp/erc/erc-replace.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-03-19 15:28:00 +0100
committerAndrea Corallo <akrl@sdf.org>2021-03-19 15:28:00 +0100
commit6ca6c71cd0bf8fc970d9b1477ea61a670469f672 (patch)
tree98876b3f80794a8aad43293fbe005102e26e94f9 /lisp/erc/erc-replace.el
parentb3ad62f8a35617366886be2a86e8641282824adf (diff)
parent3af2cee64b86e4ce59adb8e8720d92db35039cbc (diff)
downloademacs-6ca6c71cd0bf8fc970d9b1477ea61a670469f672.tar.gz
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'lisp/erc/erc-replace.el')
-rw-r--r--lisp/erc/erc-replace.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
index c67d7514037..d08d9850c10 100644
--- a/lisp/erc/erc-replace.el
+++ b/lisp/erc/erc-replace.el
@@ -1,4 +1,4 @@
-;; erc-replace.el -- wash and massage messages inserted into the buffer
+;; erc-replace.el -- wash and massage messages inserted into the buffer -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation,
;; Inc.
@@ -49,7 +49,6 @@ expression or a variable, or any sexp, TO can be a string or a
function to call, or any sexp. If a function, it will be called with
one argument, the string to be replaced, and it should return a
replacement string."
- :group 'erc-replace
:type '(repeat (cons :tag "Search & Replace"
(choice :tag "From"
regexp
@@ -68,23 +67,23 @@ It replaces text according to `erc-replace-alist'."
(let ((from (car elt))
(to (cdr elt)))
(unless (stringp from)
- (setq from (eval from)))
+ (setq from (eval from t)))
(while (re-search-forward from nil t)
(cond ((stringp to)
(replace-match to))
- ((and (symbolp to) (fboundp to))
+ ((functionp to)
(replace-match (funcall to (match-string 0))))
(t
- (eval to))))))
+ (eval to t))))))
erc-replace-alist))
;;;###autoload(autoload 'erc-replace-mode "erc-replace")
(define-erc-module replace nil
"This mode replaces incoming text according to `erc-replace-alist'."
((add-hook 'erc-insert-modify-hook
- 'erc-replace-insert))
+ #'erc-replace-insert))
((remove-hook 'erc-insert-modify-hook
- 'erc-replace-insert)))
+ #'erc-replace-insert)))
(provide 'erc-replace)