Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14145

Re: [PATCH] Add nofirstword completion option

Path csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: [PATCH] Add nofirstword completion option
Date Fri, 25 May 2018 14:40:38 -0400
Organization ITS, Case Western Reserve University
Lines 41
Approved bug-bash@gnu.org
Message-ID <mailman.491.1527273653.1292.bug-bash@gnu.org> (permalink)
References <20180518110611.5099-1-bluca@debian.org> <96bcb197-40d1-aac8-c214-c513a6db805d@case.edu> <1527068652.6997.5.camel@debian.org> <76b1d3fa-4cb1-3e70-d93c-ada07c04dfa2@case.edu> <1527082457.6997.14.camel@debian.org> <4ccfc554-15a9-2ec1-55e1-b2df687f0bee@case.edu> <1527270167.6997.22.camel@debian.org>
Reply-To chet.ramey@case.edu
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1527273653 13633 208.118.235.17 (25 May 2018 18:40:53 GMT)
X-Complaints-To action@cs.stanford.edu
Cc chet.ramey@case.edu
To Luca Boccassi <bluca@debian.org>, bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
In-Reply-To <1527270167.6997.22.camel@debian.org>
Content-Language en-US
X-Junkmail-Status score=7/90, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw score=7/90, refid=2.7.2:2018.5.25.173016:17:7.944, ip=, rules=__HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH, __URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1600_1699, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy]
X-Received-From 129.22.103.195
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14145

Show key headers only | View raw


On 5/25/18 1:42 PM, Luca Boccassi wrote:

>> There is already logic that determines whether the shell is trying to
>> complete a command word (in_command_position). The existing code does
>> not attempt programmable completion if in_command_position == 1. The
>> additional functionality would:
>>
>> 1. Add an option to the complete builtin to specify how to complete
>>    command names, and store it in a specially-named compspec, like
>>    completion for empty lines does.
>>
>> 2. Add code to invoke that completion, if it exists and programmable
>>    completion is active, before attempting bash's default completion,
>>    if in_command_position == 1.
>>
>> Chet
> 
> Hi,
> 
> Thanks for the guidance! Unfortunately I'm still not quite there yet -
> inlined are the changes based on my understanding of the above. It
> implements a "usercmd/-U" option similar to the existing -E for empty
> line.
> 
> But at the moment all it does is to allow (via "complete -U -F foo") to
> complete when nothing is typed in, which seemed to be possible already
> with -E. If some characters are already typed in, it will still do the
> default completion to commands in the PATH.
> 
> What have I missed?

You should make sure you don't add your code in the section with the rest
of the programmable completions, since that block is not entered if
in_command_position != 0.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] Add nofirstword completion option Chet Ramey <chet.ramey@case.edu> - 2018-05-25 14:40 -0400

csiph-web