Function: term-replace-by-expanded-history

term-replace-by-expanded-history is an interactive and byte-compiled function defined in term.el.gz.

Signature

(term-replace-by-expanded-history &optional SILENT)

Documentation

Expand input command history references before point.

Expansion is dependent on the value of term-input-autoexpand.

This function depends on the buffer's idea of the input history, which may not match the command interpreter's idea, assuming it has one.

Assumes history syntax is like typical Un*x shells'. However, since Emacs cannot know the interpreter's idea of input line numbers, assuming it has one, it cannot expand absolute input line number references.

If the optional argument SILENT is non-nil, never complain even if history reference seems erroneous.

See term-magic-space and term-replace-by-expanded-history-before-point.

Returns t if successful.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/term.el.gz
(defun term-replace-by-expanded-history (&optional silent)
  "Expand input command history references before point.
Expansion is dependent on the value of `term-input-autoexpand'.

This function depends on the buffer's idea of the input history, which may not
match the command interpreter's idea, assuming it has one.

Assumes history syntax is like typical Un*x shells'.  However, since Emacs
cannot know the interpreter's idea of input line numbers, assuming it has one,
it cannot expand absolute input line number references.

If the optional argument SILENT is non-nil, never complain
even if history reference seems erroneous.

See `term-magic-space' and `term-replace-by-expanded-history-before-point'.

Returns t if successful."
  (interactive)
  (when (and term-input-autoexpand
	     (string-match "[!^]" (funcall term-get-old-input))
	     (save-excursion (beginning-of-line)
			     (looking-at term-prompt-regexp)))
    ;; Looks like there might be history references in the command.
    (let ((previous-modified-tick (buffer-modified-tick)))
      (message "Expanding history references...")
      (term-replace-by-expanded-history-before-point silent)
      (/= previous-modified-tick (buffer-modified-tick)))))