diff options
| -rw-r--r-- | lisp/international/ucs-normalize.el | 10 | ||||
| -rw-r--r-- | test/lisp/international/ucs-normalize-tests.el | 11 |
2 files changed, 17 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 |
diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el index c36808ad72f..2c60bd318a2 100644 --- a/test/lisp/international/ucs-normalize-tests.el +++ b/test/lisp/international/ucs-normalize-tests.el | |||
| @@ -341,4 +341,15 @@ implementations: | |||
| 341 | (display-buffer (current-buffer))) | 341 | (display-buffer (current-buffer))) |
| 342 | (message "No changes to failing lines needed")))) | 342 | (message "No changes to failing lines needed")))) |
| 343 | 343 | ||
| 344 | (ert-deftest ucs-normalize-save-match-data () | ||
| 345 | "Verify that match data isn't clobbered (bug#41445)" | ||
| 346 | (string-match (rx (+ digit)) "a47b") | ||
| 347 | (should (equal (match-data t) '(1 3))) | ||
| 348 | (should (equal | ||
| 349 | (decode-coding-string | ||
| 350 | (encode-coding-string "Käsesoßenrührlöffel" 'utf-8-hfs) | ||
| 351 | 'utf-8-hfs) | ||
| 352 | "Käsesoßenrührlöffel")) | ||
| 353 | (should (equal (match-data t) '(1 3)))) | ||
| 354 | |||
| 344 | ;;; ucs-normalize-tests.el ends here | 355 | ;;; ucs-normalize-tests.el ends here |