From: Vitalie Spinu <spinuvit@gmail.com>
To: emacs-devel@gnu.org
Subject: comint-filename-completion and :exclusive completion bugs
Date: Wed, 14 Mar 2012 12:44:04 +0100 [thread overview]
Message-ID: <87ehsvh0fv.fsf@gmail.com> (raw)
Hi,
In case of no completion comint-filename-completion doesn't transfer the
completion to next completion-at-point-function.
Example:
(defun test-completion ()
(message "here")
nil)
(setq completion-at-point-functions '(comint-filename-completion test-completion))
Place the point after 'sfsdf and M-x completion-at-point. You will get
"No-match" message. The intended behavior is to pass over to next
completion function `test-completion'.
The fix is to pass :exlusive 'no :
diff --git a/lisp/comint.el b/lisp/comint.el
index 4c2229f..4935630 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3164,13 +3164,14 @@ the form (concat S2 S)."
(let ((completion-ignore-case read-file-name-completion-ignore-case)
(completion-ignored-extensions comint-completion-fignore))
(complete-with-action action table string pred))))
- (unless (zerop (length filesuffix))
- (list :exit-function
- (lambda (_s finished)
- (when (memq finished '(sole finished))
- (if (looking-at (regexp-quote filesuffix))
- (goto-char (match-end 0))
- (insert filesuffix)))))))))
+ (append (list :exclusive 'no)
+ (unless (zerop (length filesuffix))
+ (list :exit-function
+ (lambda (_s finished)
+ (when (memq finished '(sole finished))
+ (if (looking-at (regexp-quote filesuffix))
+ (goto-char (match-end 0))
+ (insert filesuffix))))))))))
(defun comint-dynamic-complete-as-filename ()
"Dynamically complete at point as a filename.
Now it works after 'sfsfd, but it reveals the following problem with
:exlusive argument:
Place your cursor after /bin and M-x completion-at-point, which
completes to /bin/, but calls test-completion with 3 arguments:
Debugger entered--Lisp error: (wrong-number-of-arguments (lambda nil (message "here") nil) 3)
test-completion("/bin/" (closure ((table . #[771 "\306.\307\301G\301\310\211.&\a\311=\205$.\x02\301G\310O\302\304\203 .\304.!\202!.\x01P\262.\211\205/.\312.\300.\x06.$\211\205\342.\x02\242\313=\203l.\211\242\313=\203K.\211.\x1a\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\x03\211.\x1aAA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&\a\311=\205\342.\211\302G\310O\301\303\203\221.\303.!\202\222.\x01P\262.\202\342.\x02\311=\203\341.\314.\300.\x06\315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334.\x01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\327\"\330\331%.\x06\"\"\262.\262.\202\342.\211\207" [comint-completion-file-name-table "" "" comint-quote-filename comint-unquote-filename completion-ignore-case compare-strings 0 nil t complete-with-action boundaries completion-boundaries "" mapcar "\\`" regexp-quote delq make-byte-code 257 "\302\301.\"\205.\0\211\303\225\304O\300\203.\0\300.!\202.\0\211\262.\207" vconcat vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STRING PRED ACTION)"]) (unquoted . #("/bin" 0 4 (fontified t))) (filename-end . 1984) (filename-beg . 1980) (filename . #("/bin" 0 4 (fontified t))) (filesuffix . " ") comint-dynamic-list-input-ring-window-conf t) (string pred action) (let ((completion-ignore-case read-file-name-completion-ignore-case) (completion-ignored-extensions comint-completion-fignore)) (complete-with-action action table string pred))) nil)
completion--do-completion()
minibuffer-complete()
call-interactively(minibuffer-complete)
#[1028 ".\x01\304.\x06.\x06\305\211\306%.\x18\305\262.\x02.\305\262.\307.\310\311#\210\307.\312\313#\210\n\2032.\314\315!\210p.\a.\a.\aF.\316\317\320\321\322\323.\x06!\324\"\325\326%DC\216\327\330!+\207" [minibuffer-completion-predicate minibuffer-completion-table completion-in-region-mode-predicate completion-in-region--data make-overlay nil t overlay-put field completion priority 100 completion-in-region-mode 1 funcall make-byte-code 0 "\301\300!\207" vconcat vector [delete-overlay] 2 "\n\n(fn)" call-interactively minibuffer-complete] 14 "\n\n(fn START END COLLECTION PREDICATE)"](1980 1984 (closure ((table . #[771 "\306.\307\301G\301\310\211.&\a\311=\205$.\x02\301G\310O\302\304\203 .\304.!\202!.\x01P\262.\211\205/.\312.\300.\x06.$\211\205\342.\x02\242\313=\203l.\211\242\313=\203K.\211.\x1a\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\x03\211.\x1aAA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&\a\311=\205\342.\211\302G\310O\301\303\203\221.\303.!\202\222.\x01P\262.\202\342.\x02\311=\203\341.\314.\300.\x06\315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334.\x01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\327\"\330\331%.\x06\"\"\262.\262.\202\342.\211\207" [comint-completion-file-name-table "" "" comint-quote-filename comint-unquote-filename completion-ignore-case compare-strings 0 nil t complete-with-action boundaries completion-boundaries "" mapcar "\\`" regexp-quote delq make-byte-code 257 "\302\301.\"\205.\0\211\303\225\304O\300\203.\0\300.!\202.\0\211\262.\207" vconcat vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STRING PRED ACTION)"]) (unquoted . #("/bin" 0 4 (fontified t))) (filename-end . 1984) (filename-beg . 1980) (filename . #("/bin" 0 4 (fontified t))) (filesuffix . " ") comint-dynamic-list-input-ring-window-conf t) (string pred action) (let ((completion-ignore-case read-file-name-completion-ignore-case) (completion-ignored-extensions comint-completion-fignore)) (complete-with-action action table string pred))) nil)
apply(#[1028 ".\x01\304.\x06.\x06\305\211\306%.\x18\305\262.\x02.\305\262.\307.\310\311#\210\307.\312\313#\210\n\2032.\314\315!\210p.\a.\a.\aF.\316\317\320\321\322\323.\x06!\324\"\325\326%DC\216\327\330!+\207" [minibuffer-completion-predicate minibuffer-completion-table completion-in-region-mode-predicate completion-in-region--data make-overlay nil t overlay-put field completion priority 100 completion-in-region-mode 1 funcall make-byte-code 0 "\301\300!\207" vconcat vector [delete-overlay] 2 "\n\n(fn)" call-interactively minibuffer-complete] 14 "\n\n(fn START END COLLECTION PREDICATE)"] (1980 1984 (closure ((table . #[771 "\306.\307\301G\301\310\211.&\a\311=\205$.\x02\301G\310O\302\304\203 .\304.!\202!.\x01P\262.\211\205/.\312.\300.\x06.$\211\205\342.\x02\242\313=\203l.\211\242\313=\203K.\211.\x1a\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\x03\211.\x1aAA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&\a\311=\205\342.\211\302G\310O\301\303\203\221.\303.!\202\222.\x01P\262.\202\342.\x02\311=\203\341.\314.\300.\x06\315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334.\x01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\327\"\330\331%.\x06\"\"\262.\262.\202\342.\211\207" [comint-completion-file-name-table "" "" comint-quote-filename comint-unquote-filename completion-ignore-case compare-strings 0 nil t complete-with-action boundaries completion-boundaries "" mapcar "\\`" regexp-quote delq make-byte-code 257 "\302\301.\"\205.\0\211\303\225\304O\300\203.\0\300.!\202.\0\211\262.\207" vconcat vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STRING PRED ACTION)"]) (unquoted . #("/bin" 0 4 (fontified t))) (filename-end . 1984) (filename-beg . 1980) (filename . #("/bin" 0 4 (fontified t))) (filesuffix . " ") comint-dynamic-list-input-ring-window-conf t) (string pred action) (let ((completion-ignore-case read-file-name-completion-ignore-case) (completion-ignored-extensions comint-completion-fignore)) (complete-with-action action table string pred))) nil))
#[771 ".:\2030.\x02@\301=\203.\0\300@\302.\x05A\"\303.#\207\304.@\305\306\307\310\311\312\300!\313\"\314\315%.\x06A.\x06#.#\207\304\316.\"\207" [(#0) t append nil apply apply-partially make-byte-code 642 "\300@.\x03.#\207" vconcat vector [] 7 "\n\n(fn FUNS GLOBAL &rest ARGS)" #[1028 ".\x01\304.\x06.\x06\305\211\306%.\x18\305\262.\x02.\305\262.\307.\310\311#\210\307.\312\313#\210\n\2032.\314\315!\210p.\a.\a.\aF.\316\317\320\321\322\323.\x06!\324\"\325\326%DC\216\327\330!+\207" [minibuffer-completion-predicate minibuffer-completion-table completion-in-region-mode-predicate completion-in-region--data make-overlay nil t overlay-put field completion priority 100 completion-in-region-mode 1 funcall make-byte-code 0 "\301\300!\207" vconcat vector [delete-overlay] 2 "\n\n(fn)" call-interactively minibuffer-complete] 14 "\n\n(fn START END COLLECTION PREDICATE)"]] 12 "\n\n(fn FUNS GLOBAL ARGS)"](nil nil (1980 1984 (closure ((table . #[771 "\306.\307\301G\301\310\211.&\a\311=\205$.\x02\301G\310O\302\304\203 .\304.!\202!.\x01P\262.\211\205/.\312.\300.\x06.$\211\205\342.\x02\242\313=\203l.\211\242\313=\203K.\211.\x1a\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\x03\211.\x1aAA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&\a\311=\205\342.\211\302G\310O\301\303\203\221.\303.!\202\222.\x01P\262.\202\342.\x02\311=\203\341.\314.\300.\x06\315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334.\x01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\327\"\330\331%.\x06\"\"\262.\262.\202\342.\211\207" [comint-completion-file-name-table "" "" comint-quote-filename comint-unquote-filename completion-ignore-case compare-strings 0 nil t complete-with-action boundaries completion-boundaries "" mapcar "\\`" regexp-quote delq make-byte-code 257 "\302\301.\"\205.\0\211\303\225\304O\300\203.\0\300.!\202.\0\211\262.\207" vconcat vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STRING PRED ACTION)"]) (unquoted . #("/bin" 0 4 (fontified t))) (filename-end . 1984) (filename-beg . 1980) (filename . #("/bin" 0 4 (fontified t))) (filesuffix . " ") comint-dynamic-list-input-ring-window-conf t) (string pred action) (let ((completion-ignore-case read-file-name-completion-ignore-case) (completion-ignored-extensions comint-completion-fignore)) (complete-with-action action table string pred))) nil))
completion-in-region(1980 1984 (closure ((table . #[771 "\306.\307\301G\301\310\211.&\a\311=\205$.\x02\301G\310O\302\304\203 .\304.!\202!.\x01P\262.\211\205/.\312.\300.\x06.$\211\205\342.\x02\242\313=\203l.\211\242\313=\203K.\211.\x1a\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\x03\211.\x1aAA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&\a\311=\205\342.\211\302G\310O\301\303\203\221.\303.!\202\222.\x01P\262.\202\342.\x02\311=\203\341.\314.\300.\x06\315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334.\x01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\327\"\330\331%.\x06\"\"\262.\262.\202\342.\211\207" [comint-completion-file-name-table "" "" comint-quote-filename comint-unquote-filename completion-ignore-case compare-strings 0 nil t complete-with-action boundaries completion-boundaries "" mapcar "\\`" regexp-quote delq make-byte-code 257 "\302\301.\"\205.\0\211\303\225\304O\300\203.\0\300.!\202.\0\211\262.\207" vconcat vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STRING PRED ACTION)"]) (unquoted . #("/bin" 0 4 (fontified t))) (filename-end . 1984) (filename-beg . 1980) (filename . #("/bin" 0 4 (fontified t))) (filesuffix . " ") comint-dynamic-list-input-ring-window-conf t) (string pred action) (let ((completion-ignore-case read-file-name-completion-ignore-case) (completion-ignored-extensions comint-completion-fignore)) (complete-with-action action table string pred))) nil)
completion-at-point()
It looks like the 3 spurious arguments are passed from
comint-filename-completion. Most surely this is not an intended behavior
of :exlusive keyword. Or, is it?
Vitalie.
next reply other threads:[~2012-03-14 11:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-14 11:44 Vitalie Spinu [this message]
2012-03-14 13:53 ` comint-filename-completion and :exclusive completion bugs Stefan Monnier
2012-03-14 14:54 ` Vitalie Spinu
2012-03-14 15:45 ` Stefan Monnier
2012-03-14 21:51 ` Vitalie Spinu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ehsvh0fv.fsf@gmail.com \
--to=spinuvit@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).