[BUG] kill-buffer invoked org-persistent-write-all-buffer caused Emacs long suspend

2021-10-28 Thread Christopher M. Miles


Here is the profiler report:

CPU:

#+begin_example
4003  66% - command-execute
4003  66%  - call-interactively
3913  65%   - funcall-interactively
3320  55%- kill-buffer
3318  55% - org-persist-write-all-buffer
3318  55%  - org-persist-write-all
3318  55%   - if
3318  55%- let
3318  55% - while
3318  55%  - let
3318  55%   - if
3318  55%- progn
3318  55% - org-persist-write
3318  55%  - if
3318  55%   - save-current-buffer
3318  55%- let
3097  51% - let
3097  51%  - if
3097  51%   - if
3095  51%- progn
3095  51% - let
1799  29%  - unwind-protect
1799  29%   - prog1
1798  29%- save-current-buffer
 114   1% - write-region
 114   1%  - select-safe-coding-system
  98   1%   - find-auto-coding
  94   1%  auto-coding-alist-lookup
   4   0%  
sgml-html-meta-auto-coding-function
  15   0%   + find-coding-systems-region
1290  21%  - let
1290  21%   - unwind-protect
1290  21%- prog1
1289  21% - save-current-buffer
 182   3%  - write-region
 182   3%   - select-safe-coding-system
 155   2%- find-auto-coding
 154   2%   auto-coding-alist-lookup
   1   0%   
sgml-html-meta-auto-coding-function
  26   0%+ find-coding-systems-region
   6   0%if
 220   3% + org-persist--get-index
   2   0% + valign--maybe-clean-advice
 592   9%+ counsel-M-x
   1   0%+ previous-line
  90   1%   + ivy-completing-read
 978  16% - youtube-dl--filter
 978  16%  - youtube-dl--redisplay
 585   9%   - youtube-dl--list-buffer
 585   9%- youtube-dl-list-mode
 332   5% - hl-line-mode
 332   5%  - add-hook
 332   5%   + sort
 165   2% + special-mode
  88   1% + run-mode-hooks
 393   6%   + youtube-dl-list-redisplay
 954  15% + ...
  40   0% + timer-event-handler
   9   0% + redisplay_internal (C function)
   9   0% + global-font-lock-mode-check-buffers
   5   0% + global-dash-fontify-mode-check-buffers
   3   0% + global-prettify-symbols-mode-check-buffers
   3   0% + yas-global-mode-check-buffers
   3   0% + global-atomic-chrome-edit-mode-check-buffers
   2   0% + global-edit-server-edit-mode-check-buffers
   2   0% + global-flycheck-mode-check-buffers
   2   0% + global-company-mode-check-buffers
   1   0% + org-pretty-tags-global-mode-check-buffers
   1   0% + magit-auto-revert-mode-check-buffers
   1   0% + emojify-update-visible-emojis-background-after-command
   1   0% + global-ligature-mode-check-buffers
   1   0% + global-emojify-mode-check-buffers
   1   0% + global-anzu-mode-check-buffers
   1   0% + mode-local-post-major-mode-change

#+end_example

Memory report:

#+begin_example
  5,860,697,032  99% - ...
  5,860,697,032  99%  - org-persist-write-all
  5,860,697,032  99%   - if
  5,860,697,032  99%- let
  5,860,697,032  99% - while
  5,860,697,032  99%  - let
  5,860,697,032  99%   - if
  5,860,697,032  99%- progn
  5,860,697,032  99% - org-persist-write
  5,860,697,032  99%  - if
  5,860,697,032  99%   - save-current-buffer
  5,860,697,032  99%- let
  5,671,666,312  96% - let
  5,671,666,312  96%  - if
  5,671,666,312  96%   - if
  5,671,666,312  96%- progn
  5,671,666,312  96% - let
  4,109,383,193  70%  - unwind-protect
  4,109,383,193  70%   - prog1
  4,109,383,193  70%- save-current-buffer
  4,825,178   0% - write-region
  4,792,442   0%  + select-safe-coding-system
 32,736   0%  + make-lock-file-name
 39,558   0% + prin1
  1,562,123,885  26%  + let
 32,736   0%  + if
 28,290   0%   

