[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: change pcomplete/make to include targets in included files
From: |
Stephen Leake |
Subject: |
Re: change pcomplete/make to include targets in included files |
Date: |
Mon, 16 Sep 2019 16:33:29 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) |
Stefan Monnier <address@hidden> writes:
>> 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?)
>
> I definitely don't want to pass anything by reference (I like things to
> be immutable). I meant you should be doing
>
> (setq targets (pcmpl-gnu-make-all-targets ... targets))
>
> instead of
>
> (setq targets (append (pcmpl-gnu-make-all-targets ...)
> targets))
>
> it's a standard coding style in functional programming (except
> using recursion rather than while+setq, of course).
Ah; you can do 'push' on the 'targets' arg (whether nil or otherwise),
then return it. That makes sense.
--
-- Stephe