emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* folding problems
@ 2022-08-04 13:24 Fraga, Eric
  2022-08-04 14:34 ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Fraga, Eric @ 2022-08-04 13:24 UTC (permalink / raw)
  To: Emacs Org mode mailing list

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

Hello all,

Just a quick heads up: I have just built emacs from git and updated org
also from git.  Having changed my org files to remove

  (org-content 3)

lines from hooks and file local variables, replacing them with the
appropriate STARTUP setting, I am sort of back where I was except that
folding an org file shows a lot of garbage text.  See attached
screenshot where the heading is "** Illustrative example".  This
unexpected text was not visible before upgrading and the org file has
not changed except for the addition of the startup line and the deletion
of the org-content line.

In the screenshot example, it seems to be part of the cache information
on a results line from a src block in a subheading of the illustrative
example:

#+results[7dc3bf0b2288ae445ec4a381d3aabdc73515a957]: somesrcblock

Most of my headings show similar hex strings (as most of my content
includes src blocks and results).  I'm not sure what is responsible and
haven't tried to track anything down yet but thought I would mention
this issue.

Thank you,
eric

-- 
: Eric S Fraga, with org release_9.5.4-706-g4702a7 in Emacs 29.0.50

[-- Attachment #2: screendump-20220804141449.png --]
[-- Type: image/png, Size: 11852 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-04 13:24 folding problems Fraga, Eric
@ 2022-08-04 14:34 ` Ihor Radchenko
  2022-08-04 14:46   ` Fraga, Eric
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ihor Radchenko @ 2022-08-04 14:34 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Emacs Org mode mailing list

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> In the screenshot example, it seems to be part of the cache information
> on a results line from a src block in a subheading of the illustrative
> example:
>
> #+results[7dc3bf0b2288ae445ec4a381d3aabdc73515a957]: somesrcblock
>
> Most of my headings show similar hex strings (as most of my content
> includes src blocks and results).  I'm not sure what is responsible and
> haven't tried to track anything down yet but thought I would mention
> this issue.

Are you able to reproduce starting from emacs -Q?

I just tried the following example file, and it works just fine for me.

-----
#+STARTUP: show3levels
* this level 1
** this level 2
*** this level 3
**** this level 4
#+results[7dc3bf0b2288ae445ec4a381d3aabdc73515a957]: somesrcblock
-----

Best,
Ihor


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-04 14:34 ` Ihor Radchenko
@ 2022-08-04 14:46   ` Fraga, Eric
  2022-08-04 15:10   ` Fraga, Eric
  2022-08-04 16:23   ` Fraga, Eric
  2 siblings, 0 replies; 10+ messages in thread
From: Fraga, Eric @ 2022-08-04 14:46 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

On Thursday,  4 Aug 2022 at 22:34, Ihor Radchenko wrote:
> Are you able to reproduce starting from emacs -Q?

No, I am not able to reproduce with -Q unfortunately.
😕
I'll investigate when time permits.
Thank you,
eric

-- 
: Eric S Fraga, with org release_9.5.4-706-g4702a7 in Emacs 29.0.50

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-04 14:34 ` Ihor Radchenko
  2022-08-04 14:46   ` Fraga, Eric
@ 2022-08-04 15:10   ` Fraga, Eric
  2022-08-05  1:45     ` Ihor Radchenko
  2022-08-04 16:23   ` Fraga, Eric
  2 siblings, 1 reply; 10+ messages in thread
From: Fraga, Eric @ 2022-08-04 15:10 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

Maybe unrelated but I will add that the recent changes to how local
variables are processed is breaking my usage of org quite seriously.  To
be clear: I am not complaining: it's my fault for tracking the bleeding
edge of development for both org and Emacs. 😉 But I thought I would
mention what I am seeing just in case it's useful.

An example: when exporting a long document which has many src blocks,
each of those blocks is now being loaded and local variables (which
include dir local variables) are being evaluated (which they were not
before, I guess?).  I don't know if this is an org change or an Emacs
change?

The src blocks are likely loaded by org because I am using engraved for
formatting the src blocks on export.  This is a nightmare if any of the
variables are considered unsafe as it requires confirmation for each
such case.

And if some src block mode needs a special input method, this is causing
the export to fail:

    activate-input-method: Can’t activate input method ‘TeX’

although I am not sure, at this point, where/when this is happening.

And, no, unfortunately I don't know if emacs -Q solves these issues.  I
did try and it does seem like the local variable aspect happens; it's
just that my export is so tailored that other things break for not being
defined in emacs -Q and so I cannot fully export my document.

I will need to revert to an older version of org as I need to get work
done. There's too much breaking to spend the time at the moment
investigating. 😕  But no worries: that's what git is for! 👍

Thank you,
eric

PS -if any of the above is the fault of changes to Emacs, I will post on
the devel list.

-- 
: Eric S Fraga, with org release_9.5.4-706-g4702a7 in Emacs 29.0.50

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-04 14:34 ` Ihor Radchenko
  2022-08-04 14:46   ` Fraga, Eric
  2022-08-04 15:10   ` Fraga, Eric
@ 2022-08-04 16:23   ` Fraga, Eric
  2 siblings, 0 replies; 10+ messages in thread
From: Fraga, Eric @ 2022-08-04 16:23 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

Ihor,

folding is now fine.  But only by disabling (reverting) the early
loading of local file variables.  Which I'm doing as it was breaking too
many things.  Org is back to being usable.

-- 
Eric S Fraga, @ericsfraga:matrix.org, GnuPG: 0xc89193d8fffcf67d

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-04 15:10   ` Fraga, Eric
@ 2022-08-05  1:45     ` Ihor Radchenko
  2022-08-05  9:35       ` Fraga, Eric
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2022-08-05  1:45 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Emacs Org mode mailing list

[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> Maybe unrelated but I will add that the recent changes to how local
> variables are processed is breaking my usage of org quite seriously.  To
> be clear: I am not complaining: it's my fault for tracking the bleeding
> edge of development for both org and Emacs. 😉 But I thought I would
> mention what I am seeing just in case it's useful.
>
> An example: when exporting a long document which has many src blocks,
> each of those blocks is now being loaded and local variables (which
> include dir local variables) are being evaluated (which they were not
> before, I guess?).  I don't know if this is an org change or an Emacs
> change?
>
> The src blocks are likely loaded by org because I am using engraved for
> formatting the src blocks on export.  This is a nightmare if any of the
> variables are considered unsafe as it requires confirmation for each
> such case.
>
> And if some src block mode needs a special input method, this is causing
> the export to fail:
>
>     activate-input-method: Can’t activate input method ‘TeX’
>
> although I am not sure, at this point, where/when this is happening.

If you have some time, can you try the attached patch?

> I will need to revert to an older version of org as I need to get work
> done. There's too much breaking to spend the time at the moment
> investigating. 😕  But no worries: that's what git is for! 👍

Sorry for this. This is one of those innocently-looking changes that can
cause unforeseen consequences.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-export-Do-not-try-to-load-file-directory-locals-.patch --]
[-- Type: text/x-patch, Size: 2627 bytes --]

From 197bbbd91c54b28516ec6818f57bb07539fcfd9f Mon Sep 17 00:00:00 2001
Message-Id: <197bbbd91c54b28516ec6818f57bb07539fcfd9f.1659663319.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Fri, 5 Aug 2022 09:33:44 +0800
Subject: [PATCH] org-export: Do not try to load file/directory-locals in
 export buffer

* lisp/org.el (org-inhibit-local-variables): New variable controlling
loading file-local and directory-local variables when `org-mode' is
being loaded.
(org-mode): Use `org-inhibit-local-variables'.
* lisp/ox.el (org-export--generate-copy-script): Disable loading local
variables in the export buffer.

Fixes https://orgmode.org/list/87fsichwo0.fsf@ucl.ac.uk
---
 lisp/org.el | 5 ++++-
 lisp/ox.el  | 8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 9549ec5f0..12214ecbb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4691,6 +4691,8 @@ (defvar org-element-cache-persistent); Defined in org-element.el
 (defvar org-element-use-cache); Defined in org-element.el
 (defvar org-mode-loading nil
   "Non-nil during Org mode initialisation.")
+(defvar org-inhibit-local-variables nil
+  "Unless nil, Org mode will not load file/directory-local variables.")
 ;;;###autoload
 (define-derived-mode org-mode outline-mode "Org"
   "Outline-based notes management and organizer, alias
@@ -4719,7 +4721,8 @@ (define-derived-mode org-mode outline-mode "Org"
     ;; Apply file-local and directory-local variables, so that Org
     ;; startup respects them.  See
     ;; https://list.orgmode.org/587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com/T/#u
-    (hack-local-variables 'ignore-mode-settings)
+    (unless org-inhibit-local-variables
+      (hack-local-variables 'ignore-mode-settings))
     (org-load-modules-maybe)
     (org-install-agenda-files-menu)
     (when (and org-link-descriptive
diff --git a/lisp/ox.el b/lisp/ox.el
index fa6f3f19a..57d375b35 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -2623,8 +2623,12 @@ (defun org-export--generate-copy-script (buffer)
       (lambda ()
 	(let ((inhibit-modification-hooks t))
 	  ;; Set major mode. Ignore `org-mode-hook' as it has been run
-	  ;; already in BUFFER.
-	  (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode))
+	  ;; already in BUFFER.  Ignore loading local variables as
+	  ;; well.
+	  (let ((org-mode-hook nil)
+                (org-inhibit-startup t)
+                (org-inhibit-local-variables t))
+            (org-mode))
 	  ;; Copy specific buffer local variables and variables set
 	  ;; through BIND keywords.
 	  (pcase-dolist (`(,var . ,val) varvals)
-- 
2.35.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-05  1:45     ` Ihor Radchenko
@ 2022-08-05  9:35       ` Fraga, Eric
  2022-08-05 11:37         ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Fraga, Eric @ 2022-08-05  9:35 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

On Friday,  5 Aug 2022 at 09:45, Ihor Radchenko wrote:
> If you have some time, can you try the attached patch?

I have tried it but it doesn't seem to solve the issue of multiple
responses required due to "unsafe" dir local variables unfortunately.

I may remove that particular setting and do what I am doing slightly
differently or maybe just record it as being safe...  But, for the
record, the dir local setting is:

((org-mode . ((org-babel-pre-tangle-hook
    . (esf/update-julia-project-toml-version save-buffer)))))

Thank you,
eric

-- 
: Eric S Fraga, with org release_9.5.4-706-g4702a7.dirty in Emacs 29.0.50

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-05  9:35       ` Fraga, Eric
@ 2022-08-05 11:37         ` Ihor Radchenko
  2022-08-05 12:16           ` Fraga, Eric
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2022-08-05 11:37 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Emacs Org mode mailing list

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> On Friday,  5 Aug 2022 at 09:45, Ihor Radchenko wrote:
>> If you have some time, can you try the attached patch?
>
> I have tried it but it doesn't seem to solve the issue of multiple
> responses required due to "unsafe" dir local variables unfortunately.
>
> I may remove that particular setting and do what I am doing slightly
> differently or maybe just record it as being safe...  But, for the
> record, the dir local setting is:
>
> ((org-mode . ((org-babel-pre-tangle-hook
>     . (esf/update-julia-project-toml-version save-buffer)))))

Thanks for providing an example!
I was able to reproduce, and I have to say that fixing this is getting
into fragile terrain. I'm afraid that early loading of local variables is
too tricky to implement. It should better be done on Emacs side as an
option.

Hence, I have reverted the problematic commit in 1449bb31e.
Thanks for the heads-up and the patience!

Best,
Ihor


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-05 11:37         ` Ihor Radchenko
@ 2022-08-05 12:16           ` Fraga, Eric
  2022-08-05 13:55             ` Fraga, Eric
  0 siblings, 1 reply; 10+ messages in thread
From: Fraga, Eric @ 2022-08-05 12:16 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

On Friday,  5 Aug 2022 at 19:37, Ihor Radchenko wrote:
> Hence, I have reverted the problematic commit in 1449bb31e.

Thank you.  Back to "normal" (now having problems with latest Emacs updates ;-)).

-- 
: Eric S Fraga, with org release_9.5.4-707-g215de6 in Emacs 29.0.50

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: folding problems
  2022-08-05 12:16           ` Fraga, Eric
@ 2022-08-05 13:55             ` Fraga, Eric
  0 siblings, 0 replies; 10+ messages in thread
From: Fraga, Eric @ 2022-08-05 13:55 UTC (permalink / raw)
  To: Org Mode List

On Friday,  5 Aug 2022 at 12:16, Fraga, Eric wrote:
> Thank you.  Back to "normal" (now having problems with latest Emacs updates ;-)).

Heads up for those of you that might be using graphviz-dot-mode, e.g. in
dot src blocks.  The development version of Emacs has removed
font-lock-reference-face completely, marked obsolete since Emacs v20 but
still in use in the wild, specifically at least by graphviz-dot mode.

For me, this caused exporting to fail because I'm using engraved for
fontifying src blocks which depends on being able to fontify a buffer in
Emacs.

Not getting much work done today... ;-)

-- 
: Eric S Fraga, with org release_9.5.4-707-g215de6 in Emacs 29.0.50

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-08-05 14:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04 13:24 folding problems Fraga, Eric
2022-08-04 14:34 ` Ihor Radchenko
2022-08-04 14:46   ` Fraga, Eric
2022-08-04 15:10   ` Fraga, Eric
2022-08-05  1:45     ` Ihor Radchenko
2022-08-05  9:35       ` Fraga, Eric
2022-08-05 11:37         ` Ihor Radchenko
2022-08-05 12:16           ` Fraga, Eric
2022-08-05 13:55             ` Fraga, Eric
2022-08-04 16:23   ` Fraga, Eric

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).