From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Stefan-W. Hahn" 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 Message-ID: <1395569771-32421-2-git-send-email-stefan.hahn@s-hahn.de> References: <20140221161702.GS7560@pille.home> <1395569771-32421-1-git-send-email-stefan.hahn@s-hahn.de> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRfSI-0008Jv-E3 for emacs-orgmode@gnu.org; Sun, 23 Mar 2014 06:16:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WRfSC-0008Qj-9w for emacs-orgmode@gnu.org; Sun, 23 Mar 2014 06:16:38 -0400 In-Reply-To: <1395569771-32421-1-git-send-email-stefan.hahn@s-hahn.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org, "Stefan-W. Hahn" * 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 --- 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