From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] org-bibtex.el: Make headline format costomizable Date: Sat, 03 Dec 2016 08:59:32 +0100 Message-ID: <87inr1cujf.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cD5EK-0002ne-DE for emacs-orgmode@gnu.org; Sat, 03 Dec 2016 02:59:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD5EJ-0004fD-I5 for emacs-orgmode@gnu.org; Sat, 03 Dec 2016 02:59:32 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:58108) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cD5EJ-0004f7-Bg for emacs-orgmode@gnu.org; Sat, 03 Dec 2016 02:59:31 -0500 In-Reply-To: (Eric Danan's message of "Thu, 24 Nov 2016 22:22:17 +0100") 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" To: Eric Danan Cc: emacs-orgmode@gnu.org Hello, Eric Danan writes: > When adding an org-bibtex entry with `org-bibtex-write' (or any > command relying on it), the headline is the title. The patch below > simply makes the headline customizable through a new variable. Thank you. > If you find it worth to incorporate this into org-bibtex I should > probably add a dosctring for the new variable Yes, please. Also, an entry in ORG-NEWS is welcome. > `org-bibtex-headline-format' and I would also have a few questions: > 1. Should I name this variable differently? Indeed. It should indicate it represents a function: `org-bibltex-headline-format-function' is better, IMO, since a "format" could be a format string. > 2. Should I use `defcustom' instead of `defvar'? Correct. Mind the :version and :package-version keywords. > 3. Should I move the `defvar' / `defcustom' at the beginning of the file? Yes. > 4. In the default value of the variable should I make use of the `val' > function that is let-bound inside `org-bibtex-write'? I think the default value is fine. Another option is to create a new `org-bibtex-headline-default' function and bound the variable to that. > +(defvar org-bibtex-headline-format > + (lambda (entry) > + (cdr (assoc :title entry)))) Nitpick `assoc' -> `assq' Regards, -- Nicolas Goaziou