[PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-05-14 Thread Christopher M. Miles

I found a lot of third-part Emacs packages refresh Org source block image 
result using the API function like this:

#+begin_src emacs-lisp
;; Automatically refresh inline images.
  (add-hook 'org-babel-after-execute-hook
(defun ob-dall-e--refresh-inline-images ()
  (when org-inline-image-overlays
(org-redisplay-inline-images
#+end_src

The `org-redisplay-inline-images' will refresh whole buffer inline
images. When the buffer is a big Org file, and not all inline images are
display already by default (still image file links under fold status).
Invoking `org-redisplay-inline-images' will cause Emacs suspend a long
time.

So I suggest to add an variant local function of
`org-redisplay-inline-images' which named
`org-redisplay-inline-images-under-headline' that only redisplay inline
images under current headline to solve the issue.

Here is the diff code prototype, Ihor, can you review it? If it's ok, I
will send patch update then.

#+begin_src diff
 (defun org-redisplay-inline-images ()
-  "Assure display of inline images and refresh them."
+  "Assure display of global all inline images in buffer and refresh them.
+
+NOTE: This function will refresh whole buffer inline images, if
+you only want to refresh inline images under headline, suggest to
+use `org-redisplay-inline-images-under-headline' in your hook or advice."
   (interactive)
   (org-toggle-inline-images)
   (unless org-inline-image-overlays
 (org-toggle-inline-images)))
 
+(defun org-redisplay-inline-images-under-headline ()
+  "Assure display of images under current headline and refresh them.
+This function is the suggested to be used in hook or advice."
+  (interactive)
+  (org-with-wide-buffer
+   (org-narrow-to-subtree)
+   ;; If has nested headlines, beg,end only from parent headline
+   ;; to first child headline which reference to upper
+   ;; let-binding `org-next-visible-heading'.
+   (org-display-inline-images
+nil nil
+(point-min) (progn (org-next-visible-heading 1) (point)
+
#+end_src

-- 

[ 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: org code and error catching

2023-05-14 Thread Michael Heerdegen
Ihor Radchenko  writes:

> This is a good idea, except that `condition-case-unless-debug' has
> non-obvious side effects that interfere with ERT (Org testing system).

What side effects are these?

Thx,
Michael.



Re: [RFC/PATCH] naming src/bin files in ob-C.el

2023-05-14 Thread Leo Butler
On Sat, May 13 2023, Ihor Radchenko  wrote:

> Leo Butler  writes:
>
>>> IMHO, it will be more consistent with other backends to use :results file 
>>> :file /path/to/executable
>>
>> No, I don't think this is the way to do it. What happens in this
>> case is:
>>
>> 1. `org-babel-C-execute' creates a named source file, compiles it to the
>>named binary file;
>> 2. then executes that binary file, producing output;
>> 3. that output is inserted into the named binary file, overwriting its
>>contents.
>
> What I am suggesting is making :results file :file /path/to stop after 1
> and produce a link to the binary file.

Ok, stopping after 1 seems reasonable when the code block is meant to
produce just the executable. But, your suggestion would mean that the
code block can *only* produce an executable file. Maybe that is ok, but
since the current semantics allow something like

#+begin_src C++ :includes   :results file :file ./results.csv
  using namespace std;
  for(int i=0; i<10; i++){ cout << i << "," << i*i << endl; }
#+end_src

so I am not sure that we should break that.

On the other hand, I don't see any sense in producing a link to the
binary file. Org can't do anything with that link, so the user would
need to write something like ":results file :file /path/to :wrap
comment". That is why I would prefer something like a :bin-file header.

Leo


[PATCH v2] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
 #+begin_src emacs-lisp
 (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
   (if (length> bound-tags 0)
   bound-tags
 (seq-take temp-fulltable 26)))
 #+end_src
>>>
>>> This will unconditionally drop auto-labeled tags when user-bound tags
>>> exist, even if the total number of tags in buffer does not exceed 26.
>>
>> I try to read the source code of `org-fast-tag-selection', but the code is 
>> hard to read.
>
> Yeah. I agree. But we have what we have.
>
>> I don't know how to keep auto-labeled tags. Do you have any suggestions?
>
> You are almost there.
> Just run your code only when (lentgh> fulltable 26).
>
> Of course, 26 should be a defcustom rather than a hard-coded constant.
> And do the same for `org-fast-todo-selection'.

Ok, I added defcustom option, and add cl-case condition on custom option
`org-use-fast-tag-selection'.



0001-org-Improve-the-tags-fast-selection-performance.patch
Description: 

-- 

[ 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: [PATCH] ox.el: Customize org-export-dispatch options

2023-05-14 Thread Jim Wisniewski
On Sun, May 14, 2023 at 10:16 AM Ihor Radchenko  wrote:
>
> Bastien Guerry  writes:
>
> > Yes I do, sorry for the delay.
>
> Thanks for confirming!
> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9d06e7bf8
>
> and updated our copyright records
> https://git.sr.ht/~bzg/worg/commit/ea0b70ea

Thank you!

-- 
JJW



Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

>>> #+begin_src emacs-lisp
>>> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>>>   (if (length> bound-tags 0)
>>>   bound-tags
>>> (seq-take temp-fulltable 26)))
>>> #+end_src
>>
>> This will unconditionally drop auto-labeled tags when user-bound tags
>> exist, even if the total number of tags in buffer does not exceed 26.
>
> I try to read the source code of `org-fast-tag-selection', but the code is 
> hard to read.

Yeah. I agree. But we have what we have.

> I don't know how to keep auto-labeled tags. Do you have any suggestions?

You are almost there.
Just run your code only when (lentgh> fulltable 26).

Of course, 26 should be a defcustom rather than a hard-coded constant.
And do the same for `org-fast-todo-selection'.

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



Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Sorry, wrong code, here is the correct code snippet:
>>
>> #+begin_src emacs-lisp
>> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>>   (if (length> bound-tags 0)
>>   bound-tags
>> (seq-take temp-fulltable 26)))
>> #+end_src
>
> This will unconditionally drop auto-labeled tags when user-bound tags
> exist, even if the total number of tags in buffer does not exceed 26.

I try to read the source code of `org-fast-tag-selection', but the code is hard 
to read.
I don't know how to keep auto-labeled tags. Do you have any suggestions?


-- 

[ 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: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> Sorry, wrong code, here is the correct code snippet:
>
> #+begin_src emacs-lisp
> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>   (if (length> bound-tags 0)
>   bound-tags
> (seq-take temp-fulltable 26)))
> #+end_src

This will unconditionally drop auto-labeled tags when user-bound tags
exist, even if the total number of tags in buffer does not exceed 26.

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



Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> What about like this?
>>
>> #+begin_src emacs-lisp
>> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
>> (if (length> shortkeys 0)
>> bound-tags
>>   (seq-take fulltable 26)))
>>   char ?a cnt 0)
>> #+end_src
>
> What do you mean by "shortkeys"?

Sorry, wrong code, here is the correct code snippet:

#+begin_src emacs-lisp
(let ((bound-tags (seq-filter 'cdr temp-fulltable)))
  (if (length> bound-tags 0)
  bound-tags
(seq-take temp-fulltable 26)))
#+end_src

-- 

[ 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: [PATCH] ox.el: Customize org-export-dispatch options

2023-05-14 Thread Ihor Radchenko
Bastien Guerry  writes:

 Thanks! Let us know when FSF replies with a countersignature.
>>>
>>> Just got it back today.
>>
>> Thanks for the update!
>> Bastien, may you confirm?
>
> Yes I do, sorry for the delay.

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

and updated our copyright records
https://git.sr.ht/~bzg/worg/commit/ea0b70ea

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



Re: [test] org-colview/org-columns

2023-05-14 Thread Ihor Radchenko


Ihor Radchenko  writes:
> Sławomir Grochowski  writes:
>
>> I'm trying to better understand 'org-colview/org-columns'.
>> So I wrote some tests. File in attachment.
>
> Thanks! The tests look good to me.

Applied, onto main. (A different, sent privately, version.)
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=03afd2558

You are now listed as Org contributor
https://git.sr.ht/~bzg/worg/commit/1e54a8ad

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



Re: [PATCH] ox.el: Customize org-export-dispatch options

2023-05-14 Thread Bastien Guerry
Hi,

Ihor Radchenko  writes:

> Jim Wisniewski  writes:
>
>> On Thu, Apr 20, 2023 at 4:46 AM Ihor Radchenko  wrote:
>>
>>> Thanks! Let us know when FSF replies with a countersignature.
>>
>> Just got it back today.
>
> Thanks for the update!
> Bastien, may you confirm?

Yes I do, sorry for the delay.

-- 
 Bastien Guerry



Re: BUG: org-cycle does not unfold some subtrees

2023-05-14 Thread Gregor Zattler
Hi Michael, Ihor, ...
* Michael Dauer  [2023-05-14; 12:56 +02]:
> I think I found a way to consistently reproduce the issue:

> * h1
> a
> * h2
> b
> * h3
> b
> * h4
> c
> <<<
> Collapse all. All is fine at this time.
> At pos-min call (query-replace) bbb -> zzz: Already when asking whether to
> replace it cannot expand. h2 and h3 are expansion is broken.

I confirm this recipe.  For me and with my
configuration, as with emacs -Q, I then cannot unfold
h2.

> (org-fold-core--clear-isearch-overlays) repairs it.

This is also the case with my configuration, as with
emacs -Q.

Then I can unfold all headings and see that the
replacement bbb --> zzz worked.


GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, cairo version 1.16.0) of 
2023-05-04
Org mode version 9.7-pre (release_9.6.5-357-g080710 @ 
/home/grfz/src/org-mode/lisp/)


Ciao; Gregor



Re: BUG: org-cycle does not unfold some subtrees

2023-05-14 Thread Michael Dauer
I think I found a way to consistently reproduce the issue:
>>>
* h1
a
* h2
b
* h3
b
* h4
c
<<<
Collapse all. All is fine at this time.
At pos-min call (query-replace) bbb -> zzz: Already when asking whether to
replace it cannot expand. h2 and h3 are expansion is broken.
(org-fold-core--clear-isearch-overlays) repairs it.
At pos-max (query-replace) bbb -> zzz does not find a match, and does not
break the expansion.


Am Do., 11. Mai 2023 um 11:47 Uhr schrieb Ihor Radchenko <
yanta...@posteo.net>:

> William Denton  writes:
>
> >> Does it also help if you run M-:
> (org-fold-core--clear-isearch-overlays)?
> >
> > That worked!  I just had the problem.  I ran that, and the tree popped
> open!
>
> Do you use evil-mode?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> What about like this?
>
> #+begin_src emacs-lisp
> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
> (if (length> shortkeys 0)
> bound-tags
>   (seq-take fulltable 26)))
>   char ?a cnt 0)
> #+end_src

What do you mean by "shortkeys"?

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