all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-bibtex manual
@ 2023-07-15 22:59 Ypo
  2023-07-16 10:00 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Ypo @ 2023-07-15 22:59 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

Hi

I have been reading about org-bibtex, and I think the mail list were 
right when advised it to me 
(https://lists.gnu.org/archive/html/emacs-orgmode/2021-10/msg00621.html).

Now... I would like to start using it. I have seen it has a kind of 
org-capture template (M-x org-bibtex-create-in-current-entry).

If I wanted to add more properties:

- How should the different properties be named and filled to work correctly?

- Should the names of the properties be exactly like in Bibtex?

- Are there any existing org-capture templates with the properties each 
entry type could have? Or could you advise a manual of bibtex to create 
myself some complete templates?


Thanks!


[-- Attachment #2: Type: text/html, Size: 1613 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
  2023-07-15 22:59 Ypo
@ 2023-07-16 10:00 ` Ihor Radchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2023-07-16 10:00 UTC (permalink / raw)
  To: Ypo; +Cc: Org-mode

Ypo <ypuntot@gmail.com> writes:

> Now... I would like to start using it. I have seen it has a kind of 
> org-capture template (M-x org-bibtex-create-in-current-entry).
>
> If I wanted to add more properties:
>
> - How should the different properties be named and filled to work correctly?

In general, the types of properties are dictated by `org-bibtex-types',
which is declaring Bibtex standards. With C-u argument, you will be
asked for optional properties.

If you want to add non-standard properties, org-set-property will work.

> - Should the names of the properties be exactly like in Bibtex?

Yes. Either exact, or prefixed with `org-bibtex-prefix'. Mixing
with/without prefix will also work.

See also `org-bibtex-export-arbitrary-fields'.

> - Are there any existing org-capture templates with the properties each 
> entry type could have? Or could you advise a manual of bibtex to create 
> myself some complete templates?

You can create a template by adding `org-bibtex-create'
to :hook property of your capture template:

(setq org-capture-templates '(("a" "test" entry (file "/tmp/1.org") "" :hook org-bibtex-create)))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
@ 2023-07-16 20:19 Ypo
  2023-07-16 20:28 ` Ihor Radchenko
  2023-07-16 20:34 ` Ihor Radchenko
  0 siblings, 2 replies; 9+ messages in thread
From: Ypo @ 2023-07-16 20:19 UTC (permalink / raw)
  To: yantar92, Org-mode

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

Thanks, Ihor.

I would like to customize the name of the heading. I think it should be 
customized this function: "Org Bibtex Headline Format Function".

Is there a guide to do this?

I can see the default is:

#[257 "\300\x01\236A\207"
       [:title]
       3 "\n\n(fn ENTRY)"]


But I don't know how to customize it.

ChatGPT says:

"Unless you are an advanced Emacs Lisp developer and have a specific 
need to work with byte-compiled code, you generally don't need to 
interact with or modify this representation directly. Instead, you can 
work with the function using its regular name and definition."


And ChatGPT offers me this alternative, which doesn't seem to work (BTW, 
I am not able to install asoc.el):

#+begin_src emacs-lisp
(defun my-org-bibtex-headline-format (entry)
   "Custom function to generate the headline text for org-bibtex-write."
   (let* ((title (cdr (assoc :title entry)))
          (author (cdr (assoc :author entry))))
     (concat "Mi encabezado personalizado: " title " - " author)))

(setq org-bibtex-headline-format #'my-org-bibtex-headline-format)
#+end_src


Best regards

[-- Attachment #2: Type: text/html, Size: 2247 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
  2023-07-16 20:19 org-bibtex manual Ypo
@ 2023-07-16 20:28 ` Ihor Radchenko
  2023-07-25 10:53   ` Ihor Radchenko
  2023-07-16 20:34 ` Ihor Radchenko
  1 sibling, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2023-07-16 20:28 UTC (permalink / raw)
  To: Ypo; +Cc: Org-mode

Ypo <ypuntot@gmail.com> writes:

> I would like to customize the name of the heading. I think it should be 
> customized this function: "Org Bibtex Headline Format Function".
>
> Is there a guide to do this?
>
> I can see the default is:
>
> #[257 "\300.\236A\207"
>        [:title]
>        3 "\n\n(fn ENTRY)"]
>

That's a bit misleading because of compilation.
The original code is

(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 "26.1"
  :package-version '(Org . "9.1")
  :type 'function)

I should factor out that lambda into a separate readable function name,
like `org-bibtex-headline-from-title'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
  2023-07-16 20:19 org-bibtex manual Ypo
  2023-07-16 20:28 ` Ihor Radchenko
@ 2023-07-16 20:34 ` Ihor Radchenko
  1 sibling, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2023-07-16 20:34 UTC (permalink / raw)
  To: Ypo; +Cc: Org-mode

Ypo <ypuntot@gmail.com> writes:

> And ChatGPT offers me this alternative, which doesn't seem to work (BTW, 
> I am not able to install asoc.el):

You do not need asoc.el.. `assoc' is the built-in function.

> #+begin_src emacs-lisp
> (defun my-org-bibtex-headline-format (entry)
>    "Custom function to generate the headline text for org-bibtex-write."
>    (let* ((title (cdr (assoc :title entry)))
>           (author (cdr (assoc :author entry))))
>      (concat "Mi encabezado personalizado: " title " - " author)))
>
> (setq org-bibtex-headline-format #'my-org-bibtex-headline-format)
> #+end_src

This is correct, but this customization only works in
`org-bibtex-write', which works together with `org-bibtex-read-buffer' /
`org-bibtex-read-file'.

`org-bibtex-create' hard-codes heading to be the same with BiBTeX :title
field.

Yes, org-bibtex is not very polished.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
@ 2023-07-20 18:42 Ypo
  2023-07-20 19:00 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Ypo @ 2023-07-20 18:42 UTC (permalink / raw)
  To: yantar92, Org-mode

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

Hi Ihor.

Then, is it not possible to customize the entry generated with 
org-bibtex-create?

Bests


> >/#+begin_src emacs-lisp/
> >/(defun my-org-bibtex-headline-format (entry)/
> >/  "Custom function to generate the headline text for org-bibtex-write."/
> >/  (let* ((title (cdr (assoc :title entry)))/
> >/         (author (cdr (assoc :author entry))))/
> >/    (concat "Mi encabezado personalizado: " title " - " author)))/
> >
> >/(setq org-bibtex-headline-format #'my-org-bibtex-headline-format)/
> >/#+end_src/
>
> This is correct, but this customization only works in
> `org-bibtex-write', which works together with `org-bibtex-read-buffer' /
> `org-bibtex-read-file'.
>
> `org-bibtex-create' hard-codes heading to be the same with BiBTeX :title
> field.
>
> Yes, org-bibtex is not very polished.

[-- Attachment #2: Type: text/html, Size: 1222 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
  2023-07-20 18:42 Ypo
@ 2023-07-20 19:00 ` Ihor Radchenko
  2023-07-20 19:33   ` Ypo
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2023-07-20 19:00 UTC (permalink / raw)
  To: Ypo; +Cc: Org-mode

Ypo <ypuntot@gmail.com> writes:

> Then, is it not possible to customize the entry generated with 
> org-bibtex-create?

You mean fields?
Everything is defined in `org-bibtex-types', but it is not currently a defcustom.

I see no problem adding user types.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
  2023-07-20 19:00 ` Ihor Radchenko
@ 2023-07-20 19:33   ` Ypo
  0 siblings, 0 replies; 9+ messages in thread
From: Ypo @ 2023-07-20 19:33 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-mode

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

No, I mean customizing the generated headline. Instead of just title, to 
be like:

* Author (year) /Title/. Publisher

Bests

El 20/07/2023 a las 21:00, Ihor Radchenko escribió:
> Ypo<ypuntot@gmail.com>  writes:
>
>> Then, is it not possible to customize the entry generated with
>> org-bibtex-create?
> You mean fields?
> Everything is defined in `org-bibtex-types', but it is not currently a defcustom.
>
> I see no problem adding user types.
>

[-- Attachment #2: Type: text/html, Size: 1211 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-bibtex manual
  2023-07-16 20:28 ` Ihor Radchenko
@ 2023-07-25 10:53   ` Ihor Radchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2023-07-25 10:53 UTC (permalink / raw)
  To: Ypo; +Cc: Org-mode

Ihor Radchenko <yantar92@posteo.net> writes:

> I should factor out that lambda into a separate readable function name,
> like `org-bibtex-headline-from-title'.

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ac0042184

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-25 10:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-16 20:19 org-bibtex manual Ypo
2023-07-16 20:28 ` Ihor Radchenko
2023-07-25 10:53   ` Ihor Radchenko
2023-07-16 20:34 ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2023-07-20 18:42 Ypo
2023-07-20 19:00 ` Ihor Radchenko
2023-07-20 19:33   ` Ypo
2023-07-15 22:59 Ypo
2023-07-16 10:00 ` Ihor Radchenko

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.