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

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

>> *Can you please share the exact output of M-x org-version?If you really
>> see 9.5.1, then you likely have a "mixed" Org installationwith some code in
>> your init file first loading built-in Org mode andthen loading the newer
>> version. Such state can cause all kinds of bugs.*
>
>
> You are right. When I  Update Org to the latest version *Org mode version
> 9.5.3 (9.5.3-g277897)* .  The bug is gone。

Sharing this to the mailing list (it was not in CC).

Best,
Ihor



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

2022-05-17 Thread Ihor Radchenko
William Denton  writes:

> I'm also having problems like this with large files.  I haven't been able to 
> narrow it down but I'll try what you say about org-startup-folded.
>
> Do you also have a problem where sometimes TAB or SHIFT-TAB on a heading has 
> no 
> effect?  Some Org files seem to get broken after editing them for a while, 
> and 
> some folding no longer works (that is, some headings stay closed, while 
> others 
> can be cycled), and the only way to fix it is to reload.
>
> I'll turn on debugging and see what that says.

Before you try anything weird, can you do the following:
(1) Update Org to the latest version and make sure that M-x org-version
reports Org 9.5.3
(2) Remove org-persist-directory
(3) Try to see if the error persists

Best,
Ihor



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

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

>   - desktop environment
> - GNU Emacs 29.0.50 (build 2, x86_64-apple-darwin20.4.0, NS
> appkit-2022.44 Version 11.3.1 (Build 20E241)) of 2022-01-08
> - Org mode version 9.5.1

Thanks for reporting!
Can you please share the exact output of M-x org-version?
If you really see 9.5.1, then you likely have a "mixed" Org installation
with some code in your init file first loading built-in Org mode and
then loading the newer version. Such state can cause all kinds of bugs.

The latest Org version is Org mode version 9.5.3 (release_9.5.3-1799-ge73d5b)
The latest stable Org version (distributed via ELPA) is also 9.5.3

Best,
Ihor



[BUG] org-table-blank-field missing keybinding [9.5.2 (N/A @ /gnu/store/zkm1kxbk6p56ag6rscsl4k8ckxksp1bz-emacs-org-9.5.2/share/emacs/site-lisp/org-9.5.2/)]

2022-05-17 Thread André A . Gomes
Hi Org,

org-table-auto-blank-field used to be bound to C-c SPC and the manual
still refers to it.  Was the keybinding removed by mistake?  Thanks.



Emacs  : GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, 
cairo version 1.16.0)
Package: Org mode version 9.5.2 (N/A @ 
/gnu/store/zkm1kxbk6p56ag6rscsl4k8ckxksp1bz-emacs-org-9.5.2/share/emacs/site-lisp/org-9.5.2/)
-- 
André A. Gomes
"You cannot even find the ruins..."



Re: [tip] Export and open a PDF in Android via Termux

2022-05-17 Thread Juan Manuel Macías
Max Nikulin writes:

> Do termux and emacs build for it have support of D-Bus or notify-send
> binary?

I'm not sure, but I would say yes, because Termux has a repository for
X11 applications and to be able to run desktop environments and
graphical applications (via VNC). But in such a case, I understand that
notify-send would only have life within that frame.

Full GNU/Linux distros can also be installed on termux in a proot
environment. In fact, there is another application, andronix, which
speeds up the process through a series of scripts. Recently I tried
to install using Arch and it worked fine (at least in the installation,
another thing is what can be done in there...).

Anyway, I agree with you about the caveats you mention around termux.
Termux and those other neighboring projects are very notable but they
are still (to put it in some way) juggling games and tightrope walks
without a net. A year ago I made the decision not to use a smartphone,
but lately I have been forced to go back to these devices for work
reasons, so I thought of Termux as the foreigner who is in a strange
land and finds something familiar :- ) The ideal would be a smartphone
running GNU/Linux, but there seems to be a long way to go: hostile
hardware, no drivers... I'm more or less aware of projects like librem
or pinephone, but I'm too lazy to do the disbursement...

Best regards,

Juan Manuel 



Re: I can't set dabbrev to respect the writen case

2022-05-17 Thread Ypo

Hi, acdw

I am trying your package, but I see no list of expansion candidates. 
When I eval hippie-completing-read, it just inserts one candidate.


Thanks for your work,
Ypo


