From: Ihor Radchenko <yantar92@posteo.net>
To: Martin Kampas <martin.kampas@ubedi.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-bibtex-yank: Allow to populate existing item
Date: Sun, 18 Feb 2024 14:29:09 +0000 [thread overview]
Message-ID: <87frxpsv62.fsf@localhost> (raw)
In-Reply-To: <4868155.GXAFRqVoOG@gt1>
Martin Kampas <martin.kampas@ubedi.net> writes:
> The attached patch allows to use org-bibtex-yank to
> populate an existing item instead of creating a new one,
> aligning its behavior with org-bibtex-create.
Thanks!
> Subject: [PATCH] org-bibtex-yank: Allow to populate existing item
>
> Align with org-bibtex-create.
Please quote like `org-bibtex-create'. Here and in the rest of the
commit message. See https://orgmode.org/worg/org-contribute.html#orgfabdc17
> * lisp/ol-bibtex.el (org-bibtex-write): New optional argument nonew,
> similar to the existing nonew argument of org-bibtex-create
> * lisp/ol-bibtex.el (org-bibtex-yank): New optional argument nonew,
> similar to the existing nonew argument of org-bibtex-create
When adding new arguments, we need to announce the change in
etc/ORG_NEWS file. Also, in `org-bibtex-yank', you did not only add an
optional argument, but also modified its behavior with prefix argument.
Changes in prefix arguments should also be announced - they directly
affect all the users.
> -(defun org-bibtex-write (&optional noindent)
> +(defun org-bibtex-write (&optional noindent nonew)
> "Insert a heading built from the first element of `org-bibtex-entries'.
> When optional argument NOINDENT is non-nil, do not indent the properties
> -drawer."
> +drawer. If NONEW is t, add data to the headline of the entry at point."
In the code, you do not check for t, but for non-nil. So, please say
"non-nil" in the docstring as well.
Also, I'd prefer a more descriptive name, like update-heading. nonew is
ambiguous - it can be interpreted in several ways.
> -(defun org-bibtex-yank ()
> - "If kill ring holds a bibtex entry yank it as an Org headline."
> - (interactive)
> - (let (entry)
> +(defun org-bibtex-yank (&optional nonew)
> + "If kill ring holds a bibtex entry yank it as an Org headline.
> +If nonew is t, add data to the headline of the entry at point."
Same here. And please upcase NONEW to indicate that it is a function argument.
Also, document that NONEW is interpreted as interactive prefix argument:
When called with non-nil prefix argument NONEW, add data to the headline
of the entry at point.
> + (interactive "P")
> + (let (entry
> + (noindent nonew))
Why do you bind noindent here?
--
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>
next prev parent reply other threads:[~2024-02-18 12:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 12:50 [PATCH] org-bibtex-yank: Allow to populate existing item Martin Kampas
2024-02-18 14:29 ` Ihor Radchenko [this message]
2024-02-22 15:30 ` Martin Kampas
2024-02-25 8:58 ` Ihor Radchenko
2024-03-02 22:00 ` Martin Kampas
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frxpsv62.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=martin.kampas@ubedi.net \
/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 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.