Function: inversion-find-version
inversion-find-version is a byte-compiled function defined in
inversion.el.gz.
Signature
(inversion-find-version PACKAGE)
Documentation
Search for the version and incompatible version of PACKAGE.
Does not load PACKAGE nor requires that it has been previously loaded.
Search in the directories in load-path for a PACKAGE.el library.
Visit the file found and search for the declarations of variables or
constants PACKAGE-version and PACKAGE-incompatible-version. The
value of these variables must be a version string.
Return a pair (VERSION-STRING . INCOMPATIBLE-VERSION-STRING) where INCOMPATIBLE-VERSION-STRING can be nil. Return nil when VERSION-STRING was not found.
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/inversion.el.gz
(defun inversion-find-version (package)
"Search for the version and incompatible version of PACKAGE.
Does not load PACKAGE nor requires that it has been previously loaded.
Search in the directories in `load-path' for a PACKAGE.el library.
Visit the file found and search for the declarations of variables or
constants `PACKAGE-version' and `PACKAGE-incompatible-version'. The
value of these variables must be a version string.
Return a pair (VERSION-STRING . INCOMPATIBLE-VERSION-STRING) where
INCOMPATIBLE-VERSION-STRING can be nil.
Return nil when VERSION-STRING was not found."
(let* ((file (locate-library (format "%s.el" package) t))
(tag (car inversion-find-data))
(idx (nth 1 inversion-find-data))
version)
(when file
(with-temp-buffer
;; The 3000 is a bit arbitrary, but should cut down on
;; fileio as version info usually is at the very top
;; of a file. After a long commentary could be bad.
(insert-file-contents-literally file nil 0 3000)
(goto-char (point-min))
(when (re-search-forward (format tag package 'version) nil t)
(setq version (list (match-string idx)))
(goto-char (point-min))
(when (re-search-forward
(format tag package 'incompatible-version) nil t)
(setcdr version (match-string idx))))))
version))