Function: info-lookup-setup-mode

info-lookup-setup-mode is a byte-compiled function defined in info-look.el.gz.

Signature

(info-lookup-setup-mode TOPIC MODE)

Documentation

Initialize the internal data structure.

Source Code

;; Defined in /usr/src/emacs/lisp/info-look.el.gz
(defun info-lookup-setup-mode (topic mode)
  "Initialize the internal data structure."
  (or (info-lookup->initialized topic mode)
      (let ((initialized 0)
	    cell data completions refer-modes Info-history-list)
	(if (not (info-lookup->mode-value topic mode))
	    (message "No %s help available for `%s'" topic mode)
	  ;; Recursively setup cross references.
	  ;; But refer only to non-void modes.
	  (dolist (arg (info-lookup->other-modes topic mode))
	    (or (info-lookup->initialized topic arg)
		(info-lookup-setup-mode topic arg))
	    (and (eq (info-lookup->initialized topic arg) t)
		 (setq refer-modes (cons arg refer-modes))))
	  (setq refer-modes (nreverse refer-modes))
	  ;; Build the full completion alist.
	  (setq completions
		(nconc (condition-case nil
			   (info-lookup-make-completions topic mode)
			 (error nil))
		       (apply #'append
			      (mapcar (lambda (arg)
					(info-lookup->completions topic arg))
				      refer-modes))))
	  (setq initialized t))
	;; Update `info-lookup-cache'.
	(setq cell (info-lookup->mode-cache topic mode)
	      data (list initialized completions refer-modes))
	(if (not cell)
	    (setcdr (info-lookup->cache topic)
		    (cons (cons mode data) (info-lookup->topic-cache topic)))
	  (setcdr cell data))
	initialized)))