Function: help-fns--first-release

help-fns--first-release is a byte-compiled function defined in help-fns.el.gz.

Signature

(help-fns--first-release SYMBOL)

Documentation

Return the likely first release that defined SYMBOL, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-fns--first-release (symbol)
  "Return the likely first release that defined SYMBOL, or nil."
  ;; Code below relies on the etc/NEWS* files.
  ;; FIXME: Maybe we should also use the */ChangeLog* files when available.
  ;; FIXME: Maybe we should also look for announcements of the addition
  ;; of the *packages* in which the function is defined.
  (let* ((name (symbol-name symbol))
         (re (concat "\\_<" (regexp-quote name) "\\_>"))
         (news (directory-files data-directory t "\\`NEWS\\(\\'\\|\\.\\)"))
         (place nil)
         (first nil))
    (with-temp-buffer
      (dolist (f news)
        (erase-buffer)
        (insert-file-contents f)
        (goto-char (point-min))
        (search-forward "\n*")
        (while (re-search-forward re nil t)
          (let ((pos (match-beginning 0)))
            (save-excursion
              ;; Almost all entries are of the form "* ... in Emacs NN.MM."
              ;; but there are also a few in the form "* Emacs NN.MM is a bug
              ;; fix release ...".
              (if (not (re-search-backward "^\\* .* Emacs \\([0-9.]+[0-9]\\)"
                                           nil t))
                  (message "Ref found in non-versioned section in %S"
                           (file-name-nondirectory f))
                (let ((version (match-string 1)))
                  (when (or (null first) (version< version first))
                    (setq place (list f pos))
                    (setq first version)))))))))
    (when first
      (make-text-button first nil 'type 'help-news 'help-args place))))