mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
* some small fixes and a new helper function...
This commit is contained in:
parent
6ccfb1da5d
commit
a1df3cd2ac
15
yasnippet.el
15
yasnippet.el
@ -1177,7 +1177,7 @@ return an expression that when evaluated will issue an error."
|
|||||||
(condition-case err
|
(condition-case err
|
||||||
(read string)
|
(read string)
|
||||||
(error (and (not nil-on-error)
|
(error (and (not nil-on-error)
|
||||||
`(error (error-message-string err))))))
|
`(error ,(error-message-string err))))))
|
||||||
|
|
||||||
(defvar yas/mode-symbol nil
|
(defvar yas/mode-symbol nil
|
||||||
"If non-nil, lookup snippets using this instead of `major-mode'.")
|
"If non-nil, lookup snippets using this instead of `major-mode'.")
|
||||||
@ -2361,8 +2361,11 @@ With optional prefix argument KILL quit the window and buffer."
|
|||||||
(yas/define-snippets (car major-mode-and-parent)
|
(yas/define-snippets (car major-mode-and-parent)
|
||||||
(list parsed)
|
(list parsed)
|
||||||
(cdr major-mode-and-parent))))
|
(cdr major-mode-and-parent))))
|
||||||
|
|
||||||
(when (and (buffer-modified-p)
|
(when (and (buffer-modified-p)
|
||||||
(y-or-n-p "Also save snippet buffer? "))
|
(file-writable-p buffer-file-name)
|
||||||
|
;; (y-or-n-p "Also save snippet buffer? ")
|
||||||
|
)
|
||||||
(save-buffer))
|
(save-buffer))
|
||||||
(when kill
|
(when kill
|
||||||
(quit-window kill))
|
(quit-window kill))
|
||||||
@ -2396,7 +2399,8 @@ With optional prefix argument KILL quit the window and buffer."
|
|||||||
(first yas/snippet-dirs)
|
(first yas/snippet-dirs)
|
||||||
yas/snippet-dirs))))
|
yas/snippet-dirs))))
|
||||||
(when chosen
|
(when chosen
|
||||||
(let ((default-directory chosen))
|
(let ((default-directory chosen)
|
||||||
|
(ido-mode nil))
|
||||||
(call-interactively 'write-file))
|
(call-interactively 'write-file))
|
||||||
(setq yas/guessed-directories nil)
|
(setq yas/guessed-directories nil)
|
||||||
(setq yas/current-template nil)
|
(setq yas/current-template nil)
|
||||||
@ -2508,6 +2512,11 @@ Otherwise throw exception."
|
|||||||
(defun yas/inside-string ()
|
(defun yas/inside-string ()
|
||||||
(equal 'font-lock-string-face (get-char-property (1- (point)) 'face)))
|
(equal 'font-lock-string-face (get-char-property (1- (point)) 'face)))
|
||||||
|
|
||||||
|
(defun yas/get-lose-selected-text ()
|
||||||
|
(or yas/selected-text
|
||||||
|
(prog1 (get-register ?0)
|
||||||
|
(set-register ?0 nil))))
|
||||||
|
|
||||||
|
|
||||||
;;; Snippet expansion and field management
|
;;; Snippet expansion and field management
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user