Skip to content
David Goodwin edited this page Nov 10, 2024 · 3 revisions

Kermit 95 has a dedicated keyboard mode for Emacs giving you Alt as the Meta key as you'd expect (the command screen being moved from Alt+x to Alt+F4) among other settings. It can be activated with: set terminal keyboard-mode emacs

This mode isn't perfect though - when used with the Linux terminal type at least it leaves a handful of keys incorrectly mapped or not mapped at all making org-mode more difficult to use. If you run into these issues, the following may help correct them:

set term key emacs \4388 \Kansif49      ; Home key: end start of document -> start of line
set term key emacs \4387 \Kansif57      ; End key: end of document-> end of line
set term key emacs \4398 \Kansif61      ; Delete key: delete character to the left -> delete character to the right
set term key emacs \2317 \27\269        ; Alt+Enter -> Meta+Enter
set term key emacs \6437 \27\27[D       ; Alt-LeftArrow -> Meta-LeftArrow
set term key emacs \6439 \27\27[C       ; Alt-RightArrow -> Meta-RightArrow
set term key emacs \2829 \3\24\77       ; Alt+Shift+Enter -> C-c C-x M (synonym for M-S-RET in org-mode) 

Opening Links with your Browser

If you'd prefer Emacs to open links with the browser on your local machine, you can put something like this 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)

This will send an APC to kermit instructing it to run the browse command with the URL you triggered in Emacs. For this to work, you must have APCs turned on (set terminal apc on). Letting the remote machine ask Kermit to run commands, even if limited to "safe" commands (apc on rather than unchecked), can be a security risk so make sure you only do this if you trust the remote host.