From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id EGlqK0T40WWnEQEAqHPOHw:P1 (envelope-from ) for ; Sun, 18 Feb 2024 13:29:56 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id EGlqK0T40WWnEQEAqHPOHw (envelope-from ) for ; Sun, 18 Feb 2024 13:29:56 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=C8b4ma+V; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708259396; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+K2fWlRw/2IG0O2MPP7tco0r31aY2sokXglbLuIO+ng=; b=gWbhANb9gk1Jgj1PBd6kRSWtAbCar8L+VTheoYfTn4fu6g8mh7a0g5W/vmosRgSJGTVhJW vBdJlGL3x5arycP5hiO6DZTvbMke+4XK/Sv6WpW+dt4Z7DPjeTrSeuCiyB2qAm5dJKYjI+ wovg7/ZdyJS8GTEIXjf3UCh7UGobt4PKybiwwXgfxE5lJqjiti50AuAJwSoBn9bYdjaDbk VYluLTfVaIGlpS5SiwbeS1oE/ap21QFG+u0jl7jVRYbJlmRWpszBOKCH7zWWHkZJp8fHfb qpctbD42VTJUvAcfsNyP2T5UwFAYHQS6BIHxMIPAI9KceJLcQW7P74ldU9OFWw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=C8b4ma+V; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708259396; a=rsa-sha256; cv=none; b=STBc0rlHnX457CX4BoaRaiCDKf+JG+/PvUnE8wELCrkMAEbkjbXcVqG3EdO6NqS1wyrRvY qaJynDG2ir/9MwfeXcwElcHaoJxYZ6t1dAJ3blNpM3Wfbsx3mDsMUwS4OsBwzssJ5zmBzb K7OG1btDldOW5dkQXlUaKZTmWT4M/7Q3q3LT5FmTiYQLb0ja+ARpukBCj6fY8Hk1LLW45I uEh3urG1psbeLTh4fv8VIOVDpz7WhD4Lh0ESDz0s6IuMi3hGlrDp3mr1oJl9iH4pxoBH2s BtHRzTJDh40PlYy+GQihfwez13f8Q5WQzA5JSoVpX6SAlCHETIwhh5e1ZsyIwA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E90E4B018 for ; Sun, 18 Feb 2024 13:29:55 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbgI4-0005yQ-6l; Sun, 18 Feb 2024 07:29:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbgI2-0005yG-5O for emacs-orgmode@gnu.org; Sun, 18 Feb 2024 07:29:02 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbgHx-0005AW-Dx for emacs-orgmode@gnu.org; Sun, 18 Feb 2024 07:29:00 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5E9C1240029 for ; Sun, 18 Feb 2024 13:28:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708259335; bh=no6JkSwdOiPOXFLDGpj4Ej116SOZfeXCVEQdrQk2G/0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=C8b4ma+VU3bQ0P1GSsUOZ2SDG+Eh5Leo6eMHzNlZkHDHB8dVv0AohYpEUMYIy51w+ qCGLsyDgoFvyNNTfssnTHVaYjUzJpzqlEhMSK3q5P5g+60WWqz8nf3pMeqPGzA/4Xz 8AmAfek60MS6/+eEL/kbMFDESAnhalpLKsNwPYEhHKcnulsEZ2AbKebiet+p0Ss1Ge RJ9J3hjTn4CzAHjUg5kQVANDXHUODlrcnYavIRRwd9Ou3elbpFVRCvBtrBovEW7BXx ylEOx3DESswtqQ1GQbGdNTnzy50uMM6XZ7lnybr4r5Y6zNWdBmdk9ezwAySzekBW8R FwiOsYKhkjhbg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Td4j25LRDz6tvs; Sun, 18 Feb 2024 13:28:54 +0100 (CET) From: Ihor Radchenko To: Martin Kampas Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] org-bibtex-yank: Allow to populate existing item In-Reply-To: <4868155.GXAFRqVoOG@gt1> References: <4868155.GXAFRqVoOG@gt1> Date: Sun, 18 Feb 2024 14:29:09 +0000 Message-ID: <87frxpsv62.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -5.24 X-Spam-Score: -5.24 X-Migadu-Queue-Id: E90E4B018 X-TUID: 7+gX6Qut0N95 Martin Kampas 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 . Support Org development at , or support my work at