Function: lm-version

lm-version is a byte-compiled function defined in lisp-mnt.el.gz.

Signature

(lm-version &optional FILE)

Documentation

Return the version listed in file FILE, or current buffer if FILE is nil.

This can be found in an RCS or SCCS header.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/lisp-mnt.el.gz
(defun lm-version (&optional file)
  "Return the version listed in file FILE, or current buffer if FILE is nil.
This can be found in an RCS or SCCS header."
  (lm-with-file file
    (or (lm-header "version")
        (let ((header-max (lm-code-start)))
	  (goto-char (point-min))
	  (cond
	   ;; Look for an RCS header
	   ((re-search-forward "\\$[I]d: [^ ]+ \\([^ ]+\\) " header-max t)
	    (match-string-no-properties 1))
	   ((re-search-forward "\\$Revision: +\\([^ ]+\\) " header-max t)
	    (match-string-no-properties 1))
	   ;; Look for an SCCS header
	   ((re-search-forward
	     (concat
	      "@(#)"
              (if buffer-file-name
                  (regexp-quote (file-name-nondirectory buffer-file-name))
                "[^\t\n]+")
	      "\t\\([012345679.]*\\)")
	     header-max t)
	    (match-string-no-properties 1)))))))