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

2023-05-13 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> It would be great if you can come up with a patch.
>>> 1. Keeping tags with explicitly assigned key binding indeed makes sense
>>> 2. If we limit the number of displayed tags (on top of explicitly
>>>assigned), it should be a defcustom.
>>
>> Here is the patch.
>> -(setq tbl fulltable char ?a cnt 0)
>> +(setq tbl (seq-filter 'cdr fulltable) char ?a cnt 0)
>
> Thanks, but it will make the tag selection useless for people who did
> not customize explicit tag bindings.
>
> You should instead only filter when the number of tags exceeds some
> customized value.

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

-- 

[ 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: [BUG] Contents of the *Warnings* buffer, which has begun popping up at random intervals

2023-05-13 Thread George Mauer
Not at my computer now, but that looks like a warning I've been getting
pretty constantly for a few weeks and have an investigated. I assumed it
was coming from org-ai as I just recently added to that to my workflow and
use it a lot, but maybe not

On Sat, May 13, 2023, 17:22 Tom Davey  wrote:

> I was prompted by a buffer named *Warnings* to send an email to
>
> emacs-orgmode@gnu.org.
>
>
>
> This buffer appears seemingly at random every few days or so (I use
>
> Emacs and Org mode for about eight hours a day). The warnings began
>
> after I upgraded to Org 9.6.3. Find the contents of that buffer below.
>
>
>
> Thank you for the work on Org mode, which is magnificent and
>
> without peer.
>
>
>
> Tom Davey
>
>
>
> 
>
>
>
> ■  Warning (org-element-cache): org-element--cache: Org parser error in
> journal.org::18359990. Resetting.
>
> The error was: (error "Invalid search bound (wrong side of point)")
>
>
>
> Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32)
>
> of 2022-09-14
>
> Package: Org mode version 9.6.3 ( @
> c:/Users/tdavey/Documents/Dropbox/Emacs/Prod/.emacs.d/load-path-subdirs/td-esdf/td-startup-lisp/Elpa/org-9.6.3/)
>
>
>
> current state:
>
> ==
>
> (setq
>
> org-archive-location "%s_archive::datetree/"
>
> org-link-elisp-confirm-function 'yes-or-no-p
>
> org-directory "~/org-files"
>
> org-yank-adjusted-subtrees t
>
> org-tag-faces '(("PROJ" :background "indianred3" :foreground "cornsilk2"
> :weight bold))
>
> org-agenda-custom-commands '(("c" "Computers and Project Tags"
>
>((agenda "") (tags-todo "project")
> (tags-todo "orgmode") (tags-todo "emacs")
>
> (tags-todo "computers"))
>
>)
>
>   ("e" "Email tag" ((tags-todo "email")
> (agenda "")))
>
>   ("g" "Microscheduling tag" ((tags-todo
> "microscheduling") (tags-todo "today") (agenda "")))
>
>   ("h" "Housing tags"
>
>((tags "+Strivers") (tags "+SGCagenda")
> (tags "+SGCbudget") (tags "+SGCcuo")
>
> (tags "+SGCdiscussion") (tags
> "+SGChouseRules") (tags "+SGCminutes") (tags "+SGCstaff")
>
> (tags "+SGCunit") (tags "+SGCvote") (tags
> "+improvement") (tags "+household"))
>
>((org-columns-default-format "%CATEGORY
> %75ITEM %TODO %TAGS %25CREATED %25TIMESTAMP")))
>
>   ("n" "Agenda and all TODOs" ((agenda "")
> (alltodo "")))
>
>   ("p" "People tags"
>
>((agenda "") (tags-todo "atrajkov")
> (tags-todo "apotter") (tags-todo "dmcewan")
>
> (tags-todo "espector") (tags-todo
> "jbousley") (tags-todo "kmandel") (tags-todo "rosoria")
>
> (tags-todo "twasson") (tags-todo
> "cfrappier") (tags-todo "cmorales") (tags-todo "cwolan")
>
> (tags-todo "dbolen") (tags-todo
> "jterranella") (tags-todo "lortiz") (tags-todo "malzuru")
>
> (tags-todo "dhalsey") (tags-todo
> "jkendall") (tags-todo "kolson"))
>
>)
>
>   ("b" "Tom's basic block agenda"
>
>((agenda "") (tags-todo
> "+homeImprovement-household") (tags-todo "FAredesign")
>
> (tags-todo "rhaass") (tags-todo "kolson")
> (tags-todo "dhalsey") (tags-todo "hr")
>
> (tags-todo "lhammes") (tags-todo
> "StaffMeeting") (tags-todo "cfrappier") (tags-todo "espector")
>
> (tags-todo "ahenry") (tags-todo "atrajkov")
>
> (tags-todo
>
>
> "+work-rhaass-kolson-cfrappier-jmcgrath-tkatavic-egosselin-aqualls-cshehadi-espector-pituk-ahalliday-metchison-nfreiberg-lhammes-emacs-lifelongLearning")
>
> (tags-todo "computers") (tags-todo "desk")
> (tags-todo "errands") (tags-todo "household")
>
> (tags-todo "lifelongLearning") (tags-todo
> "reading") (tags-todo "social"))
>
>)
>
>   )
>
> org-log-into-drawer t
>
> org-use-fast-tag-selection t
>
> org-agenda-files '("~/org-files/")
>
> org-capture-templates '(("a" "Appointments & Meetings
> :appt:   timestamp" entry
>
>   (file+olp+datetree "~/org-files/calendar.org")
> "* %? :appt:\nAppt time: %^T\n%i\n\n")
>
>  ("b" "Bills & paperwork at home
> :desk:" entry (file+olp+datetree "~/org-files/desk.org")
>
>   "* TODO %?  :desk:")
>
>  ("c" "Capture no
> tag  planning" entry
>
>   

[BUG] Contents of the *Warnings* buffer, which has begun popping up at random intervals

2023-05-13 Thread Tom Davey
I was prompted by a buffer named *Warnings* to send an email to
emacs-orgmode@gnu.org.

This buffer appears seemingly at random every few days or so (I use
Emacs and Org mode for about eight hours a day). The warnings began
after I upgraded to Org 9.6.3. Find the contents of that buffer below.

Thank you for the work on Org mode, which is magnificent and
without peer.

Tom Davey



■  Warning (org-element-cache): org-element--cache: Org parser error in 
journal.org::18359990. Resetting.
The error was: (error "Invalid search bound (wrong side of point)")

Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32)
of 2022-09-14
Package: Org mode version 9.6.3 ( @ 
c:/Users/tdavey/Documents/Dropbox/Emacs/Prod/.emacs.d/load-path-subdirs/td-esdf/td-startup-lisp/Elpa/org-9.6.3/)

current state:
==
(setq
org-archive-location "%s_archive::datetree/"
org-link-elisp-confirm-function 'yes-or-no-p
org-directory "~/org-files"
org-yank-adjusted-subtrees t
org-tag-faces '(("PROJ" :background "indianred3" :foreground "cornsilk2" 
:weight bold))
org-agenda-custom-commands '(("c" "Computers and Project Tags"
   ((agenda "") (tags-todo "project") (tags-todo 
"orgmode") (tags-todo "emacs")
(tags-todo "computers"))
   )
  ("e" "Email tag" ((tags-todo "email") (agenda 
"")))
  ("g" "Microscheduling tag" ((tags-todo 
"microscheduling") (tags-todo "today") (agenda "")))
  ("h" "Housing tags"
   ((tags "+Strivers") (tags "+SGCagenda") (tags 
"+SGCbudget") (tags "+SGCcuo")
(tags "+SGCdiscussion") (tags "+SGChouseRules") 
(tags "+SGCminutes") (tags "+SGCstaff")
(tags "+SGCunit") (tags "+SGCvote") (tags 
"+improvement") (tags "+household"))
   ((org-columns-default-format "%CATEGORY %75ITEM 
%TODO %TAGS %25CREATED %25TIMESTAMP")))
  ("n" "Agenda and all TODOs" ((agenda "") (alltodo 
"")))
  ("p" "People tags"
   ((agenda "") (tags-todo "atrajkov") (tags-todo 
"apotter") (tags-todo "dmcewan")
(tags-todo "espector") (tags-todo "jbousley") 
(tags-todo "kmandel") (tags-todo "rosoria")
(tags-todo "twasson") (tags-todo "cfrappier") 
(tags-todo "cmorales") (tags-todo "cwolan")
(tags-todo "dbolen") (tags-todo "jterranella") 
(tags-todo "lortiz") (tags-todo "malzuru")
(tags-todo "dhalsey") (tags-todo "jkendall") 
(tags-todo "kolson"))
   )
  ("b" "Tom's basic block agenda"
   ((agenda "") (tags-todo 
"+homeImprovement-household") (tags-todo "FAredesign")
(tags-todo "rhaass") (tags-todo "kolson") 
(tags-todo "dhalsey") (tags-todo "hr")
(tags-todo "lhammes") (tags-todo 
"StaffMeeting") (tags-todo "cfrappier") (tags-todo "espector")
(tags-todo "ahenry") (tags-todo "atrajkov")
(tags-todo
 
"+work-rhaass-kolson-cfrappier-jmcgrath-tkatavic-egosselin-aqualls-cshehadi-espector-pituk-ahalliday-metchison-nfreiberg-lhammes-emacs-lifelongLearning")
(tags-todo "computers") (tags-todo "desk") 
(tags-todo "errands") (tags-todo "household")
(tags-todo "lifelongLearning") (tags-todo 
"reading") (tags-todo "social"))
   )
  )
org-log-into-drawer t
org-use-fast-tag-selection t
org-agenda-files '("~/org-files/")
org-capture-templates '(("a" "Appointments & Meetings:appt: 
  timestamp" entry
  (file+olp+datetree "~/org-files/calendar.org") "* %? 
:appt:\nAppt time: %^T\n%i\n\n")
 ("b" "Bills & paperwork at home  :desk:" 
entry (file+olp+datetree "~/org-files/desk.org")
  "* TODO %?  :desk:")
 ("c" "Capture no tag   
   planning" entry
  (file+olp+datetree "~/org-files/capture.org") "* TODO 
%?\nSCHEDULED: %T\n%i\n\n")
 ("C" "Computers -- everything but Emacs")
 ("Cc" "Computers -- hardware generally 
 :computers:" entry
  (file+olp+datetree "~/org-files/computers.org") "* 
TODO %?  :computers:")
 ("Cr" "Replace Fortunata with Circe
 :circe:computers:" entry
   

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

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

>> It would be great if you can come up with a patch.
>> 1. Keeping tags with explicitly assigned key binding indeed makes sense
>> 2. If we limit the number of displayed tags (on top of explicitly
>>assigned), it should be a defcustom.
>
> Here is the patch.
> - (setq tbl fulltable char ?a cnt 0)
> + (setq tbl (seq-filter 'cdr fulltable) char ?a cnt 0)

Thanks, but it will make the tag selection useless for people who did
not customize explicit tag bindings.

You should instead only filter when the number of tags exceeds some
customized value.

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



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

2023-05-13 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> I applied your diff with a testing. This indeed solved the performance
>> issue.
>> Will this be updated in Org-mode source code?
>> Also I come up with one thing, filter out tags which have shortcut
>> keybinding bound. Because user defined shortcut key defined tags are not
>> always on head of list.
>
> It would be great if you can come up with a patch.
> 1. Keeping tags with explicitly assigned key binding indeed makes sense
> 2. If we limit the number of displayed tags (on top of explicitly
>assigned), it should be a defcustom.

Here is the patch.



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: Help using org-entities or arternatives.

2023-05-13 Thread Ypo
Thanks, Ruijie. I think it is not what I was asking for, but it's nice 
to read your code.


Best regards.

El 09/05/2023 a las 13:48, Ruijie Yu escribió:

Ypo  writes:


Hi

Is it possible to, each time I write "" to be subsituted by "[...]" ?

I can't do it using abbrev, and I don't know how to do it using org-entities.

I use it to yank quotes, for example, I write:

  "Like other editors, Emacs has commands to search for occurrences of a 
string. There are also commands that do the same thing, but
  search for patterns instead of fixed strings."

And I would like to get, automatically:

  "Like other editors, Emacs has commands to search for occurrences of a 
string. [...] There are also commands that do the same thing, but
  search for patterns instead of fixed strings."

Best regards

Not necessarily Org-specific, but here's my idea, untested:

```emacs-lisp
(defun my/yank-subst-ellipses ()
   (interactive)
   (let* ((start (point-marker))
  (_ (insert (current-kill 0)))
  (end (point-marker)))
 (save-match-data
   ;; Play around with this regexp
   (while (re-search-forward (rx "...") end t)
 ;; And this replacement text
 (replace-match "[...]")
```

Then, since Org sets C-y as `org-yank', make an advice with it.  I am
not confident in this portion at all, but here goes nothing ;)

```emacs-lisp
(require 'cl-lib)
(advice-add
  #'org-yank :around
  (lambda (org-yank  arg)
(cl-letf (((symbol-function 'yank)
   (symbol-function 'my/yank-subst/ellipses)))
  (funcall org-yank arg
```


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

2023-05-13 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> I have a large `org-tag-alist` value that contains about ~7000 tags.
>> When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long time.
>
> Indeed. That's because `org-fast-tag-selection' tries to put all those
> 7k tags into tag selection window.
>
> We can probably limit the maximum number of tags in the quick selection
> window.
>
> Can you try the attached simple diff for `org-fast-tag-selection' and
> check if it is enough to solve the hang?
>
> diff --git a/lisp/org.el b/lisp/org.el
> index c148409d9..d745fd01e 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -11765,7 +11765,7 @@ (defun org-fast-tag-selection (current inherited 
> table  todo-table)
>   (org-fast-tag-insert "Current" current c-face "\n\n")
>   (org-fast-tag-show-exit exit-after-next)
>   (org-set-current-tags-overlay current ov-prefix)
> - (setq tbl fulltable char ?a cnt 0)
> + (setq tbl (seq-take fulltable 26) char ?a cnt 0)
>   (while (setq e (pop tbl))
> (cond
>  ((eq (car e) :startgroup)

I applied your diff with a testing. This indeed solved the performance issue.
Will this be updated in Org-mode source code?

-- 

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

2023-05-13 Thread Ihor Radchenko
stardiviner  writes:

> I applied your diff with a testing. This indeed solved the performance
> issue.
> Will this be updated in Org-mode source code?
> Also I come up with one thing, filter out tags which have shortcut
> keybinding bound. Because user defined shortcut key defined tags are not
> always on head of list.

It would be great if you can come up with a patch.
1. Keeping tags with explicitly assigned key binding indeed makes sense
2. If we limit the number of displayed tags (on top of explicitly
   assigned), it should be a defcustom.

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



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

2023-05-13 Thread stardiviner
I applied your diff with a testing. This indeed solved the performance
issue.
Will this be updated in Org-mode source code?
Also I come up with one thing, filter out tags which have shortcut
keybinding bound. Because user defined shortcut key defined tags are not
always on head of list.

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Sat, May 13, 2023 at 3:39 PM Ihor Radchenko  wrote:

> stardiviner  writes:
>
> > I have a large `org-tag-alist` value that contains about ~7000 tags.
> > When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long
> time.
>
> Indeed. That's because `org-fast-tag-selection' tries to put all those
> 7k tags into tag selection window.
>
> We can probably limit the maximum number of tags in the quick selection
> window.
>
> Can you try the attached simple diff for `org-fast-tag-selection' and
> check if it is enough to solve the hang?
>
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: [BUG] <2022-04-11 Mon 17:1-19:10> is wrongly parsed as a valid timestamp [9.5.3 (release_9.5.3-461-ga3dac4 @ /home/yantar92/.emacs.d/straight/build/org/)]

2023-05-13 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Consider the following timestamp with a typo in starting minute:
>
> <2022-04-11 Mon 17:1-19:10>
> ...
>
> Expected: The example timestamp is not parsed as a valid timestamp, but
> rather considered a paragraph.

Upon further thinking, I do not think that the above should be parsed as
a paragraph. We are rather permissive about extra unrecognized text in
the timestamps - it is a feature.

I, however, added a low-trust linter that reports timestamps with
unexpected extra text.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ab542a653

Handled.

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



Re: BUG: (org-insert-subheading) fails when on true begin of line (first star) of heading

2023-05-13 Thread Ihor Radchenko
Michael Dauer  writes:

> I understand that it's behavior is derived from org-insert-heading. But IMO
> that does not make sense for this function, advice all that it is taking
> the current indentation level as basis to devote the new heading as child
> of the previous heading. It e.g. created a "orphan" grand child instead of
> a child.

I tend to agree.
Would you be interested to provide a patch?

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



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

2023-05-13 Thread Ihor Radchenko
stardiviner  writes:

> I have a large `org-tag-alist` value that contains about ~7000 tags.
> When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long time.

Indeed. That's because `org-fast-tag-selection' tries to put all those
7k tags into tag selection window.

We can probably limit the maximum number of tags in the quick selection
window.

Can you try the attached simple diff for `org-fast-tag-selection' and
check if it is enough to solve the hang?

diff --git a/lisp/org.el b/lisp/org.el
index c148409d9..d745fd01e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11765,7 +11765,7 @@ (defun org-fast-tag-selection (current inherited table  todo-table)
 	(org-fast-tag-insert "Current" current c-face "\n\n")
 	(org-fast-tag-show-exit exit-after-next)
 	(org-set-current-tags-overlay current ov-prefix)
-	(setq tbl fulltable char ?a cnt 0)
+	(setq tbl (seq-take fulltable 26) char ?a cnt 0)
 	(while (setq e (pop tbl))
 	  (cond
 	   ((eq (car e) :startgroup)

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


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

2023-05-13 Thread Ihor Radchenko
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.

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