summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Lundin <mdl@imapmail.org>2011-04-30 18:03:37 +0000
committerEric Schulte <schulte.eric@gmail.com>2011-05-02 11:22:27 -0600
commit3c148beeb7e2ab4031a5bd6d9515df0200dfb7bb (patch)
tree1310820f66847577ae0eafc695a4a22396eabd90
parent54aa9eb6c07a4dae943f312bed2120f2fdfa2230 (diff)
downloadorg-mode-3c148beeb7e2ab4031a5bd6d9515df0200dfb7bb.tar.gz
More options in use of headlines as substitute for title field
* lisp/org-bibtex.el (org-bibtex-treat-headline-as-title): New defcustom. (org-bibtex-headline): Only use headline text (not TODO or other metadata) to generate title field and auto key. (org-bibtex-fleshout): Allow user to choose whether to treat headline as title.
-rw-r--r--lisp/org-bibtex.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 311a25d..ba243fe 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -223,6 +223,14 @@ For example setting to 'BIB_' would allow interoperability with fireforg."
:group 'org-bibtex
:type 'string)
+(defcustom org-bibtex-treat-headline-as-title t
+ "Treat headline text as title if title property is absent.
+If an entry is missing a title property, use the headline text as
+the property. If this value is t, `org-bibtex-check` will ignore
+a missing title field."
+ :group 'org-bibtex
+ :type 'boolean)
+
(defcustom org-bibtex-export-arbitrary-fields nil
"When converting to bibtex allow fields not defined in `org-bibtex-fields'.
This only has effect if org-bibtex-prefix is defined, so as to
@@ -324,7 +332,7 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
(lambda (field)
(let ((value (or (org-bibtex-get (from field))
(and (equal :title field)
- (org-get-heading)))))
+ (nth 4 (org-heading-components))))))
(when value (cons (from field) value))))
(flatten
(val :required (val (to type) org-bibtex-types))
@@ -379,7 +387,9 @@ With optional argument OPTIONAL, also prompt for optional fields."
(keyword (name) (intern (concat ":" (downcase name))))
(name (keyword) (upcase (substring (symbol-name keyword) 1))))
(dolist (field (append
- (remove :title (val :required (val type org-bibtex-types)))
+ (if org-bibtex-treat-headline-as-title
+ (remove :title (val :required (val type org-bibtex-types)))
+ (val :required (val type org-bibtex-types)))
(when optional (val :optional (val type org-bibtex-types)))))
(when (consp field) ; or'd pair of fields e.g., (:editor :author)
(let ((present (first (remove nil