Re: [PATCH v3] Re: [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)]

2022-08-12 Thread Ihor Radchenko
Max Nikulin  writes:

> was a really bad one. It leads to a separate directory for each short 
> ID. However I still believe that the purpose of 
> `org-attach-id-ts-folder-format' is avoid concentration of huge number 
> of file in a single directory. Distribution of attachments over 
> subdirectories is not perfectly even but it still works reasonably well 
> for long-lasting projects while IDs follow assumed format and month is 
> included into directory names.

This is only true for uuid-style. Also, this is likely not the problem
we need to worry about. To be a problem, the number of attach dirs
should be really large, which is only relevant when thousands of attach
dirs are cramped into a single parent directory. Thousands of attach
dirs would probably correspond to tens of thousands of headings, which
is not something we commonly have and, honestly, Org will have much more
serious issues when the number of headings is that large.

If someone ends up complaining about too many attach dirs, we can always
ask to adjust the ID naming scheme.

The previous paragraph appears to be consistent with

> Back to the original problem. First of all, I believe that if a user 
> decided to use non-standard IDs then it is their responsibility to 
> customize `org-attach-id-to-path-function-list' and to provide a 
> function that implements alternative layout of attachment files.
> Depending on expected amount, they may be put into single directory, 
> spread using some hash function, or accordingly to project structure. So 
> today I am against default fallback directories especially in 
> `org-attach-id-ts-folder-format'.

---

> I believe that interaction between `org-attach-dir-from-id' and members 
> of `org-attach-id-to-path-function-list' could be improved. If a too 
> short ID is passed to `org-attach-id-uuid-folder-format', 
> `org-attach-id-ts-folder-format', or a user-defined function, they may 
> return nil and `org-attach-dir-from-id' should try next element from the 
> list. If nothing succeeds then a user error should be signaled demanding 
> to implement a strategy to properly deal with peculiar IDs.

I do not think that it is a good idea. We currently promise to use the
first function in the list to generate the IDs. Other functions are
mostly a fallback to catch the existing attach dirs created in the past
using different ID scheme.

I guess that one option could be demanding a non-nil return value when
generating a new attach dir (without TRY-ALL argument) and wrapping
things into (ignore-errors ...) otherwise.

> There should be no problem to put single character IDs into a common 
> directory (UUID case), but there are enough variants for 5 characters 
> long names to create delayed performance problem. The worst case is when 
> a user decides to use some common prefix, e.g. "id-" before UUID and all 
> files go to the same directory. On the other hand I do not think that 
> code should detect such cases.

We should not worry about this. It will be the user responsibility to
create the relevant custom function.

-- 
Ihor Radchenko,
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



Re: [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)]

2022-08-12 Thread Ihor Radchenko
Janek F  writes:

> Considering the other messages, let's not get lost in details, the default 
> function does not need to consider all edge cases. It simply should not error 
> out on ids in a different format.

You are indeed right, but we may use multiple different approaches to
achieve this. Some are more simplistic, some are less. We are trying to
find a balance between less hassle for users and not overthinking
things.

The simplest approach would be wrapping the function calls into
(ignore-errors ...), which would avoid errors when we just try to check
the existence of the attachment dir. However, it may raise unexpected errors
for non-standard/copy-pasted IDs for users who did not customize this
area.

The approach I am proposing is handling unexpected IDs inside the
default functions and bringing errors in user-defined functions to the
attention of user - I feel that it will be more useful than ignoring
errors.

We could use yet another approach and use a global fallback if no
available function can generate an ID, but we may run into tricky cases
because the first function in the list has a special meaning - it _must_
generate a path from ID or the user may run into unexpected breakage in
some cases when custom IDs are being used.

-- 
Ihor Radchenko,
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



[PATCH v2] Re: Adding target and custom id links doesn't ask for description

2022-08-12 Thread Ihor Radchenko
Carlos Pita  writes:

>> Carlos, have you tried Ihor's patch? I like the intention, but I do not
>> see any effect.
>>
>
> Yes, I've tested it with target and custom_id links and, as you said, there
> is no change in behavior. The entire URL is still pasted and no chance to
> edit it is given to the user.

Oops. Somehow some way things worked for me at some point when I was
making the patch.

See the updated version of the patch attached. It works on my side.

