From: Alex Branham <alex.branham@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 32378@debbugs.gnu.org
Subject: bug#32378: [PATCH] bibtex-next/previous-entry
Date: Mon, 20 Aug 2018 14:23:58 -0500 [thread overview]
Message-ID: <87efesyh81.fsf@gmail.com> (raw)
In-Reply-To: <87a7prwki1.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3094 bytes --]
On Sun 12 Aug 2018 at 12:41, Noam Postavsky <npostavs@gmail.com> wrote:
> Would it make sense to use [remap forward-paragraph] and [remap
> backward-paragraph] instead of "\M-\}" and "\M-\{"? (I guess the
> question is how "paragraph-like" are these movement commands)
Yes, that probably makes sense. Revised patch attached.
Thanks!
Alex
---
From d329f0c7465e7c8d66b918eb984be6863a895544 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 a9f8ed2ef8..2145983afa 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -255,6 +255,11 @@ navigation and editing of large files.
\f
* 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..fccaed7cac 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 [remap forward-paragraph] 'bibtex-next-entry)
+ (define-key km [remap backward-paragraph] '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)
+ (when (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)
+ (when (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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-textmodes-bibtex.el-New-functions-bibtex-next-p.patch --]
[-- Type: text/x-patch, Size: 2745 bytes --]
From d329f0c7465e7c8d66b918eb984be6863a895544 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 a9f8ed2ef8..2145983afa 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -255,6 +255,11 @@ navigation and editing of large files.
\f
* 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..fccaed7cac 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 [remap forward-paragraph] 'bibtex-next-entry)
+ (define-key km [remap backward-paragraph] '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)
+ (when (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)
+ (when (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
next prev parent reply other threads:[~2018-08-20 19:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-06 21:03 bug#32378: [PATCH] bibtex-next/previous-entry Alex Branham
2018-08-07 2:15 ` Noam Postavsky
2018-08-07 13:03 ` Alex Branham
2018-08-12 17:41 ` Noam Postavsky
2018-08-20 19:23 ` Alex Branham [this message]
2018-08-21 0:47 ` Noam Postavsky
2018-08-21 15:19 ` Alex Branham
2018-08-21 15:21 ` Alex Branham
2018-08-27 23:56 ` Noam Postavsky
2018-08-21 2:28 ` Eli Zaretskii
2018-08-21 15:23 ` Alex Branham
2018-08-21 16:09 ` Eli Zaretskii
2018-08-07 9:19 ` Basil L. Contovounesios
2018-08-07 13:07 ` Alex Branham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87efesyh81.fsf@gmail.com \
--to=alex.branham@gmail.com \
--cc=32378@debbugs.gnu.org \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.