From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xue Fuqiao Newsgroups: gmane.emacs.help Subject: About an example in Emacs Lisp manual Date: Sun, 10 Feb 2013 22:19:25 +0800 Organization: The Church of Emacs Message-ID: <20130210221925.0022a7cd8b573a1e316fa476@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1360505984 14250 80.91.229.3 (10 Feb 2013 14:19:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Feb 2013 14:19:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 10 15:20:05 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U4XlF-0002HA-47 for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Feb 2013 15:20:05 +0100 Original-Received: from localhost ([::1]:52173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4Xku-0004gJ-Dq for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Feb 2013 09:19:44 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4Xko-0004g2-8r for help-gnu-emacs@gnu.org; Sun, 10 Feb 2013 09:19:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4Xkm-00050g-Oq for help-gnu-emacs@gnu.org; Sun, 10 Feb 2013 09:19:38 -0500 Original-Received: from mail-da0-f46.google.com ([209.85.210.46]:52503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4Xkm-00050M-H0 for help-gnu-emacs@gnu.org; Sun, 10 Feb 2013 09:19:36 -0500 Original-Received: by mail-da0-f46.google.com with SMTP id p5so2387974dak.19 for ; Sun, 10 Feb 2013 06:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:organization:x-mailer :mime-version:content-type:content-transfer-encoding; bh=50nzSAXSbIXevOViSWsYyAhh9SZfb+vXlO108lGCgRw=; b=tlsxeUdEi2VVfzEHX/s5KDtSdI2/oM8ET4FLgkoLht+ZqmT9zkhzcqqh+vG8dtBMXh 4rrdqExBKJW6jsALZO64lv0BLxjd8l+6ubUMvzOpZygRk8c9QeATs8zwalNCrpc3iDrx Qvkp147YNKkCF6Nv8LIcfZv+l+cyokTWetcDio02l7ncNmL4Aje2NwTruhLp+3OMUVJl ZV//bFSJYCyqAw1hU7SEVZU9sy1pxy7IIuwy+FyGo9t0GXjtRahF83ESLmp19bB0osVB xQa/YX6Jls6OlZ4YIVBZ0BKWeJAJlStwd5Ta/LB0ChqjOYwCO5bWRS3tTnMArQzX/94A EI6w== X-Received: by 10.68.196.162 with SMTP id in2mr11290299pbc.67.1360505975454; Sun, 10 Feb 2013 06:19:35 -0800 (PST) Original-Received: from Emacs ([49.118.21.177]) by mx.google.com with ESMTPS id z6sm37760404pav.3.2013.02.10.06.19.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 10 Feb 2013 06:19:34 -0800 (PST) X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.13; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.46 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89036 Archived-At: 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