# HG changeset patch # User Miles Bader # Date 972886873 0 # Node ID eb3d446c4a6e73884d94acb76d91853ad7093438 # Parent 9ec478daa4687863e6ca462eb2d541b4c9b1f8db (comint-replace-by-expanded-history): Don't use comint-get-old-input (we're not looking at *old* input). (comint-get-old-input-default): If using fields, signal an error when the point is not in an input field. diff -r 9ec478daa468 -r eb3d446c4a6e lisp/comint.el --- a/lisp/comint.el Mon Oct 30 04:10:22 2000 +0000 +++ b/lisp/comint.el Mon Oct 30 06:21:13 2000 +0000 @@ -1106,14 +1106,15 @@ Returns t if successful." (interactive) (if (and comint-input-autoexpand - (string-match "!\\|^\\^" (funcall comint-get-old-input)) (if comint-use-prompt-regexp-instead-of-fields ;; Use comint-prompt-regexp - (save-excursion (beginning-of-line) - (looking-at 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. - (null (get-char-property (point) 'field)))) + (and (null (get-char-property (point) 'field)) + (string-match "!\\|^\\^" (field-string))))) ;; 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) @@ -1711,8 +1712,10 @@ (end-of-line) (buffer-substring beg (point)))) ;; Return the contents of the field at the current point. - (field-string))) - + (let ((pos (field-beginning (point)))) + (unless (eq (get-char-property pos 'field) 'input) + (error "Point not in input field")) + (field-string pos)))) (defun comint-copy-old-input () "Insert after prompt old input at point as new input to be edited.