On 2022-05-16 (Monday) at 12:25, Ypo  wrote:

>/Thanks, Samuel/
>
>/I've uninstalled fancy-dabbrev, and it seems to work when I complete /
>/using M-/. But, now I don't have candidates to choose the completion. /
>/Any advice with this?/
>

I also wrote the package `hippie-completing-read'[1] to give a nicer UI (in my
opinion) to the hippie-expand command.

[1]:https://github.com/duckwork/hippie-completing-read

--
~ acdw
acdw.net | breadpunk.club/~breadw




Re: Change of behavior of org-meta-return in 9.6/DoomEmacs?

2022-05-17 Thread Kaushal Modi
On Tue, May 17, 2022 at 12:24 PM Guillaume MULLER
 wrote:
>
> I noticed that hitting Meta-Return in org in Doom does not behave as in 
> Vanilla Emacs. If I have (with <> being the cursor):
>
> * outline 1
> ** outline 2
>+ no<>te1
>+ note2
>
> In Vanilla Emacs, hitting M-Ret (i.e. calling org-meta-return) resulted in:
>
> * outline 1
> ** outline 2
>+ no
>+ <>te1
>+ note2

I am seeing your Vanilla Emacs behavior on Emacs 28.1 with Org built
from main branch (Org mode version 9.5.3 (release_9.5.3-504-gcdbb1c)).

> As I use "keycast" package, I can see that, in both cases:
> - M-Ret is org-meta-return
> - C-Ret is +org/insert-item-below

The keycast package's modeline display might not show if that
org-meta-return has been advised to modify the behavior.

If you do C-h f org-meta-return, do you see something like "This
function has .. advice: .." towards the end of that *Help* buffer?

> How can I check if it is a change in org 9.6 or in DoomEmacs?

Try reverting your DoomEmacs version to an older version to see if
that fixes it.
Then try reverting to the Org stable version from GNU ELPA (version
9.5.3) and see if that fixes the issue.

Also, may be opening an issue on the DoomEmacs repo might help.

Good luck!



Re: [tip] Export and open a PDF in Android via Termux

2022-05-17 Thread Max Nikulin

On 16/05/2022 23:05, Juan Manuel Macías wrote:

Max Nikulin writes:

Termux is quite interesting (and addictive :-)). Now I am playing with
Termux-api to send notifications from Emacs/Gnus to Android (with
gnus-desktop-notifier and the termux-notification command). And also to
send sms from Emacs and bbdb...


Do termux and emacs build for it have support of D-Bus or notify-send 
binary? The following thread is related to MacOS, but the discussion was 
a bit more general. Android notification may have more features though.


stardiviner to emacs-orgmode. [PATCH] make org-notify support for macOS 
desktop notification. Sun, 4 Jul 2021 08:23:03 +0800. 
https://list.orgmode.org/5b57cd8b-aa91-4c63-a449-a07364083...@gmail.com


I have not tried termux, but I agree that it is an interesting project. 
Unfortunately it is against various policies (only binaries from the 
application package are allowed, even access to filesystem is considered 
unsafe, etc.). Unsure if it is possible to implement a kind of 
virtualization to hide processes from the host system but to keep 
integration with platform. Unfortunately during struggle with 
applications requiring unreasonable permissions and with malware, 
legitimate applications suffer as well (e.g. KDE Connect).





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

2022-05-17 Thread William Denton
I'm also having problems like this with large files.  I haven't been able to 
narrow it down but I'll try what you say about org-startup-folded.


Do you also have a problem where sometimes TAB or SHIFT-TAB on a heading has no 
effect?  Some Org files seem to get broken after editing them for a while, and 
some folding no longer works (that is, some headings stay closed, while others 
can be cycled), and the only way to fix it is to reload.


I'll turn on debugging and see what that says.

Bill

On 17 May 2022, imymorror wang wrote:


 - desktop environment
   - GNU Emacs 29.0.50 (build 2, x86_64-apple-darwin20.4.0, NS
appkit-2022.44 Version 11.3.1 (Build 20E241)) of 2022-01-08
   - Org mode version 9.5.1
 - bug description
   - influence factor
 - a large org file : 11053 lines。1092 headlines。
 - (setq org-startup-folded t)
 - org-indent-mode : (add-hook 'org-mode-hook 'org-indent-mode)
   - My Observation
 - if setting org-startup-folded t , open the large org file, emacs
get stuck, the mouse can't move。
 - if keeping org-startup-folded defaul value(i.e  "showeverything") ,
enable org-indent-mode , open the large org file, get a warning:
   #+begin_quote
   Warning (org-element-cache): org-element--cache: Unregistered
buffer modifications detected. Resetting.
   If this warning appears regularly, please report it to Org mode
mailing list (M-x org-submit-bug-report).
   #+end_quote
 - if keeping org-startup-folded defaul value and disable
org-indent-mode , open the large org file, everything works fine



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

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

2022-05-17 Thread imymorror wang
  - desktop environment
- GNU Emacs 29.0.50 (build 2, x86_64-apple-darwin20.4.0, NS
appkit-2022.44 Version 11.3.1 (Build 20E241)) of 2022-01-08
- Org mode version 9.5.1
  - bug description
- influence factor
  - a large org file : 11053 lines。1092 headlines。
  - (setq org-startup-folded t)
  - org-indent-mode : (add-hook 'org-mode-hook 'org-indent-mode)
- My Observation
  - if setting org-startup-folded t , open the large org file, emacs
get stuck, the mouse can't move。
  - if keeping org-startup-folded defaul value(i.e  "showeverything") ,
enable org-indent-mode , open the large org file, get a warning:
#+begin_quote
Warning (org-element-cache): org-element--cache: Unregistered
buffer modifications detected. Resetting.
If this warning appears regularly, please report it to Org mode
mailing list (M-x org-submit-bug-report).
#+end_quote
  - if keeping org-startup-folded defaul value and disable
org-indent-mode , open the large org file, everything works fine


Change of behavior of org-meta-return in 9.6/DoomEmacs?

2022-05-17 Thread Guillaume MULLER

Hi,

I've been using org-mode for a few years now. Thanks for the tool, I love it! 
What I love most is that it really feels like built FOR the user, as every 
default behavior is the right one!

I recently switched from Vanilla Emacs (org 9.5.3) to DoomEmacs (org 9.6), 
because I'm tired of managing my 2000+ config.org with half-backed results.

I noticed that hitting Meta-Return in org in Doom does not behave as in Vanilla 
Emacs. If I have (with <> being the cursor):

* outline 1
** outline 2
  + no<>te1
  + note2

In Vanilla Emacs, hitting M-Ret (i.e. calling org-meta-return) resulted in:

* outline 1
** outline 2
  + no
  + <>te1
  + note2

In Doom Emacs, it results in:
* outline 1
** outline 2
  + note1
  + note2
** <>

As I use "keycast" package, I can see that, in both cases:
- M-Ret is org-meta-return
- C-Ret is +org/insert-item-below
but in the case of DoomEmacs, both result in the same behavior.

I tried many combinations of C/M/Ret, but I cannot reproduce the behavior of 
Vanilla/9.5.3 in Doom/9.6 . The only way I found to reach the same result as 
Vanilla Emacs in Doom Emacs (i.e. creating a new entry based on the remaining of 
the line) is to cut & paste line splits and creating new items/outlines 
manually, which is very painful.

How can I check if it is a change in org 9.6 or in DoomEmacs?

How can I get back org-meta-return acting in Doom/9.6 as in Vanilla/9.5.3?

Thanks in advance for your help


Guillaume


OpenPGP_signature
Description: OpenPGP digital signature


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

2022-05-17 Thread Max Nikulin

On 17/05/2022 02:29, Craig STCR wrote:

On 5/16/22 11:14 AM, Max Nikulin wrote:
Sounds reasonable. However I just have tried a 
[[file:~/path/to/script]] link running Org main HEAD and the file is 
opened in emacs (26.3) other window.


Hmmm.  That's interesting.  I upgraded from Emacs 26.x to 27.x at some 
point in the not-too-distant past.  Maybe that explains it. I'm on 
ubuntu bionic, using emacs 27.1 from kelleyk emacs ppa.


Craig, Have you tried it in Emacs-27 without your default config? I mean 
something like


emacs -Q -L ~/src/org-mode/lisp test.org

I do not think emacs version matters here. It works even with emacs-27 
for me.





Re: [PATCH] Re: tangle option to not write a file with same contents?

2022-05-17 Thread Max Nikulin

On 08/05/2022 11:42, Ihor Radchenko wrote:

On 28/10/2021 11:04, Greg Minshall wrote:


i wonder if it would be reasonable to add an option such that, when
tangling, `org-babel-tangle` would not write a file with the
already-existing contents of the target file?

[...]

The patch is attached.

On SSD, when tangling into ~200 files, the patch speeds up tangling
by almost 2x: before 7.6 sec; after 4.4 sec.


By mistake I sent my reply to Ihor off-list, so a part of discussion is 
missed in the list archives. The only excuse is that a copy of message 
received as Cc does not have List-Post header, so reply action works as 
for private messages.


Ihor Radchenko. [BUG] org-babel-load-file can not compile file. Fri, 13 
May 2022 18:38:14 +0800. https://list.orgmode.org/878rr5ra3t.fsf@localhost


This is a patch from another thread that should be a part of this change.


diff --git a/lisp/org.el b/lisp/org.el
index 47a16e94b..09a001414 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -256,6 +256,11 @@ (defun org-babel-load-file (file &optional compile)
 tangled-file
 (file-attribute-modification-time
  (file-attributes (file-truename file
+  ;; Make sure that tangled file modification time is
+  ;; updated even when `org-babel-tangle-file' does not make changes.
+  ;; This avoids re-tangling changed FILE where the changes did
+  ;; not affect the tangled code.
+  (set-file-times tangled-file)
   (org-babel-tangle-file file
  tangled-file
  (rx string-start


`set-file-times' signals if the file does not exist, so I expect that 
the call should be after `org-babel-tangle-file' otherwise first 
invocation for a new org file will fail. I would prefer to avoid 
touching the tangled file at all, but it makes impossible to check if 
the file is up to date (at least without saving hashes somewhere, that 
is unnecessary complication here). With optimizing of writhing of the 
tangled file overall behavior is rather close to original approach, so 
`set-file-times' should be OK.


Ihor Radchenko, off-list [PATCH v2] Re: tangle option to not write a 
file with same contents? Mon, 09 May 2022 21:22:55 +0800.



diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 16d938afb..76243f83f 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -282,11 +282,24 @@ (defun org-babel-tangle (&optional arg target-file 
lang-re)
lspecs)
   (when make-dir
 (make-directory fnd 'parents))
-   ;; erase previous file
-   (when (file-exists-p file-name)
- (delete-file file-name))
-  (write-region nil nil file-name)
-  (mapc (lambda (mode) (set-file-modes file-name mode)) modes)
+   (unless
+   (when (file-exists-p file-name)
+ (let ((tangle-buf (current-buffer)))
+   (with-temp-buffer
+ (insert-file-contents file-name)
+ (and
+  (equal (buffer-size)
+ (buffer-size tangle-buf))
+  (= 0
+ (let (case-fold-search)
+   (compare-buffer-substrings
+nil nil nil
+tangle-buf nil nil)))
+ ;; erase previous file
+ (when (file-exists-p file-name)
+   (delete-file file-name))
+(write-region nil nil file-name)
+(mapc (lambda (mode) (set-file-modes file-name mode)) 
modes))
(push file-name path-collector))
 (if (equal arg '(4))
 (org-babel-tangle-single-block 1 t)


I do not like (unless (when ...)) composition. If I remember correctly, 
`when' should be used for side effects, so `and' may be more suitable 
here. Otherwise it looks like what Greg suggested and should work faster 
than first variant of this patch.


My fault caused significant delay, so feel free to ignore comments below.

I still had a hope that `org-babel-load-file' might be improved a bit by 
using `byte-recompile-file' with 0 passed for ARG (previously I 
incorrectly wrote FORCE). The goal is to avoid recompiling the tangled 
.el file if it is not changed.


I am still curious if it is reliable to compare file size from 
`file-attributes' with (+ 1 (bufferpos-to-filepos (buffer-size))) for 
tangle result prior to loading existing file. I am unsure due to 
variations in encodings and newline formats, however it might further 
improve performance then tangle result changes.


I have noticed that `org-babel-tangle-file' may create empty org file if 
it does not exist. From my point of view it is questionable behavior.


Finall

Re: org-noter

2022-05-17 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> Ok, so it is my setting, sigh.
>> 
>> BTW does this mode set any sort of marker in the pdf?

> FYI, org-pdftools package allows to set links to specific coordinates in
> pdf files by creating annotations.

Thanks, works nicely.



-- 
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. 


smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH] New function org-speed-command-add for adding/modifying speed commands

