- Notifications
You must be signed in to change notification settings - Fork31
bm.el -- Visual Bookmarks for GNU Emacs
License
joodland/bm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This package provides visible, buffer local, bookmarks and the abilityto jump forward and backward to the next bookmark.
It was created because I missed the bookmarks from M$ Visual Studio inGNU Emacs. I think they provide an easy way to navigate in a buffer.
- Auto remove bookmark after jump to it by
bm-next
orbm-previous
: - Cycle through bookmarks in all open buffers in LIFO order
- Toggle bookmarks. Jump to next/previous bookmark.
- Setting bookmarks based on a regexp. (Useful when searching logfiles.)
- Mouse navigation.
- Annotate bookmarks.
- Different wrapping modes.
- Different bookmarks styles, line-only, fringe-only or both.
- Persistent bookmarks (buffer local), also in non-file buffers (info) and indirect buffers.
- List bookmarks (in all buffers) in a separate buffer.
- Cycle through bookmarks in all open buffers.
There are some incompatibilities with lazy-lock when usingfill-paragraph. All bookmark below the paragraph being filled will belost. This issue can be resolved using the `jit-lock-mode'.
To use bm.el, put it in your load-path and add the following to your .emacs
(require'bm)
or
(autoload'bm-toggle"bm""Toggle bookmark in current buffer."t)(autoload'bm-next"bm""Goto bookmark."t)(autoload'bm-previous"bm""Goto previous bookmark."t)
To make it easier to use, assign the commands to some keys.
M$ Visual Studio key setup.
(global-set-key (kbd"<C-f2>")'bm-toggle)(global-set-key (kbd"<f2>")'bm-next)(global-set-key (kbd"<S-f2>")'bm-previous)
Click on fringe to toggle bookmarks, and use mouse wheel to move between them.
(global-set-key (kbd"<left-fringe> <mouse-5>")'bm-next-mouse)(global-set-key (kbd"<left-fringe> <mouse-4>")'bm-previous-mouse)(global-set-key (kbd"<left-fringe> <mouse-1>")'bm-toggle-mouse)
If you would like the markers on the right fringe instead of the left, add the following line:
(setq bm-marker'bm-marker-right)
If you would like to cycle bookmark in LIFO order, add the following line:
(setq bm-in-lifo-ordert)
If you would like to cycle through bookmarks inall open buffers, add the following line:
(setq bm-cycle-all-bufferst)
If you would like to remove bookmark after jump to it bybm-next
orbm-previous
:
(setq temporary-bookmark-pt)
or if you want use this feature in your library:
(bm-bookmark-addnilnilt)
If you need org-mode to expand the region containing a bookmark, add the following:
(add-hook'bm-after-goto-hook'org-bookmark-jump-unhide)
Configuring bm.el withuse-package
(use-package bm:ensuret:demandt:init;; restore on load (even before you require bm) (setq bm-restore-repository-on-loadt):config;; Allow cross-buffer 'next' (setq bm-cycle-all-bufferst);; where to store persistant files (setq bm-repository-file"~/.emacs.d/bm-repository");; save bookmarks (setq-default bm-buffer-persistencet);; Loading the repository from file when on start up. (add-hook'after-init-hook'bm-repository-load);; Saving bookmarks (add-hook'kill-buffer-hook#'bm-buffer-save);; Saving the repository to file when on exit.;; kill-buffer-hook is not called when Emacs is killed, so we;; must save all bookmarks first. (add-hook'kill-emacs-hook#'(lambdanil (bm-buffer-save-all) (bm-repository-save)));; The`after-save-hook' is not necessary to use to achieve persistence,;; but it makes the bookmark data in repository more in sync with the file;; state. (add-hook'after-save-hook#'bm-buffer-save);; Restoring bookmarks (add-hook'find-file-hooks#'bm-buffer-restore) (add-hook'after-revert-hook#'bm-buffer-restore);; The`after-revert-hook' is not necessary to use to achieve persistence,;; but it makes the bookmark data in repository more in sync with the file;; state. This hook might cause trouble when using packages;; that automatically reverts the buffer (like vc after a check-in).;; This can easily be avoided if the package provides a hook that is;; called before the buffer is reverted (like`vc-before-checkin-hook').;; Then new bookmarks can be saved before the buffer is reverted.;; Make sure bookmarks is saved before check-in (and revert-buffer) (add-hook'vc-before-checkin-hook#'bm-buffer-save):bind (("<f2>". bm-next) ("S-<f2>". bm-previous) ("C-<f2>". bm-toggle)) )
About
bm.el -- Visual Bookmarks for GNU Emacs