[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
About an example in Emacs Lisp manual
From: |
Xue Fuqiao |
Subject: |
About an example in Emacs Lisp manual |
Date: |
Sun, 10 Feb 2013 22:19:25 +0800 |
In (info "(elisp) Translation Keymaps"):
For example, here's how to define `C-c h' to turn the character that
follows into a Hyper character:
(defun hyperify (prompt)
(let ((e (read-event)))
(vector (if (numberp e)
(logior (lsh 1 24) e)
(if (memq 'hyper (event-modifiers e))
e
(add-event-modifier "H-" e))))))
(defun add-event-modifier (string e)
(let ((symbol (if (symbolp e) e (car e))))
(setq symbol (intern (concat string
(symbol-name symbol))))
(if (symbolp e)
symbol
(cons symbol (cdr e)))))
(define-key local-function-key-map "\C-ch" 'hyperify)
In the first `defun' form, if `e' is a number, (vector (logior (lsh 1 24) e))
will be returned. I don't understand what the meaning of the bitwise-or and
bit-shifting functions are here. Can anybody explain it for me (and maybe for
other people)? Thanks.
--
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao
- About an example in Emacs Lisp manual,
Xue Fuqiao <=