2022-05-17 Thread Shankar Rao
Thank you for looking into this. As you recommended, I tried modifying
``org-speed-commands'' using the customize interface. While it did
enable me to configure and organize ``org-speed-commands'' in just the
way I would like, I found using the customize interface to be a bit
cumbersome. Using the customize interface, for each command that I
wished to add, I had to visually scan over the whole structure of
``org-speed-commands'' to see if the key for this command was already
present in the list, and replace it with my command if it is, or
prepend my command to the top of the list if not it was already
present. Then after I saved the customization, it added the whole new
value of ``org-speed-commands'' to the end of my init.el, making it
more cluttered.

Alternatively using my ``org-speed-command-add'' requires me to add a
single command to my init.el containing only my modifications:

(org-speed-command-add
'(("N" . ded-org-show-next-heading-tidily)
  ("P" . ded-org-show-previous-heading-tidily)
  ("h" . sbr-org-speed-insert-subheading)
  ("f" . org-forward-heading-or-item)
  ("b" . org-backward-heading-or-item)
  ("u" . org-up-heading-or-item)
  ("n" . org-next-heading-or-item)
  ("p" . org-prev-heading-or-item)))

Using ``org-speed-command-add'', I don't have to be concerned with
whether or not a given key is already present in
``org-speed-commands''.

