Re: Running a system command from within Lilypond [Solved]

2023-12-16 Thread Hans Aikema



> On 15 Dec 2023, at 17:24, Raphael Mankin  wrote:
> 
> 
> 
> On 15/12/2023 16:23, Jean Abou Samra wrote:
>>> I am on version Frescobaldi 3.2 and Lilypond 2.22.1 and do not appear
>>> to have that option. At least, I have not found it. Anyway, I have
>>> "automatic engraving" on.
>> It's in Edit > Preferences > LilyPond Preferences > Running LilyPond > Save 
>> document if possible, but I don't think it's going to auto-save when the 
>> engraving job is triggered by automatic engraving, unfortunately.
> 
> Ah, that one. Thank you. Now set.

Beware that the version you interpolate can only be trusted upon if you use git 
also to determine the ‘added/modified files’ state and take the 
‘with-local-modifications’ state into account in your interpolation (either by 
not putting the git version in, or by indicating that it is a locally modified 
state derived from a certain git version)





Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Raphael Mankin




On 15/12/2023 16:23, Jean Abou Samra wrote:

I am on version Frescobaldi 3.2 and Lilypond 2.22.1 and do not appear
to have that option. At least, I have not found it. Anyway, I have
"automatic engraving" on.


It's in Edit > Preferences > LilyPond Preferences > Running LilyPond > 
Save document if possible, but I don't think it's going to auto-save 
when the engraving job is triggered by automatic engraving, unfortunately.


Ah, that one. Thank you. Now set.

--
In software design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away. - After RFC1925



Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Jean Abou Samra
> I am on version Frescobaldi 3.2 and Lilypond 2.22.1 and do not appear 
> to have that option. At least, I have not found it. Anyway, I have 
> "automatic engraving" on.

It's in Edit > Preferences > LilyPond Preferences > Running LilyPond > Save
document if possible, but I don't think it's going to auto-save when the
engraving job is triggered by automatic engraving, unfortunately.


signature.asc
Description: This is a digitally signed message part


Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Raphael Mankin




On 15/12/2023 16:06, Jean Abou Samra wrote:
[Later] The error I am getting now is:  Processing 
`/tmp/frescobaldi-duowk0s5/tmpz726e77a/testGit.ly'   Parsing...fatal: 
not a git repository (or any of the parent directories): .git


If the path is in |/tmp/|, it means that you did not save your file 
before compiling, so Frescobaldi put the contents of the current editing 
window in a temporay file and compiled that.


If you simply remember to always save before compiling (or turn on 
save-on-compile in the preferences), Frescobaldi will compile your file 
with the directory where it's saved as the current directory. If that's 
inside a Git repository, |git| commands should work.




I am on version Frescobaldi 3.2 and Lilypond 2.22.1 and do not appear 
to have that option. At least, I have not found it. Anyway, I have 
"automatic engraving" on.


--
In software design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away. - After RFC1925



Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Jean Abou Samra
> [Later] The error I am getting now is:
>  Processing `/tmp/frescobaldi-duowk0s5/tmpz726e77a/testGit.ly'
>   Parsing...fatal: not a git repository (or any of the parent 
> directories): .git


If the path is in `/tmp/`, it means that you did not save your file before 
compiling, so Frescobaldi put the contents of the current editing window in a 
temporay file and compiled that.

If you simply remember to always save before compiling (or turn on 
save-on-compile in the preferences), Frescobaldi will compile your file with 
the directory where it's saved as the current directory. If that's inside a Git 
repository, `git` commands should work.




signature.asc
Description: This is a digitally signed message part


Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Raphael Mankin
Thank you for the very  prompt response. I had tried popen, but with no 
luck. I will give it another go.I do not now remember what it originally 
said, if anything.


[Later] The error I am getting now is:
Processing `/tmp/frescobaldi-duowk0s5/tmpz726e77a/testGit.ly'
 Parsing...fatal: not a git repository (or any of the parent 
directories): .git


So, after a bit of faffing around for how to change the TMPDIR in the 
GUI, I changed my whisker-menu (Ubuntu/xfce4) entry to	

bash -c "TMPDIR=$HOME/src/Music/tmp frescobaldi %F"

Doing just
TMPDIR=$HOME/src/Music/tmp frescobaldi %F
did not work.

On 15/12/2023 13:25, Jean Abou Samra wrote:
I keep my Lilypond files in a git repository. I would like to 
interpolate the repo's version number in the Lilypond output by 
running a command like "git log|head -1". I can  do this from raw 
Scheme  using the system() function, but this does not seem to work in 
Lilypond.


How does it fail? It should definitely work. It will just not capture 
the output. See LSR 567  for a 
snippet that uses |open-pipe*| from |(ice-9 popen)| to achive 
essentially the same need as yours.


I realise that being able to do so opens up a massive security hole, 
but that is not a problem here.


LilyPond does not attempt to securely compile the file if it untrusted. 
(There used to exist a |-dsafe| option, but it was found to be 
irreparably broken, and got removed.)




--
In software design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away. - After RFC1925