diff options
| author | Harald Jörg | 2021-06-11 13:52:45 +0200 |
|---|---|---|
| committer | Harald Jörg | 2021-06-11 13:55:08 +0200 |
| commit | 87bd14ca8bdecda6964aeb3c323faee846a8c1b8 (patch) | |
| tree | 8f47365401b013d5b558cc57af40b206657ca481 | |
| parent | 56e21ab2e1bf4836573acfeb1e36716526a183b9 (diff) | |
| download | emacs-87bd14ca8bdecda6964aeb3c323faee846a8c1b8.tar.gz emacs-87bd14ca8bdecda6964aeb3c323faee846a8c1b8.zip | |
; perl-mode.el: Allow newline between quote-likes and delimiter
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function):
Allow newline between a quote-like operator and its delimiter
(Bug#22355).
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-22355):
Test case for the fix.
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl:
Test resource for a quote-like with newline before the delimiter.
| -rw-r--r-- | lisp/progmodes/perl-mode.el | 2 | ||||
| -rw-r--r-- | test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl | 14 | ||||
| -rw-r--r-- | test/lisp/progmodes/cperl-mode-tests.el | 11 |
3 files changed, 26 insertions, 1 deletions
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index a20887621e8..f49ee4cb2b5 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el | |||
| @@ -285,7 +285,7 @@ | |||
| 285 | (put-text-property (match-beginning 2) (match-end 2) | 285 | (put-text-property (match-beginning 2) (match-end 2) |
| 286 | 'syntax-table (string-to-syntax "\"")) | 286 | 'syntax-table (string-to-syntax "\"")) |
| 287 | (perl-syntax-propertize-special-constructs end))))) | 287 | (perl-syntax-propertize-special-constructs end))))) |
| 288 | ("\\(^\\|[?:.,;=|&!~({[ \t]\\|=>\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\(?:\\([^])}>= \n\t]\\)\\|\\(?3:=\\)[^>]\\)" | 288 | ("\\(^\\|[?:.,;=|&!~({[ \t]\\|=>\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\(?:\\s-\\|\n\\)*\\(?:\\([^])}>= \n\t]\\)\\|\\(?3:=\\)[^>]\\)" |
| 289 | ;; Nasty cases: | 289 | ;; Nasty cases: |
| 290 | ;; /foo/m $a->m $#m $m @m %m | 290 | ;; /foo/m $a->m $#m $m @m %m |
| 291 | ;; \s (appears often in regexps). | 291 | ;; \s (appears often in regexps). |
diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl new file mode 100644 index 00000000000..f54d55241df --- /dev/null +++ b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | # The source file contains non-ASCII characters, supposed to be saved | ||
| 2 | # in UTF-8 encoding. Tell Perl about that, just in case. | ||
| 3 | use utf8; | ||
| 4 | |||
| 5 | # Following code is the example from the report Bug#22355 which needed | ||
| 6 | # attention in perl-mode. | ||
| 7 | |||
| 8 | printf qq | ||
| 9 | {<?xml version="1.0" encoding="UTF-8"?> | ||
| 10 | <kml xmlns="http://www.opengis.net/kml/2.2"> | ||
| 11 | <Document> | ||
| 12 | <Folder><name>台灣 %s 廣播電台</name> | ||
| 13 | <description><![CDATA[http://radioscanningtw.wikia.com/wiki/台描:地圖 %d-%02d-%02d]]></description> | ||
| 14 | }, uc( substr( $ARGV[0], 0, 2 ) ), $year + 1900, $mon + 1, $mday; | ||
diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index dcf4f398c29..4d2bac6ee47 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el | |||
| @@ -377,6 +377,17 @@ documentation it does the right thing anyway." | |||
| 377 | (cperl-indent-command) | 377 | (cperl-indent-command) |
| 378 | (forward-line 1)))) | 378 | (forward-line 1)))) |
| 379 | 379 | ||
| 380 | (ert-deftest cperl-test-bug-22355 () | ||
| 381 | "Verify that substitutions are fontified directly after \"|&\". | ||
| 382 | Regular expressions are strings in both perl-mode and cperl-mode." | ||
| 383 | (with-temp-buffer | ||
| 384 | (insert-file-contents (ert-resource-file "cperl-bug-22355.pl")) | ||
| 385 | (funcall cperl-test-mode) | ||
| 386 | (goto-char (point-min)) | ||
| 387 | ;; Just check for the start of the string | ||
| 388 | (search-forward "{") | ||
| 389 | (should (nth 3 (syntax-ppss))))) | ||
| 390 | |||
| 380 | (ert-deftest cperl-test-bug-23992 () | 391 | (ert-deftest cperl-test-bug-23992 () |
| 381 | "Verify that substitutions are fontified directly after \"|&\". | 392 | "Verify that substitutions are fontified directly after \"|&\". |
| 382 | Regular expressions are strings in both perl-mode and cperl-mode." | 393 | Regular expressions are strings in both perl-mode and cperl-mode." |