;;; bookmark-conf.el --- My configurations for bookmark -*- lexical-binding: t; -*- ;; Copyright (C) 2021 Durand ;; Author: Durand ;; 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 . ;;; 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 "PDF" #'blist-pdf-p) (cons "Eshell" #'blist-eshell-p) (cons "ELisp" #'blist-elisp-p) (cons "Gnus" #'blist-gnus-p) (cons "EWW" #'blist-eww-p) (cons "Info" #'blist-info-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" (memq (bookmark-get-handler bookmark) (list #'gnus-summary-bookmark-jump #'gnus-bookmark-jump))) ;;;; EWW group (blist-define-criterion "eww" "EWW" (eq (bookmark-get-handler bookmark) #'durand-eww-bookmark-jump)) ;;;; Info group (blist-define-criterion "info" "Info" (eq (bookmark-get-handler bookmark) #'Info-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