help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Biblatex section navigator


From: Emanuel Berg
Subject: Biblatex section navigator
Date: Thu, 21 Mar 2019 23:40:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

I just wrote this [source yanked last] to
navigate a Biblatex file organized with section
names as comments.

The functions should be bound to keys for it to
make sense tho, otherwise it'll just be
unbearably slow to use. So for example, I have
C-M-k for "bibtex-next-section" and C-M-i for
"bibtex-prev-section".

Here is a Biblatex book list [1] for you to
test it on, with section marks that match the
regexp in the source. (Easter egg: Note the
Elisp snippet on line 8 which when evaluated
echoes the number of items!)

Comments and improvements as always welcome.


[1] http://user.it.uu.se/~embe8573/books/books.bib


All my Biblatex stuff (including this addition
on line 31):

    http://user.it.uu.se/~embe8573/emacs-init/my-bibtex.el


Source:

;;;; SECTION

(defvar bibtex-section-mark)
(setq bibtex-section-mark "^%%%%")

(defun bibtex-next-section ()
  (interactive)
  (when (looking-at bibtex-section-mark) (forward-char 1))
  (unless
      (when (search-forward-regexp bibtex-section-mark (point-max) t)
        (goto-char (match-beginning 0) )
        (recenter)
        t)
    (forward-char -1) ))

(defun bibtex-prev-section ()
  (interactive)
  (when (search-backward-regexp bibtex-section-mark (point-min) t)
    (goto-char (match-beginning 0) )
    (recenter) ))

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]