I agree that ``org-speed-command-add'' has undefined behavior when
provided with only a descriptive headline as its first element. Would
you be more amenable to this command if it either ignored or
explicitly disallowed descriptive headline entries?

Shankar


On Tue, May 3, 2022 at 12:23 PM Ihor Radchenko  wrote:
>
> Shankar Rao  writes:
>
> > Over the weekend I thought about this issue of configuring
> > `org-speed-commands' more easily, and I believe I have come up with a
> > simpler solution that I have provided in the attached patch.
> >
> > This patch creates a new function `org-speed-command-add' that can be
> > used to add new speed command shortcuts to `org-speed-commands', as
> > well as modify existing shortcuts. This function takes as argument an
> > alist in the same format as `org-speed-commands'. For each command for
> > which the shortcut key is already present in `org-speed-commands', the
> > old command is replaced with the new command at the same position.
> > Commands with brand new shortcut keys are added to the user section of
> > `org-speed-commands'.
> >
> > I believe this patch strikes a balance between power users, who can
> > still directly customize `org-speed-commands', and non-experts, who
> > may want to add/modify some speed commands without having to
> > understand the structure and organization of `org-speed-commands'.
>
> I am not sure about usefulness of the proposed command. For non-power
> users, we have cusomize interface. It should work just fine without a
> need to introduce another function.
>
> Also, org-speed-command-add may behave strangely if the argument
> contains descriptive headline like ("My command group title") as its
> first element.
>
> Best,
> Ihor



