summaryrefslogtreecommitdiff
path: root/lisp/nxml
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-08-15 10:18:08 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-08-15 10:18:08 -0400
commitbf11c698b6af5eb243da656b57d99084a2c2e890 (patch)
treec607efe7e83caf8cc095ac1573841422e7d8416a /lisp/nxml
parent2a022e9be3a1f46dde2fa230d0b31fb6fbb5d66a (diff)
downloademacs-bf11c698b6af5eb243da656b57d99084a2c2e890.tar.gz
* lisp/nxml/nxml-mode.el (nxml-mode): Use add-function
This avoids calling the internal function `buffer-substring--filter` from `nxml.el`. (nxml--buffer-substring-filter): Adjust accordingly.
Diffstat (limited to 'lisp/nxml')
-rw-r--r--lisp/nxml/nxml-mode.el25
1 files changed, 12 insertions, 13 deletions
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 5a3499dd165..b7d1b190e85 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -540,7 +540,8 @@ Many aspects this mode can be customized using
(nxml-scan-prolog)))))
(setq-local syntax-ppss-table sgml-tag-syntax-table)
(setq-local syntax-propertize-function #'nxml-syntax-propertize)
- (setq-local filter-buffer-substring-function #'nxml--buffer-substring-filter)
+ (add-function :filter-return (local 'filter-buffer-substring-function)
+ #'nxml--buffer-substring-filter)
(add-hook 'change-major-mode-hook #'nxml-cleanup nil t)
(when (not (and (buffer-file-name) (file-exists-p (buffer-file-name))))
@@ -565,18 +566,16 @@ Many aspects this mode can be customized using
(with-demoted-errors (rng-nxml-mode-init)))
-(defun nxml--buffer-substring-filter (beg end &optional delete)
- (let ((string (buffer-substring--filter beg end delete)))
- ;; The `rng-state' property is huge, so don't copy it to the kill
- ;; ring. This avoids problems when saving the kill ring with
- ;; savehist.
- (when (seq-find (lambda (elem)
- (plist-get (nth 2 elem) 'rng-state))
- (object-intervals string))
- (remove-text-properties 0 (length string)
- '(rng-state nil fontified nil)
- string))
- string))
+(defun nxml--buffer-substring-filter (string)
+ ;; The `rng-state' property is huge, so don't copy it to the kill ring.
+ ;; This avoids problems when saving the kill ring with savehist.
+ (when (seq-find (lambda (elem)
+ (plist-get (nth 2 elem) 'rng-state))
+ (object-intervals string))
+ (remove-text-properties 0 (length string)
+ '(rng-state nil fontified nil)
+ string))
+ string)
(defun nxml-cleanup ()
"Clean up after nxml-mode."