-
Notifications
You must be signed in to change notification settings - Fork 17
Hyperlinks
Kermit 95s support for hyperlinks predates the defacto-standard OSC 8 escape sequence. As a result, OSC 8 is not currently supported (see: #123).
Kermit 95s own (quite similar) hyperlink escape sequence is documented in ctlseqs.html, but briefly:
- Start a DCS string with
\eP1+m
(for a URL) or\eP2+m
(for a UNC path) - Follow with the URL in quotes
- End with the DCS string terminator:
\e\\
(ESC ) - Output the link text
- Terminate the link with
\eP0+m\e\\
(ESC P 0 + m ESC )
Examples:
printf 'Look, some text!\n\eP1+m"http://www.google.com"\e\\This is a link to a website\eP0+m\e\\\n This is not a hyperlink\n'
printf 'Look, some text!\n\eP2+m"\\\\10.0.1.53\\shared"\e\\This is a link to a UNC path\eP0+m\e\\\n This is not a hyperlink\n'
If you'd like hyperlinks in Emacs to open on your local PC, rather than in a browser on the remote host, the easiest way is to use APC. Turning on APC allows the remote host to ask Kermit 95 to run various Kermit commands, including the browse
command which opens a URL in your browser. You can turn on APC for your terminal session with set term apc on
(it is off by default for security reasons)
You can then configure Emacs to ask Kermit 95 to browse
whatever URL you click by putting something like the following in your .emacs file:
(defun k95-browse-url (url &optional new-window)
(cond ((not window-system)
(send-string-to-terminal (concat "\e_browse " url "\e\\")))
;; [ some more cond cases here... ]
;; the rest goes to external
(t
(browse-url-firefox url new-window))))
(setq browse-url-browser-function 'k95-browse-url)
Note that this example will always use Kermit 95 APCs when emacs is running in a terminal - even if you're sitting at the physical machine using emacs on the frame buffer console, and if you're running emacs under X11 it will always use firefox when you click a link. You may want to customise this example further to meet your needs.
You should only enable APC when connecting to computers that you trust! Enabling APC lets the remote host ask Kermit 95 to run commands on your computer. By default, Kermit 95 only allows certain "safe" commands to be executed by the remote host but this is still not without risk. See Chapter 13 of the C-Kermit Manual for more information on APCs and their risks.