mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Document yas/compute-major-mode-and-parents better
This commit is contained in:
parent
3ce27b8e92
commit
d608b66a5d
13
yasnippet.el
13
yasnippet.el
@ -2345,7 +2345,13 @@ there, otherwise, proposes to create the first option returned by
|
|||||||
(snippet-mode)))))
|
(snippet-mode)))))
|
||||||
(message "Could not guess snippet dir!"))))
|
(message "Could not guess snippet dir!"))))
|
||||||
|
|
||||||
(defun yas/compute-major-mode-and-parents (file &optional prompt-if-failed)
|
(defun yas/compute-major-mode-and-parents (file)
|
||||||
|
"Given FILE, find the nearest snippet directory for a given
|
||||||
|
mode, then return a list (MODE-SYM PARENTS), the mode's symbol and a list
|
||||||
|
representing one or more of the mode's parents.
|
||||||
|
|
||||||
|
Note that MODE-SYM need not be the symbol of a real major mode,
|
||||||
|
neither do the elements of PARENTS."
|
||||||
(let* ((file-dir (and file
|
(let* ((file-dir (and file
|
||||||
(directory-file-name (or (some #'(lambda (special)
|
(directory-file-name (or (some #'(lambda (special)
|
||||||
(locate-dominating-file file special))
|
(locate-dominating-file file special))
|
||||||
@ -2357,10 +2363,7 @@ there, otherwise, proposes to create the first option returned by
|
|||||||
(major-mode-name (and file-dir
|
(major-mode-name (and file-dir
|
||||||
(file-name-nondirectory file-dir)))
|
(file-name-nondirectory file-dir)))
|
||||||
(major-mode-sym (or (and major-mode-name
|
(major-mode-sym (or (and major-mode-name
|
||||||
(intern major-mode-name))
|
(intern major-mode-name))))
|
||||||
(when prompt-if-failed
|
|
||||||
(read-from-minibuffer
|
|
||||||
"[yas] Cannot auto-detect major mode! Enter a major mode: "))))
|
|
||||||
(parents (when (file-readable-p parents-file-name)
|
(parents (when (file-readable-p parents-file-name)
|
||||||
(mapcar #'intern
|
(mapcar #'intern
|
||||||
(split-string
|
(split-string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user