mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
* corrected another problem when evaling user elisp with errors
This commit is contained in:
parent
10e8b41f7c
commit
555897a4ad
19
yasnippet.el
19
yasnippet.el
@ -114,11 +114,11 @@ return the error string instead.")
|
|||||||
(t (:background "tomato")))
|
(t (:background "tomato")))
|
||||||
"The face used for debugging")
|
"The face used for debugging")
|
||||||
|
|
||||||
(defvar yas/window-system-popup-function #'yas/dropdown-list-popup-for-template
|
(defvar yas/window-system-popup-function #'yas/x-popup-menu-for-template
|
||||||
"When there's multiple candidate for a snippet key. This function
|
"When there's multiple candidate for a snippet key. This function
|
||||||
is called to let user select one of them. `yas/text-popup-function'
|
is called to let user select one of them. `yas/text-popup-function'
|
||||||
is used instead when not in a window system.")
|
is used instead when not in a window system.")
|
||||||
(defvar yas/text-popup-function #'yas/dropdown-list-popup-for-template
|
(defvar yas/text-popup-function #'yas/x-popup-menu-for-template
|
||||||
"When there's multiple candidate for a snippet key. If not in a
|
"When there's multiple candidate for a snippet key. If not in a
|
||||||
window system, this function is called to let user select one of
|
window system, this function is called to let user select one of
|
||||||
them. `yas/window-system-popup-function' is used instead when in
|
them. `yas/window-system-popup-function' is used instead when in
|
||||||
@ -1325,11 +1325,18 @@ will be deleted before inserting template."
|
|||||||
;; at the end of this function.
|
;; at the end of this function.
|
||||||
;;
|
;;
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(let ((buffer-undo-list t)
|
(narrow-to-region end end)
|
||||||
(template-start end))
|
(condition-case err
|
||||||
(narrow-to-region template-start template-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
|
||||||
|
;;
|
||||||
(insert template)
|
(insert template)
|
||||||
(setq snippet (yas/snippet-create (point-min) (point-max)))))
|
(setq snippet (yas/snippet-create (point-min) (point-max))))
|
||||||
|
(error
|
||||||
|
(push (cons (point-min) (point-max)) buffer-undo-list)
|
||||||
|
(error (error-message-string err)))))
|
||||||
;; Delete the trigger key, this *does* get undo-recorded.
|
;; Delete the trigger key, this *does* get undo-recorded.
|
||||||
;;
|
;;
|
||||||
(delete-region start end)
|
(delete-region start end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user