2011-11-19

PC Keyboard Modifier Keys (A Short Survey)

Microsoft digital media keyboard Flip3D key

Updated: PC Keyboard Modifier Keys (A Short Survey)

Enter Unicode by Decimal

Here's a piece of code that lets you inpute unicode by its decimal number

(defun replace-current-word-as-decimal-unicode-char ()
  "Replace current word as decimal number by a corresponding Unicode character.
If there's a text selection, use that as input."
  (interactive)
  (let (bds p1 p2 inputStr )
    (if (region-active-p)
        (progn
          (setq p1 (region-beginning))
          (setq p2 (region-end)) )
      (progn
        (setq bds (bounds-of-thing-at-point 'word)  )
        (setq p1 (car bds))
        (setq p2 (cdr bds)) ) )

    (setq inputStr (buffer-substring-no-properties p1 p2)  )

    (delete-region p1 p2 )
    (ucs-insert (string-to-number inputStr) ) ) )

Emacs Lisp Example: mark-unicode

Often, when coding HTML, i need to mark a character as Unicode, using a custom HTML tag with special CSS markup, like this:

<b class="u">∑</b>

The <b>bold</b> tag is used to markup a text to stand out, with no particular semantic meaning (as opposed to <strong>strong</strong> or <em>emphasis</em>. (See: HTML5 Tags.)). The class “u” just indicate its Unicode. This way, i can write a Javascript so that when mouse hovers on the symbol, it'll show the Unicode number and also a enlarged font.

I have several elisp commands that wraps HTML tags in various ways, but i need to do this so often that i decided to write a dedicated command just for this. Here it is:

(defun mark-unicode (p1)
  "Wrap 「<b class=\"u\"></span>」 around current character.

When called in elisp program, wrap the tag at point P1."
  (interactive (list (point)))
    (goto-char p1)
    (insert "<b class=\"u\">")
    (forward-char 1)
    (insert "</b>"))

All my easy keys are used up, so i give it a alias of “u”. (See: Emacs: Defining Alias to Increase Productivity.)

2011-11-18

Unicode: W3C Proposed Icons {Image, Video, Sound File, Trash, Keyboard, Mouse, …}

Image file icon, video icon, mouse icon, trash bin icon …

film movie audio sound1 sound2 image1 image2 image3 generic document notebook a text text document compressed compressed document binary binary document binhex binhex document unknown unknown document uuencoded uuencoded document comp.blue comp.gray clock trash filing cabinet display printer keyboard mouse cd i cd rom fixed disk disk drive diskette calculator camera telephone fax network folder.open folder folder2 mail mail in mail out html form home toc index index2 glossary summary parent previous next back forward play-stop play-start play-pause play-fast-reverse play-fast-forward map archive new burst caution alert.black alert.red stop work work2 sadsmiley smiley telnet tn3270 transfer ftp gopher www

For full detail and some unicode equivalents, see: http://xahlee.org/comp/unicode_w3c_icons.html