Function: dictionary-do-search

dictionary-do-search is a byte-compiled function defined in dictionary.el.gz.

Signature

(dictionary-do-search WORD DICTIONARY FUNCTION &optional NOMATCHING)

Documentation

Search for WORD in DICTIONARY and call FUNCTION for each result.

Optional argument NOMATCHING, if non-nil, means suppress the display of the "Searching" report and of the matching words.

Source Code

;; Defined in /usr/src/emacs/lisp/net/dictionary.el.gz
(defun dictionary-do-search (word dictionary function &optional nomatching)
  "Search for WORD in DICTIONARY and call FUNCTION for each result.
Optional argument NOMATCHING, if non-nil, means suppress the display
of the \"Searching\" report and of the matching words."
  (unless nomatching
    (insert (format-message "Searching for `%s' in `%s'\n" word dictionary)))
  (dictionary-send-command (concat "define "
				   (dictionary-encode-charset dictionary "")
				   " \""
				   (dictionary-encode-charset word dictionary)
				   "\""))

  (message nil)
  (let ((reply (dictionary-read-reply-and-split)))
    (if (dictionary-check-reply reply 552)
	(progn
	  (unless nomatching
	    (insert (format-message "Word `%s' not found\n" word))
	    (dictionary-do-matching
             word
	     dictionary
	     "."
	     (lambda (reply)
               (insert "Maybe you are looking for one of these words\n")
               (dictionary-display-only-match-result reply)))
	    (dictionary-post-buffer)))
      (if (dictionary-check-reply reply 550)
          (error "Dictionary \"%s\" is unknown, please select an existing one"
		 dictionary)
	(unless (dictionary-check-reply reply 150)
	  (error "Unknown server answer: %s" (dictionary-reply reply)))
	(funcall function reply)))))