Function: calc-describe-thing

calc-describe-thing is a byte-compiled function defined in calc-help.el.gz.

Signature

(calc-describe-thing THING WHERE &optional TARGET NOT-QUOTED)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-help.el.gz
(defun calc-describe-thing (thing where &optional target not-quoted)
  (message "Looking for `%s' in %s..." thing where)
  (let ((savewin (current-window-configuration)))
    (calc-info-goto-node where)
    (or (let ((case-fold-search nil))
	  (re-search-forward (format "\n\\* +%s: \\(.*\\)\\."
				     (regexp-quote thing))
			     nil t))
	(and (string-match "\\`\\([a-z ]*\\)[0-9]\\'" thing)
	     (re-search-forward (format "\n\\* +%s[01]-9: \\(.*\\)\\."
					(substring thing 0 -1))
				nil t)
	     (setq thing (format "%s9" (substring thing 0 -1))))
	(progn
          (if Info-history
              (Info-last))
	  (set-window-configuration savewin)
	  (error "Can't find `%s' in %s" thing where)))
    (let (Info-history)
      (Info-goto-node (buffer-substring (match-beginning 1) (match-end 1))))
    (let* ((string-target (or target thing))
           (quoted (format "['`‘]%s['’]" (regexp-quote string-target)))
           (bracketed (format "\\[%s\\]\\|(%s)\\|\\<The[ \n]%s"
                              quoted quoted quoted)))
      (or (let ((case-fold-search nil))
            (or (re-search-forward bracketed nil t)
                (and not-quoted
                     (let ((case-fold-search t))
                       (search-forward string-target nil t)))
                (re-search-forward quoted nil t)
                (search-forward string-target nil t)))
          (let ((case-fold-search t))
            (or (re-search-forward bracketed nil t)
                (re-search-forward quoted nil t)
                (search-forward string-target nil t)))))
    (beginning-of-line)
    (message "Found `%s' in %s" thing where)))