Re: [BUG] kill-buffer invoked org-persistent-write-all-buffer caused Emacs long suspend

2021-10-28 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> Here is the profiler report:
>
> CPU:
>
> #+begin_example
> 4003  66% - command-execute
> 4003  66%  - call-interactively
> 3913  65%   - funcall-interactively
> 3320  55%- kill-buffer
> 3318  55% - org-persist-write-all-buffer
> 3318  55%  - org-persist-write-all

Sorry for this. Should be already fixed by 5abd149cf. Are you on latest
main?

Best,
Ihor



Re: [BUG] kill-buffer invoked org-persistent-write-all-buffer caused Emacs long suspend

2021-10-28 Thread Christopher M. Miles


Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Here is the profiler report:
>>
>> CPU:
>>
>> #+begin_example
>> 4003  66% - command-execute
>> 4003  66%  - call-interactively
>> 3913  65%   - funcall-interactively
>> 3320  55%- kill-buffer
>> 3318  55% - org-persist-write-all-buffer
>> 3318  55%  - org-persist-write-all
>
> Sorry for this. Should be already fixed by 5abd149cf. Are you on latest
> main?
>
> Best,
> Ihor

Thanks for quick patch, I'm on the latest main. and I pulled your patch. Now 
it's not infinite
looping, but still takes about 3.5 seconds. So I take another profiler 
profiling again.

CPU

#+begin_example
4824  88% - command-execute
4824  88%  - call-interactively
4797  87%   - funcall-interactively
4313  78%- kill-buffer
4310  78% - org-persist-write-all-buffer
4310  78%  - org-persist-write-all
4310  78%   - if
4310  78%- let
4310  78% - while
4310  78%  - let
4310  78%   - if
4310  78%- progn
4310  78% - org-persist-write
4310  78%  - if
4310  78%   - save-current-buffer
4310  78%- let
3903  71% - let
3903  71%  - if
3903  71%   - if
3858  70%- progn
3858  70% - let
3380  61%  - unwind-protect
3380  61%   - prog1
3380  61%- save-current-buffer
 103   1% + write-region
 390   7%  + let
  88   1%if
 405   7% + org-persist--get-index
   2   0% + setq
   1   0% + auto-revert-notify-rm-watch
   1   0% + valign--maybe-clean-advice
   1   0% + recentf-track-closed-file
 484   8%+ counsel-M-x
  27   0%   + ivy-completing-read
 642  11% - ...
 642  11%Automatic GC
   1   0% + global-font-lock-mode-check-buffers
   1   0% + redisplay_internal (C function)

#+end_example

Memory:

#+begin_example
  4,155,608,836  99% - command-execute
  4,155,608,836  99%  - call-interactively
  4,155,381,887  99%   - funcall-interactively
  4,151,008,326  99%- kill-buffer
  4,151,002,497  99% - org-persist-write-all-buffer
  4,151,002,497  99%  - org-persist-write-all
  4,151,002,497  99%   - if
  4,151,002,497  99%- let
  4,151,002,497  99% - while
  4,151,002,497  99%  - let
  4,151,002,497  99%   - if
  4,150,994,313  99%- progn
  4,150,994,313  99% - org-persist-write
  4,150,994,313  99%  - if
  4,150,994,313  99%   - save-current-buffer
  4,150,994,313  99%- let
  4,140,546,179  99% - let
  4,140,546,179  99%  - if
  4,140,546,179  99%   - if
  4,140,540,035  99%- progn
  4,140,540,035  99% - let
  3,879,416,903  93%  - unwind-protect
  3,879,416,903  93%   - prog1
  3,879,416,903  93%- save-current-buffer
 20,391,917   0% - write-region
 20,165,663   0%  + select-safe-coding-system
