Re: Fwd: [BUG] when open a large org file, emacs get stuck and show a warning "org-element--cache: Unregistered buffer modifications detected"

2022-05-21 Thread imymorror wang
>Can you try to reproduce the problem starting from clean Emacs state
>(emacs -Q)? See https://orgmode.org/manual/Feedback.html
thank you for reminding me to use this method.


I found out why. package *valign-mode*(https://github.com/casouri/valign)
causes the problem:

(add-hook 'org-mode-hook #'valign-mode)

If I don't add-hook for valign-mode, everything works fine.

Ihor Radchenko  于2022年5月21日周六 12:37写道:

> imymorror wang  writes:
>
> >> Can you share the values of change-major-mode-hook and org-mode-hook?
> > I uploaded all *emacs **current state* in recent e-mail .
>
> Sorry, I missed that. Unfortunately I do not see anything suspicious
> there.
>
> Now, it is confusing. I am unable to reproduce the warning on my side
> even with org-fragtog and valign installed.
>
> Can you try to reproduce the problem starting from clean Emacs state
> (emacs -Q)? See https://orgmode.org/manual/Feedback.html
>
> >> Also, do you deliberately drop the CC to emacs-orgmode@gnu.org and
> prefer
> > the conversation to be not public?
> > sorry. I'm not good at email communication. This is my first attempt to
> > submit a bug report to Emacs. Maybe I could add CC to
> emacs-orgmode@gnu.org on
> > the recent email that shows all my emacs current state info.
>
> Just use "Reply All" in future.
>
> Best,
> Ihor
>


Re: Fwd: [BUG] when open a large org file, emacs get stuck and show a warning "org-element--cache: Unregistered buffer modifications detected"

2022-05-21 Thread imymorror wang
>Now, it is confusing. I am unable to reproduce the warning on my side
>even with org-fragtog and valign installed.

valign-mode causes the problem. Try these steps to reproduce the problem :
add-hook for valign and open a large org file, then try moving the mouse a
few times,quickly TAB and SHIFT-TAB a few times.

Ihor Radchenko  于2022年5月21日周六 12:37写道:

> imymorror wang  writes:
>
> >> Can you share the values of change-major-mode-hook and org-mode-hook?
> > I uploaded all *emacs **current state* in recent e-mail .
>
> Sorry, I missed that. Unfortunately I do not see anything suspicious
> there.
>
> Now, it is confusing. I am unable to reproduce the warning on my side
> even with org-fragtog and valign installed.
>
> Can you try to reproduce the problem starting from clean Emacs state
> (emacs -Q)? See https://orgmode.org/manual/Feedback.html
>
> >> Also, do you deliberately drop the CC to emacs-orgmode@gnu.org and
> prefer
> > the conversation to be not public?
> > sorry. I'm not good at email communication. This is my first attempt to
> > submit a bug report to Emacs. Maybe I could add CC to
> emacs-orgmode@gnu.org on
> > the recent email that shows all my emacs current state info.
>
> Just use "Reply All" in future.
>
> Best,
> Ihor
>


Re: Fwd: [BUG] when open a large org file, emacs get stuck and show a warning "org-element--cache: Unregistered buffer modifications detected"

2022-05-21 Thread Ihor Radchenko
imymorror wang  writes:

>>Now, it is confusing. I am unable to reproduce the warning on my side
>>even with org-fragtog and valign installed.
>
> valign-mode causes the problem. Try these steps to reproduce the problem :
> add-hook for valign and open a large org file, then try moving the mouse a
> few times,quickly TAB and SHIFT-TAB a few times.

Thanks! I have opened an issue in valign repo:
https://github.com/casouri/valign/issues/30

This problem needs to be fixed on valign side.

Best,
Ihor



Re: [BUG] HTML export of buffer with fringe indicators

2022-05-21 Thread Daniel Fleischer
Ihor Radchenko [2022-05-20 Fri 16:36]  wrote:

> I am unable to reproduce your problem on my side using the following
> steps.

Ok, thanks anyway. BTW, even the steps you took are useful for me for future 
debugging. 

Best,

Daniel Fleischer


Re: [BUG] HTML export of buffer with fringe indicators

2022-05-21 Thread Ihor Radchenko
Daniel Fleischer  writes:

> Ihor Radchenko [2022-05-20 Fri 16:36]  wrote:
>
>> I am unable to reproduce your problem on my side using the following
>> steps.
>
> Ok, thanks anyway. BTW, even the steps you took are useful for me for future 
> debugging. 

It is exactly the reason I listed the steps. So that you can also try on
your side.

If you cannot reproduce using my steps, there is a chance that the
problem is also caused by some other part of your config. In which case,
you can use https://github.com/Malabarba/elisp-bug-hunter to hunt down
the cause. Also, see
https://open.tube/videos/watch/4d819114-43bf-42df-af94-f94fc53dd0d9

Best,
Ihor



[BUG] Let org-latex-compile fall back on org-latex-compiler as the default instead of "pdflatex" [9.6 (9.6-??-4f0f24447 @ /home/dan/.emacsen/doom-emacs/.local/straight/build-29.0.50/org/)]

2022-05-21 Thread daanturo
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See

https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Having set `org-latex-compiler` to `lualatex`, when exporting with
`org-latex-export-to-pdf`, I expected that `lualatex` is the compiler to
be used but `org-latex-compile` falled back on `pdflatex` instead.


Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, 
cairo version 1.17.6)
 of 2022-05-20
