Skip to content

Commit dcdc4be

Browse files
authored
Merge pull request #49 from lycheeje11y/master
use emacs-lisp syntax highlighting in code blocks
2 parents 1351e2e + 0a3085a commit dcdc4be

File tree

1 file changed

+94
-93
lines changed

1 file changed

+94
-93
lines changed

README.md

Lines changed: 94 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -40,120 +40,121 @@ Installation:
4040
-------------
4141

4242
To use bm.el, put it in your load-path and add the following to your .emacs
43-
44-
(require 'bm)
45-
43+
```emacs-lisp
44+
(require 'bm)
45+
```
4646
or
4747

48-
(autoload 'bm-toggle "bm" "Toggle bookmark in current buffer." t)
49-
(autoload 'bm-next "bm" "Goto bookmark." t)
50-
(autoload 'bm-previous "bm" "Goto previous bookmark." t)
51-
48+
```emacs-lisp
49+
(autoload 'bm-toggle "bm" "Toggle bookmark in current buffer." t)
50+
(autoload 'bm-next "bm" "Goto bookmark." t)
51+
(autoload 'bm-previous "bm" "Goto previous bookmark." t)
52+
```
5253

5354
Configuration:
5455
--------------
5556

5657
To make it easier to use, assign the commands to some keys.
5758

5859
M$ Visual Studio key setup.
59-
60-
(global-set-key (kbd "<C-f2>") 'bm-toggle)
61-
(global-set-key (kbd "<f2>") 'bm-next)
62-
(global-set-key (kbd "<S-f2>") 'bm-previous)
63-
60+
```emacs-lisp
61+
(global-set-key (kbd "<C-f2>") 'bm-toggle)
62+
(global-set-key (kbd "<f2>") 'bm-next)
63+
(global-set-key (kbd "<S-f2>") 'bm-previous)
64+
```
6465
Click on fringe to toggle bookmarks, and use mouse wheel to move between them.
65-
66-
(global-set-key (kbd "<left-fringe> <mouse-5>") 'bm-next-mouse)
67-
(global-set-key (kbd "<left-fringe> <mouse-4>") 'bm-previous-mouse)
68-
(global-set-key (kbd "<left-fringe> <mouse-1>") 'bm-toggle-mouse)
69-
66+
```emacs-lisp
67+
(global-set-key (kbd "<left-fringe> <mouse-5>") 'bm-next-mouse)
68+
(global-set-key (kbd "<left-fringe> <mouse-4>") 'bm-previous-mouse)
69+
(global-set-key (kbd "<left-fringe> <mouse-1>") 'bm-toggle-mouse)
70+
```
7071
If you would like the markers on the right fringe instead of the left, add the following line:
71-
72-
(setq bm-marker 'bm-marker-right)
73-
72+
```emacs-lisp
73+
(setq bm-marker 'bm-marker-right)
74+
```
7475
If you would like to cycle bookmark in LIFO order, add the following line:
75-
76-
(setq bm-in-lifo-order t)
77-
76+
```emacs-lisp
77+
(setq bm-in-lifo-order t)
78+
```
7879
If you would like to cycle through bookmarks in *all* open buffers, add the following line:
79-
80-
(setq bm-cycle-all-buffers t)
81-
80+
```emacs-lisp
81+
(setq bm-cycle-all-buffers t)
82+
```
8283
If you would like to remove bookmark after jump to it by `bm-next` or `bm-previous`:
83-
84-
(setq temporary-bookmark-p t)
85-
84+
```emacs-lisp
85+
(setq temporary-bookmark-p t)
86+
```
8687
or if you want use this feature in your library:
87-
88-
(bm-bookmark-add nil nil t)
89-
88+
```emacs-lisp
89+
(bm-bookmark-add nil nil t)
90+
```
9091
If you need org-mode to expand the region containing a bookmark, add the following:
91-
92-
(add-hook 'bm-after-goto-hook 'org-bookmark-jump-unhide)
93-
92+
```emacs-lisp
93+
(add-hook 'bm-after-goto-hook 'org-bookmark-jump-unhide)
94+
```
9495

9596

9697
Configuring bm.el with use-package:
9798
---------------------------------
9899
Configuring bm.el with [use-package](https://github.com/jwiegley/use-package)
99-
100-
(use-package bm
101-
:ensure t
102-
:demand t
103-
104-
:init
105-
;; restore on load (even before you require bm)
106-
(setq bm-restore-repository-on-load t)
107-
108-
109-
:config
110-
;; Allow cross-buffer 'next'
111-
(setq bm-cycle-all-buffers t)
112-
113-
;; where to store persistant files
114-
(setq bm-repository-file "~/.emacs.d/bm-repository")
115-
116-
;; save bookmarks
117-
(setq-default bm-buffer-persistence t)
118-
119-
;; Loading the repository from file when on start up.
120-
(add-hook 'after-init-hook 'bm-repository-load)
121-
122-
;; Saving bookmarks
123-
(add-hook 'kill-buffer-hook #'bm-buffer-save)
124-
125-
;; Saving the repository to file when on exit.
126-
;; kill-buffer-hook is not called when Emacs is killed, so we
127-
;; must save all bookmarks first.
128-
(add-hook 'kill-emacs-hook #'(lambda nil
129-
(bm-buffer-save-all)
130-
(bm-repository-save)))
131-
132-
;; The `after-save-hook' is not necessary to use to achieve persistence,
133-
;; but it makes the bookmark data in repository more in sync with the file
134-
;; state.
135-
(add-hook 'after-save-hook #'bm-buffer-save)
136-
137-
;; Restoring bookmarks
138-
(add-hook 'find-file-hooks #'bm-buffer-restore)
139-
(add-hook 'after-revert-hook #'bm-buffer-restore)
140-
141-
;; The `after-revert-hook' is not necessary to use to achieve persistence,
142-
;; but it makes the bookmark data in repository more in sync with the file
143-
;; state. This hook might cause trouble when using packages
144-
;; that automatically reverts the buffer (like vc after a check-in).
145-
;; This can easily be avoided if the package provides a hook that is
146-
;; called before the buffer is reverted (like `vc-before-checkin-hook').
147-
;; Then new bookmarks can be saved before the buffer is reverted.
148-
;; Make sure bookmarks is saved before check-in (and revert-buffer)
149-
(add-hook 'vc-before-checkin-hook #'bm-buffer-save)
150-
151-
152-
:bind (("<f2>" . bm-next)
153-
("S-<f2>" . bm-previous)
154-
("C-<f2>" . bm-toggle))
155-
)
156-
100+
```emacs-lisp
101+
(use-package bm
102+
:ensure t
103+
:demand t
104+
105+
:init
106+
;; restore on load (even before you require bm)
107+
(setq bm-restore-repository-on-load t)
108+
109+
110+
:config
111+
;; Allow cross-buffer 'next'
112+
(setq bm-cycle-all-buffers t)
113+
114+
;; where to store persistant files
115+
(setq bm-repository-file "~/.emacs.d/bm-repository")
116+
117+
;; save bookmarks
118+
(setq-default bm-buffer-persistence t)
119+
120+
;; Loading the repository from file when on start up.
121+
(add-hook 'after-init-hook 'bm-repository-load)
122+
123+
;; Saving bookmarks
124+
(add-hook 'kill-buffer-hook #'bm-buffer-save)
125+
126+
;; Saving the repository to file when on exit.
127+
;; kill-buffer-hook is not called when Emacs is killed, so we
128+
;; must save all bookmarks first.
129+
(add-hook 'kill-emacs-hook #'(lambda nil
130+
(bm-buffer-save-all)
131+
(bm-repository-save)))
132+
133+
;; The `after-save-hook' is not necessary to use to achieve persistence,
134+
;; but it makes the bookmark data in repository more in sync with the file
135+
;; state.
136+
(add-hook 'after-save-hook #'bm-buffer-save)
137+
138+
;; Restoring bookmarks
139+
(add-hook 'find-file-hooks #'bm-buffer-restore)
140+
(add-hook 'after-revert-hook #'bm-buffer-restore)
141+
142+
;; The `after-revert-hook' is not necessary to use to achieve persistence,
143+
;; but it makes the bookmark data in repository more in sync with the file
144+
;; state. This hook might cause trouble when using packages
145+
;; that automatically reverts the buffer (like vc after a check-in).
146+
;; This can easily be avoided if the package provides a hook that is
147+
;; called before the buffer is reverted (like `vc-before-checkin-hook').
148+
;; Then new bookmarks can be saved before the buffer is reverted.
149+
;; Make sure bookmarks is saved before check-in (and revert-buffer)
150+
(add-hook 'vc-before-checkin-hook #'bm-buffer-save)
151+
152+
153+
:bind (("<f2>" . bm-next)
154+
("S-<f2>" . bm-previous)
155+
("C-<f2>" . bm-toggle))
156+
)
157+
```
157158

158159

159160
Reviews and comments:

0 commit comments

Comments
 (0)