emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Eric Danan <eric.danan@u-cergy.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-bibtex.el: Make headline format costomizable
Date: Sat, 03 Dec 2016 08:59:32 +0100	[thread overview]
Message-ID: <87inr1cujf.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAMBH+RZJ1UwTP0qVFbpAdawKEBwK3qnfarme4wS2uqCUNcbr4g@mail.gmail.com> (Eric Danan's message of "Thu, 24 Nov 2016 22:22:17 +0100")

Hello,

Eric Danan <eric.danan@u-cergy.fr> 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

  reply	other threads:[~2016-12-03  7:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24 21:22 [PATCH] org-bibtex.el: Make headline format costomizable Eric Danan
2016-12-03  7:59 ` Nicolas Goaziou [this message]
2016-12-07 21:20   ` Eric Danan
2016-12-09 20:48     ` Nicolas Goaziou
2016-12-09 22:11       ` Eric Danan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87inr1cujf.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.danan@u-cergy.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).