From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org, "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
Subject: [PATCH 1/5] org-bibtex.el (org-bibtex-read): Split in two functions for internal use
Date: Sun, 23 Mar 2014 11:16:07 +0100 [thread overview]
Message-ID: <1395569771-32421-2-git-send-email-stefan.hahn@s-hahn.de> (raw)
In-Reply-To: <1395569771-32421-1-git-send-email-stefan.hahn@s-hahn.de>
* org-bibtex.el (org-bibtex-read): Organize `org-bibtex-read' function
into two functions, so that it can be used by other functions without
storing the result in `org-bibtex-entries'.
TINY CHANGE
Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
---
lisp/org-bibtex.el | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index ed645e5..7a12c30 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -603,10 +603,9 @@ (defun org-bibtex-create-in-current-entry (&optional arg)
(interactive "P")
(org-bibtex-create arg t))
-(defun org-bibtex-read ()
+(defun org-bibtex-read-internal ()
"Read a bibtex entry and save to `org-bibtex-entries'.
This uses `bibtex-parse-entry'."
- (interactive)
(let ((keyword (lambda (str) (intern (concat ":" (downcase str)))))
(clean-space (lambda (str) (replace-regexp-in-string
"[[:space:]\n\r]+" " " str)))
@@ -617,16 +616,21 @@ (defun org-bibtex-read ()
(= (aref str 0) (car pair))
(= (aref str (1- (length str))) (cdr pair)))
(setf str (substring str 1 (1- (length str)))))) str)))
- (push (mapcar
- (lambda (pair)
- (cons (let ((field (funcall keyword (car pair))))
- (case field
- (:=type= :type)
- (:=key= :key)
- (otherwise field)))
- (funcall clean-space (funcall strip-delim (cdr pair)))))
- (save-excursion (bibtex-beginning-of-entry) (bibtex-parse-entry)))
- org-bibtex-entries)))
+ (mapcar
+ (lambda (pair)
+ (cons (let ((field (funcall keyword (car pair))))
+ (case field
+ (:=type= :type)
+ (:=key= :key)
+ (otherwise field)))
+ (funcall clean-space (funcall strip-delim (cdr pair)))))
+ (save-excursion (bibtex-beginning-of-entry) (bibtex-parse-entry)))))
+
+(defun org-bibtex-read ()
+ "Read a bibtex entry and save to `org-bibtex-entries'.
+This uses `bibtex-parse-entry'."
+ (interactive)
+ (push (org-bibtex-read-internal) org-bibtex-entries))
(defun org-bibtex-read-buffer (buffer)
"Read all bibtex entries in BUFFER and save to `org-bibtex-entries'.
--
1.8.3.2.733.gf8abaeb
next prev parent reply other threads:[~2014-03-23 10:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 16:17 Problem with org-bibtex-read with fields type, key Stefan-W. Hahn
2014-03-19 11:08 ` Bastien
2014-03-21 19:26 ` Stefan-W. Hahn
2014-03-21 22:02 ` Bastien
2014-03-23 10:16 ` [RFC] " Stefan-W. Hahn
2014-03-23 10:16 ` Stefan-W. Hahn [this message]
2014-03-23 10:16 ` [PATCH 2/5] org-bibtex.el: Use `org-bibtex-read-internal' in `org-bibtex-store-link' Stefan-W. Hahn
2014-03-23 10:16 ` [PATCH 3/5] org-bibtex.el: Replace double used fieldnames ":key" and ":byte" Stefan-W. Hahn
2014-03-23 10:16 ` [PATCH 4/5] org-bibtex.el: Change property names in `org-bibtex-store-link' API Stefan-W. Hahn
2014-03-23 10:16 ` [PATCH 5/5] org-bibtex.el: Clarifying description of `org-bibtex-type-property-name' Stefan-W. Hahn
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395569771-32421-2-git-send-email-stefan.hahn@s-hahn.de \
--to=stefan.hahn@s-hahn.de \
--cc=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).