From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: bvraghav@iitk.ac.in (B.V. Raghav) Newsgroups: gmane.emacs.help Subject: Re: C Headers completion candidates Date: Mon, 18 Jul 2016 08:37:22 +0530 Organization: Indian Institute of Technology, Kanpur Message-ID: <871t2rzlsl.fsf@ram.bvr.dp.lan> References: <87k2gozusa.fsf@ram.bvr.dp.lan> <87twfohd2e.fsf@ram.bvr.dp.lan> <9d12723a-07a8-47e4-9f8a-451da7bccb63@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1468811296 2107 80.91.229.3 (18 Jul 2016 03:08:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Jul 2016 03:08:16 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 18 05:08:09 2016 Return-path: Envelope-to: geh-help-gnu-emacs@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 1bOyue-0004Yb-SR for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Jul 2016 05:08:09 +0200 Original-Received: from localhost ([::1]:44042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOyud-0006C4-QP for geh-help-gnu-emacs@m.gmane.org; Sun, 17 Jul 2016 23:08:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOyuD-0006Bl-9R for help-gnu-emacs@gnu.org; Sun, 17 Jul 2016 23:07:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOyu8-0007hA-7G for help-gnu-emacs@gnu.org; Sun, 17 Jul 2016 23:07:40 -0400 Original-Received: from mail2.iitk.ac.in ([202.3.77.186]:50377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOyu7-0007g0-Fo for help-gnu-emacs@gnu.org; Sun, 17 Jul 2016 23:07:36 -0400 Original-Received: from smtp.cc.iitk.ac.in (smtp.cc.iitk.ac.in [172.31.1.22]) by mail2.iitk.ac.in (Postfix) with ESMTP id E71DC100018F; Mon, 18 Jul 2016 08:37:22 +0530 (IST) Original-Received: from ram.bvr.dp.lan.iitk.ac.in (unknown [172.20.240.119]) (Authenticated sender: bvraghav) by smtp.cc.iitk.ac.in (Postfix) with ESMTPA id DD4A048; Mon, 18 Jul 2016 08:37:22 +0530 (IST) In-Reply-To: <9d12723a-07a8-47e4-9f8a-451da7bccb63@default> (Drew Adams's message of "Sun, 17 Jul 2016 08:02:30 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 202.3.77.186 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110879 Archived-At: Drew Adams writes: > .. Lots of fantastic stuff, and explanation of the code... > Your acknowledgement is very encouraging. Thank you. >> Way forward, I want to implement this: >> 1. Implement a list of completions, at the user level; quite like >> persistent completions; >>=20 >> a. Any completion, after being pruned for prefix (before being >> returned), goes as into the list of completions, without >> duplicacy. >>=20 >> b. This list is read, and appened to the lib-name-list; before the >> first completion is invoked. > > (There was no #2, right? Not that one was needed - this is > already quite a lot. ;-)) Yes, in fact there were #2 and #3 2. Projectile use a completion set for projectile-find-file (probably using completing-read). a. Leverage it on the include list for first level of completions, with a user custom regexp variable for filter, e.g. "\\.h[pp]\?$" b. May be it is just worth accumulating the results of a shell `find' on the projectile-root with flags `-type f -iname ...' and so forth. 3. Make use of the point, e.g. #include If I invoke the command `insert-c-header' here, then the software should: a. mark a region like ...<[vec]|>... (`[]' representing the region, and `|' -- the point) b. send this as completion string to match against. e.g. using argument initial for the `completing-read' function. But Info document for Elisp > Minibuffers > Initial Input, says: " This is a mostly-deprecated feature for specifying that the minibuffer should start out with certain text, instead of empty as usual. =20=20=20=20=20=20 AND " *We discourage use of a non-=A1=AEnil=A1=AF value for INITIAL* Is there another way? What more should I read? > > By "persistent completions" I guess you mean a persistent list > of completions such as those you gather, as in=20 > https://www.emacswiki.org/emacs/Icicles_-_Persistent_Completions. Yes very much so. I will open another thread, to understand why Icicles-PersistentCompletions does not like me! > Or maybe you would even add a defcustom that has, as its default > value, a list of such completions. > Does it mean that the variable will be initialized once using 'customize variable' interface, and then subsequent automatic edits will be lost between different emacs sessions. > It all sounds good to me. And I expect it could be useful to > others too. And this is so whether or not people use Icicles. > That's the beauty of using just `completing-read': it works > whether or not one uses Icicles. > > And the code creating the persistent completions could also be > used by other completion libraries besides Icicles - they too > could no doubt make use of such a persistent list, even if they > do their thing otherwise than by `completing-read'. > I did not realize that the code creating persistent list may be orthogonal to `c-header', also --- until I read this. Thank you. > Please consider, if you haven't already, posting your code as > a library somewhere (e.g. Emacs Wiki, MELPA). Others will not > only use it but also offer suggestions etc. > I am just a novice with lisp... Flattered with the suggestion. I will definitely try to package this, put it up on melpa, and discuss it on Emacs Wiki. > [There might be better (in some sense) ways to code some of > what you have. For example, it might be that using dolist `C-h i m elisp RET i dolist RET' Thanks, I did not know about this. `C-x r m' > instead of the more functional-style nested mapcars, etc. > would be faster. And maybe just use `string-match-p' with a > regexp such as "[.~_]$", instead of bothering with testing Yeah... Thank you this looks both simpler to read and easy to type. > multiple suffixes separately using `string-suffix-p'. But > such considerations, even assuming they make sense, are not > important.] Thanks...=20 --=20 (B.V. Raghav) Ph.D. Student, Design Programme, IIT Kanpur