diff options
Diffstat (limited to '.emacs.d/lisp/yasnippet.el')
| -rw-r--r-- | .emacs.d/lisp/yasnippet.el | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 0d52a96..782c440 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el | |||
| @@ -4128,39 +4128,40 @@ Returns the newly created snippet." | |||
| 4128 | (yas--letenv expand-env | 4128 | (yas--letenv expand-env |
| 4129 | ;; Put a single undo action for the expanded snippet's | 4129 | ;; Put a single undo action for the expanded snippet's |
| 4130 | ;; content. | 4130 | ;; content. |
| 4131 | (let ((buffer-undo-list t)) | 4131 | (unwind-protect |
| 4132 | (goto-char begin) | 4132 | (let ((buffer-undo-list t)) |
| 4133 | (if (> emacs-major-version 29) | 4133 | (goto-char begin) |
| 4134 | ;; Don't use the workaround for CC-mode's cache, | 4134 | (if (> emacs-major-version 29) |
| 4135 | ;; since it was presumably a bug in CC-mode, so either | 4135 | ;; Don't use the workaround for CC-mode's cache, |
| 4136 | ;; it's fixed already, or it should get fixed. | 4136 | ;; since it was presumably a bug in CC-mode, so either |
| 4137 | (progn | 4137 | ;; it's fixed already, or it should get fixed. |
| 4138 | (insert content) | 4138 | (progn |
| 4139 | (narrow-to-region begin (point)) | 4139 | (insert content) |
| 4140 | (goto-char (point-min)) | 4140 | (narrow-to-region begin (point)) |
| 4141 | (yas--snippet-parse-create snippet)) | 4141 | (goto-char (point-min)) |
| 4142 | ;; Call before and after change functions manually, | 4142 | (yas--snippet-parse-create snippet)) |
| 4143 | ;; otherwise cc-mode's cache can get messed up. Don't use | 4143 | ;; Call before and after change functions manually, |
| 4144 | ;; `inhibit-modification-hooks' for that, that blocks | 4144 | ;; otherwise cc-mode's cache can get messed up. Don't use |
| 4145 | ;; overlay and text property hooks as well! FIXME: Maybe | 4145 | ;; `inhibit-modification-hooks' for that, that blocks |
| 4146 | ;; use `combine-change-calls'? (Requires Emacs 27+ though.) | 4146 | ;; overlay and text property hooks as well! FIXME: Maybe |
| 4147 | (run-hook-with-args 'before-change-functions begin end) | 4147 | ;; use `combine-change-calls'? (Requires Emacs 27+ though.) |
| 4148 | (let ((before-change-functions nil) | 4148 | (run-hook-with-args 'before-change-functions begin end) |
| 4149 | (after-change-functions nil)) | 4149 | (let ((before-change-functions nil) |
| 4150 | ;; Some versions of cc-mode (might be the one with Emacs | 4150 | (after-change-functions nil)) |
| 4151 | ;; 24.3 only) fail when inserting snippet content in a | 4151 | ;; Some versions of cc-mode (might be the one with Emacs |
| 4152 | ;; narrowed buffer, so make sure to insert before | 4152 | ;; 24.3 only) fail when inserting snippet content in a |
| 4153 | ;; narrowing. | 4153 | ;; narrowed buffer, so make sure to insert before |
| 4154 | (insert content) | 4154 | ;; narrowing. |
| 4155 | (narrow-to-region begin (point)) | 4155 | (insert content) |
| 4156 | (goto-char (point-min)) | 4156 | (narrow-to-region begin (point)) |
| 4157 | (yas--snippet-parse-create snippet)) | 4157 | (goto-char (point-min)) |
| 4158 | (run-hook-with-args 'after-change-functions | 4158 | (yas--snippet-parse-create snippet)) |
| 4159 | (point-min) (point-max) | 4159 | (run-hook-with-args 'after-change-functions |
| 4160 | (- end begin)))) | 4160 | (point-min) (point-max) |
| 4161 | (when (listp buffer-undo-list) | 4161 | (- end begin)))) |
| 4162 | (push (cons (point-min) (point-max)) | 4162 | (when (listp buffer-undo-list) |
| 4163 | buffer-undo-list)) | 4163 | (push (cons (point-min) (point-max)) |
| 4164 | buffer-undo-list))) | ||
| 4164 | 4165 | ||
| 4165 | ;; Indent, collecting undo information normally. | 4166 | ;; Indent, collecting undo information normally. |
| 4166 | (yas--indent snippet) | 4167 | (yas--indent snippet) |