Package: Org mode version 9.6 (9.6-??-4f0f24447 @ 
/home/dan/.emacsen/doom-emacs/.local/straight/build-29.0.50/org/)
 
current state:
==
(setq
 org-link-elisp-confirm-function nil
 org-directory "~/Documents/org"
 org-after-refile-insert-hook '(save-buffer)
 org-indirect-buffer-display 'current-window
 org-crypt-key nil
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-load-hook '(+org-init-org-directory-h
 +org-init-appearance-h +org-init-agenda-h
 +org-init-attachments-h +org-init-babel-h
 +org-init-babel-lazy-loader-h
 +org-init-capture-defaults-h
 +org-init-capture-frame-h
 +org-init-custom-links-h +org-init-export-h
 +org-init-habit-h +org-init-hacks-h
 +org-init-keybinds-h +org-init-popup-rules-h
 +org-init-protocol-h
 +org-init-protocol-lazy-loader-h
 +org-init-smartparens-h)
 org-startup-folded nil
 org-babel-after-execute-hook '(+org-redisplay-inline-images-in-babel-result-h)
 org-link-abbrev-alist '(("doom-repo" .
  "https://github.com/hlissner/doom-emacs/%s";)
 ("wolfram" .
  "https://wolframalpha.com/input/?i=%s";)
 ("wikipedia" .
  "https://en.wikipedia.org/wiki/%s";)
 ("duckduckgo" .
  "https://duckduckgo.com/?q=%s";)
 ("gmap" .
  "https://maps.google.com/maps?q=%s";)
 ("gimages" .
  "https://google.com/images?q=%s";)
 ("google" .
  "https://google.com/search?q=";)
 ("youtube" .
  "https://youtube.com/watch?v=%s";)
 ("github" . "https://github.com/%s";))
 org-agenda-files '("~/Documents/org")
 org-capture-templates '(("t" "Personal todo" entry
  (file+headline
   +org-capture-todo-file "Inbox")
  "* [ ] %?\n%i\n%a" :prepend t)
 ("n" "Personal notes" entry
  (file+headline
   +org-capture-notes-file "Inbox")
  "* %u %?\n%i\n%a" :prepend t)
 ("j" "Journal" entry
  (file+olp+datetree
   +org-capture-journal-file)
  "* %U %?\n%i\n%a" :prepend t)
 ("p" "Templates for projects")
 ("pt" "Project-local todo" entry
  (file+headline
   +org-capture-project-todo-file
   "Inbox")
  "* TODO %?\n%i\n%a" :prepend t)
 ("pn" "Project-local notes" entry
  (file+headline
   +org-capture-project-notes-file
   "Inbox")
  "* %U %?\n%i\n%a" :prepend t)
 ("pc" "Project-local changelog" entry
  (file+headline
   +org-capture-project-changelog-file
   "Unreleased")
  "* %U %?\n%i\n%a" :prepend t)
 ("o"
  "Centralized templates for projects")
 ("ot" "Project todo" entry
  #'+org-capture-central-project-todo-file "* TODO %?\n 
%i\n %a" :heading "Tasks" :prepend nil)
 ("on" "Project notes" entry
  #'+org-capture-central-project-notes-file "* %U %?\n 
%i\n %a" :heading "Notes" :prepend t)
 ("oc" "Project changelog" entry
  #'+org-capture-central-project-changelog-file "* %U 
%?\n %i\n %a" :heading "Changelog" :prepend t)
 )
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-re-reveal-root 
"/home/dan/.emacsen/doom-emacs/.local/straight/build-29.0.50/revealjs/"
 org-refile-targets '((nil :maxlevel . 3)
   

Re: Bug in 9.5.3 org--file-default-apps

2022-05-21 Thread Max Nikulin

On 21/05/2022 08:44, Ihor Radchenko wrote:

Max Nikulin writes:


It is the same with and without -Q and no, I have not customized
`mailcap-user-mime-data', its value is nil, easy customization interface
tells that it is the standard value. There is a chance that debian has
some patch, but most of debian specific is disabled when -Q option is used.


Interesting. In any case, it confirms that mailcap behaviour depends on
both Emacs settings and also system settings.


You should be even more surprised, if I say that [[file:~/tstorg]] link 
is opened in emacs buffer in shell-script mode (emacs-27.1, org main 
HEAD) despite


   (mailcap-mime-info nil)
   nil

actually it is a minimal LXC container with no mime-support package 
installed, so /etc/mailcap file is absent.


Notice `mailcap-mime-data' has the following entries for a long time
("text"
 ("plain"
  (viewer  . view-mode)
  (type. "text/plain"))
 ("plain"
  (viewer  . fundamental-mode)
  (type. "text/plain"))

The source of the problem is that Emacs-27 was released with the 
following bug:


https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40247
mailcap-mime-data erased when parsing mime parts

So `mailcap-parse-mailcaps' called from `mailcap-mime-info' erases 
predefined associations in Emacs-27.





Re: [BUG] Let org-latex-compile fall back on org-latex-compiler as the default instead of "pdflatex" [9.6 (9.6-??-4f0f24447 @ /home/dan/.emacsen/doom-emacs/.local/straight/build-29.0.50/org/)]

2022-05-21 Thread Ihor Radchenko
daanturo  writes:

> Having set `org-latex-compiler` to `lualatex`, when exporting with
> `org-latex-export-to-pdf`, I expected that `lualatex` is the compiler to
> be used but `org-latex-compile` falled back on `pdflatex` instead.

Can you provide more details on the problem?
`org-latex-compile' relies on `org-latex--insert-compiler' that is
called by `org-latex-template'. So, your org-latex-compiler
customization should be obeyed.

Best,
Ihor



[PATCH] Avoid ignoring LaTeX export output errors when org-latex-pdf-process is a list

2022-05-21 Thread Ihor Radchenko
Hi,

The attached patch is fixing a rather annoying problem when
org-latex-pdf-process is set to a list. Currently, only output of the
last command in the list is preserved in *Org PDF LaTeX output* buffer,
which sometimes prevents ox-latex from detecting compilation warnings.

ox-latex relies on *Org PDF LaTeX output* to contain the output of latex
compiler. However, unless the last command in the org-latex-pdf-process
is something like pdflatex, the compiler errors are erased by
`shell-command' called by `org-compile-file'.

Best,
Ihor

>From d4f15ed260f47195b01cb60061b57823428d2eef Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Sun, 22 May 2022 11:44:56 +0800
Subject: [PATCH] Avoid ignoring LaTeX export output errors

* lisp/org-macs.el (org-compile-file): When PROCESS is a list, keep
output of all the listed commands, not just the last one.
* lisp/ox-latex.el (org-latex-pdf-process): Clarify that the process
output is parsed to detect compilation errors/warnings.
---
 lisp/org-macs.el | 9 +++--
 lisp/ox-latex.el | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 10eed2686..2a7131ded 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -323,8 +323,13 @@ (defun org-compile-file (source process ext &optional err-msg log-buf spec)
 			   (?F . ,(shell-quote-argument full-name))
 			   (?o . ,(shell-quote-argument out-dir))
 			   (?O . ,(shell-quote-argument output))
-	   (dolist (command process)
-	 (shell-command (format-spec command spec) log-buf))
+   ;; Combine output of all commands in PROCESS.
+   (with-current-buffer log-buf
+ (let (buffer-read-only)
+   (erase-buffer)))
+   (let ((shell-command-dont-erase-buffer t))
+	 (dolist (command process)
+	   (shell-command (format-spec command spec) log-buf)))
 	   (when log-buf (with-current-buffer log-buf (compilation-mode)
 	(_ (error "No valid command to process %S%s" source err-msg
 ;; Check for process failure.  Output file is expected to be
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5a2de8afb..ed16ec46f 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1426,6 +1426,9 @@ (defcustom org-latex-pdf-process
   "%latex -interaction nonstopmode -output-directory %o %f"))
   "Commands to process a LaTeX file to a PDF file.
 
+The command output will be parsed to extract compilation errors and
+warnings according to `org-latex-known-warnings'.
+
 This is a list of strings, each of them will be given to the
 shell as a command.  %f in the command will be replaced by the
 relative file name, %F by the absolute file name, %b by the file
-- 
2.35.1



[PATCH] Re: Bug in 9.5.3 org--file-default-apps

2022-05-21 Thread Ihor Radchenko
Max Nikulin  writes:

> On 21/05/2022 08:44, Ihor Radchenko wrote:
>> Max Nikulin writes:
>> 
>>> It is the same with and without -Q and no, I have not customized
>>> `mailcap-user-mime-data', its value is nil, easy customization interface
>>> tells that it is the standard value. There is a chance that debian has
>>> some patch, but most of debian specific is disabled when -Q option is used.
>> 
>> Interesting. In any case, it confirms that mailcap behaviour depends on
>> both Emacs settings and also system settings.
>
> You should be even more surprised, if I say that [[file:~/tstorg]] link 
> is opened in emacs buffer in shell-script mode (emacs-27.1, org main 
> HEAD) despite
>
> (mailcap-mime-info nil)
> nil

>
> The source of the problem is that Emacs-27 was released with the 
> following bug:
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40247
> mailcap-mime-data erased when parsing mime parts
>
> So `mailcap-parse-mailcaps' called from `mailcap-mime-info' erases 
> predefined associations in Emacs-27.

If I understand correctly, this extra complication does not affect most
of the systems. I am not sure if we need to work around it.

Also, I am attaching a patch to address the original issue. We can just
use file command when available. WDYT?

Best,
Ihor

>From f69824559d62cb6963ff30f11ceb46303bf1b3d4 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Sun, 22 May 2022 12:04:35 +0800
Subject: [PATCH] org-open-file: Use file command to determine mime type, when
 available

* lisp/org.el (org-open-file): Prefer file command to determine file
type instead of relying on `mailcap-extension-to-mime'.  Only fallback
to the latter when file command is not available on the system.

Fixes https://list.orgmode.org/874k1n2hpv.fsf@localhost/T/#mcc10df4ea7937360671e6dea8061153dee518807
---
 lisp/org.el | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index d7da8efc4..3102fe611 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7975,7 +7975,12 @@ (defun org-open-file (path &optional in-emacs line search)
 (when (eq cmd 'mailcap)
   (require 'mailcap)
   (mailcap-parse-mailcaps)
-  (let* ((mime-type (mailcap-extension-to-mime (or ext "")))
+  (let* ((mime-type (if (executable-find "file")
+(shell-command-to-string
+ (format "%s --brief --mime-type %s"
+ (executable-find "file")
+ file))
+  (mailcap-extension-to-mime (or ext ""
 	 (command (mailcap-mime-info mime-type)))
 	(if (stringp command)
 	(setq cmd command)
-- 
2.35.1



[BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient [9.5.3 (release_9.5.3-508-ge268e4 @ /home/yantar92/.emacs.d/straight/build/org/)]

2022-05-21 Thread Ihor Radchenko
Hi,

I have a problem with the following commits:

869b7a21b org-open-file: Avoid make-process for Emacs 24 compatibility
5db61eb0f org.el: Avoid xdg-open silent failure

They both set process-connection-type to nil/'pipe. Somehow, this change
breaks org-open-file for me when org-open-file calls xdg-open and xdg is
confugured to open the file with emacsclient. I only see a flicker and
the file does not open. Sometimes, Emacs even crashes.

If I change the process type back to default tty value, things work
again as expected.

While I understand that the original commits intended to solve a similar
problem, they clearly caused the same problem with other apps.

Best,
Ihor

Emacs  : GNU Emacs 28.1.50 (build 1, x86_64-pc-linux-gnu, cairo version 1.16.0)
 of 2022-05-14
Package: Org mode version 9.5.3 (release_9.5.3-508-ge268e4 @ 
/home/yantar92/.emacs.d/straight/build/org/)
-- 



Re: [BUG] Let org-latex-compile fall back on org-latex-compiler as the default instead of "pdflatex" [9.6 (9.6-??-4f0f24447 @ /home/dan/.emacsen/doom-emacs/.local/straight/build-29.0.50/org/)]

2022-05-21 Thread Ihor Radchenko
daanturo  writes:

> On 5/22/22 10:42, Ihor Radchenko wrote:
>> Can you provide more details on the problem?
>> `org-latex-compile' relies on `org-latex--insert-compiler' that is
>> called by `org-latex-template'. So, your org-latex-compiler
>> customization should be obeyed.
>
> Sorry, I was a problem on my side, the file where I test has 
> `org-latex-compiler-file-string' set to nil as a local variable.

Note that `org-latex-compiler-file-string' must not be set to nil. It is
not considered a valid value and causes undefined behavior.

> But IMO, falling back to the customized `org-latex-compiler' instead of 
> "pdflatex" should be intuitive.

Not necessarily. If org-latex-compiler is not a member of
org-latex-compilers, we need some sane fallback. Moreover, apart from
org-latex-compiler variable, the compiler can be set locally in buffer
or locally in the subtree. Either way, it is not necessarily clear which
fallback is reasonable. I'd go as far as throwing an error instead of
using "pdflatex", but alas, we already have the existing behavior and
changing it without strong justification can break things for other
users.

Docstring of org-latex-compiler:

>>> Must be an element in org-latex-compilers or the empty quote.
>>> Can also be set in buffers via #+LATEX_COMPILER.  See also
>>> org-latex-compiler-file-string.

Best,
Ihor

P.S. You dropped org mailing list from CC. Please, use "reply all" when
replying to the Org mailing list messages in future.



how to update remote calls?

2022-05-21 Thread Uwe Brauer


Hi

I have the following example

#+begin_src 

,** Statistic
   :PROPERTIES:
   :ID:   test-master
   :END:


| Result|
|---|
|   7.5 |
|   4.3 |
|   7.5 |
|   5.5 |
|   8.5 |
|   7.5 |
|   8.2 |
| 9 |
|   8.5 |
| 7 |
|   7.5 |
|   8.5 |
| 7 |
| 6 |
| 7 |
|---|


| lower bound | upper bound | frequency |
|-+-+---|
|   0 | 4.9 | 1 |
|   5 |  10 |14 |
,#+TBLFM: $3='(length (org-lookup-all '($1 $2) 
'(remote(test-master,@I$1..@II$1)) nil 'in-interval));N



| Mean | Desviation | Median |
|--++|
|  7.3 |1.2 | 7.5|
,#+TBLFM: 
$1=vmean(remote(test-master,@I$1..@II$1));f-1::$2=vpsdev(remote(test-master,@I$1..@II$1));f-1::$3=vmedian(remote(test-master,@I$1..@II$1));f-1


#+end_src

Now I if I update the test-master table, is there anyway that the remote calls 
get updated as well?

Thanks and regards

Uwe Brauer 





-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 





calculating quartils, tercils (or percentiles) Using R?

2022-05-21 Thread Uwe Brauer


Hi

I can use R to calculate quartils 
as in 
#+begin_src 

#+tblname: TC
| Data |
|--|
|5 |
|   10 |
|   12 |
|   15 |
|   20 |
|   24 |
|   27 |
|   30 |
|   35 |




#+begin_src R :colnames t :var t1=TC 
 summary(t1)
#+end_src

#+RESULTS:
| Data  |
|---|
| Min.   : 5.00 |
| 1st Qu.:12.00 |
| Median :20.00 |
| Mean   :19.78 |
| 3rd Qu.:27.00 |
| Max.   :35.00 |
#+end_src

but I can't not find a way to calculate other percentiles, like terciles or so.

Does anybody know about this, or a org-function doing it?

regards

Uwe Brauer


-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.