From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vitalie Spinu Newsgroups: gmane.emacs.devel Subject: comint-filename-completion and :exclusive completion bugs Date: Wed, 14 Mar 2012 12:44:04 +0100 Organization: EUR Message-ID: <87ehsvh0fv.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1331725504 24489 80.91.229.3 (14 Mar 2012 11:45:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 14 Mar 2012 11:45:04 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 14 12:45:03 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S7mdb-0006Rn-DW for ged-emacs-devel@m.gmane.org; Wed, 14 Mar 2012 12:45:03 +0100 Original-Received: from localhost ([::1]:39687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7mda-0002EZ-PA for ged-emacs-devel@m.gmane.org; Wed, 14 Mar 2012 07:45:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7mdR-0002Dn-7M for emacs-devel@gnu.org; Wed, 14 Mar 2012 07:45:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7mcu-00064e-VP for emacs-devel@gnu.org; Wed, 14 Mar 2012 07:44:52 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7mcu-00064U-GT for emacs-devel@gnu.org; Wed, 14 Mar 2012 07:44:20 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S7mcp-0005ym-4u for emacs-devel@gnu.org; Wed, 14 Mar 2012 12:44:15 +0100 Original-Received: from e138158.upc-e.chello.nl ([213.93.138.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 Mar 2012 12:44:15 +0100 Original-Received: from spinuvit by e138158.upc-e.chello.nl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 Mar 2012 12:44:15 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 199 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: e138158.upc-e.chello.nl User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.0.94 (gnu/linux) Cancel-Lock: sha1:0fffF4DsGTLSgtAWvgCiVY5xJhI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:149037 Archived-At: Hi,=20 In case of no completion comint-filename-completion doesn't transfer the completion to next completion-at-point-function.=20 Example: (defun test-completion () (message "here") nil) (setq completion-at-point-functions '(comint-filename-completion test-compl= etion)) 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-cas= e) (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)))))))))) =20 (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 (messa= ge "here") nil) 3) test-completion("/bin/" (closure ((table . #[771 "\306.\307\301G\301\310\= 211.&=07\311=3D\205$.=02\301G\310O\302\304\203 .\304.!\202!.=01P\262.\211\2= 05/.\312.\300.=06.$\211\205\342.=02\242\313=3D\203l.\211\242\313=3D\203K.\2= 11.=1A\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=3D\205e.=03\211.= =1AAA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&=07\311=3D\= 205\342.\211\302G\310O\301\303\203\221.\303.!\202\222.=01P\262.\202\342.=02= \311=3D\203\341.\314.\300.=06\315$\211@\302GY\203\274.\303\203\270.\316\303= .\"\202\334.=01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\325\3= 26\303. \"\327\"\330\331%.=06\"\"\262.\262.\202\342.\211\207" [comint-compl= etion-file-name-table "" "" comint-quote-filename comint-unquote-filename c= ompletion-ignore-case compare-strings 0 nil t complete-with-action boundari= es completion-boundaries "" mapcar "\\`" regexp-quote delq make-byte-code 2= 57 "\302\301.\"\205.=00\211\303\225\304O\300\203.=00\300.!\202.=00\211\262.= \207" vconcat vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STR= ING PRED ACTION)"]) (unquoted . #("/bin" 0 4 (fontified t))) (filename-end = . 1984) (filename-beg . 1980) (filename . #("/bin" 0 4 (fontified t))) (fil= esuffix . " ") comint-dynamic-list-input-ring-window-conf t) (string pred a= ction) (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 ".=01\304.=06.=06\305\211\306%.=18\305\262.=02.\305\262.\307.\310\= 311#\210\307.\312\313#\210\n\2032.\314\315!\210p.=07.=07.=07F.\316\317\320\= 321\322\323.=06!\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 mini= buffer-complete] 14 "\n\n(fn START END COLLECTION PREDICATE)"](1980 1984 (c= losure ((table . #[771 "\306.\307\301G\301\310\211.&=07\311=3D\205$.=02\301= G\310O\302\304\203 .\304.!\202!.=01P\262.\211\205/.\312.\300.=06.$\211\205\= 342.=02\242\313=3D\203l.\211\242\313=3D\203K.\211.=1A\211A@)\206L.\307\313\= 301G.\301G\302GZ\\].\242\313=3D\205e.=03\211.=1AAA)BB\262.\202\342.\211;\20= 3\230.\306.\307\302G\302\310\211.&=07\311=3D\205\342.\211\302G\310O\301\303= \203\221.\303.!\202\222.=01P\262.\202\342.=02\311=3D\203\341.\314.\300.=06\= 315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334.=01\202\334.\317\3= 20\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\327\"\330\331%.=06\= "\"\262.\262.\202\342.\211\207" [comint-completion-file-name-table "" "" co= mint-quote-filename comint-unquote-filename completion-ignore-case compare-= strings 0 nil t complete-with-action boundaries completion-boundaries "" ma= pcar "\\`" regexp-quote delq make-byte-code 257 "\302\301.\"\205.=00\211\30= 3\225\304O\300\203.=00\300.!\202.=00\211\262.\207" vconcat vector [string-m= atch 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-ignor= e-case read-file-name-completion-ignore-case) (completion-ignored-extension= s comint-completion-fignore)) (complete-with-action action table string pre= d))) nil) apply(#[1028 ".=01\304.=06.=06\305\211\306%.=18\305\262.=02.\305\262.\307= .\310\311#\210\307.\312\313#\210\n\2032.\314\315!\210p.=07.=07.=07F.\316\31= 7\320\321\322\323.=06!\324\"\325\326%DC\216\327\330!+\207" [minibuffer-comp= letion-predicate minibuffer-completion-table completion-in-region-mode-pred= icate completion-in-region--data make-overlay nil t overlay-put field compl= etion priority 100 completion-in-region-mode 1 funcall make-byte-code 0 "\3= 01\300!\207" vconcat vector [delete-overlay] 2 "\n\n(fn)" call-interactivel= y minibuffer-complete] 14 "\n\n(fn START END COLLECTION PREDICATE)"] (1980 = 1984 (closure ((table . #[771 "\306.\307\301G\301\310\211.&=07\311=3D\205$.= =02\301G\310O\302\304\203 .\304.!\202!.=01P\262.\211\205/.\312.\300.=06.$\2= 11\205\342.=02\242\313=3D\203l.\211\242\313=3D\203K.\211.=1A\211A@)\206L.\3= 07\313\301G.\301G\302GZ\\].\242\313=3D\205e.=03\211.=1AAA)BB\262.\202\342.\= 211;\203\230.\306.\307\302G\302\310\211.&=07\311=3D\205\342.\211\302G\310O\= 301\303\203\221.\303.!\202\222.=01P\262.\202\342.=02\311=3D\203\341.\314.\3= 00.=06\315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334.=01\202\334= .\317\320\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\327\"\330\33= 1%.=06\"\"\262.\262.\202\342.\211\207" [comint-completion-file-name-table "= " "" comint-quote-filename comint-unquote-filename completion-ignore-case c= ompare-strings 0 nil t complete-with-action boundaries completion-boundarie= s "" mapcar "\\`" regexp-quote delq make-byte-code 257 "\302\301.\"\205.=00= \211\303\225\304O\300\203.=00\300.!\202.=00\211\262.\207" vconcat vector [s= tring-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STRING PRED ACTION)"]) (un= quoted . #("/bin" 0 4 (fontified t))) (filename-end . 1984) (filename-beg .= 1980) (filename . #("/bin" 0 4 (fontified t))) (filesuffix . " ") comint-d= ynamic-list-input-ring-window-conf t) (string pred action) (let ((completio= n-ignore-case read-file-name-completion-ignore-case) (completion-ignored-ex= tensions comint-completion-fignore)) (complete-with-action action table str= ing pred))) nil)) #[771 ".:\2030.=02@\301=3D\203.=00\300@\302.=05A\"\303.#\207\304.@\305\30= 6\307\310\311\312\300!\313\"\314\315%.=06A.=06#.#\207\304\316.\"\207" [(#0)= t append nil apply apply-partially make-byte-code 642 "\300@.=03.#\207" vc= oncat vector [] 7 "\n\n(fn FUNS GLOBAL &rest ARGS)" #[1028 ".=01\304.=06.= =06\305\211\306%.=18\305\262.=02.\305\262.\307.\310\311#\210\307.\312\313#\= 210\n\2032.\314\315!\210p.=07.=07.=07F.\316\317\320\321\322\323.=06!\324\"\= 325\326%DC\216\327\330!+\207" [minibuffer-completion-predicate minibuffer-c= ompletion-table completion-in-region-mode-predicate completion-in-region--d= ata 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)"](ni= l nil (1980 1984 (closure ((table . #[771 "\306.\307\301G\301\310\211.&=07\= 311=3D\205$.=02\301G\310O\302\304\203 .\304.!\202!.=01P\262.\211\205/.\312.= \300.=06.$\211\205\342.=02\242\313=3D\203l.\211\242\313=3D\203K.\211.=1A\21= 1A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=3D\205e.=03\211.=1AAA)BB\26= 2.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&=07\311=3D\205\342.\21= 1\302G\310O\301\303\203\221.\303.!\202\222.=01P\262.\202\342.=02\311=3D\203= \341.\314.\300.=06\315$\211@\302GY\203\274.\303\203\270.\316\303.\"\202\334= .=01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\325\326\303. \"\= 327\"\330\331%.=06\"\"\262.\262.\202\342.\211\207" [comint-completion-file-= name-table "" "" comint-quote-filename comint-unquote-filename completion-i= gnore-case compare-strings 0 nil t complete-with-action boundaries completi= on-boundaries "" mapcar "\\`" regexp-quote delq make-byte-code 257 "\302\30= 1.\"\205.=00\211\303\225\304O\300\203.=00\300.!\202.=00\211\262.\207" vconc= at vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(fn STRING PRED AC= TION)"]) (unquoted . #("/bin" 0 4 (fontified t))) (filename-end . 1984) (fi= lename-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) (completio= n-ignored-extensions comint-completion-fignore)) (complete-with-action acti= on table string pred))) nil)) completion-in-region(1980 1984 (closure ((table . #[771 "\306.\307\301G\3= 01\310\211.&=07\311=3D\205$.=02\301G\310O\302\304\203 .\304.!\202!.=01P\262= .\211\205/.\312.\300.=06.$\211\205\342.=02\242\313=3D\203l.\211\242\313=3D\= 203K.\211.=1A\211A@)\206L.\307\313\301G.\301G\302GZ\\].\242\313=3D\205e.=03= \211.=1AAA)BB\262.\202\342.\211;\203\230.\306.\307\302G\302\310\211.&=07\31= 1=3D\205\342.\211\302G\310O\301\303\203\221.\303.!\202\222.=01P\262.\202\34= 2.=02\311=3D\203\341.\314.\300.=06\315$\211@\302GY\203\274.\303\203\270.\31= 6\303.\"\202\334.=01\202\334.\317\320\302.@\310O!P\321\310\316\322\323\324\= 325\326\303. \"\327\"\330\331%.=06\"\"\262.\262.\202\342.\211\207" [comint-= completion-file-name-table "" "" comint-quote-filename comint-unquote-filen= ame completion-ignore-case compare-strings 0 nil t complete-with-action bou= ndaries completion-boundaries "" mapcar "\\`" regexp-quote delq make-byte-c= ode 257 "\302\301.\"\205.=00\211\303\225\304O\300\203.=00\300.!\202.=00\211= \262.\207" vconcat vector [string-match 0 nil] 4 "\n\n(fn C)" x] 18 "\n\n(f= n 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 p= red 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.