Fix #4127: arrayp error on some snippets via +snippets/edit
This commit is contained in:
parent
ed1996e6f9
commit
523ced6e9a
2 changed files with 34 additions and 31 deletions
|
@ -47,7 +47,7 @@ ignored. This makes it easy to override built-in snippets with private ones."
|
|||
(abbreviate-file-name (yas--template-load-file tpl)))
|
||||
collect
|
||||
(progn
|
||||
(set-text-properties 0 (length txt) `(uuid ,(yas--template-name tpl)
|
||||
(set-text-properties 0 (length txt) `(uuid ,(yas--template-uuid tpl)
|
||||
path ,(yas--template-load-file tpl))
|
||||
txt)
|
||||
txt))
|
||||
|
@ -169,9 +169,9 @@ buggy behavior when <delete> is pressed in an empty field."
|
|||
(interactive
|
||||
(list
|
||||
(+snippet--completing-read-uuid "Visit snippet: " current-prefix-arg)))
|
||||
(if-let (template (yas--get-template-by-uuid major-mode template-uuid))
|
||||
(let* ((template (yas--get-template-by-uuid major-mode template-uuid))
|
||||
(if-let* ((template (yas--get-template-by-uuid major-mode template-uuid))
|
||||
(template-path (yas--template-load-file template)))
|
||||
(progn
|
||||
(unless (file-readable-p template-path)
|
||||
(user-error "Cannot read %S" template-path))
|
||||
(find-file template-path)
|
||||
|
@ -239,7 +239,7 @@ shadow the default snippet)."
|
|||
(list
|
||||
(+snippet--completing-read-uuid "Select snippet to alias: "
|
||||
current-prefix-arg)))
|
||||
(let* ((major-mode (if (eq major-mode 'snippet-mode)
|
||||
(if-let* ((major-mode (if (eq major-mode 'snippet-mode)
|
||||
(intern (file-name-base (directory-file-name default-directory)))
|
||||
major-mode))
|
||||
(template (yas--get-template-by-uuid major-mode template-uuid))
|
||||
|
@ -253,7 +253,8 @@ shadow the default snippet)."
|
|||
(setq default-directory
|
||||
(expand-file-name (file-name-nondirectory template-path)
|
||||
(expand-file-name (symbol-name major-mode)
|
||||
+snippets-dir))))))))
|
||||
+snippets-dir))))))
|
||||
(user-error "Couldn't find a snippet with uuid %S" template-uuid)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +snippets-show-hints-in-header-line-h ()
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
;; Enable `read-only-mode' for built-in snippets (in `doom-local-dir')
|
||||
(add-hook 'snippet-mode-hook #'+snippets-read-only-maybe-h)
|
||||
|
||||
(map! :map yas-keymap
|
||||
(map! (:map yas-keymap
|
||||
"C-e" #'+snippets/goto-end-of-field
|
||||
"C-a" #'+snippets/goto-start-of-field
|
||||
[M-right] #'+snippets/goto-end-of-field
|
||||
|
@ -90,6 +90,8 @@
|
|||
:map yas-minor-mode-map
|
||||
[remap yas-new-snippet] #'+snippets/new
|
||||
[remap yas-visit-snippet-file] #'+snippets/edit)
|
||||
(:map snippet-mode-map
|
||||
"C-c C-k" #'+snippet--abort))
|
||||
|
||||
;; REVIEW Fix #2639: For some reason `yas--all-templates' returns duplicates
|
||||
;; of some templates. Until I figure out the real cause this fixes it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue