summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-09-20 09:20:53 -0600
committerEric Schulte <schulte.eric@gmail.com>2011-09-20 09:20:53 -0600
commit4fbefd87aa6ce30e6d6bc7c115c9b59042ed02f0 (patch)
treedf012c6f68cb3054e70ffbd944127e9663215d73
parent94c0f143dd2631c61e5c276378aa4ccbb1ce96ef (diff)
downloadorg-mode-4fbefd87aa6ce30e6d6bc7c115c9b59042ed02f0.tar.gz
configurable property name for bibtex entry types
* lisp/org-bibtex.el (org-bibtex-type-property-name): Configurable property name for bibtex entry types. (org-bibtex-headline): Use new configurable property name. (org-bibtex-check): Use new configurable property name. (org-bibtex-create): Use new configurable property name. (org-bibtex-write): Use new configurable property name.
-rw-r--r--lisp/org-bibtex.el34
1 files changed, 23 insertions, 11 deletions
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 8d3a5c0..6d6bc1c 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -274,6 +274,11 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
:group 'org-bibtex
:type '(repeat :tag "Tag" (string)))
+(defcustom org-bibtex-type-property-name "btype"
+ "Property in which to store bibtex entry type (e.g., article)."
+ :group 'org-bibtex
+ :type 'string)
+
;;; Utility functions
(defun org-bibtex-get (property)
@@ -305,7 +310,7 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
lsts))))
(let ((notes (buffer-string))
(id (org-bibtex-get org-bibtex-key-property))
- (type (org-bibtex-get "type"))
+ (type (org-bibtex-get org-bibtex-type-property-name))
(tags (when org-bibtex-tags-are-keywords
(delq nil
(mapcar
@@ -319,16 +324,20 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
(let ((entry (format
"@%s{%s,\n%s\n}\n" type id
(mapconcat
- (lambda (pair) (format " %s={%s}" (car pair) (cdr pair)))
+ (lambda (pair)
+ (format " %s={%s}" (car pair) (cdr pair)))
(remove nil
(if (and org-bibtex-export-arbitrary-fields
org-bibtex-prefix)
(mapcar
(lambda (kv)
(let ((key (car kv)) (val (cdr kv)))
- (when (and (string-match org-bibtex-prefix key)
- (not (string=
- (downcase (concat org-bibtex-prefix "TYPE")) (downcase key))))
+ (when (and
+ (string-match org-bibtex-prefix key)
+ (not (string=
+ (downcase (concat org-bibtex-prefix
+ org-bibtex-type-property-name))
+ (downcase key))))
(cons (downcase (replace-regexp-in-string
org-bibtex-prefix "" key))
val))))
@@ -527,7 +536,7 @@ With prefix argument OPTIONAL also prompt for optional fields."
(save-restriction
(org-narrow-to-subtree)
(let ((type ((lambda (name) (when name (intern (concat ":" name))))
- (org-bibtex-get "TYPE"))))
+ (org-bibtex-get org-bibtex-type-property-name))))
(when type (org-bibtex-fleshout type optional)))))
(defun org-bibtex-check-all (&optional optional)
@@ -544,7 +553,8 @@ If nonew is t, add data to the headline of the entry at point."
"Type: " (mapcar (lambda (type)
(substring (symbol-name (car type)) 1))
org-bibtex-types)
- nil nil (when nonew (org-bibtex-get "TYPE"))))
+ nil nil (when nonew
+ (org-bibtex-get org-bibtex-type-property-name))))
(type (if (keywordp type) type (intern (concat ":" type))))
(org-bibtex-treat-headline-as-title (if nonew nil t)))
(unless (assoc type org-bibtex-types)
@@ -555,7 +565,8 @@ If nonew is t, add data to the headline of the entry at point."
(let ((title (org-bibtex-ask :title)))
(insert title)
(org-bibtex-put "TITLE" title)))
- (org-bibtex-put "TYPE" (substring (symbol-name type) 1))
+ (org-bibtex-put org-bibtex-type-property-name
+ (substring (symbol-name type) 1))
(org-bibtex-fleshout type arg)
(mapc (lambda (tag) (org-toggle-tag tag 'on)) org-bibtex-tags)))
@@ -600,7 +611,7 @@ This uses `bibtex-parse-entry'."
(org-insert-heading)
(insert (val :title))
(org-bibtex-put "TITLE" (val :title))
- (org-bibtex-put "TYPE" (downcase (val :type)))
+ (org-bibtex-put org-bibtex-type-property-name (downcase (val :type)))
(dolist (pair entry)
(case (car pair)
(:title nil)
@@ -639,8 +650,9 @@ This function relies `org-search-view' to locate results."
(let ((org-agenda-overriding-header "Bib search results:")
(org-agenda-search-view-always-boolean t))
(org-search-view nil
- (format "%s +{:%sTYPE:}"
- string org-bibtex-prefix))))
+ (format "%s +{:%s%s:}"
+ string org-bibtex-prefix
+ org-bibtex-type-property-name))))
(provide 'org-bibtex)