π

Searching and Typing Unicode Characters - Like Emojis - System-Wide Via Emacs

Show Sidebar

Update 2020-02-13: trying to move from insert-char to counsel-unicode-char after this reddit comment

Mastodon-user @jeeger tooted about a nice way to search for Unicode characters such as Emojis:

Use #emacs to enter UTF-8 characters...
Screenshot jeeger from mastodon.social with function definition of emacs-ime().
And here we are, a X11-wide #emacs-based method to enter unicode symbols with completion. + animated GIF
Screenshot jeeger from mastodon.social with an animated GIF.

Unlike somebody would think that this is only relevant within Emacs, this method is using the really nice built-in Emacs character search for entering special characters in any application:

  1. Define my-insert-char() in your Emacs configuration (see below).

  2. Manually test in the command line using the following line:

    emacsclient -c -e '(my-insert-char)'
    
  3. Map to a system-wise keyboard shortcut and use it to put arbitrary Unicode characters in the system clipboard.

(defun my-insert-char ()
  (interactive)
  (with-temp-buffer
    (call-interactively 'insert-char) ;; classic method
    ;; (call-interactively 'counsel-unicode-char) ;; improved usability but inserts characters differently
    (kill-ring-save (point-min) (point-max))))	  

I mapped this command to Fn-Search which is a special key that is available on some keyboards.

This way, I can search for something like "arrow" and using TAB completion to get something like this: โคด For emojis, I might search for "happy" to get "happy person raising one hand": ๐Ÿ™‹

This is going to be an additional input method to me besides emojione-picker.


Related articles that link to this one:

Comment via email (persistent) or via Disqus (ephemeral) comments below: