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.