mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
Make `yas-about' more informative
* yasnippet.el (yas--loaddir): New constant. (yas-installed-snippets-dir): Use it to compute value. (yas-about): Get version from git or `package' if available.
This commit is contained in:
parent
5043a96121
commit
ca04f69c10
25
yasnippet.el
25
yasnippet.el
@ -152,10 +152,13 @@
|
|||||||
:prefix "yas-"
|
:prefix "yas-"
|
||||||
:group 'editing)
|
:group 'editing)
|
||||||
|
|
||||||
|
(defconst yas--loaddir
|
||||||
|
(file-name-directory (or load-file-name buffer-file-name))
|
||||||
|
"Directory that yasnippet was loaded from.")
|
||||||
|
|
||||||
(defvar yas-installed-snippets-dir nil)
|
(defvar yas-installed-snippets-dir nil)
|
||||||
(setq yas-installed-snippets-dir
|
(setq yas-installed-snippets-dir
|
||||||
(when load-file-name
|
(expand-file-name "snippets" yas--loaddir))
|
||||||
(expand-file-name "snippets" (file-name-directory load-file-name))))
|
|
||||||
|
|
||||||
(defconst yas--default-user-snippets-dir
|
(defconst yas--default-user-snippets-dir
|
||||||
(expand-file-name "snippets" user-emacs-directory))
|
(expand-file-name "snippets" user-emacs-directory))
|
||||||
@ -1977,9 +1980,21 @@ This works by stubbing a few functions, then calling
|
|||||||
|
|
||||||
(defun yas-about ()
|
(defun yas-about ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(message (concat "yasnippet (version "
|
(message "yasnippet (version %s) -- pluskid/joaotavora/npostavs"
|
||||||
yas--version
|
(or (ignore-errors (car (let ((default-directory yas--loaddir))
|
||||||
") -- pluskid/joaotavora/npostavs")))
|
(process-lines "git" "describe"
|
||||||
|
"--tags" "--dirty"))))
|
||||||
|
(when (and (featurep 'package) (fboundp 'package-desc-version))
|
||||||
|
(ignore-errors
|
||||||
|
(let* ((yas-pkg (cdr (assq 'yasnippet package-alist)))
|
||||||
|
(version (package-version-join
|
||||||
|
(package-desc-version (car yas-pkg)))))
|
||||||
|
;; Special case for MELPA's bogus version numbers.
|
||||||
|
(if (string-match "\\`20..[01][0-9][0-3][0-9][.][0-9]\\{3,4\\}\\'"
|
||||||
|
version)
|
||||||
|
(concat yas--version "-snapshot" version)
|
||||||
|
version))))
|
||||||
|
yas--version)))
|
||||||
|
|
||||||
|
|
||||||
;;; Apropos snippet menu:
|
;;; Apropos snippet menu:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user