Tuesday, 15 June 2010

Emacs: Is it possible to assign a number-key kb shortcut to a buffer? -



Emacs: Is it possible to assign a number-key kb shortcut to a buffer? -

i utilize desktop sessions save project state between loads. working on feature shared between few buffers, , love assign quick keyboard shortcut -# buffer. switch between fe buffers hitting cmd-1, cmd-2, cmd-3, etc. thoughts?

thanks!

i'm using code purpose:

class="lang-lisp prettyprint-override">(require 'bookmark) (defvar zz-minibuffer-map (copy-keymap minibuffer-local-must-match-map) "keymap `bookmark-do-quick-jump'") (define-key zz-minibuffer-map [remap self-insert-command] 'zz-self-insert-complete-and-exit) (define-key zz-minibuffer-map " " "-") (defvar zz-display-function nil) (defun zz-self-insert-complete-and-exit (n) (interactive "p") (self-insert-command n) (ignore-errors (completion--do-completion nil 'expect-exact)) (let ((candidates (completion-all-sorted-completions))) (cond ((null candidates) (backward-delete-char-untabify 1) (minibuffer-complete)) ((eq 1 (safe-length candidates)) (minibuffer-complete-and-exit))))) ;;;###autoload (defun zz-bookmark-jump (bookmark) "jump specified bookmark auto-completion , auto-acceptance." (interactive (list (if (window-minibuffer-p) (error "already in minibuffer") (let ((minibuffer-local-must-match-map zz-minibuffer-map)) (completing-read "jump bookmark: " bookmark-alist nil t))))) (ignore-errors (bookmark-jump bookmark zz-display-function)))

just bind zz-bookmark-jump want, m-m. now, if name bookmark 1..., ... want, , no other bookmarks start 1, m-m 1 jump bookmark.

here of bookmarks reference:

b: .bashrc ~/.bashrc e: .emacs ~/.conf.d/.emacs h: hooks.el - no file - l: main.cc ~/dropbox/source/c++/lattice/main.cc m: magit - no file - q: *scratch* - no file - s: source ~/dropbox/source/

i add together : create them nice visually when phone call bookmark-bmenu-list.

emacs

No comments:

Post a Comment