[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 51e9e8e 017/177: wait till after content insertion to narr
From: |
João Távora |
Subject: |
[elpa] master 51e9e8e 017/177: wait till after content insertion to narrow |
Date: |
Sat, 28 Mar 2015 15:40:31 +0000 |
branch: master
commit 51e9e8e53c7fe6abb58466fb8cb5a0ad133a86c6
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
wait till after content insertion to narrow
Fixes #404 without inhibiting change hooks.
---
yasnippet.el | 58 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index af45262..5ca5978 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3511,22 +3511,20 @@ considered when expanding the snippet."
;; plain text will get recorded at the end.
;;
;; stacked expansion: also shoosh the overlay modification hooks
- (save-restriction
- (narrow-to-region start start)
- (let ((buffer-undo-list t))
- ;; snippet creation might evaluate users elisp, which
- ;; might generate errors, so we have to be ready to catch
- ;; them mostly to make the undo information
- ;;
- (setq yas--start-column (save-restriction (widen)
(current-column)))
- (yas--inhibit-overlay-hooks
- (setq snippet
- (if expand-env
- (eval `(let* ,expand-env
- (insert content)
- (yas--snippet-create (point-min))))
- (insert content)
- (yas--snippet-create (point-min)))))))
+ (let ((buffer-undo-list t))
+ ;; snippet creation might evaluate users elisp, which
+ ;; might generate errors, so we have to be ready to catch
+ ;; them mostly to make the undo information
+ ;;
+ (setq yas--start-column (current-column))
+ (yas--inhibit-overlay-hooks
+ (setq snippet
+ (if expand-env
+ (eval `(let* ,expand-env
+ (insert content)
+ (yas--snippet-create start (point))))
+ (insert content)
+ (yas--snippet-create start (point))))))
;; stacked-expansion: This checks for stacked expansion, save the
;; `yas--previous-active-field' and advance its boundary.
@@ -3604,25 +3602,27 @@ After revival, push the `yas--take-care-of-redo' in the
(push `(apply yas--take-care-of-redo ,beg ,end ,snippet)
buffer-undo-list))))
-(defun yas--snippet-create (begin)
- "Create a snippet from a template inserted at BEGIN.
+(defun yas--snippet-create (begin end)
+ "Create a snippet from a template inserted at BEGIN to END.
Returns the newly created snippet."
- (let ((snippet (yas--make-snippet)))
- (goto-char begin)
- (yas--snippet-parse-create snippet)
+ (save-restriction
+ (narrow-to-region begin end)
+ (let ((snippet (yas--make-snippet)))
+ (goto-char begin)
+ (yas--snippet-parse-create snippet)
- ;; Sort and link each field
- (yas--snippet-sort-fields snippet)
+ ;; Sort and link each field
+ (yas--snippet-sort-fields snippet)
- ;; Create keymap overlay for snippet
- (setf (yas--snippet-control-overlay snippet)
- (yas--make-control-overlay snippet (point-min) (point-max)))
+ ;; Create keymap overlay for snippet
+ (setf (yas--snippet-control-overlay snippet)
+ (yas--make-control-overlay snippet (point-min) (point-max)))
- ;; Move to end
- (goto-char (point-max))
+ ;; Move to end
+ (goto-char (point-max))
- snippet))
+ snippet)))
;;; Apropos adjacencies and "fom's":
- [elpa] master 79f3656 011/177: fix font-lock-keywords syntax, (continued)
- [elpa] master 79f3656 011/177: fix font-lock-keywords syntax, João Távora, 2015/03/28
- [elpa] master 13cfdbc 009/177: fix: remove references to dropdown-list.el in Rakefile, João Távora, 2015/03/28
- [elpa] master 8853127 007/177: Update manual.mdown, João Távora, 2015/03/28
- [elpa] master d963c41 010/177: Closes #406: correct docstring for yas-extra-modes, João Távora, 2015/03/28
- [elpa] master f21ddd1 012/177: remove redundant font-lock-keywords, João Távora, 2015/03/28
- [elpa] master 90d4cae 013/177: inhibit change hooks during (insert content), João Távora, 2015/03/28
- [elpa] master 7849ffc 015/177: fix: don't use universal-argument-num-events, João Távora, 2015/03/28
- [elpa] master 6997922 016/177: Revert "inhibit change hooks during (insert content)", João Távora, 2015/03/28
- [elpa] master 6268cc2 014/177: add: test for issue #404, João Távora, 2015/03/28
- [elpa] master 5c76a0f 019/177: test middle-of-buffer snippet insertion, João Távora, 2015/03/28
- [elpa] master 51e9e8e 017/177: wait till after content insertion to narrow,
João Távora <=
- [elpa] master 3bb1515 018/177: Merge pull request #409 from npostavs/font-lock, João Távora, 2015/03/28
- [elpa] master 6c3e029 020/177: Merge pull request #412 from npostavs/less-narrow, João Távora, 2015/03/28
- [elpa] master 32ee5cb 021/177: Closes #415: remove c-specific hacks, harmful on emacs 24.3, João Távora, 2015/03/28
- [elpa] master ffd497d 022/177: don't kill snippet buffer unless saved, João Távora, 2015/03/28
- [elpa] master 205b0e6 023/177: move snippet saving from loading to closing, João Távora, 2015/03/28
- [elpa] master 33dff9a 024/177: let C-c C-c save existing snippets too, João Távora, 2015/03/28
- [elpa] master d7b2b89 027/177: widen before deleting regions, João Távora, 2015/03/28
- [elpa] master 84b7e69 025/177: Merge pull request #423 from npostavs/load-snippet-ui, João Távora, 2015/03/28
- [elpa] master 43a484e 028/177: add: external test for issue #404, João Távora, 2015/03/28
- [elpa] master d5d6e45 026/177: Feature: de/activate-extra-mode, João Távora, 2015/03/28