GNU bug report logs - #74694
comint-complete-input-ring

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 4 Dec 2024 18:49:01 UTC

Severity: normal

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74694 in the body.
You can then email your comments to 74694 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#74694; Package emacs. (Wed, 04 Dec 2024 18:49:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 04 Dec 2024 18:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: comint-complete-input-ring
Date: Wed, 04 Dec 2024 20:46:40 +0200
[Message part 1 (text/plain, inline)]
Like discussed in
https://mail.gnu.org/archive/html/emacs-devel/2024-11/msg00094.html
here is the patch that implements completion on comint history:

[comint-complete-input-ring.patch (text/x-diff, inline)]
diff --git a/lisp/comint.el b/lisp/comint.el
index 6423e695430..9b8ea6869c2 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -543,6 +543,7 @@ comint-mode-map
     (define-key map "\er" 	  'comint-history-isearch-backward-regexp)
     (define-key map [?\C-c ?\M-r] 'comint-previous-matching-input-from-input)
     (define-key map [?\C-c ?\M-s] 'comint-next-matching-input-from-input)
+    (define-key map [?\C-x up]    'comint-complete-input-ring)
     (define-key map "\e\C-l" 	  'comint-show-output)
     (define-key map "\C-m" 	  'comint-send-input)
     (define-key map "\C-d" 	  'comint-delchar-or-maybe-eof)
@@ -1180,6 +1181,26 @@ comint-dynamic-list-input-ring
 	    (set-window-configuration conf)
 	  (push ch unread-command-events))))))
 
+(defun comint-complete-input-ring ()
+  "Complete a list of recent inputs entered into the current buffer.
+Like `minibuffer-complete-defaults' but completes on comint inputs.
+This function makes `comint-dynamic-list-input-ring' obsolete."
+  (interactive)
+  (let ((completions
+         (if (and (ring-p comint-input-ring)
+                  (not (ring-empty-p comint-input-ring)))
+             (ring-elements comint-input-ring)
+           (user-error "No history available")))
+        (completion-in-region-mode-predicate
+         (lambda () (get-buffer-window "*Completions*" 0))))
+    (completion-in-region
+     (comint-line-beginning-position) (point-max)
+     (lambda (string pred action)
+       (if (eq action 'metadata)
+           '(metadata (category . comint-input)
+                      (display-sort-function . identity)
+                      (cycle-sort-function . identity))
+         (complete-with-action action completions string pred))))))
 
 (defun comint-regexp-arg (prompt)
   "Return list of regexp and prefix arg using PROMPT."

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74694; Package emacs. (Mon, 16 Dec 2024 18:22:02 GMT) Full text and rfc822 format available.

Message #8 received at 74694 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: 74694 <at> debbugs.gnu.org
Subject: Re: bug#74694: comint-complete-input-ring
Date: Mon, 16 Dec 2024 20:15:00 +0200
close 74694 31.0.50
quit

> Like discussed in
> https://mail.gnu.org/archive/html/emacs-devel/2024-11/msg00094.html
> here is the patch that implements completion on comint history:

Now pushed to master.




bug marked as fixed in version 31.0.50, send any further explanations to 74694 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 16 Dec 2024 18:22:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 14 Jan 2025 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 234 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.