emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Q: org-publish-project-alist and :exclude
@ 2024-05-05  0:47 David Masterson
  2024-05-05 12:30 ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: David Masterson @ 2024-05-05  0:47 UTC (permalink / raw)
  To: emacs-orgmode

In the Org Mode manual section 14.1.3, it says that ":exclude" takes a
regular expression of filenames to exclude from publishing but it
doesn't really explain what the regular expression format is (I assume
Elisp regex).  I have two Org files that I want to exclude:

* calendar-beorg.org
* init.org

So I have this form:

  :exclude "\(init\|calendar-beorg\).org"

but that doesn't seem to work as I get an ignorable error in processing
calendar-beorg.org (a known Beorg issue).

Is my regex wrong?

-- 
David Masterson


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

* Re: Q: org-publish-project-alist and :exclude
  2024-05-05  0:47 Q: org-publish-project-alist and :exclude David Masterson
@ 2024-05-05 12:30 ` Ihor Radchenko
  2024-05-06  5:34   ` David Masterson
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2024-05-05 12:30 UTC (permalink / raw)
  To: David Masterson; +Cc: emacs-orgmode

David Masterson <dsmasterson@gmail.com> writes:

> So I have this form:
>
>   :exclude "\(init\|calendar-beorg\).org"
>
> but that doesn't seem to work as I get an ignorable error in processing
> calendar-beorg.org (a known Beorg issue).
>
> Is my regex wrong?

Yes. You got to escape the \ inside string.
I recommend using `rx' instead to avoid the backslash hell.

-- 
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] 8+ messages in thread

* Re: Q: org-publish-project-alist and :exclude
  2024-05-05 12:30 ` Ihor Radchenko
@ 2024-05-06  5:34   ` David Masterson
  2024-05-07  0:42     ` David Masterson
  0 siblings, 1 reply; 8+ messages in thread
From: David Masterson @ 2024-05-06  5:34 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> David Masterson <dsmasterson@gmail.com> writes:
>
>> So I have this form:
>>
>>   :exclude "\(init\|calendar-beorg\).org"
>>
>> but that doesn't seem to work as I get an ignorable error in processing
>> calendar-beorg.org (a known Beorg issue).
>>
>> Is my regex wrong?
>
> Yes. You got to escape the \ inside string.
> I recommend using `rx' instead to avoid the backslash hell.

Thanks, I didn't know about `rx'.

-- 
David Masterson


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

* Re: Q: org-publish-project-alist and :exclude
  2024-05-06  5:34   ` David Masterson
@ 2024-05-07  0:42     ` David Masterson
  2024-05-07  9:22       ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: David Masterson @ 2024-05-07  0:42 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

David Masterson <dsmasterson@gmail.com> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> David Masterson <dsmasterson@gmail.com> writes:
>>
>>> So I have this form:
>>>
>>>   :exclude "\(init\|calendar-beorg\).org"
>>>
>>> but that doesn't seem to work as I get an ignorable error in processing
>>> calendar-beorg.org (a known Beorg issue).
>>>
>>> Is my regex wrong?
>>
>> Yes. You got to escape the \ inside string.
>> I recommend using `rx' instead to avoid the backslash hell.
>
> Thanks, I didn't know about `rx'.

Hmm.  Couldn't get rx (or rx-to-string) to work for me.  Kept getting an
error that a stringp was expected for the argument to :exclude. I tried
variations on:

  :exclude (rx-to-string (seq (or "init" "calendar-beorg") ".org"))

Reverted to using a simple regex as above with proper escapes.  Can I
suggest making the complex example in 14.3.2 of the Org Manual use a
better example regex (in rx form?) as a hint to what :exclude can do?

-- 
David Masterson


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

* Re: Q: org-publish-project-alist and :exclude
  2024-05-07  0:42     ` David Masterson
@ 2024-05-07  9:22       ` Ihor Radchenko
  2024-05-08  0:38         ` David Masterson
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2024-05-07  9:22 UTC (permalink / raw)
  To: David Masterson; +Cc: emacs-orgmode

David Masterson <dsmasterson@gmail.com> writes:

> Hmm.  Couldn't get rx (or rx-to-string) to work for me.  Kept getting an
> error that a stringp was expected for the argument to :exclude. I tried
> variations on:
>
>   :exclude (rx-to-string (seq (or "init" "calendar-beorg") ".org"))

When you have '(:foo bar :baz eet), nothing inside is evaluated because
of the quote. To evaluate expressions selectively, use backquote:

`(:foo bar:baz ,(concat "foo" "bar"))

