+ (and (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)))
+ (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))))
+
+ (ly:format "<a style=\"color:inherit;\" xlink:href=\"textedit://~a:~a:~a:~a\">\n"
+ ;; Backslashes are not valid
+ ;; file URI path separators.
+ (ly:string-percent-encode
+ (ly:string-substitute "\\" "/" file))
+
+ (cadr location)
+ (caddr location)
+ (1+ (cadddr location))))))))