From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: alex_sv Newsgroups: gmane.emacs.help Subject: Re: easy-to-use bookmarks functionality Date: Wed, 17 Mar 2010 02:48:51 -0700 (PDT) Organization: http://groups.google.com Message-ID: <94416e89-9d9e-416f-8382-7b76da1bfc8c@f8g2000yqn.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1273055266 24201 80.91.229.12 (5 May 2010 10:27:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 May 2010 10:27:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 05 12:27:45 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9bpR-0000FW-7P for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 12:27:45 +0200 Original-Received: from localhost ([127.0.0.1]:57711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9bpQ-0006Vj-F1 for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 06:27:44 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!f8g2000yqn.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-NNTP-Posting-Host: 94.25.210.15 Original-X-Trace: posting.google.com 1268819332 20440 127.0.0.1 (17 Mar 2010 09:48:52 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 17 Mar 2010 09:48:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f8g2000yqn.googlegroups.com; posting-host=94.25.210.15; posting-account=RvPXvAoAAAC66COmfkq16Km7mmTRje1Z User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.350.0 Safari/533.2,gzip(gfe),gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:177483 X-Mailman-Approved-At: Tue, 04 May 2010 16:47:15 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73354 Archived-At: On Mar 16, 11:58=A0pm, Jos=E9 A. Romero L. wrote: >... Great! I didn't noticed possibility to use read-kbd-macro and back-quote form. Thank you! I slightly modified your function - now it prints message that bookmark is set, just a copestone: (defun bind-navigation-commands-to-numkeys () "provides easy-to-use bookmarking functionality - binds navigation commands to C-{index}, M-{index} keys, where index is a numeric key from 1 to 9, C-{index} - saves bookmark, M-{index} - jumps to the saved point" ;; assign handlers for C/M-[1..9] keys (loop for key-index from 1 to 9 do (let ((key-str (int-to-string key-index))) ;; save point (local-set-key ;; retrieve C-{index} keyboard sequence (read-kbd-macro (concat "C-" (int-to-string key-index))) ;; handler form `(lambda () (interactive) (point-to-register ,key-index) (message (concat "setting bookmark #" ,key-str)))) ;; goto saved point (local-set-key ;; retrieve M-{index} keyboard sequence (read-kbd-macro (concat "M-" (int-to-string key-index))) ;; handler form `(lambda () (interactive) (register-to-point ,key-index))))))