help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: easy-to-use bookmarks functionality


From: José A . Romero L .
Subject: Re: easy-to-use bookmarks functionality
Date: Tue, 04 May 2010 15:42:36 -0000
User-agent: G2/1.0

On 16 Mar, 16:51, alex_sv <avshaba...@gmail.com> wrote:
> Hi all,
>
> For my own needs I wrote a small function that provides easy-to-use
> bookmarking: C-[1..9] - sets "bookmark" (in fact remembers point in
> the corresponding register), M-[1..9] - jumps to the corresponding
> position.
(...)

Cool idea. Here is a somewhat shorter implementation:

(defun jarl/bind-navigation-command-to-numkeys ()
  (dotimes (i 9)
    (local-set-key
     (read-kbd-macro (concat "C-" (number-to-string (1+ i))))
     `(lambda () (interactive) (point-to-register ,(1+ i))))
    (local-set-key
     (read-kbd-macro (concat "M-" (number-to-string (1+ i))))
     `(lambda () (interactive) (register-to-point ,(1+ i))))))

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]