226,254   0%  + make-lock-file-name
256,994   0% + prin1
260,984,307   6%  + let
122,760   0%  + if
 16,065   0%generate-new-buffer
  7,942,223   0% + org-persist--get-index
  2,505,911   0% + setq
  8,184   0%+ or
  3,072   0% + tramp-flush-file-function
  1,120   0% + preview-kill-buffer-cleanup
  1,024   0% + save-place-to-alist
613   0% + replace-buffer-in-windows
  4,373,561   0%+ counsel-M-x
226,949   0%   + ivy-completing-read
 65,528   0% + ...
 20,692   0% + redisplay_internal (C function)

#+end_example


<#secure method=pgpmime mode=sign>
-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

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


Re: Bug: font-lock error with - in code-mode (reopened)

2021-10-28 Thread Max Nikulin

This is a message to track the issue on https://updates.orgmode.org

On 01/10/2021 16:56, Ihor Radchenko wrote:

"Dr. Arne Babenhauserheide" writes:


When parsing the following code:

Am richtigen Ort zur richtigen Zeit (=+=; 1x pro Abenteuer im richtigen
Moment auftauchen), Computeraffinität (=+= oder =++=; Bonus von 3 oder 6),
Kurze Aufmerksamskeitsspanne (~-~), Photographisches Gedächtnis (=+=),
Primitive Technologie (~-~), Schreckhaft (~-~), Schrecklich Schusselig (~-~),
Toller Laptop (=+=) oder Verträumt (~-~).

The fourth line is highlighted as code beginning at the first ~-~ until
the final closing paren (")")  of the paragraph.


The fix is attached.


So Ihor reverted the change by commit 52cdf53328


Revert "org-do-emphasis-faces: Never treat closing marker as next opening 
marker"

This reverts commit fa315986a115028d289f4921281e44e35842a27b.

The commit broke fontification of nested emphasis like

/italic *bold* more italic/.


P.S. Earlier added "yes" entry were successfully removed by my previous 
message to this thread with "X-Woof-Bug: canceled" header. Hope, correct 
header will be set by "X-Woof-Bug: Bug: font-lock error with - in 
code-mode (reopened)"




Re: Bug: font-lock error with - in code-mode (reopened)

2021-10-28 Thread Ihor Radchenko
Max Nikulin  writes:

> P.S. Earlier added "yes" entry were successfully removed by my previous 
> message to this thread with "X-Woof-Bug: canceled" header. Hope, correct 
> header will be set by "X-Woof-Bug: Bug: font-lock error with - in 
> code-mode (reopened)"

Thanks! I can see the correct bug title in updates.orgmode.org now.

Best,
Ihor



Re: [BUG] kill-buffer invoked org-persistent-write-all-buffer caused Emacs long suspend

2021-10-28 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> Thanks for quick patch, I'm on the latest main. and I pulled your patch. Now 
> it's not infinite
> looping, but still takes about 3.5 seconds. So I take another profiler 
> profiling again.

Fixed (hopefully) on main via 1b2d06880. Please, restart emacs after
loading the latest Org (or call M-: (org-persist-gc) before testing.

A bug introduced in 5ca866d08 caused cache index corruption.
org-persist-gc should fix the corrupted index.

Best,
Ihor



[PATCH] org-src: Reset buffer-modified-p after fontifying

2021-10-28 Thread Clément Pit-Claudel
Hi all,

* lisp/org-src.el (org-src-font-lock-fontify-block): Reset the
modification flag of the temporary fontification buffer after
fontifying.

Without this some modes cause Emacs to prompt about unsaved buffers
when exiting: `Save buffer *org-src-fontification:...-mode*?'

(I'm seeing this with Proof General's coq-mode, specifically.)

Clément.
>From 085cc7ae79ff3649dbe9a53bb6a9ca26f30d58f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Pit-Claudel?= 
Date: Thu, 28 Oct 2021 11:09:55 -0400
Subject: [PATCH] org-src: Reset buffer-modified-p after fontifying

* lisp/org-src.el (org-src-font-lock-fontify-block): Reset the
modification flag of the temporary fontification buffer after
fontifying.

Without this some modes cause Emacs to prompt about unsaved buffers
when exiting: `Save buffer *org-src-fontification:...-mode*?'
---
 lisp/org-src.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index f1948bfa9..51dde602d 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -642,7 +642,8 @@ org-src-font-lock-fontify-block
 		  (put-text-property
 		   (+ start (1- pos)) (1- (+ start next)) prop new-prop
 		   org-buffer)))
