Re: [BUG] Hang on latex preview [9.7-pre (release_9.6.7-661-g34ee6f @ /home/csj7701/.emacs.d/straight/build/org/)]

2023-08-23 Thread Christian
Following your suggestion, I am able to preview the latex snippets 
without any issue.
I also tried removing org-fragtog from my config and previewing 
manually; I still get an org-element-cache error. I haven't yet 
seen emacs hang without org-fragtog, but I suspect that that is 
just because the latex previews are happening less frequently 
because I'm triggering them manually. Not sure.  
Ihor Radchenko  writes:



Project  writes:


 I take class notes using latex. I
use org-fragtog to automatically
 preview inline latex snippets as I type. My org documents are 
 usually


full of small snippets of latex:
 —
 E.G.:
 



Basic Addition


$5+5 = 5\(
 ---
 Lately, whenever I write a new latex snippet and move my 
 cursor outside

 the two dollar
signs, instead of rendering the latex, my entire emacs
 instance hangs. I then have to run "pkill emacs",
restart the daemon, go
 back in and run "recover-this-file" to continue my work.


Thanks for the report!
Does the problem happen if you run emacs without your config and 
toggle

latex preview? (emacs -Q)




Re: [RFC] Quoting property names in tag/property matches [Was: [BUG?] Matching tags: & operator no more implicit between tags and special property]

2023-08-23 Thread Jens Schmidt
On 2023-08-23  16:00, Jens Schmidt wrote:

> Given the property name syntax in
> 
>   https://orgmode.org/worg/org-syntax.html#Node_Properties
> 
> the subre in `org-make-tags-matcher' to match property names
> should then look similar to
> 
>   "\\(?5:[[:alnum:]_]+\\|:[^[:space:]]+?:\\)"
> 
> , right (colons being stripped off later)?  I'm really asking
> about the trailing plus signs here, but these do not seem to
> make sense in property queries.

Yet another edge-case: In the Org syntax definition a property
name is really delimited by a "colon-whitespace" sequence.  This
takes out the ambiguity whether a property name is defined
non-greedily

  :[^[:space:]]+?:

or greedily

  :[^[:space:]]+:

I'm too lazy right now to think about the consequences, but I
hope this makes a difference only for really weird property
matches, like this:

  :foo:=1+:bar:=2

This would be parsed non-greedily as

  FOO == 1 && BAR == 2

or greedily as

  FOO:=1+:BAR == 2

I'd go for non-greedily defined property names.



Re: [BUG] Hang on latex preview [9.7-pre (release_9.6.7-661-g34ee6f @ /home/csj7701/.emacs.d/straight/build/org/)]

2023-08-23 Thread Ihor Radchenko
Christian  writes:

> Following your suggestion, I am able to preview the latex snippets 
> without any issue.
> I also tried removing org-fragtog from my config and previewing 
> manually; I still get an org-element-cache error. I haven't yet 
> seen emacs hang without org-fragtog, but I suspect that that is 
> just because the latex previews are happening less frequently 
> because I'm triggering them manually. Not sure.  

You can try to re-install org-fragtog. Just in case - we had some issues
with recent Org main + compiled packages.

What if you also load org-fragtog by adding it to /tmp/bug.el?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: org-element: headline's :title is sometimes string, sometimes list

2023-08-23 Thread Hraban Luyat
Thank you Ihor.

On 8/23/23 5:49 AM, Ihor Radchenko wrote:
> Hraban Luyat  writes:
>
>> I expect: "string" everywhere.
>>
>> I get:
>>
>>   Headline title from map is of type: cons
>>   Headline title from context is of type: string
>>   Headline title from at-point is of type: string
>>
>> Question 1: Do you know what that `cons' structure is? Where is it
>> documented, how would I go about figuring this out myself? The
>> org-element API documentation is daunting.
> This is "anonymous element". `org-element-parse-buffer', by default,
> parses down to object level:
>
> * Heading *bold* text
>
> contains bold markup, which is reflected in the parsed AST. The title
> itself is called secondary value, which may contain Org markup.
>
> You are not getting it using `org-element-at-point' API because it does
> not parse objects and simply returns a heading parsed down to element
> level - :title is not parsed in details.
>
>> Question 2: how do I reliably get the title as a string? Properties are
>> fine, I don't mind, but that weird list structure is awkward to handle.
> Use `org-element-interpret-data' to convert Org AST back to plain text.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 




How to solve "Warning (emacs): Please update the LaTeX src-block-backend to listings"

2023-08-23 Thread Guillaume MULLER

Hi,

I'm trying to create a code block with some latex code to be interpreted 
inside. I only knew lstlistings until now. Page 
https://orgmode.org/manual/Source-blocks-in-LaTeX-export.html lists Engraved 
and Minted as possible backend. 
https://list.orgmode.org/87wnf1z1w8@gmail.com/T/ also lists verbatim.

So from what I understand, of the message "Warning (emacs): Please update the LaTeX 
src-block-backend to listings", is that the default backend is not lstlistings and 
that there is a variable somewhere that should be set to lstlistings.

However I cannot find any documentation on what variable and where to set it. Is the 
variable indeed called "src-block-backend". Is it set in global Emacs config? 
Locally in the org file?

I tried to eval (setq src-block-backend 'listings) and (setq org-latex-listings 
t) . But error is still there.


Any idea?

--
Guillaume MULLER
Associate Professor, PhD
Fayol Institue - ISI Department
 #426
☎ 04 77 42 02 71
 https://www.mines-stetienne.fr
留= Physical Address =
  Espace Fauriel
  29 Rue Pierre et Dominique Ponchardier
  42100 Saint-Étienne
 = Postal Address =
  École des Mines de Saint-Étienne
  158 cours Fauriel
  42100 Saint-Étienne


OpenPGP_0xF3BCAD9F46F5FADC.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: org-cite: how to force a reparsing of the .bib file

2023-08-23 Thread Leo Butler
On Wed, Aug 23 2023, Ihor Radchenko  wrote:

> Leo Butler  writes:
>
>> Does org-cite monitor contents or the timestamp?
>> I am using a symlink to the bib file.
>
> Timestamp.
>
> Does the attached patch fix the problem?

Thanks, Ihor.

To avoid an unneeded setq, I applied the patch:

  (dolist (file (mapcar #'file-truename (org-cite-list-bibliography-files)))

This caused the bibtex file to be re-parsed when I changed it.

Best,
Leo

>
> From 39b503301fc7a3ea68733dfd9e4391e3f84efec8 Mon Sep 17 00:00:00 2001
> Message-ID: 
> <39b503301fc7a3ea68733dfd9e4391e3f84efec8.1692781998.git.yanta...@posteo.net>
> From: Ihor Radchenko 
> Date: Wed, 23 Aug 2023 12:12:13 +0300
> Subject: [PATCH] oc-basic: Fix detecting changes in symlinked bibliography
>
> * lisp/oc-basic.el (org-cite-basic--parse-bibliography): Use
> `file-truename' to follow symlinks first before checking bibliography
> file change times.
>
> Reported-by: Leo Butler 
> Link: https://orgmode.org/list/877cpmkds1@t14.reltub.ca
> ---
>  lisp/oc-basic.el | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
> index 84d9492ea..c4468e5a8 100644
> --- a/lisp/oc-basic.el
> +++ b/lisp/oc-basic.el
> @@ -272,6 +272,9 @@ (defun org-cite-basic--parse-bibliography ( info)
>(plist-get info :cite-basic/bibliography)
>  (let ((results nil))
>(dolist (file (org-cite-list-bibliography-files))
> +;; Follow symlinks, to look into modification time of the
> +;; actual file, not its symlink.
> +(setq file (file-truename file))
>  (when (file-readable-p file)
>(with-temp-buffer
>  (when (or (org-file-has-changed-p file)
> -- 
> 2.41.0


Re: [RFC] Quoting property names in tag/property matches [Was: [BUG?] Matching tags: & operator no more implicit between tags and special property]

2023-08-23 Thread Jens Schmidt
> On 2023-08-23  12:31, Ihor Radchenko wrote:
> 
>> Jens, we got an edge case with "-", after all.
>>
>> What is happening here is that the new parser
>> (https://orgmode.org/list/9132e58f-d89e-f7df-bbe4-43d53a236...@vodafonemail.de)
>> treats the above match string as
>>
>> property "tag-TODO" not equal "TODO"
>>
>> instead of
>>
>> not tag equal "tag" and not TODO equal "TODO"

Right.  And you already provided in the other branch of this
discussion a direction how to resolve that:

> [...] In case of ambiguity TAG1-TAG2-TAG3-PROP="" like we see here, we
> should prefer multiple shorter conditions: TAG1 && -TAG2 && -TAG3 && PROP=""
> 
> When "TAG1-TAG2" is an actual tag name with dash, we may allow escaping.

But I'd like to clarify that.  From the Org syntax

  https://orgmode.org/worg/org-syntax.html#Headings

I understood that tag names cannot contain minus characters,
and `org-tag-re' does not match any, either.  So we are talking
about property names only, right?  At least I'll do so in the
following ...


Then the question is what quoting scheme to use for property
names.  The previous one used before my commit f689eb4

  (A) "\\-" => "-"

never has been documented and never has been working properly,
since the *matching* of these was done on *prop* names, but
the *unescaping* on *tag* names.  So we are basically free to
come up with something new.

Some obvious choice would be a simpler single backslash

  (B) "\-" => "-"

And when I have been "fixing" the parser, I also thought that

  (C) ":...:" => "..."

would give a nice and somewhat logical quoting scheme.  That is,
if a property name contains "special" characters, it could be
surrounded by colons to quote these.

So we have so far quoting schemes A, B, C, with my preference
being C.  Any other proposals?


I'll focus on C, where there is one big cave-at:  The main
regexp in `org-make-tags-matcher' also allows for (undocumented)
colons as inclusive search term separator:

  ;; exclusion and inclusion (the latter being implicit)
  "\\(?1:[-+:]\\)?"
^
   
Which collides with the colons used by quoting scheme C.  I'd
rather sacrifice that use of colon as search term separator,
TBH.

Given the property name syntax in

  https://orgmode.org/worg/org-syntax.html#Node_Properties

the subre in `org-make-tags-matcher' to match property names
should then look similar to

  "\\(?5:[[:alnum:]_]+\\|:[^[:space:]]+?:\\)"

, right (colons being stripped off later)?  I'm really asking
about the trailing plus signs here, but these do not seem to
make sense in property queries.


What do you think?




Re: org-element--cache: Warning(izt.org): Got element without parent (cache active?: t)

2023-08-23 Thread Gregor Zattler
Hi Ihor,
* Ihor Radchenko  [2023-08-23; 10:53 GMT]:
> Gregor Zattler  writes:
>>  ■  Warning (org-element-cache): org-element--cache: Warning(izt.org): Got 
>> element without parent (cache active?: t). Please report it to Org mode 
>> mailing list (M-x org-submit-bug-report).
>> (node-property (:standard-properties [326858 326875 nil nil 0 326858 nil t 
>> nil nil nil node-property element nil # nil nil nil] :key 
>> "VISIBILITY" :value "all"))
>> Backtrace:
>>   org-element-cache diagnostics(izt.org): Added new element with nil key: 
>> "(keyword
>> ...
> May you try to reproduce the problem starting from emacs -Q, reducing
> your Org file to some small file that can be shared?

that happened when org-mode generated my agenda, there
are four rather big org-mode files involved.  Is it
sufficent to try to reproduce with izt.org only, which
is mentioned in the warning?

I tried just now, but there was no warning and since
the warning I changed the file.  Especially I did
org-link and resolved all problems...

Next time I will save the file immediately for
inspection.

Ciao; Gregor 



Re: [Pre-PATCH v2] Add the capability to specify lexical scope in tangled files (was: Add new :lexical header argument)

2023-08-23 Thread Ihor Radchenko
Ihor Radchenko  writes:

> What about generalizing the idea and providing a way to set Emacs
> buffer-local variables in the tangled files?
>
> Can be something like:
>
> #+begin_src elisp :file-locals (lexical-binding t eval (line-number-mode))

Over one month have passed since the last message in this thread.

Evgenii, are you still interested to continue working on this?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Wider margins on text, but no margins on tables?

2023-08-23 Thread Ihor Radchenko
William Denton  writes:

> But for tables it can be a problem because sometimes I have a table that i 
> want 
> as wide as possible.  Is there a way to have tables fit inside the 
> margin-width 
> settings until they get too wide, then expand out?  That way a small table 
> isn't 
> flush left, but a big one is.

No easy way, AFAIK. You may probably hook into
`window-size-change-functions' to calculate margins dynamically. See
`olivetti-mode' for an example how to use this hook.

> Or perhaps there is a way to set Org tables to have margin-widths of 0, so it 
> would be:  narrowed paragraph, narrowed paragraph, table flush left, narrowed 
> paragraph.

AFAIK, window margins are set for the whole window. They are fixed. The
best you can do it creating artificial margins by setting paragraph
line-prefix/wrap-prefix property + 
https://codeberg.org/joostkremers/visual-fill-column

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: org-element--cache: Warning(izt.org): Got element without parent (cache active?: t)

2023-08-23 Thread Ihor Radchenko
Gregor Zattler  writes:

> Dear Ihow, I caught another org-element-cache warning.
> I started Emacs (after having problems with a botched
> configuration, which in turn uses babel...) and called
> the agenda like so:
>
>   (defun gz/org-agenda-list ()
> "Show Org Agenda starting yesterday."
> (interactive)
> (org-agenda-list 0 "-1d")
> (beginning-of-buffer)
> (org-agenda-goto-today))
>
> and then I got this (see below).

Thanks for reporting!

>  ■  Warning (org-element-cache): org-element--cache: Warning(izt.org): Got 
> element without parent (cache active?: t). Please report it to Org mode 
> mailing list (M-x org-submit-bug-report).
> (node-property (:standard-properties [326858 326875 nil nil 0 326858 nil t 
> nil nil nil node-property element nil # nil nil nil] :key 
> "VISIBILITY" :value "all"))
> Backtrace:
>   org-element-cache diagnostics(izt.org): Added new element with nil key: 
> "(keyword
> ...

This is very strange. The error originates from a check in
`org-element--cache-verify-element' that only triggers when cache is
enabled, but I do not see node-property being recorded in the cache. I
am not sure how this could ever be possible.

May you try to reproduce the problem starting from emacs -Q, reducing
your Org file to some small file that can be shared?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG?] Matching tags: & operator no more implicit between tags and special property

2023-08-23 Thread Jens Schmidt
On 2023-08-23  12:31, Ihor Radchenko wrote:

> Jens, we got an edge case with "-", after all.
> 
> What is happening here is that the new parser
> (https://orgmode.org/list/9132e58f-d89e-f7df-bbe4-43d53a236...@vodafonemail.de)
> treats the above match string as
> 
> property "tag-TODO" not equal "TODO"
> 
> instead of
> 
> not tag equal "tag" and not TODO equal "TODO"

Mails crossing.  Let's continue your thread after some cool down.




Re: [BUG?] Matching tags: & operator no more implicit between tags and special property

2023-08-23 Thread Ihor Radchenko
Jens Schmidt  writes:

> OTOH, the unquoting ("\\-") that has been in place before above commit
> was broken, which might serve as a hint that few to none actually use
> minus signs in property names, at least not in queries.
>
> Ihor, WDYT?  I can (with the necessary delay to allow for proper
> testing) revert to some sort of quoting in property names which would
> allow for Samuel's use case again.

Agree. In case of ambiguity TAG1-TAG2-TAG3-PROP="" like we see here, we
should prefer multiple shorter conditions: TAG1 && -TAG2 && -TAG3 && PROP=""

When "TAG1-TAG2" is an actual tag name with dash, we may allow escaping.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG?] Matching tags: & operator no more implicit between tags and special property

2023-08-23 Thread Ihor Radchenko
Samuel Loury  writes:

> The following tags query used to implicitly behave as a AND
> "-tag-TODO=\"TODO\"".
>
> It does not anymore.

Thanks for reporting!
Confirmed.

Jens, we got an edge case with "-", after all.

What is happening here is that the new parser
(https://orgmode.org/list/9132e58f-d89e-f7df-bbe4-43d53a236...@vodafonemail.de)
treats the above match string as

property "tag-TODO" not equal "TODO"

instead of

not tag equal "tag" and not TODO equal "TODO"

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG?] Matching tags: & operator no more implicit between tags and special property

2023-08-23 Thread Jens Schmidt
Thanks for the detailed report!

On 2023-08-23  09:57, Samuel Loury wrote:

> The following tags query used to implicitly behave as a AND
> "-tag-TODO=\"TODO\"".

> Before commit f689eb44f175fbbdc4e8ef0ad6f5201b10863438, this showed only
> "nothing", as expected.

That was my short-sighted attempt to allow for unquoted minus signs
in property names, and your query right now matches all entries having
a property "tag-TODO" different from "TODO".  TBH, I didn't think
about your use case, where two negations are concatenated directly
after each other.

OTOH, the unquoting ("\\-") that has been in place before above commit
was broken, which might serve as a hint that few to none actually use
minus signs in property names, at least not in queries.

Ihor, WDYT?  I can (with the necessary delay to allow for proper
testing) revert to some sort of quoting in property names which would
allow for Samuel's use case again.



Re: [PATCH] Raise gc-cons-threshold for org-element-cache-map

2023-08-23 Thread Ihor Radchenko
Allen Li  writes:

> Attached patch, I think it's self-explanatory so the commit message is
> reproduced here:
>
> org-element: Raise gc-cons-threshold for org-element-cache-map

Thanks!
Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c905565fa

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



org-element--cache: Warning(izt.org): Got element without parent (cache active?: t)

2023-08-23 Thread Gregor Zattler
Dear Ihow, I caught another org-element-cache warning.
I started Emacs (after having problems with a botched
configuration, which in turn uses babel...) and called
the agenda like so:

  (defun gz/org-agenda-list ()
"Show Org Agenda starting yesterday."
(interactive)
(org-agenda-list 0 "-1d")
(beginning-of-buffer)
(org-agenda-goto-today))

and then I got this (see below).  This is with

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, cairo version 1.16.0) of 
2023-08-22
Org mode version 9.7-pre (release_9.6.7-721-g53c9d9 @ 
/home/grfz/src/org-mode/lisp/)

Thanks for speeding up org-mode, Gregor


 ■  Warning (org-element-cache): org-element--cache: Warning(izt.org): Got 
element without parent (cache active?: t). Please report it to Org mode mailing 
list (M-x org-submit-bug-report).
(node-property (:standard-properties [326858 326875 nil nil 0 326858 nil t nil 
nil nil node-property element nil # nil nil nil] :key 
"VISIBILITY" :value "all"))
Backtrace:
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [328278 328278 nil nil 328301 1 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"FILETAGS\" :value 
\":izt:job:\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [328148 328148 nil nil 328278 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"SEQ_TODO\" :value 
\"TODO(t) INPROGRESS(i@/@) WAITING(w@/@) VERIFY(v@/@) | DONE(d@/@) 
DELEGATED(D@/@) CANCELLED(c@/@) PUTOFF(p@/@) IDEA(I)\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [328117 328117 nil nil 328148 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"COLUMNS\" :value 
\"%45ITEM %18DEADLINE\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(paragraph (:standard-properties [328101 328101 328101 328117 328117 0 nil nil 
element nil nil nil nil nil # nil nil nil]))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [328073 328073 nil nil 328101 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"STARTUP\" :value 
\"lognoteclock-out\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [328048 328048 nil nil 328073 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"STARTUP\" :value 
\"lognoterepeat\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [328025 328025 nil nil 328048 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"STARTUP\" :value 
\"lognotedone\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(paragraph (:standard-properties [327998 327998 327998 328025 328025 0 nil nil 
element nil nil nil nil nil # nil nil nil]))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [327975 327975 nil nil 327998 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"STARTUP\" :value 
\"show3levels\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(paragraph (:standard-properties [327954 327954 327954 327975 327975 0 nil nil 
element nil nil nil nil nil # nil nil nil]))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [327939 327939 nil nil 327954 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"STARTUP\" :value 
\"odd\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(keyword (:standard-properties [327918 327918 nil nil 327939 0 nil nil element 
nil nil nil nil nil # nil nil nil] :key \"STARTUP\" :value 
\"hidestars\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(example-block (:standard-properties [327025 327025 nil nil 327918 3 nil nil 
element nil nil nil nil nil # nil nil nil] :value 
[org-element-deferred org-element--unescape-substring (16 876) nil] :switches 
nil :number-lines nil :preserve-indent nil :retain-labels t :use-labels t 
:label-fmt nil))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(drawer (:standard-properties [326881 326881 326891 327017 327025 0 nil nil 
element nil nil nil nil nil # nil nil nil] :drawer-name 
\"LOGBOOK\"))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(property-drawer (:standard-properties [326797 326797 326810 326875 326881 0 
nil planning element nil nil nil nil nil # nil nil nil]))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(section (:standard-properties [326797 326797 326797 328914 328914 0 nil 
section element nil nil 326797 328914 nil # nil nil nil]))"
  org-element-cache diagnostics(izt.org): Added new element with nil key: 
"(headline (:standard-properties [326755 326755 326797 328914 328914 0 

Re: org-element: headline's :title is sometimes string, sometimes list

2023-08-23 Thread Ihor Radchenko
Hraban Luyat  writes:

> I expect: "string" everywhere.
>
> I get:
>
>  Headline title from map is of type: cons
>  Headline title from context is of type: string
>  Headline title from at-point is of type: string
>
> Question 1: Do you know what that `cons' structure is? Where is it 
> documented, how would I go about figuring this out myself? The 
> org-element API documentation is daunting.

This is "anonymous element". `org-element-parse-buffer', by default,
parses down to object level:

* Heading *bold* text

contains bold markup, which is reflected in the parsed AST. The title
itself is called secondary value, which may contain Org markup.

You are not getting it using `org-element-at-point' API because it does
not parse objects and simply returns a heading parsed down to element
level - :title is not parsed in details.

> Question 2: how do I reliably get the title as a string? Properties are 
> fine, I don't mind, but that weird list structure is awkward to handle.

Use `org-element-interpret-data' to convert Org AST back to plain text.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [patch] Fix inner smart quotes in French

2023-08-23 Thread Ihor Radchenko
Bastien Guerry  writes:

> From the same quick look, I believe `org-export-dictionary' contains
> more entries than other variables--we could use languages names from 
> this variable.
>
> WDYT?

Agree. We can factor out the language names into a separate constant and
then use that constant as a source of "canonical" language names in
:type definitions of defcustom. Then, we can turn all the other
dictionary variables into defcustoms.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [POLL] Should we accept breaking changes to get rid of Org libraries that perform side effects when loading?

2023-08-23 Thread Ihor Radchenko
Bastien Guerry  writes:

> "Fraga, Eric"  writes:
>
>> I'll chime in regarding inlinetasks: I used to use these *a lot* but I
>> found that drawers do what I needed in almost all cases very
>> effectively (for my use cases).
>
> It resonates with my experience too and I suspect (and kinda hope)
> many inlinetasks users will feel the same once they use drawers.

My personal use case is when using Org for authoring long texts.
I often leave inline tasks around the specific paragraph I need to
revise in future:

* Section XX




<...>

* TODO Consider explaining more about X


<...>

Then, I can easily review the manuscript status using sparse tree or
agenda view.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: org-cite: how to force a reparsing of the .bib file

2023-08-23 Thread Ihor Radchenko
Leo Butler  writes:

> Does org-cite monitor contents or the timestamp?
> I am using a symlink to the bib file.

Timestamp.

Does the attached patch fix the problem?

>From 39b503301fc7a3ea68733dfd9e4391e3f84efec8 Mon Sep 17 00:00:00 2001
Message-ID: <39b503301fc7a3ea68733dfd9e4391e3f84efec8.1692781998.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Wed, 23 Aug 2023 12:12:13 +0300
Subject: [PATCH] oc-basic: Fix detecting changes in symlinked bibliography

* lisp/oc-basic.el (org-cite-basic--parse-bibliography): Use
`file-truename' to follow symlinks first before checking bibliography
file change times.

Reported-by: Leo Butler 
Link: https://orgmode.org/list/877cpmkds1@t14.reltub.ca
---
 lisp/oc-basic.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 84d9492ea..c4468e5a8 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -272,6 +272,9 @@ (defun org-cite-basic--parse-bibliography ( info)
   (plist-get info :cite-basic/bibliography)
 (let ((results nil))
   (dolist (file (org-cite-list-bibliography-files))
+;; Follow symlinks, to look into modification time of the
+;; actual file, not its symlink.
+(setq file (file-truename file))
 (when (file-readable-p file)
   (with-temp-buffer
 (when (or (org-file-has-changed-p file)
-- 
2.41.0



-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 


Re: [BUG] Bulk scattering breaks when logging rescheduling [9.7 (9.7-??-6eb773053 @ /home/shortcut/.emacs.d/.local/straight/build-28.1/org/)]

2023-08-23 Thread Ihor Radchenko
spookygos...@gmail.com writes:

> Bulk scattering agenda items when the user wants to log reschedules does not 
> work. 
>
> Steps to reproduce: 
> 1. Set `org-log-reschedule' to the value `"time"'

Should value 'note.
Confirmed.

The proper fix is re-writing note taking system to use recursive edit.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[BUG?] Matching tags: & operator no more implicit between tags and special property

2023-08-23 Thread Samuel Loury
Hi. I've been using org-mode as PKMS for 13 years. Thanks for that
awesome tool.

After upgrading on main yesterday, I realized a change of behavior. I'm
not sure whether it is a bug or not.

The following tags query used to implicitly behave as a AND
"-tag-TODO=\"TODO\"".

It does not anymore.

To reproduce this, simply use the following content.

```
* TODO todo and tag  :tag:
* TODO simply todo
* nothing
* only tag  :tag:
```

And run the following code.

`(org-tags-view nil "-tag-todo=\"TODO\"")`

Before commit f689eb44f175fbbdc4e8ef0ad6f5201b10863438, this showed only
"nothing", as expected.

Now, it shows all the entries.

To get back to the old behavior, I need to explicitly add the boolean
operator & in between.

I attached the code of the example in this mail.

Hope that this bug report is useful.


tag-match-implicit-and.tar.xz
Description: application/xz
-- 
Konubinix
GPG Key: 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A


signature.asc
Description: PGP signature


Re: [BUG] Warning when creating preview

2023-08-23 Thread Ihor Radchenko
Edgar Lux  writes:

> * Steps to reproduce
>
> 1. Type this equation
>
>#+begin_quote
>\begin{gather}
>t = 0
>\end{gather}
>#+end_quote
>
> 2. Ask for preview =C-c C-x C-l= with point on the equation
>
> 3. Ask to remove preview (without moving point) =C-c C-x C-l=
>
> 4. You get the message (below)

I cannot get the message on my side.

I did (using Emacs 28 and also Emacs master):

1. Save the equation to file /tmp/bug.org
2. Save your `setq' snippet to /tmp/bug.el
3. cd /path/to/org/repo
4. make repro REPRO_ARGS="-l /tmp/bug.el /tmp/bug.org"
5. Move point to "t = 0" line
6. C-c C-x C-l (2x)
7. The preview appears and then disappears, as expected.

May you please repeat my steps and let me know if your are seeing the warning?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] Hang on latex preview [9.7-pre (release_9.6.7-661-g34ee6f @ /home/csj7701/.emacs.d/straight/build/org/)]

2023-08-23 Thread Ihor Radchenko
Project  writes:

>  I take class notes using latex. I
> use org-fragtog to automatically
>  preview inline latex snippets as I type. My org documents are usually
> 
> full of small snippets of latex:
>  —
>  E.G.:
>  
> 
> 
> Basic Addition
> 
> 
> $5+5 = 5\(
>  ---
>  Lately, whenever I write a new latex snippet and move my cursor outside
>  the two dollar
> signs, instead of rendering the latex, my entire emacs
>  instance hangs. I then have to run "pkill emacs",
> restart the daemon, go
>  back in and run "recover-this-file" to continue my work.

Thanks for the report!
Does the problem happen if you run emacs without your config and toggle
latex preview? (emacs -Q)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] bug fix with inline figure generated by org-octave [9.7-pre (release_9.6.7-662-gb89bc5)]

2023-08-23 Thread Ihor Radchenko
Shervin Safavi  writes:

> In "ob-octave.el" line 94, instead of
>
> (format "print -dpng %S\nans=%S" gfx-file gfx-file))
>
> should be
>
> (format "print -dpng %s" gfx-file))
>
> otherwise, the figure is not saved (and thus an empty inline figure will
> appear).

Thanks for the report and for the suggestion!
May you please explain us a bit why having ans=filename is a problem?
Looking at
https://docs.octave.org/v5.2.0/Printing-and-Saving-Plots.html, it should
be enough to call print.

> I already test it with MATLAB and can confirm it.
>
> By the way, it is my first bug report/fix for org-mode, so apologies if
> I miss something in my report.

It would be nice to provide an example demonstrating the problem.
Sometimes, what happens on your machine may not happen for other people.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[PATCH] Raise gc-cons-threshold for org-element-cache-map

2023-08-23 Thread Allen Li
Attached patch, I think it's self-explanatory so the commit message is
reproduced here:

org-element: Raise gc-cons-threshold for org-element-cache-map

This garbage collects many times when calling
org-get-buffer-tags (such as during tag completion) in a large file
with many tags.  Raise gc-cons-threshold as this may affect other
callers in large files.

Note that org-element-parse-buffer also raises gc-cons-threshold as a
precedent.

This has no effect on most callers and increases performance for
extreme cases.
From 01e06d90f27b8204e69508351b7fca9c03e7af32 Mon Sep 17 00:00:00 2001
From: Allen Li 
Date: Wed, 23 Aug 2023 00:22:06 -0700
Subject: [PATCH] org-element: Raise gc-cons-threshold for
 org-element-cache-map

This garbage collects many times when calling
org-get-buffer-tags (such as during tag completion) in a large file
with many tags.  Raise gc-cons-threshold as this may affect other
callers in large files.

Note that org-element-parse-buffer also raises gc-cons-threshold as a
precedent.

This has no effect on most callers and increases performance for
extreme cases.

* lisp/org-element.el (org-element-cache-map): Raise gc-cons-threshold.
---
 lisp/org-element.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index b2c5b0402..694a4f43f 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -7568,7 +7568,8 @@ the cache."
   (let ((mk (make-marker)))
 (set-marker mk to-pos)
 (setq to-pos mk)))
-(let (;; Bind variables used inside loop to avoid memory
+(let ((gc-cons-threshold #x4000)
+  ;; Bind variables used inside loop to avoid memory
   ;; re-allocation on every iteration.
   ;; See https://emacsconf.org/2021/talks/faster/
   tmpnext-start tmpparent tmpelement)
-- 
2.41.0



#2 [[bbb:OrgMeetup]] on Wed, Sep 13, 19:00 UTC+3

2023-08-23 Thread Ihor Radchenko
Dear all,

The last meetup [1] turned out quite successful. Let's continue.

[1] https://list.orgmode.org/877cq38gdt.fsf@localhost/ (meetup notes)

URL: https://bbb.emacsverse.org/b/iho-h7r-qg8-led
Time & Date: <2023-09-13 Wed 19:00-21:00 @+03,Europe/Istanbul>
The room will be open half an hour before the official start.

During the meetup, we can:

- Give advice to new users
- Showcase Org configs or workflows
- Demo/discuss interesting packages
- Troubleshoot each-other's issues
- Discuss "Org mode" section of Emacs news (https://sachachua.com/blog/)
- Discuss anything else Org-related

Everyone is free to join the discussion/chat or lurk around silently,
listening.

We will _not_ do any recording by default.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[PATCH] Fix docstring of `org-at-timestamp-p'

2023-08-23 Thread Liu Hui
Hi,

I find that the doc string of `org-at-timestamp-p' about match groups
is not consistent with the behavior. The doc string says

When matching, the match groups are the following:
  group 1: year, if any
  group 2: month, if any
  group 3: day number, if any
  group 4: day name, if any
  group 5: hours, if any
  group 6: minutes, if any

but for timestamps like <2023-08-23 Wed>, (when (org-at-timestamp-p)
(match-string 2)) will return the year 2023 instead of the month. This
patch corrects the group numbers.
From a3c31e4f8f40202fcef61fc7c4b16acaf006e24f Mon Sep 17 00:00:00 2001
From: Liu Hui 
Date: Wed, 23 Aug 2023 14:27:21 +0800
Subject: [PATCH] * lisp/org.el (org-at-timestamp-p): fix doc string

---
 lisp/org.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3d9d61f69..6b89e14c4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14843,12 +14843,12 @@ (defun org-at-timestamp-p ( extended)
 values are possible).
 
 When matching, the match groups are the following:
-  group 1: year, if any
-  group 2: month, if any
-  group 3: day number, if any
-  group 4: day name, if any
-  group 5: hours, if any
-  group 6: minutes, if any"
+  group 2: year, if any
+  group 3: month, if any
+  group 4: day number, if any
+  group 5: day name, if any
+  group 7: hours, if any
+  group 8: minutes, if any"
   (let* ((regexp
   (if extended
   (if (eq extended 'agenda)
-- 
2.25.1



Re: ob-lilypond fontification

2023-08-23 Thread Henrik Frisk
On Tue, Aug 22, 2023, 6:17 PM Ihor Radchenko  wrote:

> Henrik Frisk  writes:
>
> > So I grabbed the file ob-lilypond from another inactive install of Emacs
> > 29.1 and linked to it in my init file. Everythin appears to work fine
> > except I dont get syntax highlightning unless I hit C-c '
>
> I recommend installing Org mode from ELPA to make sure that you are
> using the latest version.
>
> Also, there were possibly relevant changes on development branch. So you
> might need ELPA devel version.
>

Makes sense. I will try that, thanks!

>