2017-03-29 07:21:15 +00:00
|
|
|
;;; packages.el --- bm Layer packages File
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2017-03-29 07:21:15 +00:00
|
|
|
;;
|
|
|
|
;; Author: Eugene "JAremko" Yaremenko <w3techplayground@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program 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 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2017-03-29 07:21:15 +00:00
|
|
|
|
|
|
|
(setq bm-packages '(bm))
|
|
|
|
|
|
|
|
(defun bm/init-bm ()
|
|
|
|
"initializes bm-emacs and adds a key binding to `SPC f z'"
|
|
|
|
(use-package bm
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-03-29 07:21:15 +00:00
|
|
|
:commands (bm-buffer-restore)
|
|
|
|
:init (progn
|
2018-10-29 01:18:56 +00:00
|
|
|
;; restore on load (even before you require bm)
|
|
|
|
(setq bm-restore-repository-on-load t)
|
2017-03-29 07:21:15 +00:00
|
|
|
;; Allow cross-buffer 'next'
|
|
|
|
(setq bm-cycle-all-buffers t)
|
|
|
|
;; save bookmarks
|
|
|
|
(setq-default bm-buffer-persistence t)
|
2019-12-05 12:24:12 +00:00
|
|
|
;; where to store persistent files
|
2017-03-29 07:21:15 +00:00
|
|
|
(setq bm-repository-file (format "%sbm-repository"
|
|
|
|
spacemacs-cache-directory))
|
|
|
|
(spacemacs|define-transient-state bm
|
|
|
|
:title "BM Transient State"
|
|
|
|
:doc "
|
|
|
|
Go to bookmark^^^^ Toggle^^ Other^^
|
|
|
|
──────────────^^^^───── ──────^^─────────────── ─────^^───
|
|
|
|
[_n_/_N_] next/previous [_t_] bookmark at point [_q_] quit"
|
|
|
|
:bindings
|
|
|
|
("q" nil :exit t)
|
|
|
|
;; Go to bookmark
|
|
|
|
("n" bm-next)
|
|
|
|
("N" bm-previous)
|
|
|
|
;; Toggle
|
|
|
|
("t" bm-toggle))
|
|
|
|
(evil-leader/set-key
|
2020-06-21 22:04:52 +00:00
|
|
|
"atb" 'spacemacs/bm-transient-state/body)
|
2017-03-29 07:21:15 +00:00
|
|
|
(advice-add 'spacemacs/bm-transient-state/body
|
|
|
|
:before #'bm-buffer-restore))
|
|
|
|
:config (progn
|
|
|
|
;; 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 #'(lambda nil
|
|
|
|
(bm-buffer-save-all)
|
|
|
|
(bm-repository-save)))
|
|
|
|
;; Restoring bookmarks
|
|
|
|
(add-hook 'find-file-hooks #'bm-buffer-restore)
|
|
|
|
;; Make sure bookmarks is saved before check-in (and revert-buffer)
|
|
|
|
(add-hook 'vc-before-checkin-hook #'bm-buffer-save))))
|