nested blocks in org

2024-02-15 Thread mahmood sheikh
can you point me in the right direction of getting org mode to recognize
nested blocks, like code highlighting for src blocks that are within
another special block? and getting org-element-map to iterate through both
a parent and its child blocks all the same?
could modifying `org-block-regexp` to be a recursive regex be of help?


Re: (jit-lock-function 1) signaled (error "Stack overflow in regexp matcher")

2024-02-15 Thread William Denton
On Thursday, February 15th, 2024 at 15:40, William Denton 
 wrote:

> I am having a problem I've never seen before: Org can't handle anything more 
> in a large file I have!
> 
> This file is where I keep my notes day to day for work, with headings for 
> months and days and categories of work, with a lot of notes and clocking in 
> and out. It has about 10,000 lines and is about 550K in size.

Update: moving the 600-line clock table in that file to another file fixed the 
problem.  (In that new file, it generates its clock table from the clocking in 
the remote file, the old one.)

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada




(jit-lock-function 1) signaled (error "Stack overflow in regexp matcher")

2024-02-15 Thread William Denton
I am having a problem I've never seen before: Org can't handle anything more in 
a large file I have!

This file is where I keep my notes day to day for work, with headings for 
months and days and categories of work, with a lot of notes and clocking in and 
out.  It has about 10,000 lines and is about 550K in size.

When I add today's notes to the file (fifty lines and ten clockings), it starts 
throwing these errors:

