Function: comint-c-a-p-replace-by-expanded-history

comint-c-a-p-replace-by-expanded-history is a byte-compiled function defined in comint.el.gz.

Signature

(comint-c-a-p-replace-by-expanded-history &optional SILENT START)

Documentation

Expand input command history at point.

For use on completion-at-point-functions.

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-c-a-p-replace-by-expanded-history (&optional silent start)
  "Expand input command history at point.
For use on `completion-at-point-functions'."
  (if (and comint-input-autoexpand
	   (if comint-use-prompt-regexp
	       ;; Use comint-prompt-regexp
	       (save-excursion
		 (beginning-of-line)
		 (looking-at (concat comint-prompt-regexp "!\\|\\^")))
	     ;; Use input fields.  User input that hasn't been entered
	     ;; yet, at the end of the buffer, has a nil `field' property.
	     (and (null (get-char-property (point) 'field))
		  (string-match "!\\|^\\^" (field-string))))
           (catch 'dry-run
             (comint-replace-by-expanded-history-before-point
              silent start 'dry-run)))
      (lambda ()
        ;; Looks like there might be history references in the command.
        (let ((previous-modified-tick (buffer-modified-tick)))
          (comint-replace-by-expanded-history-before-point silent start)
          (/= previous-modified-tick (buffer-modified-tick))))))