refactor(snippets): use cond instead of nested if
This commit is contained in:
parent
363706744d
commit
406594b9af
1 changed files with 8 additions and 10 deletions
|
@ -67,16 +67,14 @@ Finds correctly active snippets from parent modes (based on Yas' logic)."
|
|||
(alist-get completion completion-uuid-alist nil nil #'string=)))
|
||||
|
||||
(defun +snippets--snippet-mode-name-completing-read (&optional all-modes)
|
||||
(if all-modes
|
||||
(completing-read
|
||||
"Select snippet mode: "
|
||||
obarray
|
||||
(lambda (sym)
|
||||
(string-match-p "-mode\\'" (symbol-name sym))))
|
||||
(if (not (null yas--extra-modes))
|
||||
(completing-read "Select snippet mode: "
|
||||
(cons major-mode yas--extra-modes))
|
||||
(symbol-name major-mode))))
|
||||
(cond (all-modes (completing-read
|
||||
"Select snippet mode: "
|
||||
obarray
|
||||
(lambda (sym)
|
||||
(string-match-p "-mode\\'" (symbol-name sym)))))
|
||||
((not (null yas--extra-modes)) (completing-read "Select snippet mode: "
|
||||
(cons major-mode yas--extra-modes)))
|
||||
(t (symbol-name major-mode))))
|
||||
|
||||
(defun +snippet--abort ()
|
||||
(interactive)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue