From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: [PATCH] More options in use of headlines as substitute for title field Date: Sat, 30 Apr 2011 09:03:37 -0400 Message-ID: <871v0janu4.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG9uY-0004FP-FQ for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 09:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QG9uX-0005UW-AU for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 09:08:38 -0400 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:60892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG9uX-0005US-70 for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 09:08:37 -0400 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id F0A1A217DC for ; Sat, 30 Apr 2011 09:08:36 -0400 (EDT) Received: from archdesk (67-197-161-170.dyn.comporium.net [67.197.161.170]) by mail.messagingengine.com (Postfix) with ESMTPSA id B027144B079 for ; Sat, 30 Apr 2011 09:08:36 -0400 (EDT) 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: Org Mode * 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. --- This patch consolidates the three patches for org-bibtex I sent last night. Please delete those patches from the patchwork server. Thanks! Matt lisp/org-bibtex.el | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el index f4614fb..8070755 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 @@ -289,7 +297,7 @@ IDs must be unique." (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)) @@ -329,7 +337,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 -- 1.7.5