Thursday, April 17, 2025

Re: Can makeprg (or equivalent) be locally file-customised?

Many thanks, Salman, for your suggestions - they are thought provoking:

On 17.04.25 21:11, Salman Halim wrote:
> You could set up an autocommand that reads the first few lines of the file
> and sets any option you like from there. Maybe you'd need to put it on a
> one second timer or something.

Ah, I'd dismissed autocommands, as a multitude of them would be a
maintenance burden. But I get your point; I could try to synthesise a
makeprg substitute which instead reads a custom othermodeline. Then one
autocommand suffices. It could even map more than one key, perhaps.

It's tedious that a modeline can't do an nmap either, as that would be
even more directly effective.

It might be necessary to find a vimscript primer, as executing a :nmap
from a tagged line read from the file is beyond my current ken. My take
is that there would be no delay risk - the tag is found or not, the :nmap
is executed or not - instantly?

> The security problem comes because you might have makeprg set to something
> for your project and then you open a new file that sets it to, say, 'rm -rf
> /' or some such. You try to build your project innocently and end up
> deleting your system.
> Salman

Hmmm, that type of problem is created only if the program is *not* read
from the file, i.e. the file doesn't customise to suit. Thus it is more
the current modeline exclusion which could create that problem, I
figure.

I'll look for processing commonality, as I extend the workflow. Then it may
well be OK to typify the source files by extension, and allow one common
cross-task makefile to differentiate processing. That is (for me) a high
level of organisation in an exploratory phase, where I'm still
assembling / building the toolset and forging the workflow. But using filename
extension might be best in the long run. Then we're back to make - nice and simple.

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/c7c80fc3-b821-483f-9c72-76babe1617bb%40localhost.

No comments: