aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-04-23 03:55:36 +0000
committerRichard M. Stallman1998-04-23 03:55:36 +0000
commit17ac49664b8ea7fb783fba3da30c2c558f1e6c4a (patch)
tree216acb4fd80c64a984c1f9c5f1dbd86c9e8e8f0f
parent678dc7ec25b03c79957daba0e943cfe6189aea5a (diff)
downloademacs-17ac49664b8ea7fb783fba3da30c2c558f1e6c4a.tar.gz
emacs-17ac49664b8ea7fb783fba3da30c2c558f1e6c4a.zip
(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.
-rw-r--r--lisp/comint.el23
1 files changed, 15 insertions, 8 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index c6ba27ac6af..fe4376996c6 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -935,7 +935,7 @@ If N is negative, search backwards for the -Nth previous match."
935 (comint-previous-matching-input-from-input (- arg))) 935 (comint-previous-matching-input-from-input (- arg)))
936 936
937 937
938(defun comint-replace-by-expanded-history (&optional silent) 938(defun comint-replace-by-expanded-history (&optional silent start)
939 "Expand input command history references before point. 939 "Expand input command history references before point.
940Expansion is dependent on the value of `comint-input-autoexpand'. 940Expansion is dependent on the value of `comint-input-autoexpand'.
941 941
@@ -949,6 +949,10 @@ it cannot expand absolute input line number references.
949If the optional argument SILENT is non-nil, never complain 949If the optional argument SILENT is non-nil, never complain
950even if history reference seems erroneous. 950even if history reference seems erroneous.
951 951
952If the optional argument START is non-nil, that specifies the
953start of the text to scan for history references, rather
954than the logical beginning of line.
955
952See `comint-magic-space' and `comint-replace-by-expanded-history-before-point'. 956See `comint-magic-space' and `comint-replace-by-expanded-history-before-point'.
953 957
954Returns t if successful." 958Returns t if successful."
@@ -959,17 +963,20 @@ Returns t if successful."
959 (looking-at comint-prompt-regexp))) 963 (looking-at comint-prompt-regexp)))
960 ;; Looks like there might be history references in the command. 964 ;; Looks like there might be history references in the command.
961 (let ((previous-modified-tick (buffer-modified-tick))) 965 (let ((previous-modified-tick (buffer-modified-tick)))
962 (message "Expanding history references...") 966 (comint-replace-by-expanded-history-before-point silent start)
963 (comint-replace-by-expanded-history-before-point silent)
964 (/= previous-modified-tick (buffer-modified-tick))))) 967 (/= previous-modified-tick (buffer-modified-tick)))))
965 968
966 969
967(defun comint-replace-by-expanded-history-before-point (silent) 970(defun comint-replace-by-expanded-history-before-point (silent &optional start)
968 "Expand directory stack reference before point. 971 "Expand directory stack reference before point.
969See `comint-replace-by-expanded-history'. Returns t if successful." 972See `comint-replace-by-expanded-history'. Returns t if successful.
973
974If the optional argument START is non-nil, that specifies the
975start of the text to scan for history references, rather
976than the logical beginning of line."
970 (save-excursion 977 (save-excursion
971 (let ((toend (- (save-excursion (end-of-line nil) (point)) (point))) 978 (let ((toend (- (save-excursion (end-of-line nil) (point)) (point)))
972 (start (progn (comint-bol nil) (point)))) 979 (start (or start (progn (comint-bol nil) (point)))))
973 (while (progn 980 (while (progn
974 (skip-chars-forward "^!^" 981 (skip-chars-forward "^!^"
975 (save-excursion 982 (save-excursion
@@ -1223,14 +1230,14 @@ Similarly for Soar, Scheme, etc."
1223 ;; Just whatever's already there 1230 ;; Just whatever's already there
1224 intxt 1231 intxt
1225 ;; Expand and leave it visible in buffer 1232 ;; Expand and leave it visible in buffer
1226 (comint-replace-by-expanded-history t) 1233 (comint-replace-by-expanded-history t pmark)
1227 (buffer-substring pmark (point)))) 1234 (buffer-substring pmark (point))))
1228 (history (if (not (eq comint-input-autoexpand 'history)) 1235 (history (if (not (eq comint-input-autoexpand 'history))
1229 input 1236 input
1230 ;; This is messy 'cos ultimately the original 1237 ;; This is messy 'cos ultimately the original
1231 ;; functions used do insertion, rather than return 1238 ;; functions used do insertion, rather than return
1232 ;; strings. We have to expand, then insert back. 1239 ;; strings. We have to expand, then insert back.
1233 (comint-replace-by-expanded-history t) 1240 (comint-replace-by-expanded-history t pmark)
1234 (let ((copy (buffer-substring pmark (point))) 1241 (let ((copy (buffer-substring pmark (point)))
1235 (start (point))) 1242 (start (point)))
1236 (insert input) 1243 (insert input)