Re: org-noter

2022-05-17 Thread Uwe Brauer
>>> "CB" == Colin Baxter  writes:

> Hello Uwe
>> Uwe Brauer  writes:

>> Hi I am running GNU emacs master (2 month old) and have not been
>> able to use successfully org-noter.


>> When I open a pdf file with doc-view there seems no way to add a
>> note to the file. The documentation says one should simple press
>> «️i», but either with

>> (org-noter-notes-mode 'toggle) that binding is not defined with
>> org-noter-doc-mode it is but nothing happens, only garbage
>> collecting.

> Works for me using today's pull of or-mode and emacs-29.0.50.

Now it works for me as well, no idea what is going on there.

-- 
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. 


smime.p7s
Description: S/MIME cryptographic signature


[BUG] HTML export of buffer with fringe indicators

2022-05-17 Thread Daniel Fleischer
The case I have in mind is some code with folding indicators in the
fringe. E.g. have this python block:

#+begin_src python
def hi():
pass
#+end_src

Have `elpy' installed with enabled fringe markers (have
`elpy-folding-fringe-indicators' non-nil). Then try to export, say to
HTML. I get the error

cons: Args out of range: " ", 0, -3

Org cdbb1c9633.
Emacs eaa198cd75.

Thanks,

-- 

Daniel Fleischer