>From 64c85eed9471b73e379e063dc3becefceb1ec650 Mon Sep 17 00:00:00 2001
Message-Id: <64c85eed9471b73e379e063dc3becefceb1ec650.1660366803.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Wed, 10 Aug 2022 13:25:26 +0800
Subject: [PATCH v2] org-store-link: Default to empty description for
 target/custom-id links

* lisp/ol.el (org-store-link): Use empty description by default (ask user).

Fixes https://orgmode.org/list/d99a712c-18d1-4a4f-8093-35a0bfb46...@gmail.com
---
 lisp/ol.el | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index b7d74d0bf..358a96aae 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1577,10 +1577,8 @@ (defun org-store-link (arg  interactive?)
 		  t
 	(setq link (plist-get org-store-link-plist :link))
 ;; If store function actually set `:description' property, use
-;; it, even if it is nil.  Otherwise, fallback to link value.
-	(setq desc (if (plist-member org-store-link-plist :description)
-   (plist-get org-store-link-plist :description)
-		 link)))
+;; it, even if it is nil.  Otherwise, fallback to nil (ask user).
+	(setq desc (plist-get org-store-link-plist :description)))
 
;; Store a link from a remote editing buffer.
((org-src-edit-buffer-p)
@@ -1697,9 +1695,7 @@ (defun org-store-link (arg  interactive?)
 		(and org-id-link-to-org-use-id (org-entry-get nil "ID"
 	   (setq link (condition-case nil
 			  (prog1 (org-id-store-link)
-			(setq desc (or (plist-get org-store-link-plist
-		  :description)
-	   "")))
+			(setq desc (plist-get org-store-link-plist :description)))
 			(error
 			 ;; Probably before first headline, link only to file.
 			 (concat "file:"
@@ -1761,8 +1757,7 @@ (defun org-store-link (arg  interactive?)
 
   ;; We're done setting link and desc, clean up
   (when (consp link) (setq cpltxt (car link) link (cdr link)))
-  (setq link (or link cpltxt)
-	desc (or desc cpltxt))
+  (setq link (or link cpltxt))
   (cond ((not desc))
 	((equal desc "NONE") (setq desc nil))
 	(t (setq desc (org-link-display-format desc
-- 
2.35.1



-- 
Ihor Radchenko,
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


Re: org-cite-insert + fido-mode

2022-08-12 Thread András Simonyi
Could you try Alt-j?

best wishes,
András

On Sat, 13 Aug 2022 at 03:22, Tyler Grinn  wrote:
>
> "Bruce D'Arcus"  writes:
>
> > You need to use whatever keybinding exits.
>
> I've tried every key in the mode map.
>



Re: org-cite-insert + fido-mode

2022-08-12 Thread Tyler Grinn
"Bruce D'Arcus"  writes:

> You need to use whatever keybinding exits.

I've tried every key in the mode map.



Re: org-cite-insert + fido-mode

2022-08-12 Thread Bruce D'Arcus
You need to use whatever keybinding exits.

On Fri, Aug 12, 2022, 8:53 PM Tyler Grinn  wrote:

>
> I need help inserting a citation with fido-mode (icomplete) enabled.  I
> call org-cite-insert, select the citation I want, and press return, and
> it asks for another citation to add, filling the minibuffer with the
> most likely option.  I see no way to insert the citations I've already
> selected, it always puts me back in this loop.
>
> Steps to reproduce:
>
> M-x fido-mode
> M-x org-cite-insert
>
> Best,
>
> Tyler
>
>


org-cite-insert + fido-mode

2022-08-12 Thread Tyler Grinn


I need help inserting a citation with fido-mode (icomplete) enabled.  I
call org-cite-insert, select the citation I want, and press return, and
it asks for another citation to add, filling the minibuffer with the
most likely option.  I see no way to insert the citations I've already
selected, it always puts me back in this loop.

Steps to reproduce:

M-x fido-mode
M-x org-cite-insert

Best,

Tyler



[Patch] Show org file title in org-clock clocktable

2022-08-12 Thread Duy Nguyen
Hello,

Please find attached a patch to allow users to show the org file titles
(i.e. the value of #+title) instead of the file name in the org-clock
clocktable.

I created this patch as I am using a combination of org-roam and org-agenda
to manage my tasks, where each project has its own org-roam file (and
therefore, a #+title). For my work I also need to generate weekly time
reports, with my todos spread over different org(-roam) files. I think the
clocktable looks nicer with the org file title than the name generated by
org-roam, which also has some other irrelevant information (for the
clocktable) in it such as date and time created. I believe this feature
could be useful for other users as well who have their tasks spread over
multiple org-roam files like me. The feature can easily be used by adding
":filetitle t" as an option in the clocktable.

Please note that the org-clock-get-file-prop function is heavily inspired
by vulpea-buffer-prop-get from the vulpea package - I just copied it over
and made some adjustments to make it work for the envisioned use case.

As I am relatively new to emacs / elisp and this is my first patch
submission ever, I am open to feedback on my patch or on how I did this
submission in general.

Special thanks to Ihor, who provided me with hints on how to solve this
issue and inspired me to submit a patch (original post

).

Thanks,

Duy


0001-lisp-org-clock.el-Show-file-title-in-org-clock-clock.patch
Description: Binary data


Re: [PATCH] Re: how to beamer export overlay figure?

2022-08-12 Thread edgar

On 2022-08-12 14:53, Fraga, Eric wrote:

Excellent.  I forgot about SVG.


I actually think that it's kind of useless, anyway (won't hurt).

Attached: example of work-arounds to {preserve,reserve,allocate} space 
for pictures in case someone needs it.





-
This free account was provided by VFEmail.net - report spam to ab...@vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!

Commercial and Bulk Mail Options!  

save_overlay_space_with_beamer.tgz
Description: GNU Zip compressed data


Re: [PATCH] Re: Adding target and custom id links doesn't ask for description

2022-08-12 Thread Carlos Pita
>
>
> Carlos, have you tried Ihor's patch? I like the intention, but I do not
> see any effect.
>

Yes, I've tested it with target and custom_id links and, as you said, there
is no change in behavior. The entire URL is still pasted and no chance to
edit it is given to the user.

Best regards
--
Carlos


Re: [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)]

2022-08-12 Thread Janek F
I use org-roam which creates links between org-files using the ID, and I would 
like to be able to manually add such links to common pages even if 
autocompletion doesn't work smoothly.

Considering the other messages, let's not get lost in details, the default 
function does not need to consider all edge cases. It simply should not error 
out on ids in a different format.

--- Original Message ---
Max Nikulin  schrieb am Freitag, 12. August 2022 um 17:35:


> On 21/07/2022 02:12, Janek F wrote:
>
> > However I tend to customize IDs for important files by hand,
> > causing any attempt to use org-attach on that file to fail
> > if the ID is shorter than six characters:
> >
> > org-attach-id-ts-folder-format: Args out of range: "ftt", 0, 6
> >
> > This method should be adjusted to handle non-ts-ids just as well,
> > as org-id-method does not dictate the format of existing ids.
>
>
> There are should be no such restriction for CUSTOM_ID links (referenced
> using #anchor). IDs used for attachments assume particular format and
> consistent layout of files. Janek, could you, please, provide some
> details concerning your use case. I am interested why you decided to
> avoid CUSTOM_ID for headings important to you.
>
> As I wrote yesterday, you can customize Org to use directories for
> attachments you like.



Re: [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)]

2022-08-12 Thread Max Nikulin

On 21/07/2022 02:12, Janek F wrote:


However I tend to customize IDs for important files by hand,
causing any attempt to use org-attach on that file to fail
if the ID is shorter than six characters:

     org-attach-id-ts-folder-format: Args out of range: "ftt", 0, 6

This method should be adjusted to handle non-ts-ids just as well,
as org-id-method does not dictate the format of existing ids.


There are should be no such restriction for CUSTOM_ID links (referenced 
using #anchor). IDs used for attachments assume particular format and 
consistent layout of files. Janek, could you, please, provide some 
details concerning your use case. I am interested why you decided to 
avoid CUSTOM_ID for headings important to you.


As I wrote yesterday, you can customize Org to use directories for 
attachments you like.





[PATCH] Re: how to beamer export overlay figure?

2022-08-12 Thread Fraga, Eric
On Friday, 12 Aug 2022 at 14:35, ed...@openmail.cc wrote:
> It worked! Thanks. I send a counter-patch :)  (for SVG).

Excellent.  I forgot about SVG.  So I throw one back at you! ;-) Just
deleted a spurious message line.

Maybe somebody with submit access can have a look and see if this is
suitable for applying to master?  Or if there is a better way of doing
this (I'm sure there is...)?

-- 
: Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50
From e11a09b2d69db6f7da55914276751daa8e34395b Mon Sep 17 00:00:00 2001
From: Eric S Fraga 
Date: Fri, 12 Aug 2022 15:50:17 +0100
Subject: [PATCH] lisp/ox-beamer: Enable use of overlays for images

* ox-beamer.el (org-beamer-link): If an overlay beamer attributed has
been provided, use it for images.
---
 lisp/ox-beamer.el | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index e6232d8d2..cb35850b9 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -734,13 +734,22 @@ used as a communication channel."
   (or (org-export-custom-protocol-maybe link contents 'beamer info)
   ;; Fall-back to LaTeX export.  However, prefer "\hyperlink" over
   ;; "\hyperref" since the former handles overlay specifications.
-  (let ((latex-link (org-export-with-backend 'latex link contents info)))
-	(if (string-match "\\`hyperref\\[\\(.*?\\)\\]" latex-link)
-	(replace-match
-	 (format "hyperlink%s{\\1}"
-		 (or (org-beamer--element-has-overlay-p link) ""))
-	 nil nil latex-link)
-	  latex-link
+  (let* ((latex-link (org-export-with-backend 'latex link contents info))
+ (parent (org-export-get-parent-element link))
+ (attr (org-export-read-attribute :attr_beamer parent))
+ (overlay (plist-get attr :overlay)))
+(cond ((string-match "\\`hyperref\\[\\(.*?\\)\\]" latex-link)
+   (replace-match
+(format "hyperlink%s{\\1}"
+(or (org-beamer--element-has-overlay-p link) ""))
+nil nil latex-link))
+  ((string-match "include\\(graphics\\|svg\\)\\([[{]?\\)" latex-link)
+   ;; check for overlay specification and insert if present
+   (replace-match
+(format "include\\1%s\\2"
+(if overlay overlay ""))
+nil nil latex-link))
+  (t latex-link)
 
 
  Plain List
-- 
2.30.2



Re: how to beamer export overlay figure?

2022-08-12 Thread edgar

On 2022-08-12 11:50, Fraga, Eric wrote:
Attached is a patch that seems to do what you want.  Are you able to 
try

this?

I'm sure there's a better way to do this but at least this seems to
work.


It worked! Thanks. I send a counter-patch :)  (for SVG).

-
This free account was provided by VFEmail.net - report spam to ab...@vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!

Commercial and Bulk Mail Options!  

0001-lisp-ox-beamer-Enable-use-of-overlays-for-images.patch.gz
Description: GNU Zip compressed data


t.org.gz
Description: GNU Zip compressed data


Re: [PERFORMANCE] Why some org code is so deep invoked?

2022-08-12 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

>> Also, I suggest to use M-x write-file in the profiler buffer when
>> sharing something as deeply nested as you got. The resulting file is
>> much more comfortable to view - it will preserve all the actual profiler
>> data.
>
> I see, I tried it, it indeed kept the profiler data!
>
>>
>> I will refrain from trying to deduce anything from the profiler for now.
>>
>> Please try to reproduce the report again and share it with us. Then, I
>> will try to see if we can do anything on the Org side.
>
> Ok, I attached the new generated profiler reports.

Oops. I was wrong about M-x write-file. Should be M-x
profiler-report-write-profile

Sorry for creating confusion.

-- 
Ihor Radchenko,
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



Re: [PERFORMANCE] Why some org code is so deep invoked?

2022-08-12 Thread Christopher M. Miles

Bill Burdick  writes:

> You'll have this with recursive code and recursion is fairly normal in Lisp 
> programs.
>
> -- Bill

I think this profiler report invocation stack is not recursive code. WDYT?

>
> On Fri, Aug 12, 2022 at 8:22 AM Christopher M. Miles  
> wrote:
>
>  Ihor Radchenko  writes:
>
>  > "Christopher M. Miles"  writes:
>  >
>  >> When I profiling Org Agenda generation, I found that org code is deeply 
> invoked in Emacs profiler report.
>  >>
>  >> My Question:
>  >>
>  >> - What reason caused this situation?
>  >> - Can Org Mode optimize those deeply invoked code?
>  >
>  > Could you please clarify what exactly is your problem?
>  > Is agenda generation slow?
>
>  From the profiler report, you can see that Agenda is slow on clock table
>  generation because I have ~org-agenda-start-with-clockreport-mode~
>  enabled. And this deep code invocation is from it too. It's about 5
>  seconds to generate the org-agenda clock table. Actually I can tolerate
>  this time, Just found this performance issue when profiling and curious
>  to ask this question.
>
>  > I do not see much issue with deep nesting of the code.
>
>  Is this deep nested code normal in Emacs Lisp?
>
>  Usually (based on my less than 20 times profiling experience), Emacs
>  wouldn't have deeper code than 40 levels. But my attachment profiler
>  report has more than 100 levels.
>
>  If this is normal and fine, It's OK. I repeat, I ask this question for
>  curious purpose which want to get an answer for not important question.
>
>  -- 
>
>  [ stardiviner ]
>  I try to make every word tell the meaning that I want to express without 
> misunderstanding.
>
>  Blog: https://stardiviner.github.io/
>  IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
>  GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PERFORMANCE] Why some org code is so deep invoked?

2022-08-12 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> I do not see much issue with deep nesting of the code.
>>
>> Is this deep nested code normal in Emacs Lisp?
>>
>> Usually (based on my less than 20 times profiling experience), Emacs
>> wouldn't have deeper code than 40 levels. But my attachment profiler
>> report has more than 100 levels.
>>
>> If this is normal and fine, It's OK. I repeat, I ask this question for
>> curious purpose which want to get an answer for not important question.
>
> It depends. You are looking at the complex code here, which is not
> necessarily common.
>
> However, lisp nesting is tangent to performance. Shallow nesting can be
> slow while deep nesting can be fast. Or vice versa.
>
I see, thanks for answering.

>>> Could you please clarify what exactly is your problem?
>>> Is agenda generation slow?
>>
>> From the profiler report, you can see that Agenda is slow on clock table
>> generation because I have ~org-agenda-start-with-clockreport-mode~
>> enabled. And this deep code invocation is from it too. It's about 5
>> seconds to generate the org-agenda clock table. Actually I can tolerate
>> this time, Just found this performance issue when profiling and curious
>> to ask this question.
>
> Note that your profiler result does not look like taken from a 5
> second-lasting code:
>
>  390  13% - completing-read
>
> Completing read takes >10% *CPU time* of the 5 seconds? Suspicious. I'd
> retry to get the profile.

I re-profiled three times, around 4 seconds.

>
> Also, I suggest to use M-x write-file in the profiler buffer when
> sharing something as deeply nested as you got. The resulting file is
> much more comfortable to view - it will preserve all the actual profiler
> data.

I see, I tried it, it indeed kept the profiler data!

>
> I will refrain from trying to deduce anything from the profiler for now.
>
> Please try to reproduce the report again and share it with us. Then, I
> will try to see if we can do anything on the Org side.

Ok, I attached the new generated profiler reports.

1284  57% + command-execute
 935  41% + ...
  21   0% + timer-event-handler
   2   0% + redisplay_internal (C function)
410,957,330  97% - command-execute
410,957,330  97%  - call-interactively
405,537,622  95%   - funcall-interactively
331,652,432  78%- org-agenda-redo-all
331,652,432  78% - if
331,651,376  78%  - org-agenda-redo
331,651,376  78%   - let*
331,649,112  78%- if
331,649,112  78% - progn
331,649,112  78%  - let*
331,649,112  78%   - eval
331,649,112  78%- let
331,649,112  78% - funcall
331,649,112  78%  - #
331,649,112  78%   - eval
331,649,112  78%- org-agenda-list
331,649,112  78% - catch
299,277,191  70%  - let*
213,251,714  50%   - if
213,105,362  50%- progn
213,105,362  50% - let
212,941,062  50%  - setq
212,940,006  50%   - apply
212,940,006  50%- org-clock-get-clocktable
212,940,006  50% + let
  1,056   0%   + org-plist-delete
124,712   0%  + org-agenda-files
 16,584   0%insert
  7,764   0%  + if
 58,632   0%+ or
 19,576   0%+ if
  3,136   0%+ let*
 78,430,580  18%   + while
  7,306,892   1%   + org-agenda-finalize
148,040   0% add-text-properties
139,819   0%   + org-agenda-files
 48   0%   + org-today
 32,366,705   7%  + org-agenda-prepare
  4,160   0%  + org-compile-prefix-format
  1,024   0%+ or
  1,056   0%  + turn-on-ligature-mode
 35,958,904   8%+ eyebrowse-create-window-config
 30,440,458   7%+ org-agenda
  6,646,049   1%  delete-window
839,779   0%+ execute-extended-command
  5,419,708   1%   + byte-code
 11,917,712   2% + redisplay_internal (C function)
280,655   0% + ...
  1,984   0% + timer-event-handler
  1,152   0% + corfu--auto-post-command
 80   0%   flyspell-post-command-hook
 80   0% + indent-guide-pre-command-hook
 80   0% + flycheck-maybe-display-error-at-point-soon


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [BUG] Warning (org-element-cache): org-element--cache: Org parser error in notmuch-show.el::10751. Resetting. [9.5.4 (release_9.5.4-702-g5a49cc @ /home/grfz/src/org-mode/lisp/)]

2022-08-12 Thread Ihor Radchenko
Gregor Zattler  writes:

> Dear org-mode developers, Ihor,
>
> I just got this warning:
>
> Warning (org-element-cache): org-element--cache: Org parser error in 
> notmuch-show.el::10751. Resetting.
>  The error was: (error "rx ‘**’ range error")

Thanks for reporting!

>  Backtrace:
> "  backtrace-to-string(nil)
>   org-element-at-point()
>   org-element-context()
>   hsys-org-link-at-p()
>   ibtypes::org-link-outside-org-mode()
>   ibut:at-p()
>   hbut:at-p()
>   hkey-execute(nil)
>   action-key-internal()
>   action-key()

> I don't know what triggered it, especially not in an elisp
> buffer.

It looks like Hyperbole is calling org-element-context, which does not
work outside org-mode now. Please report to Hyperbole devs.

> Just an hour ago, or some such, I lowered
> org-element--cache-self-verify-frequency from 1.0 to 0.1.
> Now I set it to 1.0 again.

This should be unrelated.

-- 
Ihor Radchenko,
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



[BUG] Warning (org-element-cache): org-element--cache: Org parser error in notmuch-show.el::10751. Resetting. [9.5.4 (release_9.5.4-702-g5a49cc @ /home/grfz/src/org-mode/lisp/)]

2022-08-12 Thread Gregor Zattler
Dear org-mode developers, Ihor,

I just got this warning:

Warning (org-element-cache): org-element--cache: Org parser error in 
notmuch-show.el::10751. Resetting.
 The error was: (error "rx ‘**’ range error")
 Backtrace:
"  backtrace-to-string(nil)
  org-element-at-point()
  org-element-context()
  hsys-org-link-at-p()
  ibtypes::org-link-outside-org-mode()
  ibut:at-p()
  hbut:at-p()
  hkey-execute(nil)
  action-key-internal()
  action-key()
  funcall-interactively(action-key)
  command-execute(action-key)
"
 Please report this to Org mode mailing list (M-x org-submit-bug-report).


I don't know what triggered it, especially not in an elisp
buffer.

Just an hour ago, or some such, I lowered
org-element--cache-self-verify-frequency from 1.0 to 0.1.
Now I set it to 1.0 again.


I deleted the "current state" part of this template due to
privacy concerns.  If you need specific variable values,
please tell me and I will provide them.[1]



Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.16.0)
 of 2022-08-02
Package: Org mode version 9.5.4 (release_9.5.4-702-g5a49cc @ 
/home/grfz/src/org-mode/lisp/)




-- 
Gregor

[1] For me:  [[file:~/tmp/2022-08-12-org-element-cache---current-state::current 
state:]]



Re: [PATCH] ob-tangle.el: fix ‘:comments noweb’ double linking

2022-08-12 Thread Max Nikulin

On 12/08/2022 09:21, Hraban Luyat wrote:


@Max: what do you think of when-let? That seems more appropriate for
this situation. Thoughts?


At first I thought about compatibility, but this form is available since 
Emacs-25, so it is not a problem.


Maybe I missed something, but I do not see clear advantage. Anyway it 
leads to `if' nested inside `when-let'.



+ (bare (and (string-match org-link-bracket-re l)
+(match-string 1 l
+(when bare
+  (if (and org-babel-tangle-use-relative-file-links
+   (string-match org-link-types-re bare)
+   (string= (match-string 1 bare) "file"))


It looks like (string-prefix-p "file:" bare) but without the complex 
regexp. I see, such code was used before. By the way, why it is "bare", 
not e.g. "target"?



+  (concat "file:"
+  (file-relative-name (substring bare (match-end 0))
+  (file-name-directory
+   (cdr (assq :tangle params)


I do not insist on changes since possible improvements are not really 
significant.





Re: [PERFORMANCE] Why some org code is so deep invoked?

2022-08-12 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

>> I do not see much issue with deep nesting of the code.
>
> Is this deep nested code normal in Emacs Lisp?
>
> Usually (based on my less than 20 times profiling experience), Emacs
> wouldn't have deeper code than 40 levels. But my attachment profiler
> report has more than 100 levels.
>
> If this is normal and fine, It's OK. I repeat, I ask this question for
> curious purpose which want to get an answer for not important question.

It depends. You are looking at the complex code here, which is not
necessarily common.

However, lisp nesting is tangent to performance. Shallow nesting can be
slow while deep nesting can be fast. Or vice versa.

>> Could you please clarify what exactly is your problem?
>> Is agenda generation slow?
>
> From the profiler report, you can see that Agenda is slow on clock table
> generation because I have ~org-agenda-start-with-clockreport-mode~
> enabled. And this deep code invocation is from it too. It's about 5
> seconds to generate the org-agenda clock table. Actually I can tolerate
> this time, Just found this performance issue when profiling and curious
> to ask this question.

Note that your profiler result does not look like taken from a 5
second-lasting code:

 390  13% - completing-read

Completing read takes >10% *CPU time* of the 5 seconds? Suspicious. I'd
retry to get the profile.

Also, I suggest to use M-x write-file in the profiler buffer when
sharing something as deeply nested as you got. The resulting file is
much more comfortable to view - it will preserve all the actual profiler
data.

I will refrain from trying to deduce anything from the profiler for now.

Please try to reproduce the report again and share it with us. Then, I
will try to see if we can do anything on the Org side.

-- 
Ihor Radchenko,
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



Re: [PERFORMANCE] Why some org code is so deep invoked?

2022-08-12 Thread Bill Burdick
You'll have this with recursive code and recursion is fairly normal in Lisp
programs.


-- Bill


On Fri, Aug 12, 2022 at 8:22 AM Christopher M. Miles 
wrote:

>
> Ihor Radchenko  writes:
>
> > "Christopher M. Miles"  writes:
> >
> >> When I profiling Org Agenda generation, I found that org code is deeply
> invoked in Emacs profiler report.
> >>
> >> My Question:
> >>
> >> - What reason caused this situation?
> >> - Can Org Mode optimize those deeply invoked code?
> >
> > Could you please clarify what exactly is your problem?
> > Is agenda generation slow?
>
> From the profiler report, you can see that Agenda is slow on clock table
> generation because I have ~org-agenda-start-with-clockreport-mode~
> enabled. And this deep code invocation is from it too. It's about 5
> seconds to generate the org-agenda clock table. Actually I can tolerate
> this time, Just found this performance issue when profiling and curious
> to ask this question.
>
> > I do not see much issue with deep nesting of the code.
>
> Is this deep nested code normal in Emacs Lisp?
>
> Usually (based on my less than 20 times profiling experience), Emacs
> wouldn't have deeper code than 40 levels. But my attachment profiler
> report has more than 100 levels.
>
> If this is normal and fine, It's OK. I repeat, I ask this question for
> curious purpose which want to get an answer for not important question.
>
> --
>
> [ stardiviner ]
> I try to make every word tell the meaning that I want to express without
> misunderstanding.
>
> Blog: https://stardiviner.github.io/
> IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
> GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>


Suspected bug: '#+STARTUP: indent' messes up inlinetasks' tag alignment

2022-08-12 Thread Alain . Cochard


Hello.

I use

emacs -Q -l ~/.emacs.git

with ~/.emacs.git containing only:

   (add-to-list 'load-path "~/Org/Coch-git/org-mode/lisp")
   (require 'org-inlinetask)

which gives:

   Org mode version 9.5.4 (release_9.5.4-727-gb42883 @
   /home/cochard/Org/Coch-git/org-mode/lisp/) GNU Emacs 27.2 (build 1,
   x86_64-redhat-linux-gnu, GTK+ Version 3.24.30, cairo version
   1.17.4) of 2021-08-07

Then, to observe the problem, I can for example compare

(1) visiting the file pb.org containing:

   #+STARTUP: noindent
   * headline 1   :htag:
   *** inelinetask :itag:
   *** END
   * headline 2   :htag:

and doing C-u C-c C-q,  to 

(2) the same, but with 'indent' instead of 'noindent'.

For me, all 3 tags end up perfectly aligned in the case (1), while
':itag:' is shifted to the right in case (2).

NB: I observe a consistent (bad) behavior by customizing
org-startup-indented.

Regards.

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 106]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France | [ slot available for rent ]




Re: [PERFORMANCE] Why some org code is so deep invoked?

2022-08-12 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> When I profiling Org Agenda generation, I found that org code is deeply 
>> invoked in Emacs profiler report.
>>
>> My Question:
>>
>> - What reason caused this situation?
>> - Can Org Mode optimize those deeply invoked code?
>
> Could you please clarify what exactly is your problem?
> Is agenda generation slow?

From the profiler report, you can see that Agenda is slow on clock table
generation because I have ~org-agenda-start-with-clockreport-mode~
enabled. And this deep code invocation is from it too. It's about 5
seconds to generate the org-agenda clock table. Actually I can tolerate
this time, Just found this performance issue when profiling and curious
to ask this question.

> I do not see much issue with deep nesting of the code.

Is this deep nested code normal in Emacs Lisp?

Usually (based on my less than 20 times profiling experience), Emacs
wouldn't have deeper code than 40 levels. But my attachment profiler
report has more than 100 levels.

If this is normal and fine, It's OK. I repeat, I ask this question for
curious purpose which want to get an answer for not important question.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: how to beamer export overlay figure?

2022-08-12 Thread Fraga, Eric
Attached is a patch that seems to do what you want.  Are you able to try
this?

I'm sure there's a better way to do this but at least this seems to
work.

-- 
: Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50
From d17d91eb8441876a87e7405de63b3e594bb8ecc6 Mon Sep 17 00:00:00 2001
From: Eric S Fraga 
Date: Fri, 12 Aug 2022 12:46:18 +0100
Subject: [PATCH] lisp/ox-beamer: Enable use of overlays for images

* ox-beamer.el (org-beamer-link): If an overlay beamer attributed has
been provided, use it for images.
---
 lisp/ox-beamer.el | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index e6232d8d2..8112b97df 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -734,13 +734,23 @@ used as a communication channel."
   (or (org-export-custom-protocol-maybe link contents 'beamer info)
   ;; Fall-back to LaTeX export.  However, prefer "\hyperlink" over
   ;; "\hyperref" since the former handles overlay specifications.
-  (let ((latex-link (org-export-with-backend 'latex link contents info)))
-	(if (string-match "\\`hyperref\\[\\(.*?\\)\\]" latex-link)
-	(replace-match
-	 (format "hyperlink%s{\\1}"
-		 (or (org-beamer--element-has-overlay-p link) ""))
-	 nil nil latex-link)
-	  latex-link
+  (let* ((latex-link (org-export-with-backend 'latex link contents info))
+ (parent (org-export-get-parent-element link))
+ (attr (org-export-read-attribute :attr_beamer parent))
+ (overlay (plist-get attr :overlay)))
+(cond ((string-match "\\`hyperref\\[\\(.*?\\)\\]" latex-link)
+	   (replace-match
+	(format "hyperlink%s{\\1}"
+		(or (org-beamer--element-has-overlay-p link) ""))
+	nil nil latex-link))
+	  ((string-match "includegraphics\\([[{]?\\)" latex-link)
+   ;; check for overlay specification and insert if present
+   (message "matched")
+   (replace-match
+	(format "includegraphics%s\\1"
+(if overlay overlay ""))
+	nil nil latex-link))
+  (t latex-link)
 
 
  Plain List
-- 
2.30.2



Re: how to beamer export overlay figure?

2022-08-12 Thread Fraga, Eric
On Thursday, 11 Aug 2022 at 23:33, Max Nikulin wrote:
> I have not tried it, but the manual suggests
>
> #+ATTR_BEAMER: :overlay <2->
>
> Does it work for lists only and not for images?

No, it definitely does not work for images.  I've been looking at the
code.  It should be possible to add this functionality.  Just trying to
get my head around the code at the moment and I'll try to do something,
assuming my elisp-fu is up to it.
-- 
: Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50


Re: [PATCH] Delete some Emacs 24 compat code

2022-08-12 Thread Bastien
Ihor Radchenko  writes:

> Sounds reasonable, though we might emphasize a bit more that it is
> relevant to the latest Org from ELPA/git.
>
> We have
>
>If, for one reason or another, you want to install Org on top of this
> pre-packaged version, you can use the Emacs package system or clone
> Org’s git repository.
>
> Adding the information that Org from ELPA/git is only compatible with
> certain Emacs versions is important.

I tried something in https://git.sr.ht/~bzg/org-mode/commit/b428839f
but feel free to enhance the wording if needed.

-- 
 Bastien