mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 13:33:04 +00:00
* Fixed issue 99 (Raking bundle and loading it doesn't correctly create menu.)
This commit is contained in:
parent
8403f2f8b5
commit
dbae0320ff
30
yasnippet.el
30
yasnippet.el
@ -687,7 +687,6 @@ Here's an example:
|
|||||||
(define-key yas/minor-mode-map "\C-c&\C-v" 'yas/visit-snippet-file)
|
(define-key yas/minor-mode-map "\C-c&\C-v" 'yas/visit-snippet-file)
|
||||||
(define-key yas/minor-mode-map "\C-c&\C-f" 'yas/find-snippets))
|
(define-key yas/minor-mode-map "\C-c&\C-f" 'yas/find-snippets))
|
||||||
|
|
||||||
|
|
||||||
(defun yas/trigger-key-reload (&optional unbind-key)
|
(defun yas/trigger-key-reload (&optional unbind-key)
|
||||||
"Rebind `yas/expand' to the new value of `yas/trigger-key'.
|
"Rebind `yas/expand' to the new value of `yas/trigger-key'.
|
||||||
|
|
||||||
@ -702,6 +701,9 @@ With optional UNBIND-KEY, try to unbind that key from
|
|||||||
(not (string= yas/trigger-key "")))
|
(not (string= yas/trigger-key "")))
|
||||||
(define-key yas/minor-mode-map (read-kbd-macro yas/trigger-key) 'yas/expand)))
|
(define-key yas/minor-mode-map (read-kbd-macro yas/trigger-key) 'yas/expand)))
|
||||||
|
|
||||||
|
;;; eval'ed on require/load
|
||||||
|
(yas/init-minor-keymap)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-minor-mode yas/minor-mode
|
(define-minor-mode yas/minor-mode
|
||||||
"Toggle YASnippet mode.
|
"Toggle YASnippet mode.
|
||||||
@ -1458,7 +1460,7 @@ content of the file is the template."
|
|||||||
(when restore-global-mode
|
(when restore-global-mode
|
||||||
(yas/global-mode 1))
|
(yas/global-mode 1))
|
||||||
|
|
||||||
(message "done.")))
|
(message "[yas] Reloading everything... Done.")))
|
||||||
|
|
||||||
(defun yas/quote-string (string)
|
(defun yas/quote-string (string)
|
||||||
"Escape and quote STRING.
|
"Escape and quote STRING.
|
||||||
@ -1535,8 +1537,7 @@ Here's the default value for all the parameters:
|
|||||||
(insert ";;;; Auto-generated code ;;;;\n")
|
(insert ";;;; Auto-generated code ;;;;\n")
|
||||||
(insert ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n")
|
(insert ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n")
|
||||||
(insert "(defun yas/initialize-bundle ()\n"
|
(insert "(defun yas/initialize-bundle ()\n"
|
||||||
" \"Initialize YASnippet and load snippets in the bundle.\""
|
" \"Initialize YASnippet and load snippets in the bundle.\"")
|
||||||
" (yas/global-mode 1)\n")
|
|
||||||
(flet ((yas/define-snippets
|
(flet ((yas/define-snippets
|
||||||
(mode snippets &optional parent-or-parents)
|
(mode snippets &optional parent-or-parents)
|
||||||
(insert ";;; snippets for " (symbol-name mode) "\n")
|
(insert ";;; snippets for " (symbol-name mode) "\n")
|
||||||
@ -1566,7 +1567,9 @@ Here's the default value for all the parameters:
|
|||||||
(dolist (subdir (yas/subdirs dir))
|
(dolist (subdir (yas/subdirs dir))
|
||||||
(yas/load-directory-1 subdir nil 'no-hierarchy-parents))))
|
(yas/load-directory-1 subdir nil 'no-hierarchy-parents))))
|
||||||
|
|
||||||
|
(insert " (yas/global-mode 1)\n")
|
||||||
(insert ")\n\n" code "\n")
|
(insert ")\n\n" code "\n")
|
||||||
|
|
||||||
(insert "(provide '"
|
(insert "(provide '"
|
||||||
(file-name-nondirectory
|
(file-name-nondirectory
|
||||||
(file-name-sans-extension
|
(file-name-sans-extension
|
||||||
@ -1855,7 +1858,7 @@ defined in `yas/fallback-behavior'"
|
|||||||
(read-kbd-macro yas/trigger-key)))
|
(read-kbd-macro yas/trigger-key)))
|
||||||
(command-1 (and keys-1 (key-binding keys-1)))
|
(command-1 (and keys-1 (key-binding keys-1)))
|
||||||
(command-2 (and keys-2 (key-binding keys-2)))
|
(command-2 (and keys-2 (key-binding keys-2)))
|
||||||
(command (or (and (not (eq' command-1 'yas/expand))
|
(command (or (and (not (eq command-1 'yas/expand))
|
||||||
command-1)
|
command-1)
|
||||||
command-2)))
|
command-2)))
|
||||||
(when (and (commandp command)
|
(when (and (commandp command)
|
||||||
@ -3464,23 +3467,6 @@ When multiple expressions are found, only the last one counts."
|
|||||||
;; When not in an undo, check if we must commit the snippet (use exited it).
|
;; When not in an undo, check if we must commit the snippet (use exited it).
|
||||||
(yas/check-commit-snippet))))
|
(yas/check-commit-snippet))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; Evaluated on load or require
|
|
||||||
;;
|
|
||||||
;; ;;;### eval this on require!
|
|
||||||
;; (progn
|
|
||||||
;; (yas/init-minor-keymap))
|
|
||||||
|
|
||||||
;; ;;;### eval this on require!
|
|
||||||
;; (progn
|
|
||||||
;; (yas/init-major-keymap))
|
|
||||||
|
|
||||||
;; ;;;### eval this on require!
|
|
||||||
;; (progn
|
|
||||||
;; (when yas/root-directory
|
|
||||||
;; (yas/reload-all)))
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Debug functions. Use (or change) at will whenever needed.
|
;; Debug functions. Use (or change) at will whenever needed.
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user