> Reverted to using a simple regex as above with proper escapes.  Can I
> suggest making the complex example in 14.3.2 of the Org Manual use a
> better example regex (in rx form?) as a hint to what :exclude can do?

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

-- 
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] 8+ messages in thread

* Re: Q: org-publish-project-alist and :exclude
  2024-05-07  9:22       ` Ihor Radchenko
@ 2024-05-08  0:38         ` David Masterson
  2024-05-08 21:06           ` David Masterson
  0 siblings, 1 reply; 8+ messages in thread
From: David Masterson @ 2024-05-08  0:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> David Masterson <dsmasterson@gmail.com> writes:
>
>> Hmm.  Couldn't get rx (or rx-to-string) to work for me.  Kept getting an
>> error that a stringp was expected for the argument to :exclude. I tried
>> variations on:
>>
>>   :exclude (rx-to-string (seq (or "init" "calendar-beorg") ".org"))
>
> When you have '(:foo bar :baz eet), nothing inside is evaluated because
> of the quote. To evaluate expressions selectively, use backquote:
>
> `(:foo bar:baz ,(concat "foo" "bar"))

I always had trouble with '"` in hacking Elisp.  I should've studied the
language more 40 years ago... :(

>> Reverted to using a simple regex as above with proper escapes.  Can I
>> suggest making the complex example in 14.3.2 of the Org Manual use a
>> better example regex (in rx form?) as a hint to what :exclude can do?
>
> Sure.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=773bba92a

Perfect.
-- 
David Masterson


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

* Re: Q: org-publish-project-alist and :exclude
  2024-05-08  0:38         ` David Masterson
@ 2024-05-08 21:06           ` David Masterson
  2024-05-12 15:47             ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: David Masterson @ 2024-05-08 21:06 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

David Masterson <dsmasterson@gmail.com> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> David Masterson <dsmasterson@gmail.com> writes:
>>
>>> Hmm.  Couldn't get rx (or rx-to-string) to work for me.  Kept getting an
>>> error that a stringp was expected for the argument to :exclude. I tried
>>> variations on:
>>>
>>>   :exclude (rx-to-string (seq (or "init" "calendar-beorg") ".org"))
>>
>> When you have '(:foo bar :baz eet), nothing inside is evaluated because
>> of the quote. To evaluate expressions selectively, use backquote:
>>
>> `(:foo bar:baz ,(concat "foo" "bar"))
>
> I always had trouble with '"` in hacking Elisp.  I should've studied the
> language more 40 years ago... :(
>
>>> Reverted to using a simple regex as above with proper escapes.  Can I
>>> suggest making the complex example in 14.3.2 of the Org Manual use a
>>> better example regex (in rx form?) as a hint to what :exclude can do?
>>
>> Sure.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=773bba92a
>
> Perfect.

I spoke too soon -- I'm still getting the same error about expecting a
string.  You mentioned '`' above, but use ',' in your manual diff.  I
tried both (along with rx-to-string).  

-- 
David Masterson


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

* Re: Q: org-publish-project-alist and :exclude
  2024-05-08 21:06           ` David Masterson
@ 2024-05-12 15:47             ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2024-05-12 15:47 UTC (permalink / raw)
  To: David Masterson; +Cc: emacs-orgmode

David Masterson <dsmasterson@gmail.com> writes:

>>> When you have '(:foo bar :baz eet), nothing inside is evaluated because
>>> of the quote. To evaluate expressions selectively, use backquote:
>>>
>>> `(:foo bar:baz ,(concat "foo" "bar"))
> ...
> I spoke too soon -- I'm still getting the same error about expecting a
> string.  You mentioned '`' above, but use ',' in your manual diff.  I
> tried both (along with rx-to-string).  

Check out https://www.gnu.org/software/emacs/manual/html_node/elisp/Backquote.html

-- 
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] 8+ messages in thread

end of thread, other threads:[~2024-05-12 15:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-05  0:47 Q: org-publish-project-alist and :exclude David Masterson
2024-05-05 12:30 ` Ihor Radchenko
2024-05-06  5:34   ` David Masterson
2024-05-07  0:42     ` David Masterson
2024-05-07  9:22       ` Ihor Radchenko
2024-05-08  0:38         ` David Masterson
2024-05-08 21:06           ` David Masterson
2024-05-12 15:47             ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).