-	  (setq pos next
+	  (setq pos next)))
+  (set-buffer-modified-p nil))
 	;; Add Org faces.
 	(let ((src-face (nth 1 (assoc-string lang org-src-block-faces t
   (when (or (facep src-face) (listp src-face))
-- 
2.25.1



[SOLVED] Re: [BUG] kill-buffer invoked org-persistent-write-all-buffer caused Emacs long suspend

2021-10-28 Thread Christopher M. Miles


Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Thanks for quick patch, I'm on the latest main. and I pulled your patch. Now 
>> it's not infinite
>> looping, but still takes about 3.5 seconds. So I take another profiler 
>> profiling again.
>
> Fixed (hopefully) on main via 1b2d06880. Please, restart emacs after
> loading the latest Org (or call M-: (org-persist-gc) before testing.
>
> A bug introduced in 5ca866d08 caused cache index corruption.
> org-persist-gc should fix the corrupted index.
>
> Best,
> Ihor

With the second latest patch, the problem solved. Thanks Thanks a lot.!


<#secure method=pgpmime mode=sign>
-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

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


Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal



>
> First, you need to convert a plist to an alist (source:
> https://caiorss.github.io/Emacs-Elisp-Programming/Elisp_Programming.html#sec-1-8-4):
>
>
> And this would be the modified function:
>


This still seems to exporting the second "options" value only.

Vikas



[ANN] EmacsConf 2021 program and posters

2021-10-28 Thread Amin Bandali
Greetings, fellow Emacsians!

On behalf of the EmacsConf 2021 organizers team, I'm very excited to
announce the program for EmacsConf 2021 (Nov 27 and 28), available at:

 https://emacsconf.org/2021/schedule

We'll continue working on scheduling the talks in a way that works
reasonably well for as many of our speakers as possible with respect
to their availability, and will add the allocated time slots for the
talks in the coming weeks.

This year we have 3 beautiful posters for EmacsConf 2021, created by
Paul Sutton, Garulfo Azules, and Adam Porter (many thanks!) that you
can share with others to help spread the word about the conference!
You can see a preview of these posters on the 2021 poster page, along
with links to various formats and their corresponding sources:

  https://emacsconf.org/2021/poster

Paul, Garulfo, and Adam have kindly dual-licensed their respective
posters under the CC BY-SA 4.0 and GPLv3+ licenses; same as our wiki:
https://emacsconf.org/COPYING.  As such, you are more than welcome to
use/modify/change these posters under the terms of either of the above
free software/culture licenses, and perhaps use them as a basis for
your own freely licensed poster!

Best,
amin

P.S. please direct all replies to this post either to myself or to the
emacsconf-discuss list, so as to help avoid generating extra off-topic
chatter in the other lists cc'd in this message; thank you.



Re: org-persist warning when archiving

2021-10-28 Thread Colin Baxter 😺


I have now discovered what is causing the org-persist warnings. It is
because my org-agenda files have local variables present. If I remove
the local variables, the warnings disappear.

Best wishes,

Colin.



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Juan Manuel Macías
Vikas Rawal writes:

> This still seems to exporting the second "options" value only.

Do you still keep this line in your init:

(advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?

If so, rename the function from my previous email as
`my/org-latex-org-table' and re-evaluate it. And comment the old
`my/org-latex-org-table'.

The new function works well for me. E.g. this:

#+ATTR_LATEX: :environment longtblr
#+ATTR_LATEX: :align align
#+ATTR_LATEX: :options options 1
#+ATTR_LATEX: :options options 2
#+ATTR_LATEX: :options options 3
#+ATTR_LATEX: :options options 4
| lorem | lorem | lorem | lorem | lorem |
|---+---+---+---+---|
| ipsum | ipsum | ipsum | ipsum | ipsum |

produces in LaTeX this:

\begin{longtblr}[options 1 options 2 options 3 options 4]{align}
lorem & lorem & lorem & lorem & lorem\\
\hline
ipsum & ipsum & ipsum & ipsum & ipsum\\
\end{longtblr}



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Juan Manuel Macías
Juan Manuel Macías writes:

> \begin{longtblr}[options 1 options 2 options 3 options 4]{align}

PS: I think the options should be separated by commas. In this
case, it's necessary to replace the line:

(mapconcat (lambda (x) (mapconcat 'identity x "")) options-list " ")))

by this line:

(mapconcat (lambda (x) (mapconcat 'identity x "")) options-list ",")))

Best regards,

Juan Manuel 



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal
> Do you still keep this line in your init:
>
> (advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?
>
> If so, rename the function from my previous email as
> `my/org-latex-org-table' and re-evaluate it. And comment the old
> `my/org-latex-org-table'.
>

You were right. My bad. I should have been more careful.

I confirm, the new function works and is a significant improvement.

Vikas



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal
> > \begin{longtblr}[options 1 options 2 options 3 options 4]{align}
>
> PS: I think the options should be separated by commas. In this
> case, it's necessary to replace the line:
>
> (mapconcat (lambda (x) (mapconcat 'identity x "")) options-list " ")))
>
> by this line:
>
> (mapconcat (lambda (x) (mapconcat 'identity x "")) options-list ",")))

I think the user can just write the comma in the option lines. It
might be more flexible to leave it to the user. I am just thinking of
a possibility that some other package may require a different
delimiter between options.

But others may have a different view.

I think this modification is useful and an improvement, and should be 
incorporated in orgmode itself.

I expect Nicholas would have a sense of whether this is likely to conflict with 
anything, or if there are some other considerations. Would be great to know 
from him and others in the know.

Thank you very much.

Vikas



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal
>
> Do you still keep this line in your init:
>
> (advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?

You were right. My bad.

I confirm, the new function works and is a significant improvement.

Vikas



Re: org-persist warning when archiving

2021-10-28 Thread Ihor Radchenko
Colin Baxter 😺  writes:

> I have now discovered what is causing the org-persist warnings. It is
> because my org-agenda files have local variables present. If I remove
> the local variables, the warnings disappear.

Do you mean file-local? Can you provide a minimal Org file example?

I also have file-local variables in my Org buffers, but I do not
experience the issue. Maybe it is some specific file-local variable?

Best,
Ihor



problems with org indent timer

2021-10-28 Thread Eric S Fraga
I upgraded org to latest from git yesterday and now the indent timer (I
didn't realize the indenting required a timer) says:

Error running timer ‘org-indent-initialize-agent’: (args-out-of-range
["" "" #("*" 0 1 (face org-indent)) [...]
#("" 0 48 (face org-indent))] 
86) [2 times]

The elided bit consists of the lists including stars (increasing by one
each time), the face sexp and the count.

I don't have time to track this down right now (teaching takes
precendence!) but thought I'd mention this.  Emacs was also updated at
the same time so the problem could be due to Emacs itself.

-- 
: Eric S Fraga via Emacs 28.0.60, Org release_9.5-189-g1b2d06
: Latest paper written in org: https://arxiv.org/abs/2106.05096