summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Danan <eric.danan@u-cergy.fr>2016-12-09 21:44:06 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-12-09 21:44:06 +0100
commit9e80c64d79bb06f7f65167bbe19cf79682cc1bc4 (patch)
treebdcb2e427568911b290cbe999c3b3b21d0ca9099
parentf184ee9d2d3ea5b409679d1b96ba281987e88096 (diff)
downloadorg-mode-9e80c64d79bb06f7f65167bbe19cf79682cc1bc4.tar.gz
New `org-bibtex-headline-format-function'
* lisp/org-bibtex.el (org-bibtex-write): Make this function read the headline format from the newly created variable `org-bibtex-headline-format-function' instead of systematically using the entry title. (org-bibtex-headline-format-function): Create this variable to hold a function of one argument, the entry alist, and return the string to be inserted as headline. The default value replicates the current behavior of returning the entry title. TINYCHANGE
-rw-r--r--etc/ORG-NEWS2
-rw-r--r--lisp/org-bibtex.el13
2 files changed, 14 insertions, 1 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 78f28cb..30d5115 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -82,6 +82,8 @@ Where clue > 0
,#+END_SRC
#+end_example
+*** New variable : ~org-bibtex-headline-format-function~
+This allow to use a different title than entry title.
*** Horizontal rules are no longer ignored in LaTeX table math mode
** Removed options
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index db5d97b..598c11e 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -237,6 +237,17 @@ a missing title field."
:version "24.1"
:type 'boolean)
+(defcustom org-bibtex-headline-format-function
+ (lambda (entry) (cdr (assq :title entry)))
+ "Function returning the headline text for `org-bibtex-write'.
+It should take a single argument, the bibtex entry (an alist as
+returned by `org-bibtex-read'). The default value simply returns
+the entry title."
+ :group 'org-bibtex
+ :version "25.2"
+ :package-version '(Org . "9.1")
+ :type 'function)
+
(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
@@ -678,7 +689,7 @@ Return the number of saved entries."
(val (lambda (field) (cdr (assoc field entry))))
(togtag (lambda (tag) (org-toggle-tag tag 'on))))
(org-insert-heading)
- (insert (funcall val :title))
+ (insert (funcall org-bibtex-headline-format-function entry))
(org-bibtex-put "TITLE" (funcall val :title))
(org-bibtex-put org-bibtex-type-property-name
(downcase (funcall val :type)))