Re: Question about paths in point-and-click
Le 01/11/2022 à 05:54, David Wright a écrit : On Tue 01 Nov 2022 at 02:23:23 (+0100), Paolo Prete wrote: Neverthless, IMHO this feature should be exposed in the API, because the lack of control of personal data should not be a trade-off for using an appealing feature such as the point-and-click one I'd agree with that. Yes, looks like a valid request. I've opened an issue about it: https://gitlab.com/lilypond/lilypond/-/issues/6451 Best, Jean
Re: Question about paths in point-and-click
On Tue 01 Nov 2022 at 02:23:23 (+0100), Paolo Prete wrote: > I need to change them. > More specifically, each: > > xlink:href="textedit:///some/personal/path/file.ly:x:y:z" > > should be changed into > > xlink:href="textedit:///dummy/path/file.ly:x:y:z" > > For all the grobs with such metadata (SVG) > > Anyway, with 4 lines of python postprocess code I did the operation, so, > never mind: all solved. > > Neverthless, IMHO this feature should be exposed in the API, because the > lack of control of personal data should not be a trade-off for using an > appealing feature such as the point-and-click one I'd agree with that. I run by default with p&c turned off, to avoid accidents when distributing scores. But with p&c on, I just compiled a score from ~/scores/fragments/random-score.ly, copied the source and PDF output into /tmp, and then ran: $ sed -i -e 's+textedit:///home/auser/scores/fragments+textedit://.+' /tmp/random-score.pdf after which, clicking in random-score.pdf points to the correct position in random-score.ly as long as both source and PDF are in the same, arbitrary current working directory. Only the last component of the path is exposed, ie textedit://.random-score.ly:99:7:8 (I hadn't tried using a relative path before.) Cheers, David.
Re: Question about paths in point-and-click
I need to change them. More specifically, each: xlink:href="textedit:///some/personal/path/file.ly:x:y:z" should be changed into xlink:href="textedit:///dummy/path/file.ly:x:y:z" For all the grobs with such metadata (SVG) Anyway, with 4 lines of python postprocess code I did the operation, so, never mind: all solved. Neverthless, IMHO this feature should be exposed in the API, because the lack of control of personal data should not be a trade-off for using an appealing feature such as the point-and-click one Best, Paolo On Monday, October 31, 2022, Jean Abou Samra wrote: > > > Wait — by "clean up", do you mean changing them or removing them? > If the latter, *that* can be done cleanly; which grobs should > be affected? > > Best, > Jean > >
Re: Question about paths in point-and-click
Le 31/10/2022 à 18:35, Paolo Prete a écrit : BTW, for unknown reasons your mails always go to the spam folder. I don't experience the same issue with other members of the ml, and I don't understand if the issue is on my account or on yours... Unfortunately, some people using GMail get my emails in their spams because GMail's spam filter seems to be particularly wary of emails from personal domains (for me, abou-samra.fr) as opposed to commonly used domains for email addresses like gmail.com, gmx.com, etc. That is actually the case for a number of people on this list, but maybe abou-samra.fr has some configuration that makes my emails more suspicious, I don't really know and I'm not the admin of the domain. Maybe I should look into DKIM or such to reduce the probability that a spam filter classifies my emails as spam. Best, Jean
Re: Question about paths in point-and-click
Le 31/10/2022 à 18:20, Paolo Prete a écrit : Thank you as always! In Spontini-Editor there are examples with generated SVG files that rely on point-and-click in order to be edited. Although included paths are dummy paths, I would like to clean them without post-processing the files. But I think I don't have alternatives, given that the functions you use are not part of the API (and I need to make this operation any supported LilyPond version). I preview I have to do some Python postprocess script with regex Wait — by "clean up", do you mean changing them or removing them? If the latter, *that* can be done cleanly; which grobs should be affected? Best, Jean
Re: Question about paths in point-and-click
BTW, for unknown reasons your mails always go to the spam folder. I don't experience the same issue with other members of the ml, and I don't understand if the issue is on my account or on yours... On Monday, October 31, 2022, Paolo Prete wrote: > > Thank you as always! > > In Spontini-Editor there are examples with generated SVG files that rely > on point-and-click in order to be edited. Although included paths are dummy > paths, I would like to clean them without post-processing the files. But I > think I don't have alternatives, given that the functions you use are not > part of the API (and I need to make this operation any supported LilyPond > version). I preview I have to do some Python postprocess script with regex > > > Cheers, > Paolo > > > On Monday, October 31, 2022, Jean Abou Samra wrote: > >> Le 31/10/2022 à 17:56, Jean Abou Samra a écrit : >> >>> In general, no. >>> >> >> >> Well, I spoke too fast. You can do >> >> \version "2.23.80" >> >> #(set! >> (@@ (lily output-ps) stencil-dispatch-alist) >> (assq-set! >>(@@ (lily output-ps) stencil-dispatch-alist) >>'grob-cause >>(lambda (offset grob) >> (if (ly:get-option 'point-and-click) >> (let* ((cause (ly:grob-property grob 'cause)) >> (music-origin (if (ly:stream-event? cause) >> (ly:event-property cause 'origin))) >> (point-and-click (ly:get-option 'point-and-click))) >>(if (and >> (ly:input-location? music-origin) >> (cond ((boolean? point-and-click) point-and-click) >> ((symbol? point-and-click) >>(ly:in-event-class? cause point-and-click)) >> (else (any (lambda (t) >>(ly:in-event-class? cause t)) >> point-and-click >>(let* ((location (ly:input-file-line-char-column >> music-origin)) >> (raw-file (car location)) >> (file (if (is-absolute? raw-file) >> raw-file >> (string-append (ly-getcwd) "/" >> raw-file))) >> (x-ext (ly:grob-extent grob grob X)) >> (y-ext (ly:grob-extent grob grob Y))) >> >> (if (and (< 0 (interval-length x-ext)) >> (< 0 (interval-length y-ext))) >> (ly:format " ~4f ~4f ~4f ~4f >> (textedit://~a:~a:~a:~a) mark_URI\n" >> (+ (car offset) (car x-ext)) >> (+ (cdr offset) (car y-ext)) >> (+ (car offset) (cdr x-ext)) >> (+ (cdr offset) (cdr y-ext)) >> >> ;; Backslashes are not valid >> ;; file URI path separators. >> (ly:string-percent-encode >> (ly:string-substitute >> "\\" "/" file)) >> "foo.ly" >> >> (cadr location) >> (caddr location) >> (1+ (cadddr location))) >> "")) >>"")) >> "" >> >> { c' } >> >> >> >> >> Basically, tamper with the LilyPond function that outputs >> these textedit:// links. In this example, I'm replacing >> the file name with "foo.ly". >> >> However, this is using undocumented variables that are explicitly >> not public, so you're at your own risk -- it can and almost >> certainly will break with some future version of LilyPond, >> and a replacement will not be guaranteed to exist. Also, it >> would need different code to work in SVG output. >> >> If you can use a different method, that would be really preferable. >> >> Best, >> Jean >> >> >> >>
Re: Question about paths in point-and-click
Thank you as always! In Spontini-Editor there are examples with generated SVG files that rely on point-and-click in order to be edited. Although included paths are dummy paths, I would like to clean them without post-processing the files. But I think I don't have alternatives, given that the functions you use are not part of the API (and I need to make this operation any supported LilyPond version). I preview I have to do some Python postprocess script with regex Cheers, Paolo On Monday, October 31, 2022, Jean Abou Samra wrote: > Le 31/10/2022 à 17:56, Jean Abou Samra a écrit : > >> In general, no. >> > > > Well, I spoke too fast. You can do > > \version "2.23.80" > > #(set! > (@@ (lily output-ps) stencil-dispatch-alist) > (assq-set! >(@@ (lily output-ps) stencil-dispatch-alist) >'grob-cause >(lambda (offset grob) > (if (ly:get-option 'point-and-click) > (let* ((cause (ly:grob-property grob 'cause)) > (music-origin (if (ly:stream-event? cause) > (ly:event-property cause 'origin))) > (point-and-click (ly:get-option 'point-and-click))) >(if (and > (ly:input-location? music-origin) > (cond ((boolean? point-and-click) point-and-click) > ((symbol? point-and-click) >(ly:in-event-class? cause point-and-click)) > (else (any (lambda (t) >(ly:in-event-class? cause t)) > point-and-click >(let* ((location (ly:input-file-line-char-column > music-origin)) > (raw-file (car location)) > (file (if (is-absolute? raw-file) > raw-file > (string-append (ly-getcwd) "/" raw-file))) > (x-ext (ly:grob-extent grob grob X)) > (y-ext (ly:grob-extent grob grob Y))) > > (if (and (< 0 (interval-length x-ext)) > (< 0 (interval-length y-ext))) > (ly:format " ~4f ~4f ~4f ~4f (textedit://~a:~a:~a:~a) > mark_URI\n" > (+ (car offset) (car x-ext)) > (+ (cdr offset) (car y-ext)) > (+ (car offset) (cdr x-ext)) > (+ (cdr offset) (cdr y-ext)) > > ;; Backslashes are not valid > ;; file URI path separators. > (ly:string-percent-encode > (ly:string-substitute > "\\" "/" file)) > "foo.ly" > > (cadr location) > (caddr location) > (1+ (cadddr location))) > "")) >"")) > "" > > { c' } > > > > > Basically, tamper with the LilyPond function that outputs > these textedit:// links. In this example, I'm replacing > the file name with "foo.ly". > > However, this is using undocumented variables that are explicitly > not public, so you're at your own risk -- it can and almost > certainly will break with some future version of LilyPond, > and a replacement will not be guaranteed to exist. Also, it > would need different code to work in SVG output. > > If you can use a different method, that would be really preferable. > > Best, > Jean > > > >
Re: Question about paths in point-and-click
Le 31/10/2022 à 17:56, Jean Abou Samra a écrit : In general, no. Well, I spoke too fast. You can do \version "2.23.80" #(set! (@@ (lily output-ps) stencil-dispatch-alist) (assq-set! (@@ (lily output-ps) stencil-dispatch-alist) 'grob-cause (lambda (offset grob) (if (ly:get-option 'point-and-click) (let* ((cause (ly:grob-property grob 'cause)) (music-origin (if (ly:stream-event? cause) (ly:event-property cause 'origin))) (point-and-click (ly:get-option 'point-and-click))) (if (and (ly:input-location? music-origin) (cond ((boolean? point-and-click) point-and-click) ((symbol? point-and-click) (ly:in-event-class? cause point-and-click)) (else (any (lambda (t) (ly:in-event-class? cause t)) point-and-click (let* ((location (ly:input-file-line-char-column music-origin)) (raw-file (car location)) (file (if (is-absolute? raw-file) raw-file (string-append (ly-getcwd) "/" raw-file))) (x-ext (ly:grob-extent grob grob X)) (y-ext (ly:grob-extent grob grob Y))) (if (and (< 0 (interval-length x-ext)) (< 0 (interval-length y-ext))) (ly:format " ~4f ~4f ~4f ~4f (textedit://~a:~a:~a:~a) mark_URI\n" (+ (car offset) (car x-ext)) (+ (cdr offset) (car y-ext)) (+ (car offset) (cdr x-ext)) (+ (cdr offset) (cdr y-ext)) ;; Backslashes are not valid ;; file URI path separators. (ly:string-percent-encode (ly:string-substitute "\\" "/" file)) "foo.ly" (cadr location) (caddr location) (1+ (cadddr location))) "")) "")) "" { c' } Basically, tamper with the LilyPond function that outputs these textedit:// links. In this example, I'm replacing the file name with "foo.ly". However, this is using undocumented variables that are explicitly not public, so you're at your own risk -- it can and almost certainly will break with some future version of LilyPond, and a replacement will not be guaranteed to exist. Also, it would need different code to work in SVG output. If you can use a different method, that would be really preferable. Best, Jean
Re: Question about paths in point-and-click
Le 31/10/2022 à 17:44, Paolo Prete a écrit : Is it possible to set/customize the path information in the point-and-click metadata of LilyPond's output? In general, no. There is no such facility. I guess you could post-process the PDF to change the links, though. What are you trying to achieve? Best, Jean
Question about paths in point-and-click
Hello, Is it possible to set/customize the path information in the point-and-click metadata of LilyPond's output? Thanks!