Function: apropos-documentation-check-elc-file

apropos-documentation-check-elc-file is a byte-compiled function defined in apropos.el.gz.

Signature

(apropos-documentation-check-elc-file FILE)

Source Code

;; Defined in /usr/src/emacs/lisp/apropos.el.gz
(defun apropos-documentation-check-elc-file (file)
  ;; .elc files have the location of the file specified as #$, but for
  ;; built-in files, that's a relative name (while for the rest, it's
  ;; absolute).  So expand the name in the former case.
  (unless (file-name-absolute-p file)
    (setq file (expand-file-name file lisp-directory)))
  (if (or (member file apropos-files-scanned)
          (not (file-exists-p file)))
      nil
    (let (symbol doc beg end this-is-a-variable)
      (setq apropos-files-scanned (cons file apropos-files-scanned))
      (erase-buffer)
      (insert-file-contents file)
      (while (search-forward "#@" nil t)
	;; Read the comment length, and advance over it.
	;; This #@ may be a false positive, so don't get upset if
	;; it's not followed by the expected number of bytes to skip.
	(when (and (setq end (ignore-errors (read))) (natnump end))
	  (setq beg (1+ (point))
                end (+ (point) end -1))
	  (forward-char)
	  (if (save-restriction
                ;; match ^ and $ relative to doc string
                (narrow-to-region beg end)
                (re-search-forward apropos-all-words-regexp nil t))
	      (progn
                (goto-char (+ end 2))
                (setq doc (buffer-substring beg end)
		      end (- (match-end 0) beg)
		      beg (- (match-beginning 0) beg))
		(when (apropos-true-hit-doc doc)
		  (setq this-is-a-variable (looking-at "(def\\(var\\|const\\) ")
			symbol (progn
                                 (skip-chars-forward "(a-z")
                                 (forward-char)
                                 (read))
			symbol (if (consp symbol)
				   (nth 1 symbol)
				 symbol))
		  (if (if this-is-a-variable
			  (get symbol 'variable-documentation)
			(and (fboundp symbol) (apropos-safe-documentation symbol)))
		      (progn
			(or (and (setq apropos-item (assq symbol apropos-accumulator))
				 (setcar (cdr apropos-item)
                                         (+ (cadr apropos-item) (apropos-score-doc doc))))
			    (setq apropos-item (list symbol
						     (+ (apropos-score-symbol symbol 2)
                                                        (apropos-score-doc doc))
						     nil nil)
				  apropos-accumulator (cons apropos-item
							    apropos-accumulator)))
			(when apropos-match-face
			  (setq doc (substitute-command-keys doc))
			  (if (or (string-match apropos-pattern-quoted doc)
				  (string-match apropos-all-words-regexp doc))
			      (put-text-property (match-beginning 0)
                                                 (match-end 0)
                                                 'face apropos-match-face doc)))
			(setcar (nthcdr (if this-is-a-variable 3 2)
                                        apropos-item)
				doc)))))))))))