summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimeon Simeonov2017-05-22 13:25:19 +0200
committerSimeon Simeonov2017-05-22 13:25:19 +0200
commitbeaddc354283a9d45a4260d171be022129443c45 (patch)
tree624857cbe085f6d67a9487ef53bff1fa2f95848a
parent0235194b50893effa55d3d6f0178906574104124 (diff)
ysnippet upgraded
-rw-r--r--.emacs.d/lisp/yasnippet.el85
1 files changed, 32 insertions, 53 deletions
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el
index fbdb461..34bc5eb 100644
--- a/.emacs.d/lisp/yasnippet.el
+++ b/.emacs.d/lisp/yasnippet.el
@@ -3580,6 +3580,11 @@ field start. This hook does nothing if an undo is in progress."
3580 (unless (or (not after?) 3580 (unless (or (not after?)
3581 yas--inhibit-overlay-hooks 3581 yas--inhibit-overlay-hooks
3582 (not (overlayp yas--active-field-overlay)) ; Avoid Emacs bug #21824. 3582 (not (overlayp yas--active-field-overlay)) ; Avoid Emacs bug #21824.
3583 ;; If a single change hits multiple overlays of the same
3584 ;; snippet, then we delete the snippet the first time,
3585 ;; and then subsequent calls get a deleted overlay.
3586 ;; Don't delete the snippet again!
3587 (not (overlay-buffer overlay))
3583 (yas--undo-in-progress)) 3588 (yas--undo-in-progress))
3584 (let* ((inhibit-modification-hooks nil) 3589 (let* ((inhibit-modification-hooks nil)
3585 (yas--inhibit-overlay-hooks t) 3590 (yas--inhibit-overlay-hooks t)
@@ -4020,45 +4025,30 @@ expansion.")
4020necessary fields, mirrors and exit points. 4025necessary fields, mirrors and exit points.
4021 4026
4022Meant to be called in a narrowed buffer, does various passes" 4027Meant to be called in a narrowed buffer, does various passes"
4023 (let ((parse-start (point)) 4028 (let ((parse-start (point)))
4024 ;; Avoid major-mode's syntax propertizing function, since we 4029 ;; Avoid major-mode's syntax propertizing function, since we
4025 ;; change the syntax-table while calling `scan-sexps'. 4030 ;; change the syntax-table while calling `scan-sexps'.
4026 (syntax-propertize-function nil)) 4031 (let ((syntax-propertize-function nil))
4027 ;; Reset the yas--dollar-regions 4032 (setq yas--dollar-regions nil) ; Reset the yas--dollar-regions.
4028 ;; 4033 (yas--protect-escapes nil '(?`)) ; Protect just the backquotes.
4029 (setq yas--dollar-regions nil) 4034 (goto-char parse-start)
4030 ;; protect just the backquotes 4035 (yas--save-backquotes) ; Replace all backquoted expressions.
4031 ;; 4036 (yas--protect-escapes) ; Protect escaped characters.
4032 (yas--protect-escapes nil '(?`)) 4037 (goto-char parse-start)
4033 ;; replace all backquoted expressions 4038 (yas--indent-parse-create) ; Parse indent markers: `$>'.
4034 ;; 4039 (goto-char parse-start)
4035 (goto-char parse-start) 4040 (yas--field-parse-create snippet) ; Parse fields with {}.
4036 (yas--save-backquotes) 4041 (goto-char parse-start)
4037 ;; protect escaped characters 4042 (yas--simple-mirror-parse-create snippet) ; Parse simple mirrors & fields.
4038 ;; 4043 (goto-char parse-start)
4039 (yas--protect-escapes) 4044 (yas--transform-mirror-parse-create snippet) ; Parse mirror transforms.
4040 ;; Parse indent markers: `$>'. 4045 ;; Invalidate any syntax-propertizing done while
4041 (goto-char parse-start) 4046 ;; `syntax-propertize-function' was nil.
4042 (yas--indent-parse-create) 4047 (syntax-ppss-flush-cache parse-start))
4043 ;; parse fields with {} 4048 ;; Set "next" links of fields & mirrors.
4044 ;;
4045 (goto-char parse-start)
4046 (yas--field-parse-create snippet)
4047 ;; parse simple mirrors and fields
4048 ;;
4049 (goto-char parse-start)
4050 (yas--simple-mirror-parse-create snippet)
4051 ;; parse mirror transforms
4052 ;;
4053 (goto-char parse-start)
4054 (yas--transform-mirror-parse-create snippet)
4055 ;; calculate adjacencies of fields and mirrors
4056 ;;
4057 (yas--calculate-adjacencies snippet) 4049 (yas--calculate-adjacencies snippet)
4058 ;; Delete $-constructs
4059 ;;
4060 (save-restriction 4050 (save-restriction
4061 (widen) 4051 (widen) ; Delete $-constructs.
4062 (yas--delete-regions yas--dollar-regions)) 4052 (yas--delete-regions yas--dollar-regions))
4063 ;; Make sure to do this insertion *after* deleting the dollar 4053 ;; Make sure to do this insertion *after* deleting the dollar
4064 ;; regions, otherwise we invalidate the calculated positions of 4054 ;; regions, otherwise we invalidate the calculated positions of
@@ -4073,23 +4063,12 @@ Meant to be called in a narrowed buffer, does various passes"
4073 (get-register yas-wrap-around-region)) 4063 (get-register yas-wrap-around-region))
4074 (insert (prog1 (get-register yas-wrap-around-region) 4064 (insert (prog1 (get-register yas-wrap-around-region)
4075 (set-register yas-wrap-around-region nil))))) 4065 (set-register yas-wrap-around-region nil)))))
4076 ;; restore backquoted expression values 4066 (yas--restore-backquotes) ; Restore backquoted expression values.
4077 ;;
4078 (yas--restore-backquotes)
4079 ;; restore escapes
4080 ;;
4081 (goto-char parse-start)
4082 (yas--restore-escapes)
4083 ;; update mirrors for the first time
4084 ;;
4085 (yas--update-mirrors snippet)
4086 ;; indent the best we can
4087 ;;
4088 (goto-char parse-start) 4067 (goto-char parse-start)
4089 ;; Invalidate any syntax-propertizing done while 4068 (yas--restore-escapes) ; Restore escapes.
4090 ;; `syntax-propertize-function' was nil. 4069 (yas--update-mirrors snippet) ; Update mirrors for the first time.
4091 (syntax-ppss-flush-cache parse-start)) 4070 (goto-char parse-start))
4092 (yas--indent snippet)) 4071 (yas--indent snippet)) ; Indent the best we can.
4093 4072
4094;; HACK: Some implementations of `indent-line-function' (called via 4073;; HACK: Some implementations of `indent-line-function' (called via
4095;; `indent-according-to-mode') delete text before they insert (like 4074;; `indent-according-to-mode') delete text before they insert (like