[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32378: [PATCH] bibtex-next/previous-entry
From: |
Alex Branham |
Subject: |
bug#32378: [PATCH] bibtex-next/previous-entry |
Date: |
Mon, 06 Aug 2018 16:03:30 -0500 |
User-agent: |
mu4e 1.0; emacs 26.1 |
This patch adds two functions in bibtex-modeto navigate forward or
backward by entry.
I also bind them to M-{ and M-} because the paragraph forward/backward
commands in bibtex-mode just go up and down single lines, which you can
just use C-n/p to do more easily.
Let me know if something looks off.
Thanks,
Alex
---
>From 406d6d438f890adb03a77c1bc15096db68f13fa7 Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Mon, 6 Aug 2018 15:47:12 -0500
Subject: [PATCH] * lisp/textmodes/bibtex.el: New functions
bibtex-next/previous-entry
(bibtex-next-entry, bibtex-previous-entry): new functions.
(bibtex-mode-map): Bind to M-{/}, overriding forward/backward
paragraph, which only move single lines in bibtex-mode
---
etc/NEWS | 5 +++++
lisp/textmodes/bibtex.el | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index 21887f5bfd..a3c06a3cb5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -232,6 +232,11 @@ navigation and editing of large files.
* Changes in Specialized Modes and Packages in Emacs 27.1
++++
+** bibtex
+*** New commands bibtex-next-entry and bibtex-previous-entry
+They are bound to M-{ and M-} in bibtex-mode-map.
+
+++
** Dired
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 50a30cf6c3..966e774ae5 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1356,6 +1356,8 @@ bibtex-mode-map
;; The Key `C-c&' is reserved for reftex.el
(define-key km "\t" 'bibtex-find-text)
(define-key km "\n" 'bibtex-next-field)
+ (define-key km "\M-\}" 'bibtex-next-entry)
+ (define-key km "\M-\{" 'bibtex-previous-entry)
(define-key km "\M-\t" 'completion-at-point)
(define-key km "\C-c\"" 'bibtex-remove-delimiters)
(define-key km "\C-c{" 'bibtex-remove-delimiters)
@@ -1415,6 +1417,8 @@ bibtex-mode-map
("Moving inside an Entry"
["End of Field" bibtex-find-text t]
["Next Field" bibtex-next-field t]
+ ["Next entry" bibtex-next-entry t]
+ ["Previous entry" bibtex-previous-entry t]
["Beginning of Entry" bibtex-beginning-of-entry t]
["End of Entry" bibtex-end-of-entry t]
"--"
@@ -4452,6 +4456,20 @@ bibtex-next-field
(goto-char (match-beginning 0)))
(bibtex-find-text begin nil bibtex-help-message)))
+(defun bibtex-next-entry (&optional arg)
+ "Move point ARG entries forward."
+ (interactive "p")
+ (bibtex-end-of-entry)
+ (re-search-forward bibtex-entry-maybe-empty-head nil t (or arg 1))
+ (goto-char (match-beginning 0)))
+
+(defun bibtex-previous-entry (&optional arg)
+ "Move point ARG entries backward."
+ (interactive "p")
+ (bibtex-beginning-of-entry)
+ (re-search-backward bibtex-entry-maybe-empty-head nil t (or arg 1))
+ (goto-char (match-beginning 0)))
+
(defun bibtex-find-text (&optional begin noerror help comma)
"Move point to end of text of current BibTeX field or entry head.
With optional prefix BEGIN non-nil, move point to its beginning.
--
2.18.0
0001-lisp-textmodes-bibtex.el-New-functions-bibtex-next-p.patch
Description: Text Data
- bug#32378: [PATCH] bibtex-next/previous-entry,
Alex Branham <=
- bug#32378: [PATCH] bibtex-next/previous-entry, Noam Postavsky, 2018/08/06
- bug#32378: [PATCH] bibtex-next/previous-entry, Alex Branham, 2018/08/07
- bug#32378: [PATCH] bibtex-next/previous-entry, Noam Postavsky, 2018/08/12
- bug#32378: [PATCH] bibtex-next/previous-entry, Alex Branham, 2018/08/20
- bug#32378: [PATCH] bibtex-next/previous-entry, Noam Postavsky, 2018/08/20
- bug#32378: [PATCH] bibtex-next/previous-entry, Alex Branham, 2018/08/21
- bug#32378: [PATCH] bibtex-next/previous-entry, Alex Branham, 2018/08/21
- bug#32378: [PATCH] bibtex-next/previous-entry, Noam Postavsky, 2018/08/27
- bug#32378: [PATCH] bibtex-next/previous-entry, Eli Zaretskii, 2018/08/20
- bug#32378: [PATCH] bibtex-next/previous-entry, Alex Branham, 2018/08/21