Function: tempo-insert-prompt

tempo-insert-prompt is a byte-compiled function defined in tempo.el.gz.

Signature

(tempo-insert-prompt PROMPT &optional SAVE-NAME NO-INSERT)

Documentation

Prompt for a text string and insert it in the current buffer.

If the variable tempo-interactive is non-nil the user is prompted for a string in the minibuffer, which is then inserted in the current buffer. If tempo-interactive is nil, the current point is placed on tempo-mark.

PROMPT is the prompt string, SAVE-NAME is a name to save the inserted text under. If the optional argument NO-INSERT is non-nil, no text is inserted. This can be useful when there is a SAVE-NAME.

If there already is a value for SAVE-NAME, it is used and the user is never prompted.

Source Code

;; Defined in /usr/src/emacs/lisp/tempo.el.gz
(defun tempo-insert-prompt (prompt &optional save-name no-insert)
  "Prompt for a text string and insert it in the current buffer.
If the variable `tempo-interactive' is non-nil the user is prompted
for a string in the minibuffer, which is then inserted in the current
buffer.  If `tempo-interactive' is nil, the current point is placed on
`tempo-mark'.

PROMPT is the prompt string, SAVE-NAME is a name to save the inserted
text under.  If the optional argument NO-INSERT is non-nil, no text is
inserted.  This can be useful when there is a SAVE-NAME.

If there already is a value for SAVE-NAME, it is used and the user is
never prompted."
  (let (insertion
	(previous (and save-name
		       (tempo-lookup-named save-name))))
    (cond
     ;; Insert  previous value, unless no-insert is non-nil
     ((and previous
	   (not no-insert))
      (tempo-insert-named save-name)) ; A double lookup here, but who
				      ; cares
     ;; If no-insert is non-nil, don't insert the previous value. Just
     ;; keep it
     (previous
      nil)
     ;; No previous value. Prompt or insert mark
     (tempo-interactive
      (if (not (stringp prompt))
	  (error "tempo: The prompt (%s) is not a string" prompt))
      (setq insertion (read-string prompt))
      (or no-insert
	  (insert insertion))
      (if save-name
	  (tempo-save-named save-name insertion)))
     (t
      (tempo-insert-mark (point-marker))))))