From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wlj2HY4VeF+NLAAA0tVLHw (envelope-from ) for ; Sat, 03 Oct 2020 06:09:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yARCGY4VeF+pJwAAB5/wlQ (envelope-from ) for ; Sat, 03 Oct 2020 06:09:18 +0000 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 8B7159402DA for ; Sat, 3 Oct 2020 06:09:17 +0000 (UTC) Received: from localhost ([::1]:33514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOajL-0004x8-OQ for larch@yhetil.org; Sat, 03 Oct 2020 02:09:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOaiP-0004wz-Cb for emacs-orgmode@gnu.org; Sat, 03 Oct 2020 02:08:17 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:51749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOaiM-0003TX-Nu for emacs-orgmode@gnu.org; Sat, 03 Oct 2020 02:08:16 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id ABDEC7E412; Sat, 3 Oct 2020 02:08:10 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=6TlPFHaP7sBryrOhJMiW/XvsdX0=; b=QANGCO 9JwvMnDZ/91eVQHIHvr2vGjvhyxZMyUcfACLiOXkbSYOewukEJWfGDEHsrPC56D2 IdAqjXM/jGbIDXFTmhZKlufkXhdEHrv30G4LtcDgC09uoRr3Awemi8h6IdHa9j4d th5wvvQUaWHIup91+BrsZFy3V+jBB+ABeDqPQ= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id A32B77E411; Sat, 3 Oct 2020 02:08:10 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=8bt2EwrzlXw8PQig8K9slRtNTVWb7teNiS7W4fKvzxY=; b=hAE+YierMtz+nILwBb5p+I8BqAMmrOS7rghQElo7QreJ2CsTSSOTzDYtgTRr9oierYodtYJj4TmaOxvbDSoX1lYWuBkW7Bc8ZdeSzOUgPxdARbZ5HKopfrvhW7cdPjUN+T7olSw+Dio28+vFsZDYHszRrlP5SvERZ4GePnLR1yY= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 229927E410; Sat, 3 Oct 2020 02:08:10 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Matt Huszagh Subject: Re: [PATCH] Omit file description when :file-desc has nil value In-Reply-To: <878scs2rpg.fsf@gmail.com> References: <87r1rf35bb.fsf@kyleam.com> <87pn6uzq41.fsf@gmail.com> <877dsv3r1w.fsf@gmail.com> <87a6xfvjck.fsf@kyleam.com> <87eemrzokq.fsf@gmail.com> <874knmvkmx.fsf@kyleam.com> <878scs2rpg.fsf@gmail.com> Date: Sat, 03 Oct 2020 02:08:09 -0400 Message-ID: <87a6x3kfjq.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: D00DCF2C-053E-11EB-BE98-01D9BED8090B-24757444!pb-smtp1.pobox.com Received-SPF: pass client-ip=64.147.108.70; envelope-from=kyle@kyleam.com; helo=pb-smtp1.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/03 02:08:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emacs-Orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=QANGCO 9; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=hAE+Yier; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: Qvxk5/Jly/bx Matt Huszagh writes: > Subject: [PATCH] list/ob-core.el: Allow passing empty vector to :file-desc to > omit description s/list/lisp/ > diff --git a/doc/org-manual.org b/doc/org-manual.org > index e7d25b90e..a790f3225 100644 > --- a/doc/org-manual.org > +++ b/doc/org-manual.org > @@ -17482,10 +17482,12 @@ default behavior is to automatically determine the result type. > #+end_example > > #+cindex: @samp{file-desc}, header argument > - The =file-desc= header argument defines the description (see > - [[*Link Format]]) for the link. If =file-desc= is present but has no value, > + The =file-desc= header argument defines the description (see [[*Link > + Format]]) for the link. If =file-desc= is present but has no value, > the =file= value is used as the link description. When this > - argument is not present, the description is omitted. > + argument is not present, the description is omitted. If you want to > + provide the =file-disc= argument but omit the description, you can s/file-disc/file-desc/ > + provide it with an empty vector (i.e., :file-desc []). > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS > index 5dc68cba4..19f6af288 100644 > --- a/etc/ORG-NEWS > +++ b/etc/ORG-NEWS > @@ -24,8 +24,19 @@ Earlier, IDs generated using =ts= method had a hard-coded format (i.e. =20200923 > The new option allows user to customise the format. > Defaults are unchanged. > > +*** New argument for ~file-desc~ babel header [...] > ** New features > -*** =ob-python= improvements to =:return= header argument > +*** =ob-python= improvements to =:return= header argument This space change is touching unrelated code. > The =:return= header argument in =ob-python= now works for session > blocks as well as non-session blocks. Also, it now works with the > diff --git a/lisp/ob-core.el b/lisp/ob-core.el > index 7300f239e..075e3f928 100644 > --- a/lisp/ob-core.el > +++ b/lisp/ob-core.el > @@ -646,6 +646,14 @@ a list with the following pattern: > (replace-regexp-in-string > (org-src-coderef-regexp coderef) "" expand nil nil 1)))) > > +(defun org-babel--file-desc (params result) > + "Retrieve file description." > + (pcase (assq :file-desc params) > + (`nil nil) All right, so this is the no header case... > + (`(:file-desc) result) ...this is for when org-babel-read maps the value to nil... > + (`(:file-desc . ,(and (pred stringp) val)) val) ...and when org-babel-read maps it to a string... > + (`(:file-desc . []) nil))) ...and this the explicit vector. Operationally any value that org-babel-read doesn't map to nil or a string leads to nil. The pcase expression then could be reduced to (pcase (assq :file-desc params) (`(:file-desc) result) (`(:file-desc . ,(and (pred stringp) val)) val)) However, I'm okay with it as is, particularly the [] arm, because I think it helps readability wise to explicitly spell out the documented case. So, with the typo/spurious space change clean-ups, this looks good to me. IIRC from a previous thread, you haven't yet completed the copyright paperwork. Is that the case? Thanks.