Il giorno lun 9 lug 2018 alle 7:26, Mats Behre
<"mb.maillists"@gmail.com> ha scritto:
> On 2018-07-08 19:56, Federico Bruni wrote:
>>
>> I found this:
>> https://superuser.com/questions/548119/how-do-i-configure-custom-url-handlers-on-os-x
>> and downloaded SwiftDefaultApps. It works on High Sierra, don't know
>> about El Capitan, but if not it seems that RCDefaultApp should do
>> the trick for you.
>>
>> Can you be more specific?
>> What do you mean with "it works"?
>> Which command did you assign for textedit protocol?
>>
>> Yesterday I read a similar answer and installed RVDefaultApp. Now I
>> can set which application should open textedit:// URIs.
>> However I cannot set the text editor directly, as the text editor
>> cannot handle this protocol.
>>
>> I guess I should use lilypond-invoke-editor but, as I've already
>> reported, I could not make it work on either Mac or Windows.
>>
>> It looks like it's the last step to get what I want.
>>
>
> OK, then you are in more or less the same situation as me - you need
> a small helper app that takes the URI and invokes your editor.
> I have a small AppleScript app which does this (I think I got the
> base for it from the LilyPond site ages ago):
>
Ok, good to know there may be a solution.
I don't have a Mac to test it until Wednesday/Thursday, but I will make
a try this week.
> roperty urlPrefix : "textedit://"
>
> on replaceText(find, replace, subject)
> set prevTIDs to text item delimiters of AppleScript
> set text item delimiters of AppleScript to find
> set subject to text items of subject
>
> set text item delimiters of AppleScript to replace
> set subject to "" & subject
> set text item delimiters of AppleScript to prevTIDs
>
> return subject
> end replaceText
>
> on open location texteditURL
>
> -- strip prefix
> set the character_count to the number of characters of the urlPrefix
> set the emacsclientURL to (characters (the character_count + 1) thru
> -1 of the texteditURL) as string
>
> -- extract PATH LINE and COLUMN
> set AppleScript's text item delimiters to ":"
> set emacsclientPATH to first text item of emacsclientURL
> set emacsclientLINE to second text item of emacsclientURL
> set emacsclientCOLUMN to third text item of emacsclientURL
> set AppleScript's text item delimiters to ""
>
> set emacsclientPATH to replaceText("%20", "\\ ", emacsclientPATH)
>
> -- launch emacsclient
> do shell script "/Applications/Eddie/tellEddie " & quoted form of
> emacsclientPATH & ":" & emacsclientLINE & ":" & emacsclientCOLUMN
>
> end open location
>
As the syntax is not Emacs, I guess that Eddie is the editor you want
to use and all the emacsclient variables are just the variables you
took from the original example. (BTW, I don't think you found it on
lilypond website)
> My problem now is that SwiftDefaultApps silently fails to set this as
> the textedit target, possibly because my info.plist is too old (it
> has worked in the past):
>
This is the info.plist of which application? Eddie?
Have you tried other text editors?
You may try Atom (see atom.io website). Its syntax (not yet documented)
is the same as above example: `atom file:line:column`.
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> <key>CFBundleAllowMixedLocalizations</key>
> <true/>
> <key>CFBundleDevelopmentRegion</key>
> <string>English</string>
> <key>CFBundleExecutable</key>
> <string>applet</string>
> <key>CFBundleIconFile</key>
> <string>applet</string>
> <key>CFBundleIdentifier</key>
> <string>com.apple.ScriptEditor.id.1A1CE0AF-AC45-4636-9B72-8CBBFCDA88F5</string>
> <key>CFBundleInfoDictionaryVersion</key>
> <string>6.0</string>
> <key>CFBundleName</key>
> <string>lilypoint</string>
> <key>CFBundlePackageType</key>
> <string>APPL</string>
> <key>CFBundleSignature</key>
> <string>aplt</string>
> <key>CFBundleURLTypes</key>
> <array>
> <dict>
> <key>CFBundleTypeRole</key>
> <string>Editor</string>
> <key>CFBundleURLName</key>
> <string>text editor via url</string>
> <key>CFBundleURLSchemes</key>
> <array>
> <string>textedit</string>
> </array>
> </dict>
> </array>
> <key>LSMinimumSystemVersionByArchitecture</key>
> <dict>
> <key>x86_64</key>
> <string>10.6</string>
> </dict>
> <key>LSRequiresCarbon</key>
> <true/>
> <key>WindowState</key>
> <dict>
> <key>bundleDividerCollapsed</key>
> <true/>
> <key>bundlePositionOfDivider</key>
> <real>0.0</real>
> <key>dividerCollapsed</key>
> <false/>
> <key>eventLogLevel</key>
> <integer>2</integer>
> <key>name</key>
> <string>ScriptWindowState</string>
> <key>positionOfDivider</key>
> <real>680</real>
> <key>savedFrame</key>
> <string>1238 373 1015 944 0 0 2560 1417 </string>
> <key>selectedTab</key>
> <string>log</string>
> </dict>
> </dict>
> </plist>
>
> I have not yet had time to find out what the problem is - you may be
> luckier.
>
> /mb