[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1043b6c 49/63: Restore syntax-propertize-function before i
From: |
Noam Postavsky |
Subject: |
[elpa] master 1043b6c 49/63: Restore syntax-propertize-function before indenting mirrors |
Date: |
Mon, 17 Jul 2017 22:54:18 -0400 (EDT) |
branch: master
commit 1043b6c557f39a38b14b7618c174d8c47e946c4a
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Restore syntax-propertize-function before indenting mirrors
* yasnippet.el (yas--snippet-parse-create): End binding of
syntax-propertize-function once snippet field parsing is finished.
---
yasnippet.el | 80 ++++++++++++++++++++----------------------------------------
1 file changed, 27 insertions(+), 53 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 77e9fc7..34bc5eb 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -4025,45 +4025,30 @@ expansion.")
necessary fields, mirrors and exit points.
Meant to be called in a narrowed buffer, does various passes"
- (let ((parse-start (point))
- ;; Avoid major-mode's syntax propertizing function, since we
- ;; change the syntax-table while calling `scan-sexps'.
- (syntax-propertize-function nil))
- ;; Reset the yas--dollar-regions
- ;;
- (setq yas--dollar-regions nil)
- ;; protect just the backquotes
- ;;
- (yas--protect-escapes nil '(?`))
- ;; replace all backquoted expressions
- ;;
- (goto-char parse-start)
- (yas--save-backquotes)
- ;; protect escaped characters
- ;;
- (yas--protect-escapes)
- ;; Parse indent markers: `$>'.
- (goto-char parse-start)
- (yas--indent-parse-create)
- ;; parse fields with {}
- ;;
- (goto-char parse-start)
- (yas--field-parse-create snippet)
- ;; parse simple mirrors and fields
- ;;
- (goto-char parse-start)
- (yas--simple-mirror-parse-create snippet)
- ;; parse mirror transforms
- ;;
- (goto-char parse-start)
- (yas--transform-mirror-parse-create snippet)
- ;; calculate adjacencies of fields and mirrors
- ;;
+ (let ((parse-start (point)))
+ ;; Avoid major-mode's syntax propertizing function, since we
+ ;; change the syntax-table while calling `scan-sexps'.
+ (let ((syntax-propertize-function nil))
+ (setq yas--dollar-regions nil) ; Reset the yas--dollar-regions.
+ (yas--protect-escapes nil '(?`)) ; Protect just the backquotes.
+ (goto-char parse-start)
+ (yas--save-backquotes) ; Replace all backquoted expressions.
+ (yas--protect-escapes) ; Protect escaped characters.
+ (goto-char parse-start)
+ (yas--indent-parse-create) ; Parse indent markers: `$>'.
+ (goto-char parse-start)
+ (yas--field-parse-create snippet) ; Parse fields with {}.
+ (goto-char parse-start)
+ (yas--simple-mirror-parse-create snippet) ; Parse simple mirrors &
fields.
+ (goto-char parse-start)
+ (yas--transform-mirror-parse-create snippet) ; Parse mirror transforms.
+ ;; Invalidate any syntax-propertizing done while
+ ;; `syntax-propertize-function' was nil.
+ (syntax-ppss-flush-cache parse-start))
+ ;; Set "next" links of fields & mirrors.
(yas--calculate-adjacencies snippet)
- ;; Delete $-constructs
- ;;
(save-restriction
- (widen)
+ (widen) ; Delete $-constructs.
(yas--delete-regions yas--dollar-regions))
;; Make sure to do this insertion *after* deleting the dollar
;; regions, otherwise we invalidate the calculated positions of
@@ -4078,23 +4063,12 @@ Meant to be called in a narrowed buffer, does various
passes"
(get-register yas-wrap-around-region))
(insert (prog1 (get-register yas-wrap-around-region)
(set-register yas-wrap-around-region nil)))))
- ;; restore backquoted expression values
- ;;
- (yas--restore-backquotes)
- ;; restore escapes
- ;;
- (goto-char parse-start)
- (yas--restore-escapes)
- ;; update mirrors for the first time
- ;;
- (yas--update-mirrors snippet)
- ;; indent the best we can
- ;;
+ (yas--restore-backquotes) ; Restore backquoted expression values.
(goto-char parse-start)
- ;; Invalidate any syntax-propertizing done while
- ;; `syntax-propertize-function' was nil.
- (syntax-ppss-flush-cache parse-start))
- (yas--indent snippet))
+ (yas--restore-escapes) ; Restore escapes.
+ (yas--update-mirrors snippet) ; Update mirrors for the first time.
+ (goto-char parse-start))
+ (yas--indent snippet)) ; Indent the best we can.
;; HACK: Some implementations of `indent-line-function' (called via
;; `indent-according-to-mode') delete text before they insert (like
- [elpa] master 47f37f7 42/63: Fix ${0:soon-to-be-deleted} with no other fields, (continued)
- [elpa] master 47f37f7 42/63: Fix ${0:soon-to-be-deleted} with no other fields, Noam Postavsky, 2017/07/17
- [elpa] master e8ed276 52/63: Make sure tests don't rely on running order, Noam Postavsky, 2017/07/17
- [elpa] master 2a3a0cd 61/63: Update CONTRIBUTING.md information, Noam Postavsky, 2017/07/17
- [elpa] master b0e729b 58/63: Optionally add undo list to debug info, Noam Postavsky, 2017/07/17
- [elpa] master 274406e 55/63: Provide command line interface from yasnippet-debug.el, Noam Postavsky, 2017/07/17
- [elpa] master 6e9b7f9 30/63: Fix running hook variable set as buffer-local, Noam Postavsky, 2017/07/17
- [elpa] master 7f337f4 32/63: Fix nested snippet expansion, Noam Postavsky, 2017/07/17
- [elpa] master 1bf7a4c 47/63: Fix field parsing in modes that use the `syntax-table' property, Noam Postavsky, 2017/07/17
- [elpa] master 8797a31 45/63: * doc/snippet-expansion.org: Complete sentence fragment., Noam Postavsky, 2017/07/17
- [elpa] master c87afe0 26/63: Merge: snippet-local exit hook; error handling improvements, Noam Postavsky, 2017/07/17
- [elpa] master 1043b6c 49/63: Restore syntax-propertize-function before indenting mirrors,
Noam Postavsky <=
- [elpa] master 65952e3 53/63: Allow customizing overlay priority, Noam Postavsky, 2017/07/17
- [elpa] master 1a860bd 51/63: Fix undo information recording for multiline snippets, Noam Postavsky, 2017/07/17
- [elpa] master 22eeb1e 36/63: Fix interaction with c auto-fill, Noam Postavsky, 2017/07/17
- [elpa] master 0311fe2 15/63: Use :filter instead of yas--fallback, Noam Postavsky, 2017/07/17
- [elpa] master 1babe81 40/63: * yasnippet.el (yas-about): Fix compile warnings in previous commit., Noam Postavsky, 2017/07/17
- [elpa] master 2f5cb2e 56/63: Make yas-debug-process-command-line easier to debug, Noam Postavsky, 2017/07/17
- [elpa] master 164acd6 59/63: * yasnippet-debug.el (yas-debug-snippet): Show modified flag., Noam Postavsky, 2017/07/17
- [elpa] master 7b03ac2 57/63: Handle dead snippets better, Noam Postavsky, 2017/07/17
- [elpa] master 75cbf72 62/63: Update NEWS, version number to 0.12, and snippets submodule, Noam Postavsky, 2017/07/17
- [elpa] master ca04f69 39/63: Make `yas-about' more informative, Noam Postavsky, 2017/07/17