changeset 21714:9c454e5e03fa

(comint-replace-by-expanded-history): New arg START. Don't display a message about doing history expansion. (comint-replace-by-expanded-history-before-point): New arg START. (comint-send-input): Pass START to comint-replace-by-expanded-history.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Apr 1998 03:55:36 +0000
parents aa160e4358ac
children 98c5740d198b
files lisp/comint.el
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/comint.el	Thu Apr 23 01:34:49 1998 +0000
+++ b/lisp/comint.el	Thu Apr 23 03:55:36 1998 +0000
@@ -935,7 +935,7 @@
   (comint-previous-matching-input-from-input (- arg)))
 
 
-(defun comint-replace-by-expanded-history (&optional silent)
+(defun comint-replace-by-expanded-history (&optional silent start)
   "Expand input command history references before point.
 Expansion is dependent on the value of `comint-input-autoexpand'.
 
@@ -949,6 +949,10 @@
 If the optional argument SILENT is non-nil, never complain
 even if history reference seems erroneous.
 
+If the optional argument START is non-nil, that specifies the
+start of the text to scan for history references, rather
+than the logical beginning of line.
+
 See `comint-magic-space' and `comint-replace-by-expanded-history-before-point'.
 
 Returns t if successful."
@@ -959,17 +963,20 @@
 			   (looking-at comint-prompt-regexp)))
       ;; Looks like there might be history references in the command.
       (let ((previous-modified-tick (buffer-modified-tick)))
-	(message "Expanding history references...")
-	(comint-replace-by-expanded-history-before-point silent)
+	(comint-replace-by-expanded-history-before-point silent start)
 	(/= previous-modified-tick (buffer-modified-tick)))))
 
 
-(defun comint-replace-by-expanded-history-before-point (silent)
+(defun comint-replace-by-expanded-history-before-point (silent &optional start)
   "Expand directory stack reference before point.
-See `comint-replace-by-expanded-history'.  Returns t if successful."
+See `comint-replace-by-expanded-history'.  Returns t if successful.
+
+If the optional argument START is non-nil, that specifies the
+start of the text to scan for history references, rather
+than the logical beginning of line."
   (save-excursion
     (let ((toend (- (save-excursion (end-of-line nil) (point)) (point)))
-	  (start (progn (comint-bol nil) (point))))
+	  (start (or start (progn (comint-bol nil) (point)))))
       (while (progn
 	       (skip-chars-forward "^!^"
 				   (save-excursion
@@ -1223,14 +1230,14 @@
 			  ;; Just whatever's already there
 			  intxt
 			;; Expand and leave it visible in buffer
-			(comint-replace-by-expanded-history t)
+			(comint-replace-by-expanded-history t pmark)
 			(buffer-substring pmark (point))))
 	       (history (if (not (eq comint-input-autoexpand 'history))
 			    input
 			  ;; This is messy 'cos ultimately the original
 			  ;; functions used do insertion, rather than return
 			  ;; strings.  We have to expand, then insert back.
-			  (comint-replace-by-expanded-history t)
+			  (comint-replace-by-expanded-history t pmark)
 			  (let ((copy (buffer-substring pmark (point)))
 				(start (point)))
 			    (insert input)