File mode specification error: (error Stack overflow in regexp matcher)
Error during redisplay: (jit-lock-function 1) signaled (error "Stack overflow 
in regexp matcher")
Error during redisplay: (jit-lock-function 1501) signaled (error "Stack 
overflow in regexp matcher")
Error during redisplay: (jit-lock-function 3001) signaled (error "Stack 
overflow in regexp matcher")

Org works, but it's not displaying properly: no fancy bullets, no proportional 
spacing, no font size differences---it looks like I was running it in terminal 
mode.  This makes sense if the problem is with font locking.

If I remove today's notes and reload, everything looks fine.  If I add in even 
one more heading and reload, it chokes again and the formatting is all lost.

I turned on debugging and restarted, and got a big stack trace, which I will 
paste in below.  If "marker at 770" means line 770 then I don't know what's 
going on, because it's just regular stuff there and around it.

What can I do to determine where the problem is?  Any help appreciated.

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada

Debugger entered--Lisp error: (error "Stack overflow in regexp matcher")
  re-search-forward("^[ 
\11]*\\(begin{\\([a-zA-Z0-9\\*]+\\)\\(?:.\\|\n\\)+?end{\\2}\\)\\|\\([^$]\\|^\\)\\(\\$[^
 
\11\15\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)\\|\\([^$]\\|^\\)\\(\\(\\$\\([^
 \11\n,;.$][^$\n\15]*?\\(\n[^$\n\15]*?\\)\\{0,2\\}[^ 
\11\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)\\|(\\(?:.\\|\n\\)*?)\\|\\[\\(?:.\\|\n\\)*?\\]\\|\\$\\$\\(?:.\\|\n\\)*?\\$\\$"
 nil t)
  org-do-latex-and-related(#)
  font-lock-fontify-keywords-region(522 # nil)
  font-lock-default-fontify-region(522 # nil)
  font-lock-fontify-region(522 #)
  #f(compiled-function (beg end) #)(522 #)
  font-lock-ensure(522 #)
  org-table-align()
  org-table-map-tables(org-table-align t)
  org-mode()
  set-auto-mode-0(org-mode nil)
  set-auto-mode--apply-alist((("\\.yml$" . yaml-mode) 
("\\.\\(r\\(?:ng\\|ss\\)\\|s\\(?:ch\\|vg\\)\\|x\\(?:ml\\|s\\(?:d\\|lt\\)\\)\\)\\'"
 . nxml-mode) ("\\.[pP][dD][fF]\\'" . pdf-view-mode) ("README\\.md\\'" . 
gfm-mode) 
("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:ld\\)?\\)\\|composer\\.lock\\)\\'\\)"
 . json-mode) ("\\.hva\\'" . LaTeX-mode) ("\\.tsv\\'" . tsv-mode) 
("\\.[Cc][Ss][Vv]\\'" . csv-mode) ("\\.[Ss][Aa][Ss]\\'" . SAS-mode) 
("\\.Sout\\'" . S-transcript-mode) ("\\.[Ss]t\\'" . S-transcript-mode) 
("\\.Rd\\'" . Rd-mode) ("DESCRIPTION\\'" . conf-colon-mode) 
("/Makevars\\(\\.win\\)?\\'" . makefile-mode) ("\\.[Rr]out\\'" . 
ess-r-transcript-mode) ("CITATION\\'" . ess-r-mode) ("NAMESPACE\\'" . 
ess-r-mode) ("\\.[rR]profile\\'" . ess-r-mode) ("\\.[rR]\\'" . ess-r-mode) 
("/R/.*\\.q\\'" . ess-r-mode) ("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode) 
("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode) ("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode) 
("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode) ("/git-rebase-todo\\'" . 
git-rebase-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . 
markdown-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) 
("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . 
elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) 
("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil 
jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" 
nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) 
("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|axlsx\\|jbuilder\\|rabl\\|gemspec\\|podspec\\)\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Puppet\\|Berks\\|Brew\\|Fast\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'"
 . ruby-mode) ("\\.re?st\\'" . rst-mode) ("/\\(?:Pipfile\\|\\.?flake8\\)\\'" . 
conf-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) 
("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . 
csharp-mode) ("\\.awk\\'" . awk-mode) 
("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . 
idl-mode) ("\\.java\\'" . java-mode) ...) nil nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil nil)
  find-file-noselect-1(# 
"~/york/shared/work-diaries/work-diary.org" :nowarn nil 
"~/york/shared/work-diaries/work-diary-2023-2024.org" (10227922 66310))
  find-file-noselect("/home/wdenton/york/shared/work-diaries/work-diary.org" 
:nowarn)
  
desktop-restore-file-buffer("/home/wdenton/york/shared/work-diaries/work-diary.org"
 "work-diary.org" nil)
  desktop-create-buffer(208 

Asynchronous blocks for everything (was Re: [BUG] Unexpected result when evaluating python src block asynchronously [9.7-pre (release_9.6.17-1131-gc9ed03.dirty @ /home/yantar92/.emacs.d/straight/build

2024-02-15 Thread Matt
If I followed correctly, the topic switched to discussing async generally 
within Babel.  I've started a new thread accordingly.

  On Tue, 06 Feb 2024 20:24:13 +0100 Bruno Barbier

 > FWIW, I've been trying to use asynchronous blocks for everything, not only 
 > the source blocks that are based on the comint mode.

I've been trying to figure out how to make everything async by default.  I'm 
super interested to see what you've come up with.

 > I think it would be good if ob-core itself could provide an asynchronous API.

Fortunately or unfortunately, depending on how you look at it, Babel already 
does.

The challenge is that the Org Babel API has grown piecemeal over 14 years.  
It's been written by several authors with limited time and knowledge.  The 
result, while powerful and useful, is a bit of a hodgepodge.  A prime example 
is that the concepts of "persistence" and "synchronicity" are conflated.  
"Session" is often used to mean "asynchronous" even though the two ideas are 
orthogonal.  Emacs provides primitives that could make non-session blocks 
asynchronous.  It's historical accident that blocks aren't async by default.

For me, the issue is that the Babel API needs some high level perspective in 
order to make it consistent.  I see the following terms as guides.  If we can 
separate these concepts within the API, then Babel to *feel* like an API:

- "Session" means a shell environment is "persistent."  Each call is executed 
in the same environment.  State exists between calls.

- "Non-session" means a shell environment is "temporary."  Each call is 
executed in an independent environment.  State does not exist between calls.

- "Synchronous" means that execution prevents the user from editing the 
document while results are obtained.

- "Asynchronous" means that execution does not prevent the user from editing 
the document while results are obtained.

 > I've modified my Org so that it does have such an API.  This is work in 
 > progress; let me describe it.
 >
 > I've modified ob-core itself to allow asynchronicity.  In the asynchrosous 
 > case, instead of calling:
 >
 >   (org-babel-execute:LANG body params)
 >
 > I'm calling:
 >
 >   (org-babel-schedule:LANG body params handle-result)
 >
 > where `org-babel-schedule:LANG' is in charge of calling `handle-result' with 
 > the result (or the error) when it is known; `handle-result' takes care to 
 > call `org-babel-insert-result' at the correct place (and 
 > `org-babel-insert-result' is only called with a real result).
 >
 > While the execution is pending, I'm using the same technique that Org is 
 > using when a source block is being edited: the result is left untouched, but 
 > below an overlay.  The overlay is used to know where to insert the result 
 > and to display the status/progress of the execution.  If the file is closed 
 > and the execution fails, nothing is lost, the old result is still available.

The use of the overlay is a really cool idea!

I hesitate to say that's a good way to convey success or failure.  If a process 
failed, I want to see the output which tells me why so that I can correct it.  
Or, I might actually want the failure output.  Maybe I want to literally 
demonstrate what a code failure looks like.  Maybe I want to use that output in 
another block.  For example, shell blocks have multiple output types.  A shell 
process may return standard output/error or a failure code.  The result of the 
failure may trigger something else.

However, using an overlay to communicate "the process is still running" could 
be good.  We'd need to be careful about accessibility, though, and make sure 
the overlay is apparent, visually and otherwise.

 > If that technique looks safe enough and interesting, I can prepare a set of 
 > patches so that we can discuss it further and, maybe, add it in Org.

Please do!  I'm super interested.  I've put a lot of thought into how we might 
make Babel async by default.  I'm excited to see your interest in the topic and 
look forward to seeing what you've come up with.

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode




old pkg fstree stopped working

2024-02-15 Thread Uwe Brauer

Hi 

I using a pretty old package called org-fstree


All it requires, after loading it of course, is  to have in an org file the 
lines
--8<---cut here---start->8---

#+begin_fstree: /home/oub/ALLES/HGs/HG-CVS-Formular :non-recursive t

#+end_fstree:
--8<---cut here---end--->8---

Which would result in 

* Overview over the files
#+begin_fstree: /home/oub/ALLES/HGs/HG-CVS-Formular :non-recursive t

** | | [[file:/home/oub/ALLES/HGs/HG-CVS-Formular/README.org][README.org]]  
   
** | | 
[[file:/home/oub/ALLES/HGs/HG-CVS-Formular/spread-orginal.org][spread-orginal.org]]
 the orginal file
** | | 
[[file:/home/oub/ALLES/HGs/HG-CVS-Formular/spread-sum-column.csv][spread-sum-column.csv]]
  the converted CSV of the ods files, with the formula included (not the 
results)
** | | 
[[file:/home/oub/ALLES/HGs/HG-CVS-Formular/spread-sum-column.ods][spread-sum-column.ods]]
  the ods file implementing the table where the colums are added
** | | 
[[file:/home/oub/ALLES/HGs/HG-CVS-Formular/spread-sum-column.org][spread-sum-column.org]]
  the org version of the CSV file
** | | 
[[file:/home/oub/ALLES/HGs/HG-CVS-Formular/spread-sum-row.csv][spread-sum-row.csv]]
 the converted CSV of the ods files, with the formula included (not the 
results)
** | | 
[[file:/home/oub/ALLES/HGs/HG-CVS-Formular/spread-sum-row.ods][spread-sum-row.ods]]
 the ods file implementing the table where the rows are added
** | | 
[[file:/home/oub/ALLES/HGs/HG-CVS-Formular/spread-sum-row.org][spread-sum-row.org]]
 the org version of the CSV file


#+end_fstree:


However not any longer when I now hit C-c C-c org tells me:
can't do anything useful here.


I updated org-mode recently could that be the reason? I have changed my emacs 
version lately.

Regards

Uwe Brauer 

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



smime.p7s
Description: S/MIME cryptographic signature