SSH client for an Emacs user on iOS

I tested two SSH clients (Prompt 2 and Termius, previously known as Serverauditor) for iOS on an iPad Pro (12.9 inch) with the Smart Keyboard.

Both Prompt 2 and Termius have very similar features and work just great doing basic ssh tasks.

However, I am an avid GNU Emacs user, and only Serverauditor worked out of the box to allow me to use Emacs (i.e., can use option as the meta key). Prompt 2 leaves the Option key as an option key, and inserts “funky” characters instead of being a meta key.

I was a little saddened by this as I find the Prompt 2 interface a little nicer (more customization’s in the user interface). So, like every question, a solution has already been posted on the internet.

I found the following StackExchange post on how to translate the resulting characters to Meta+symbols (e.g., option+a yields a å, however I want it to be Meta-a).

;; http://apple.stackexchange.com/questions/48043/how-to-ssh-from-ipad-with-external-keyboard-and-emacs

(let ((translations '( 229 [?\M-a]  nil [?\M-b]   231 [?\M-c]  8706 [?\M-d]  nil [?\M-e]
                       402 [?\M-f]  169 [?\M-g]   729 [?\M-h]   nil [?\M-i]  8710 [?\M-j]
                       730 [?\M-k]  172 [?\M-l]   181 [?\M-m]   nil [?\M-n]   248 [?\M-o]
                       960 [?\M-p]  339 [?\M-q]   174 [?\M-r]   223 [?\M-s]  8224 [?\M-t]
                       nil [?\M-u] 8730 [?\M-v]  8721 [?\M-w]  8776 [?\M-x]   165 [?\M-y]
                       937 [?\M-z]
                       197 [?\M-A]  305 [?\M-B]   199 [?\M-C]   206 [?\M-D]   nil [?\M-E]
                       207 [?\M-F]  733 [?\M-G]   211 [?\M-H]   nil [?\M-I]   212 [?\M-J]
                     63743 [?\M-K]  210 [?\M-L]   194 [?\M-M]   nil [?\M-N]   216 [?\M-O]
                      8719 [?\M-P]  338 [?\M-Q]  8240 [?\M-R]   205 [?\M-S]   711 [?\M-T]
                       nil [?\M-U] 9674 [?\M-V]  8222 [?\M-W]   731 [?\M-X]   193 [?\M-Y]
                       184 [?\M-Z]
                       nil [?\M-~]  161 [?\M-1]   162 [?\M-4]   163 [?\M-3]   167 [?\M-6]
                       170 [?\M-9]  171 [?\M-\\]  175 [?\M-<]   176 [?\M-*]   177 [?\M-+]
                       182 [?\M-7]  183 [?\M-\(]  186 [?\M-0]   187 [?\M-|]   191 [?\M-\?]
                       198 [?\M-\"] 230 [?\M-']   247 [?\M-/]   728 [?\M->]  8211 [?\M-\-]
                      8212 [?\M-_] 8216 [?\M-\]] 8217 [?\M-}]  8218 [?\M-\)] 8220 [?\M-\[]
                      8221 [?\M-{] 8225 [?\M-&]  8226 [\?M-8]  8249 [?\M-#]  8250 [?\M-$]
                      8260 [?\M-!] 8364 [\?M-@]  8482 [?\M-2]  8734 [\?M-5]  8800 [?\M-=]
                      8804 [?\M-,] 8805 [?\M-.] 64257 [?\M-%] 64258 [?\M-^])))
  (while translations
    (let ((key (car translations)) (def (cadr translations)))
      (if key
          (define-key key-translation-map (make-string 1 key) def)))
    (setq translations (cddr translations))))

Adding this code to my .emacs file at least allows me to use Prompt 2 for emacs. However, some keys are not able to be completely mapped. For example, “Option + e” cannot be bound to M-e, because that key tries to make an accent, which Emacs cannot not seem to intercept correctly.

I asked the Prompt 2 developers about re-binding Option to a Meta key, and their answer was “I’m afraid there’s no way to change/bind/unbind keys on the keyboard right now. … Your best bet in this case is to use the on-screen keys to use meta or ESC.” They must have never used Emacs, because clicking on-screen for a meta key is not even close to a solution.

Overall, both Prompt 2 and Termius work great as SSH clients. But, if you want my recommendation: use Termius (Previously known as Serverauditor).

Leave a comment

Your email address will not be published. Required fields are marked *