With a little side of applesauce...

Thursday, October 27, 2011

EMACS - bookmarks

I can't live without bookmarks in EMACS. They allow you to bookmark local AND remote files. It's pretty sweet to use a bookmark to automatically activate TRAMP and edit files over SSH!

Here are the two keyboard shortcuts that I use:
C-x r l = list bookmarks
C-x r m = bookmark with current buffer

Here is my .emacs configuration:
;; bookmarks

(require 'bookmark)
;(bookmark-load "~/.emacs.bmk")

(defun bookmark-to-abbrevs ()
"Create abbrevs based on `bookmark-alist'."
(dolist (bookmark bookmark-alist)
(let* ((name (car bookmark))
(file (bookmark-get-filename name)))
(define-abbrev global-abbrev-table name file))))

(defadvice bookmark-jump (after bookmark-jump activate)
(let ((latest (bookmark-get-bookmark bookmark)))
(setq bookmark-alist (delq latest bookmark-alist))
(add-to-list 'bookmark-alist latest)))


No comments: