summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorEric M. Ludlam <zappo@gnu.org>2000-11-02 02:25:27 +0000
committerEric M. Ludlam <zappo@gnu.org>2000-11-02 02:25:27 +0000
commit936c15f6ec47e302d1ece475778af80d5e4f51bf (patch)
tree7e8c7e62758d7ea9b459a1a352ce522df2c91e3e /lisp/comint.el
parent973a3104fd5cc71116d29d8e52ba033d43aa7606 (diff)
downloademacs-936c15f6ec47e302d1ece475778af80d5e4f51bf.tar.gz
(comint-add-to-input-history): New function.
(comint-send-input): Use `comint-add-to-input-history'.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 0b2de4aca8a..b0ae6d081bb 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1331,6 +1331,16 @@ Argument 0 is the command name."
;;
;; Input processing stuff
;;
+(defun comint-add-to-input-history (cmd)
+ "Add CMD to the input history.
+Ignore duplicates if `comint-input-ignoredups' is non-nil."
+ (if (and (funcall comint-input-filter cmd)
+ (or (null comint-input-ignoredups)
+ (not (ring-p comint-input-ring))
+ (ring-empty-p comint-input-ring)
+ (not (string-equal (ring-ref comint-input-ring 0)
+ cmd))))
+ (ring-insert comint-input-ring cmd)))
(defun comint-send-input ()
"Send input to process.
@@ -1406,13 +1416,7 @@ Similarly for Soar, Scheme, etc."
(delete-region pmark (point))
(insert ?\n))
- (if (and (funcall comint-input-filter history)
- (or (null comint-input-ignoredups)
- (not (ring-p comint-input-ring))
- (ring-empty-p comint-input-ring)
- (not (string-equal (ring-ref comint-input-ring 0)
- history))))
- (ring-insert comint-input-ring history))
+ (comint-add-to-input-history history)
(run-hook-with-args 'comint-input-filter-functions
(concat input "\n"))