This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+tools/bm/packages.el
syl20bnr ebe4c60264 Revert "Defer packages by default using use-package-always-defer"
This reverts commit 29c78ce841 and all other fixes
that have been made afterwards.

The motivation is that use-package is seen by many as a replacement for
`require`. Is use-package always defer the loading of packages then is breaks
this use case, this does not respect POLA so even if it was making Spacemacs
loading faster (up to 3s faster on some startup on my machine) we just cannot
use it, it would be irresponsible. Spacemacs should be easy to use, loading
performance will come with time but it is not a priority.
2018-03-03 23:40:10 -05:00

57 lines
2.3 KiB
EmacsLisp

;;; packages.el --- bm Layer packages File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Eugene "JAremko" Yaremenko <w3techplayground@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq bm-packages '(bm))
(defun bm/init-bm ()
"initializes bm-emacs and adds a key binding to `SPC f z'"
(use-package bm
:defer t
:commands (bm-buffer-restore)
:init (progn
;; Allow cross-buffer 'next'
(setq bm-cycle-all-buffers t)
;; save bookmarks
(setq-default bm-buffer-persistence t)
;; where to store persistant files
(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
"ab" 'spacemacs/bm-transient-state/body)
(advice-add 'spacemacs/bm-transient-state/body
:before #'bm-buffer-restore))
:config (progn
(bm-load-and-restore)
;; 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))))