Xah Emacs Blog Archive 2014-04 to 2014-04

Emacs: Remapping Keys Using key-translation-map (minor updated)

Emacs: Open File in External App (minor update)

Emacs: CSS Compressor (old goodie, on its own page)

Ruby Creator Matz on How Emacs Changed My Life (repost)

Elisp: Decoding Percent Encoded URL that Has Unicode Chars

emacs lisp. Solved a long time problem. Try to decode this using emacs lisp:

For solution see updated at: Elisp: URL Percent Decode/Encode

thanks to nns for the solution.

keyboard design. Xah Keyboard (updated)

see also, another new symmetric keyboard the Yager keyboard. Heart ♥ Keyboard, Butterfly Keyboard, Cat 😸 Keyboard, Star Trek Keyboard ⌨ (refresh page)

emacs 24.4 prelease binary for 64 bits Windows. http://semantic.supelec.fr/popineau/programming-emacs.html#sec-2, by Fabrice Popineau

new version of emacs tutorial. Buy Xah Emacs Tutorial.

tweet, repost, share, buy. Thank you.

spent 3 hours hacking emacs lisp. Created syntax coloring for CSS3 HSL (Hue, Saturation, Lightness) syntax.

emacs xah css mode 2014-04-22
emacs xah css mode

See updates at:

there's functions at Emacs: Working with CSS Color Values that you can call to color any file's hex/hsl color syntax.

Emacs: Insert Random Number/Hex/String (updated)

Emacs: Copy/Paste and kill-ring History (updated)

30 minutes job with perl python ruby becomes 5 minutes with emacs lisp:

Emacs: Find Replace on Multiple Files by Function: Add Unicode Name in HTML

Emacs: Working with CSS Color Values (updated)

Sacha Chua's Emacs Beginner Resources List, and Emacs Videos

Sacha Chua, the incredibly productive and unique emacs hacker, posted a blog about best emacs resources.

Emacs beginner resources By Marie Alexis Miravite. At http://sachachua.com/blog/2014/04/emacs-beginner-resources/

Thanks to Sacha and Marie for giving my site a high rating.

Sacha recently started to do a lot emacs videos. I've watched them all, except the new ones in the past month. Haven't had a chance to. If i can get over my stage fright, we'd do a emacs Q&A or something similar down the road.

you can watch Sacha's videos, collected at http://sachachua.com/blog/tag/emacs-chat/

actually that's not all the emacs ones. I couldn't find one place that collects all at the moment. Check out all her YouTube at https://www.youtube.com/playlist?list=UUlT2UAbC6j7TqOWurVhkuHQ

her videos are very fun to watch.

comment at https://plus.google.com/113859563190964307534/posts/XPXgDiv9VSQ

Elisp: Convert Decimal / Hexadecimal Numbers (repost)

Emacs Command: Change Unicode Char to HTML Markup

here's a useful emacs lisp command that turns a Unicode symbol into a HTML markup.

(defun xah-mark-unicode (p1)
  "Wrap 「<mark class=\"unicode\" title=\"U+…: ‹NAME›\"></mark>」 around current character.
When called in elisp program, wrap the tag at cursor position p1."
  (interactive (list (point)))
  (let* (
         ($codepoint (string-to-char (buffer-substring-no-properties p1 (1+ p1))) )
         ($name (get-char-code-property $codepoint 'name))
    (goto-char p1)
    (insert (format "<mark class=\"unicode\" title=\"U+%X: %s\">" $codepoint $name) )
    (forward-char 1)
    (insert (format "</mark>") )
    ) )

For example:


<mark class="unicode" title="U+26E4: PENTAGRAM" >⛤</mark>

Emacs Lisp Solution: Print All Unicode Characters Who's Name Contains "BULLET"

;; print all unicode chars up to 2^16 who's name contains "BULLET"
  (lambda (x)
    (let ((nn (get-char-code-property x 'name)))
          (and (not (null nn))
               (string-match "BULLET" nn))
        (insert-char x)
        (insert " " nn "\n")
  (number-sequence 0 (expt 2 16)))

See: Emacs Keyboard Macro Example: Insert All Unicode Bullets (updated)

(thanks to Martin for initial solution)

Few days ago we have a challenge: Emacs Keyboard Macro Example: Insert All Unicode Bullets (updated)

For a Python solution, see: Python: Processing Unicode: unicodedata Module Tutorial.

learned a lesson. Never open a PDF in emacs. Never even do it accidentally.

emacs since version 23 can open PDF files. 〔►see Emacs 23.2 Features (released 2010-05)〕 It opens PDF file in doc-view-mode. It works by converting the PDF file to png image files. Opening a PDF file in dedicated PDF reader takes 1 or 2 seconds, in emacs it takes 10 or freeze emacs. (and it doesn't work in Microsoft Windows or Mac, because it require some external libs.)

here's how to open PDF as hex, to prevent emacs freezing when accidentally hit a PDF file in dired.

;; open pdf files in hex mode
(add-to-list 'auto-mode-alist '("\\.pdf\\'" . hexl-mode))

emacs 24.4 pretest version is out. Linux only. http://permalink.gmane.org/gmane.emacs.devel/171413

Emacs: Using Eww Web Browser (on its own page)

Emacs Keyboard Macro Example: Insert All Unicode Bullets (repost)

the Microsoft Sculpt Ergonomic Keyboard, a great ergonomic keyboard, reviewed by Øystein E Krog (see comment)

Elisp: require, load, load-file, autoload, feature, Explained (updated)

one of the most important command, few people knew how to control case sensitivity. Emacs: Find and Replace Commands (minor update)

Unicode Basics: What's Character Set, Character Encoding, UTF-8? (major edit)

Emacs 24.4: Press F11 to Go Full Screen

emacs 24.4 feature. Alt+x toggle-frame-fullscreenF11】 to go to full screen.

Emacs: Set Unicode Specific Font

Here's how to set specific font for Unicode emoticons (or a range of Unicode characters)

;; specify font for all unicode characters
(set-fontset-font t 'unicode "Symbola" nil 'prepend)

This is very useful. Because, even if you have Unicode font, but emacs still does not display some Unicode emoticons. For example, on latest iBook, Mac OS X, emacs won't display these characters: 😃 😄 😱 😸 👸 👽 👍

updated at Emacs: Font Configuration

Delete Duplicate Lines

delete-duplicate-lines will delete duplicated lines in current text selection. The lines need not be sorted. You can try it on this:


Emacs 24.4 New Features (released 2014-10)

Emacs 24.4 hash-table-keys and hash-table-values

emacs 24.4 has new functions to extract keys from a hash table. Same for values. (but you need to load a library first.) See: Emacs 24.4 New Features (released 2014-10) and Elisp: Hash Table