Function: info-lookup-guess-default*

info-lookup-guess-default* is a byte-compiled function defined in info-look.el.gz.

Signature

(info-lookup-guess-default* TOPIC MODE)

Source Code

;; Defined in /usr/src/emacs/lisp/info-look.el.gz
(defun info-lookup-guess-default* (topic mode)
  (let ((case-fold-search (info-lookup->ignore-case topic mode))
	(rule (or (info-lookup->parse-rule topic mode)
		  (info-lookup->regexp topic mode)))
	(start (point)) end regexp subexp result)
    (save-excursion
      (if (functionp rule)
	  (setq result (funcall rule))
	(if (consp rule)
	    (setq regexp (car rule)
		  subexp (cdr rule))
	  (setq regexp rule
		subexp 0))
	;; If at start of symbol, don't go back to end of previous one.
	(if (save-match-data
	      (looking-at "[ \t\n]"))
	    (skip-chars-backward " \t\n"))
	(setq end (point))
	(while (and (re-search-backward regexp nil t)
		    (looking-at regexp)
		    (>= (match-end 0) end))
	  (setq result (match-string subexp)))
	(if (not result)
	    (progn
	      (goto-char start)
	      (skip-chars-forward " \t\n")
	      (and (looking-at regexp)
		   (setq result (match-string subexp)))))))
    result))