aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2024-12-16 20:12:25 +0200
committerJuri Linkov2024-12-16 20:12:25 +0200
commitd2986e79b76d442f8620195a54120d8be3e4583c (patch)
tree5887cebb7335d086a35e261d35d0b668964f97a8
parent61f1d7fc682c28b3e67a9d8f529ff7046dfdbff1 (diff)
downloademacs-d2986e79b76d442f8620195a54120d8be3e4583c.tar.gz
emacs-d2986e79b76d442f8620195a54120d8be3e4583c.zip
* lisp/comint.el (comint-complete-input-ring): New command (bug#74694).
(comint-mode-map): Bind 'comint-complete-input-ring' to 'C-x <up>'.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/comint.el19
2 files changed, 25 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 48546a2d916..bdcee0ed272 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -337,6 +337,12 @@ It removes all the buttons in the specified region.
337+++ 337+++
338*** Disabling 'button-mode' now removes all buttons in the current buffer. 338*** Disabling 'button-mode' now removes all buttons in the current buffer.
339 339
340** Shell
341
342*** New command to complete the shell history.
343'comint-complete-input-ring' ('C-x <up>') is like 'minibuffer-complete-history'
344but completes on comint inputs.
345
340** Eshell 346** Eshell
341 347
342--- 348---
diff --git a/lisp/comint.el b/lisp/comint.el
index d966625550c..33f095ff6b1 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -543,6 +543,7 @@ via PTYs.")
543 (define-key map "\er" 'comint-history-isearch-backward-regexp) 543 (define-key map "\er" 'comint-history-isearch-backward-regexp)
544 (define-key map [?\C-c ?\M-r] 'comint-previous-matching-input-from-input) 544 (define-key map [?\C-c ?\M-r] 'comint-previous-matching-input-from-input)
545 (define-key map [?\C-c ?\M-s] 'comint-next-matching-input-from-input) 545 (define-key map [?\C-c ?\M-s] 'comint-next-matching-input-from-input)
546 (define-key map [?\C-x up] 'comint-complete-input-ring)
546 (define-key map "\e\C-l" 'comint-show-output) 547 (define-key map "\e\C-l" 'comint-show-output)
547 (define-key map "\C-m" 'comint-send-input) 548 (define-key map "\C-m" 'comint-send-input)
548 (define-key map "\C-d" 'comint-delchar-or-maybe-eof) 549 (define-key map "\C-d" 'comint-delchar-or-maybe-eof)
@@ -1180,6 +1181,24 @@ See also `comint-read-input-ring'."
1180 (set-window-configuration conf) 1181 (set-window-configuration conf)
1181 (push ch unread-command-events)))))) 1182 (push ch unread-command-events))))))
1182 1183
1184(defun comint-complete-input-ring ()
1185 "Complete a list of recent inputs entered into the current buffer.
1186Like `minibuffer-complete-history' but completes on comint inputs.
1187This function makes `comint-dynamic-list-input-ring' obsolete."
1188 (interactive)
1189 (let ((completions
1190 (if (and (ring-p comint-input-ring)
1191 (not (ring-empty-p comint-input-ring)))
1192 (ring-elements comint-input-ring)
1193 (user-error "No history available")))
1194 (completion-in-region-mode-predicate
1195 (lambda () (get-buffer-window "*Completions*" 0))))
1196 (completion-in-region
1197 (comint-line-beginning-position) (point-max)
1198 (completion-table-with-metadata
1199 completions '((category . comint-input)
1200 (display-sort-function . identity)
1201 (cycle-sort-function . identity))))))
1183 1202
1184(defun comint-regexp-arg (prompt) 1203(defun comint-regexp-arg (prompt)
1185 "Return list of regexp and prefix arg using PROMPT." 1204 "Return list of regexp and prefix arg using PROMPT."