Function: info-xref-docstrings

info-xref-docstrings is an autoloaded, interactive and byte-compiled function defined in info-xref.el.gz.

Signature

(info-xref-docstrings FILENAME-LIST)

Documentation

Check docstring info node references in source files.

The given files are searched for docstring hyperlinks like

    Info node (elisp)Documentation Tips

and those links checked by attempting to visit the target nodes as per info-xref-check does.

Interactively filenames are read as a wildcard pattern like
"foo*.el", with the current file as a default. Usually this
will be lisp sources, but anything with such hyperlinks can be checked, including the Emacs .c sources (or the etc/DOC file of all builtins).

Because info node hyperlinks are found by a simple regexp search in the files, the Lisp code checked doesn't have to be loaded, and links can be in the file commentary or elsewhere too. Even
.elc files can usually be checked successfully if you don't have
the sources handy.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/info-xref.el.gz
;;;###autoload
(defun info-xref-docstrings (filename-list)
  ;; checkdoc-params: (filename-list)
  "Check docstring info node references in source files.
The given files are searched for docstring hyperlinks like

    Info node `(elisp)Documentation Tips'

and those links checked by attempting to visit the target nodes
as per `info-xref-check' does.

Interactively filenames are read as a wildcard pattern like
\"foo*.el\", with the current file as a default.  Usually this
will be lisp sources, but anything with such hyperlinks can be
checked, including the Emacs .c sources (or the etc/DOC file of
all builtins).

Because info node hyperlinks are found by a simple regexp search
in the files, the Lisp code checked doesn't have to be loaded,
and links can be in the file commentary or elsewhere too.  Even
.elc files can usually be checked successfully if you don't have
the sources handy."
  (interactive
   (let* ((default (and buffer-file-name
                              (file-relative-name buffer-file-name)))
          (prompt (if default
                      (format "Filename with wildcards (%s): "
                              default)
                    "Filename with wildcards: "))
          (pattern (read-file-name prompt nil default))
          ;; absolute filenames
          (filename-list (file-expand-wildcards pattern t))
          newlist)
     (setq filename-list
           (dolist (file filename-list (nreverse newlist))
             (or (info-xref-lock-file-p file)
                 (file-directory-p file)
                 (push file newlist))))
     (unless filename-list
       (error "No files: %S" pattern))
     (list filename-list)))

  (eval-and-compile
    (require 'help-mode)) ;; for `help-xref-info-regexp'

  (info-xref-with-output
   (dolist (info-xref-filename filename-list)
     (setq info-xref-xfile-alist nil)  ;; "not found"s once per file

     (info-xref-with-file info-xref-filename
       (goto-char (point-min))
       (while (re-search-forward help-xref-info-regexp nil t)
         (let ((node (match-string 2)))
           (save-excursion
             (goto-char (match-beginning 2)) ;; start of node as error position

             ;; skip nodes with "%" as probably `format' strings such as in
             ;; info-look.el
             (unless (string-search "%" node)

               ;; "(emacs)" is the default manual for docstring hyperlinks,
               ;; per `help-make-xrefs'
               (unless (string-match "\\`(" node)
                 (setq node (concat "(emacs)" node)))

               (info-xref-check-node node)))))))))