changeset 33053:eb3d446c4a6e

(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.
author Miles Bader <miles@gnu.org>
date Mon, 30 Oct 2000 06:21:13 +0000
parents 9ec478daa468
children 23eeb6da5a51
files lisp/comint.el
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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.