[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
comint-filename-completion and :exclusive completion bugs
From: |
Vitalie Spinu |
Subject: |
comint-filename-completion and :exclusive completion bugs |
Date: |
Wed, 14 Mar 2012 12:44:04 +0100 |
User-agent: |
Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.0.94 (gnu/linux) |
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.&\311=\205$.\301G\310O\302\304\203
.\304.!\202!.P\262.\211\205/.\312.\300..$\211\205\342.\242\313=\203l.\211\242\313=\203K.\211.\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\211.AA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&address@hidden"address@hidden
\"\327\"\330\331%.\"\"\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. \211\303\225\304O\300\203. \300.!\202. \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
".\304..\305\211\306%.\305\262..\305\262.\307.\310\311#\210\307.\312\313#\210\n\2032.\314\315!\210p...F.\316\317\320\321\322\323.!\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.&\311=\205$.\301G\310O\302\304\203
.\304.!\202!.P\262.\211\205/.\312.\300..$\211\205\342.\242\313=\203l.\211\242\313=\203K.\211.\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\211.AA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&address@hidden"address@hidden
\"\327\"\330\331%.\"\"\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. \211\303\225\304O\300\203. \300.!\202. \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
".\304..\305\211\306%.\305\262..\305\262.\307.\310\311#\210\307.\312\313#\210\n\2032.\314\315!\210p...F.\316\317\320\321\322\323.!\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.&\311=\205$.\301G\310O\302\304\203
.\304.!\202!.P\262.\211\205/.\312.\300..$\211\205\342.\242\313=\203l.\211\242\313=\203K.\211.\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\211.AA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&address@hidden"address@hidden
\"\327\"\330\331%.\"\"\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. \211\303\225\304O\300\203. \300.!\202. \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
".:address@hidden@\302.A\"address@hidden"\314\315%.A.#.#\207\304\316.\"\207"
[(#0) t append nil apply apply-partially make-byte-code 642 "address@hidden"
vconcat vector [] 7 "\n\n(fn FUNS GLOBAL &rest ARGS)" #[1028
".\304..\305\211\306%.\305\262..\305\262.\307.\310\311#\210\307.\312\313#\210\n\2032.\314\315!\210p...F.\316\317\320\321\322\323.!\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.&\311=\205$.\301G\310O\302\304\203
.\304.!\202!.P\262.\211\205/.\312.\300..$\211\205\342.\242\313=\203l.\211\242\313=\203K.\211.\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\211.AA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&address@hidden"address@hidden
\"\327\"\330\331%.\"\"\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. \211\303\225\304O\300\203. \300.!\202. \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.&\311=\205$.\301G\310O\302\304\203
.\304.!\202!.P\262.\211\205/.\312.\300..$\211\205\342.\242\313=\203l.\211\242\313=\203K.\211.\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=\205e.\211.AA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&address@hidden"address@hidden
\"\327\"\330\331%.\"\"\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. \211\303\225\304O\300\203. \300.!\202. \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.
- comint-filename-completion and :exclusive completion bugs,
Vitalie Spinu <=