diff options
author | JSDurand <mmemmew@gmail.com> | 2021-09-13 13:54:59 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-09-13 13:54:59 +0800 |
commit | 73088977ad62c22ca7d6da693586764148b1e022 (patch) | |
tree | a119856a9223837a78129234e3ba97233bff0a2d /bookmark-conf.el | |
parent | 9f60b02c6e022af3852d91054ff107f533d1b011 (diff) |
Add configurations for my package blist
Just adding my custom groups and setting some custom variables.
Diffstat (limited to 'bookmark-conf.el')
-rw-r--r-- | bookmark-conf.el | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/bookmark-conf.el b/bookmark-conf.el new file mode 100644 index 0000000..aed305c --- /dev/null +++ b/bookmark-conf.el @@ -0,0 +1,111 @@ +;;; bookmark-conf.el --- My configurations for bookmark -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Durand + +;; Author: Durand <mmemmew@gmail.com> +;; Keywords: convenience + +;; 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 <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; My configurations for bookmarks. + +;;; Code: + +;; dependency of blist + +(use-package "ilist" 'ilist) + +(use-package "blist" 'blist) + +;;; Customizations + +;;;; Pseudo-expert? + +(setq blist-expert t) + +;;;; Discard empty groups + +(setq blist-discard-empty-p t) + +;;;; I love cycling + +(setq blist-movement-cycle t) + +;;;; Filter groups + +(setq + blist-filter-groups + (list + (cons "Eshell" #'blist-eshell-p) + (cons "Gnus" #'blist-gnus-p) + (cons "PDF" #'blist-pdf-p) + (cons "ELisp" #'blist-elisp-p) + (cons "Org" #'blist-org-p) + (cons "C" #'blist-c-p) + (cons "Default" #'blist-default-p))) + +;;; More bookmark groups + +;;;; Gnus group + +;; There seems to be only two GNUS bookmark handlers (or one?) +(blist-define-criterion "gnus" "Gnus" + (let ((handler (bookmark-get-handler bookmark))) + (memq handler (list #'gnus-summary-bookmark-jump + #'gnus-bookmark-jump)))) + +;;;; PDF group + +(blist-define-criterion "pdf" "PDF" + (eq (bookmark-get-handler bookmark) #'pdf-view-bookmark-jump-handler)) + +;;;; Org group + +(defvar org-directory) + +(blist-define-criterion "org" "Org" + (let ((location (blist-get-location bookmark))) + (or + (string-match-p + "\\.org$" location) + (and + (file-directory-p (or org-directory "/non-existing")) + (file-in-directory-p + location org-directory))))) + +;;;; C group + +(blist-define-criterion "c" "C" + ;; `rx' is a macro, so that we don't have to compute the regular + ;; expression every time we match a line. + (string-match-p + (rx + (or + (seq ".c" + (zero-or-one "pp") + eos) + (seq ".h" + (zero-or-one "pp") + eos))) + (blist-get-location bookmark))) + +;;;; ELisp group + +(blist-define-criterion "elisp" "ELisp" + (string-match-p "\\.el$" (blist-get-location bookmark))) + +(provide 'bookmark-conf) +;;; bookmark-conf.el ends here |