[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 58640c3 080/495: Do not consider \ an escape chara
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 58640c3 080/495: Do not consider \ an escape character when in raw strings |
Date: |
Sat, 7 Aug 2021 09:04:47 -0400 (EDT) |
branch: elpa/go-mode
commit 58640c38b2f4e4f8f3797a265de40b69457d0795
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>
Do not consider \ an escape character when in raw strings
This implementation generally considers *all* \ in \` sequences as
non-escaping and doesn't touch other occurences of \.
This has two implications:
1) \` inside other structures, such as quoted strings and comments is
also not an escape sequence
2) other escape sequences are still considered escape sequences in raw
strings
The assumption here is that neither is a problem, because other escape
sequences in raw strings do not affect syntax parsing or
fontification, and \` is not a valid escape sequence in other
structures, so should not affect parsing or fontification, either.
If either of those two assumptions turns out to be false, we'll need
to refine this implementation.
---
go-mode.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/go-mode.el b/go-mode.el
index fd1839d..deacd80 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -285,6 +285,10 @@ functions, and some types. It also provides indentation
that is
(set (make-local-variable 'beginning-of-defun-function)
'go-beginning-of-defun)
(set (make-local-variable 'end-of-defun-function) 'go-end-of-defun)
+
+ (set (make-local-variable 'parse-sexp-lookup-properties) t)
+ (set (make-local-variable 'syntax-propertize-function) 'go-propertize-syntax)
+
(set (make-local-variable 'go-dangling-cache) #s(hash-table test eql))
(add-to-list 'before-change-functions (lambda (x y) (setq go-dangling-cache
#s(hash-table test eql))))
@@ -541,6 +545,12 @@ buffer. Tries to look for a URL at point."
(go-mode)
(switch-to-buffer buffer)))))
+(defun go-propertize-syntax (start end)
+ (save-excursion
+ (goto-char start)
+ (while (search-forward "\\" end t)
+ (put-text-property (1- (point)) (point) 'syntax-table (if (=
(char-after) ?`) '(1) '(9))))))
+
;; ;; Commented until we actually make use of this function
;; (defun go--common-prefix (sequences)
;; ;; mismatch and reduce are cl
- [nongnu] elpa/go-mode 3b0efdd 132/495: docstrings, (continued)
- [nongnu] elpa/go-mode 3b0efdd 132/495: docstrings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7ab928a 146/495: Add support for methods that have no name for the receiver, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 83de700 145/495: Enable compilation-mode for gofmt error buffer before displaying it, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 59f1cb5 140/495: add elisp header, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c693232 137/495: mention flymake-go as an alternative to goflymake, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode ba95288 071/495: load diff-mode on package load, not when running gofmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode bfbbb7e 072/495: remove debug output, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e0de87c 075/495: do not indent labels in column 0 but in normal indentation minus one, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8216ff9 076/495: some nicer lisp, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7d47e3c 079/495: remove old go-propertize-syntax code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 58640c3 080/495: Do not consider \ an escape character when in raw strings,
ELPA Syncer <=
- [nongnu] elpa/go-mode 0c25389 081/495: do not set syntax-propertize-function for emacsen that don't know it (GNU Emacs <24 for one), ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0ecc391 086/495: document issue with go build -o /dev/null, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d7c48cb 089/495: give in and require cl at runtime, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 23310e5 090/495: be more lenient when finding commented imports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2d500b3 091/495: builtins and keywords need to be surrounded by symbols, not word characters, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 71c7f59 101/495: use correct regexps for labels, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 3139c0f 107/495: fix regexp-opt usage for emacs <24, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8fb900e 062/495: refactor, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 183c028 068/495: use (car (last)) instead of (car (reverse)), ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0f71cee 083/495: add autoload cookie to gofmt-before-save, ELPA Syncer, 2021/08/07