aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMattias Engdegård2020-05-22 12:21:28 +0200
committerMattias Engdegård2020-05-27 16:29:43 +0200
commitc5cf630ecd467fdcac13928f7e240cfc98cedc7a (patch)
tree874eb44ee930b78552765a2fb56d8ee4d1eea1c5 /lisp
parent0fc4989f34bdaf1bc443d05ece886ea91e7bc9cc (diff)
downloademacs-c5cf630ecd467fdcac13928f7e240cfc98cedc7a.tar.gz
emacs-c5cf630ecd467fdcac13928f7e240cfc98cedc7a.zip
Don't clobber match data in utf-8-hfs conversion (bug#41445)
Reported by Ture Pålsson. * lisp/international/ucs-normalize.el (ucs-normalize-hfs-nfd-post-read-conversion) (ucs-normalize-hfs-nfd-pre-write-conversion): Use save-match-data to avoid match data clobber in normalisation. * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-save-match-data): New test.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/international/ucs-normalize.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/international/ucs-normalize.el b/lisp/international/ucs-normalize.el
index 201ff6b9b17..b703d3dd2f2 100644
--- a/lisp/international/ucs-normalize.el
+++ b/lisp/international/ucs-normalize.el
@@ -612,14 +612,16 @@ COMPOSITION-PREDICATE will be used to compose region."
612(defun ucs-normalize-hfs-nfd-post-read-conversion (len) 612(defun ucs-normalize-hfs-nfd-post-read-conversion (len)
613 (save-excursion 613 (save-excursion
614 (save-restriction 614 (save-restriction
615 (narrow-to-region (point) (+ (point) len)) 615 (save-match-data
616 (ucs-normalize-HFS-NFC-region (point-min) (point-max)) 616 (narrow-to-region (point) (+ (point) len))
617 (- (point-max) (point-min))))) 617 (ucs-normalize-HFS-NFC-region (point-min) (point-max))
618 (- (point-max) (point-min))))))
618 619
619;; Pre-write conversion for `utf-8-hfs'. 620;; Pre-write conversion for `utf-8-hfs'.
620;; _from and _to are legacy arguments (see `define-coding-system'). 621;; _from and _to are legacy arguments (see `define-coding-system').
621(defun ucs-normalize-hfs-nfd-pre-write-conversion (_from _to) 622(defun ucs-normalize-hfs-nfd-pre-write-conversion (_from _to)
622 (ucs-normalize-HFS-NFD-region (point-min) (point-max))) 623 (save-match-data
624 (ucs-normalize-HFS-NFD-region (point-min) (point-max))))
623 625
624;;; coding-system definition 626;;; coding-system definition
625(define-coding-system 'utf-8-hfs 627(define-coding-system 'utf-8-hfs