You are not logged in.

#1 2022-08-19 03:36:25

pradtf
Member
Registered: 2009-06-10
Posts: 141

SOLVED: howto open textedit:// url in emacs

i am working with lilypond.el in emacs.

after compiling the lilypond text (C-c C-l) i can view it as pdf in xpdf or qpdfview with (C-c C-s).

the pdf file shows notes that are linked back to the lines in the emacs file, like this:

textedit:///HOMEDIR/filename.ly:LINE:COLUMN

so each note refers back to it's location in the emacs file.

however, clicking on the note, instead of taking me back to the point in emacs file, produces

/usr/bin/xdg-open: line 881: x-www-browser: command not found
/usr/bin/xdg-open: line 881: firefox: command not found
/usr/bin/xdg-open: line 881: iceweasel: command not found
/usr/bin/xdg-open: line 881: seamonkey: command not found
/usr/bin/xdg-open: line 881: mozilla: command not found
/usr/bin/xdg-open: line 881: epiphany: command not found
/usr/bin/xdg-open: line 881: konqueror: command not found
/usr/bin/xdg-open: line 881: chromium: command not found
/usr/bin/xdg-open: line 881: chromium-browser: command not found
/usr/bin/xdg-open: line 881: google-chrome: command not found
/usr/bin/xdg-open: line 881: www-browser: command not found
/usr/bin/xdg-open: line 881: links2: command not found
/usr/bin/xdg-open: line 881: elinks: command not found
/usr/bin/xdg-open: line 881: links: command not found

this suggests that it can't find something to open the textedit:// url and keeps guessing at whatever is stored in emacs as possible browsers.

what i think i want to do is something like this:
emacsclient textedit:///home/pradmin/zz/Angel-Humm.ly:29:2:3
(which doesn't work because it's not opening the textedit:// url)

how can i get the note links to take me back to the emacs file?

Last edited by pradtf (2022-08-20 19:27:24)


in friendship,
prad

Offline

#2 2022-08-19 10:50:02

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,663

Re: SOLVED: howto open textedit:// url in emacs


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2022-08-19 11:24:26

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: SOLVED: howto open textedit:// url in emacs

Offline

#4 2022-08-19 20:10:31

pradtf
Member
Registered: 2009-06-10
Posts: 141

Re: SOLVED: howto open textedit:// url in emacs

thx lone_wolf, but i couldn't find anything there.

thx stefan. your link give everything i need to get this to work!
unfortunately it doesn't because i require setting in .xpdfrc:

urlCommand     "lilypond-invoke-editor %s"

but for the xpdf we have on arch, this urlCommand doesn't exist.
(as per https://forum.xpdfreader.com/viewtopic. … mmand#p56)

there is something similar launchCommand, but that doesn't respond to a url, though there is a suggestion of how it may be done, but i've had no success with the idea. there is also a suggestion of qpdfview and mimetypes.

lilypond-invoke-editor works perfectly for textedit://, but i haven't figured out how to get it to work with xpdf or qpdfview ... yet.

Last edited by pradtf (2022-08-19 20:34:49)


in friendship,
prad

Offline

#5 2022-08-20 11:57:26

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,663

Re: SOLVED: howto open textedit:// url in emacs

Looks like I read your OP not thorough enough.
You're not looking for info how to make a texteditor work with lilypond format.

In the link by stefan the "Using GNOME 3" section has valuable information related to xdg / xdg-mime that's not specific to gnome .

It may be possible to use that info to craft a solution for opening textedit:// url on any OS that supports xdg-mime

Necessary steps would go something like this :

- register the x-scheme-handler/textedit as a new mimetype
- set default application for -scheme-handler/textedit to  some-script
(the lilypond-invoke-editor.sh provided by lilypond pacakge would be first choice to try)

https://wiki.archlinux.org/title/XDG_MIME_Applications describes how the mime system works, start there.

Last edited by Lone_Wolf (2022-08-20 11:58:09)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#6 2022-08-20 19:26:42

pradtf
Member
Registered: 2009-06-10
Posts: 141

Re: SOLVED: howto open textedit:// url in emacs

hey thx for this lone_wolf!

i didn't realize the gnome info wasn't specific to gnome till you told me!!
the XDG_MIME_Applications link is quite useful too!

here's what i did following the instructions on stefan's link:

1. put in .zshenv (or some global profile):
LYEDITOR=emacs (though it seems to work with out this sometimes)
the important thing is to have the emacs-server running, so a new emacs isn't opened each click.

2. setup the mime
a. create /tmp/lilypond-invoke-editor.desktop
b. install/register it: xdg-desktop-menu install /tmp/lilypond-invoke-editor.desktop
c. associate it to textedit: xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit

after that it works beautifully with either xpdf or qpdfview - in fact, as well as frescobaldi!

Last edited by pradtf (2022-12-29 06:27:29)


in friendship,
prad

Offline

Board footer

Powered by FluxBB