[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: |
Sun, 15 Sep 2019 12:50:56 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) |
Stefan Monnier <address@hidden> 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