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

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

live-bookmarks.el --- visit bookmarks from any buffer


From: spamfilteraccount
Subject: live-bookmarks.el --- visit bookmarks from any buffer
Date: 11 Nov 2005 05:03:05 -0800
User-agent: G2/0.2

Fancy name, trivial package. :) I'm sure somebody's already written
something like this, but I couldn't find it.


;;; live-bookmarks.el --- visit bookmarks from any buffer

;; Copyright (C) 2005  Free Software Foundation, Inc.

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; Ultra simple minor mode for jumping to the bookmark under point.
;;
;; If you have notes or comments in a file which refer to places
;; in other files then simply bookmark those places, write the names
;; of the bookmarks after the notes and you can jump to the referred
;; bookmarks directly from the notes with the push of a button.
;; (By default F1.)

;;; Code:

(defvar live-bookmarks-mode-map
  (let ((map (make-sparse-keymap)))
     (define-key map (kbd "<f1>") 'live-bookmarks-visit)
     map))

(easy-mmode-define-minor-mode
  live-bookmarks-mode
  "Live bookmarks mode."
  nil
  " LiveB"
  live-bookmarks-mode-map)


(defun live-bookmarks-visit ()
  "Visit bookmark at point."
  (interactive)
  (let ((bookmark (buffer-substring (save-excursion
                                      (skip-syntax-backward "w_")
                                      (point))
                                    (save-excursion
                                      (skip-syntax-forward "w_")
                                      (point)))))
    (if (equal "" bookmark)
        (message "Nothing at point.")
      (bookmark-jump bookmark))))

(provide 'live-bookmarks)
;;; live-bookmarks.el ends here



reply via email to

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