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: Re: comint-filename-completion and :exclusive completion bugs Date: Wed, 14 Mar 2012 15:54:02 +0100 Organization: EUR Message-ID: <87obrzb5dh.fsf@gmail.com> References: <87ehsvh0fv.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1331736878 21623 80.91.229.3 (14 Mar 2012 14:54:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 14 Mar 2012 14:54:38 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 14 15:54:37 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 1S7pb3-0003QR-Bq for ged-emacs-devel@m.gmane.org; Wed, 14 Mar 2012 15:54:37 +0100 Original-Received: from localhost ([::1]:49718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7pb2-0002j6-Qi for ged-emacs-devel@m.gmane.org; Wed, 14 Mar 2012 10:54:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7par-0002hN-5M for emacs-devel@gnu.org; Wed, 14 Mar 2012 10:54:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7pak-00046D-D5 for emacs-devel@gnu.org; Wed, 14 Mar 2012 10:54:24 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7pak-00045c-6J for emacs-devel@gnu.org; Wed, 14 Mar 2012 10:54:18 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S7pah-0003AE-4I for emacs-devel@gnu.org; Wed, 14 Mar 2012 15:54: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 15:54: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 15:54:15 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 63 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/23.3 (gnu/linux) Cancel-Lock: sha1:n9ZMmotZ9RgrD3xUSmrrEvvaDPQ= 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:149048 Archived-At: >>>> Stefan Monnier >>>> on Wed, 14 Mar 2012 09:53:57 -0400 wrote: > The ":exclusive 'no" solves this dilemma by only allowing prefix > completion. I think that for filename completion, non-prefix completion > is important, so while I can agree that comint-filename-completion often > isn't really sure whether it should take responsibility (because it > doesn't actually know that there should be a filename at point), > preventing things like partial-completion on filenames would be sad. I don't really understand how :exlusive 'no prevent partial completion (in case you mean the obsolete package complete.el). So if there is no partial expansion of foo_bar|, doesn't :exlusive pass the handling over? You probably mean some advanced, usage pattern. comint-filename-completion is active in all comint buffers, and it prevents the completion UI to reach the global tags-completion-at-point-function. And this is a bit of a limitation. In other modes than comint, file completion of 'sdfdsf, or anything else not prefixed by "/", or even not quoted, is not a filename, and should be passed over. > Maybe we could provide a comint-maybe-filename-completion which would > set the ":exclusive 'no", for situations like yours where you prefer > falling back on some other completion data if the text isn't a prefix of > a valid filename. That would be great, for the simple reason that hacking comint-filename-completion, in order to be used in other modes, is a bit difficult. A real example: (defun ess-filename-completion () "Return completion only within string or comment." (when (ess-inside-string-or-comment-p (point)) (comint-filename-completion) )) Comint-filename-completion returns a list of length 2 or 3 depending on filesuffix. So to tweak it, I have to check for the length, if 2, append, if 3 insert :exclusive into the last list. Ugly as far as I am concerned. > Or maybe you can change your own completion function so that rather than > placing it after comint-filename-completion, you can place it before. Yes, this is what is now in ESS, but a knowledgeable user of emacs 24 would expect his tags completion to be reached. >> 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: > `test-completion' is a predefined function taking 3 args, which you just > redefined as something completely different, leading to all kinds of > funny results. Dammit, sorry for this noise, should have been named it `sdfseref-completion`, this explains the wreckage. Thanks, Vitalie.