[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/yaml-mode f991710 086/124: Support for apostrophe in words
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/yaml-mode f991710 086/124: Support for apostrophe in words |
Date: |
Sun, 29 Aug 2021 11:36:18 -0400 (EDT) |
branch: elpa/yaml-mode
commit f99171078fc29488f127fa48152a3fa7e1ddb23a
Author: Väinö Järvelä <vaino@jarve.la>
Commit: Väinö Järvelä <vaino@jarve.la>
Support for apostrophe in words
If a quote is written in a word it is handled as a word instead of
starting a string. This fixes the following YAML syntax highlighting:
server's:
- here: syntax is not string
- this: 'is a string'
Previously the first apostrophe/quote started a string, which meant
that the file is highlighted as a string until the next quote is met.
The single quote string detection now requires that the previous character
is a whitespace, which means that:
this:'is detected incorrectly'
without the space the above does not detect a string.
---
yaml-mode.el | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/yaml-mode.el b/yaml-mode.el
index e257379..00f0c2d 100644
--- a/yaml-mode.el
+++ b/yaml-mode.el
@@ -245,7 +245,8 @@ that key is pressed to begin a block literal."
"Additional expressions to highlight in YAML mode.")
(defun yaml-mode-syntax-propertize-function (beg end)
- "Unhighlight foo#bar tokens between BEG and END."
+ "Override buffer's syntax table for special syntactic constructs."
+ ;; Unhighlight foo#bar tokens between BEG and END.
(save-excursion
(goto-char beg)
(while (search-forward "#" end t)
@@ -255,7 +256,20 @@ that key is pressed to begin a block literal."
(when (and (not (bolp))
(not (memq (preceding-char) '(?\s ?\t))))
(put-text-property (point) (1+ (point))
- 'syntax-table (string-to-syntax "_")))))))
+ 'syntax-table (string-to-syntax "_"))))))
+
+ ;; If quote is detected as a syntactic string start but appeared
+ ;; after a non-whitespace character, then mark it as syntactic word.
+ (save-excursion
+ (goto-char beg)
+ (while (search-forward "'" end t)
+ (when (nth 8 (syntax-ppss))
+ (save-excursion
+ (forward-char -1)
+ (when (and (not (bolp))
+ (not (memq (preceding-char) '(?\s ?\t))))
+ (put-text-property (point) (1+ (point))
+ 'syntax-table (string-to-syntax "w"))))))))
(defun yaml-font-lock-block-literals (bound)
"Find lines within block literals.
- [nongnu] branch elpa/yaml-mode created (now 63b637f), ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode c92bfe4 007/124: fixed for release 0.0.3, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode 45e52cb 006/124: merge TEST-JULIAN-PATCH, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode f297efe 012/124: YAML imenu outline integration, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode 2c0359f 004/124: change VERSION, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode 18c9135 020/124: replace `last-command-char` to `last-command-event`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode ef3546b 047/124: allow spaces before '-' in yaml-scalar-context-re, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode bdc47a4 056/124: added two more test files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode 236832c 068/124: Merge branch 'liangfu-master', ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode f378589 079/124: Merge pull request #45 from dunn/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode f991710 086/124: Support for apostrophe in words,
ELPA Syncer <=
- [nongnu] elpa/yaml-mode b83482e 089/124: Support double quote in implicit keys, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode df66d7f 091/124: Merge pull request #59 from Kaali/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode fc7bac0 092/124: Formatting fixes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode 2522b3c 101/124: Fix typos, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode 8105718 105/124: Simplify the implementation; move a comment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode add6156 113/124: yaml-mode-syntax-propertize-function: Clear ppss cache, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode bce5aa1 011/124: changed version and added Changes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode 9d5a888 025/124: Merge pull request #6 from gvalkov/yaml-file-type, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode a87ab36 046/124: add RECRUITMENTS, ELPA Syncer, 2021/08/29
- [nongnu] elpa/yaml-mode dcdcd81 049/124: Add myself as maintainer, ELPA Syncer, 2021/08/29