From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: change pcomplete/make to include targets in included files Date: Sun, 15 Sep 2019 12:50:56 -0700 Message-ID: <86y2ypnxsv.fsf@stephe-leake.org> References: <86muf7p5w7.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="34834"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 15 21:51:11 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i9aY9-0008uF-Lr for ged-emacs-devel@m.gmane.org; Sun, 15 Sep 2019 21:51:10 +0200 Original-Received: from localhost ([::1]:56774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9aY8-0007R4-DA for ged-emacs-devel@m.gmane.org; Sun, 15 Sep 2019 15:51:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42054) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9aY1-0007OW-UL for emacs-devel@gnu.org; Sun, 15 Sep 2019 15:51:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9aXz-0002pC-Uz for emacs-devel@gnu.org; Sun, 15 Sep 2019 15:51:00 -0400 Original-Received: from gateway36.websitewelcome.com ([192.185.201.2]:48891) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9aXz-0002om-Kc for emacs-devel@gnu.org; Sun, 15 Sep 2019 15:50:59 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 5FF48400C8401 for ; Sun, 15 Sep 2019 14:17:55 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id 9aXxiBaAN2qH79aXxi4pkL; Sun, 15 Sep 2019 14:50:58 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qyK38Q7bclC2IMh5x1BRYWjaFGcOm7+UsZJh+bBFnRg=; b=BGngGO5Ppf9Y0ztmkumZpMSGM c1mf7+Ko197YrAl6DU3sHsCKZIZ2FrCU6/J1CxrwDM0C8XryDTh1f0+ue5iSmN9npvL6sffKSOe2U QzXDJ9fh+obw4AO372KD9cHZL9QKk6sPbsTdjXsg5r+4qDuoRhoFgunKWCQhvDNyOv5tZxx+ZWCRX v2mrVR6AqUkv26Pqxj1cn2LK/pSMkaIWgOQ///BCLy17z4No9JVhcHMIda7AhzAjYLTtwaje7GUzW IhLR9PjPXckaNwatmbSH+E76q344/9Se3cVQ0ahFf7S3Ofs1xgu4D2qI6R02NHEGQSbx/YAyyu3u7 vg8qwhGAw==; Original-Received: from [76.77.182.20] (port=50776 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1i9aXx-0016dR-HO for emacs-devel@gnu.org; Sun, 15 Sep 2019 13:50:57 -0600 In-Reply-To: (Stefan Monnier's message of "Sat, 14 Sep 2019 21:43:41 -0400") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1i9aXx-0016dR-HO X-Source-Sender: (Takver4) [76.77.182.20]:50776 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 1 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.201.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.org gmane.emacs.devel:240053 Archived-At: Stefan Monnier writes: > Stephen Leake [2019-09-14 02:46:16] wrote: >> To make this actually work in the prompt for 'compile', I had to modify >> `shell-dynamic-complete-functions' to contain just >> `pcomplete-completions-at-point'; I have not figured out why yet. > > I don't see this change in the patch (which I think is good), so > I assume you're waiting to figure it out before acting on it, right? Right; see other post about "fix for bug#34330" > I think dropping text-properties is OK, but you can do it with > (match-string-no-properties 1). > Other than dropping properties, you can also optimize the code using > `nconc` instead of `append`. Done. >> +(defun pcmpl-gnu-make-all-targets (makefile) >> + "Return a list of target names in MAKEFILE and all included files." >> + (with-temp-buffer >> + (ignore-errors ;Could be a directory or something. >> + (insert-file-contents makefile)) > > I think we could use `with-demoted-errors` here, since the error case > should only occur in cases where there's really something odd which the > user may want to be know about. Done. > > >> + (let ((filenames (when pcmpl-gnu-makefile-includes (pcmpl-gnu-make-includes))) >> + (targets (pcmpl-gnu-make-targets))) >> + (dolist (file filenames) >> + (when (file-readable-p file) >> + (setq targets (append (pcmpl-gnu-make-all-targets file) targets)))) >> + targets))) > > You can completely eliminate this `append` by passing the `targets` > argument as an additional arg to pcmpl-gnu-make-all-targets (itself > passed to pcmpl-gnu-make-targets). That doesn't seem to work. The list ('rules' in pcmp-gnu-with-file-buffer) is initially nil, which means it is not passed by reference, so it is never updated. Unless there is some way to force pass by reference? (I think that requires a macro?) -- -- Stephe