* problem with org-table-export
@ 2016-05-27 22:44 Andreas Amann
2016-05-28 9:24 ` Rasmus
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Amann @ 2016-05-27 22:44 UTC (permalink / raw)
To: emacs-orgmode
Hi list,
whenever I use
M-x org-table-export
inside a table, the buffer is marked "modified".
This is even the case if no modifications are done to the buffer by
exporting the table.
This problem happens since at least two years and possibly longer and
persists with the current git version of org-mode.
As it is quite annoying in my workflow, I tried to investigate the
problem. Looking at the definition of org-table-export in
lisp/org-table.el the problem seems to be that the line
(org-table-align) ; Make sure we have everything we need.
which seems to always set the modified flag, irrespective of real
changes being done. When I comment out this line or surround it with
(org-with-silent-modifications ... ), then the buffer remains clean.
However both solutions likely introduce other problems.
I guess the proper solution would be to improve org-table-align to not
unnecessarily set the "modified" flag, but I would not know how to do
this.
Regards,
Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: problem with org-table-export
2016-05-27 22:44 problem with org-table-export Andreas Amann
@ 2016-05-28 9:24 ` Rasmus
2016-05-28 11:59 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Rasmus @ 2016-05-28 9:24 UTC (permalink / raw)
To: emacs-orgmode
Hi Andreas,
Thanks for your bug report.
Andreas Amann <a.amann@ucc.ie> writes:
> Hi list,
>
> whenever I use
>
> M-x org-table-export
>
> inside a table, the buffer is marked "modified".
>
> This is even the case if no modifications are done to the buffer by
> exporting the table.
>
> This problem happens since at least two years and possibly longer and
> persists with the current git version of org-mode.
>
> As it is quite annoying in my workflow, I tried to investigate the
> problem. Looking at the definition of org-table-export in
> lisp/org-table.el the problem seems to be that the line
>
> (org-table-align) ; Make sure we have everything we need.
>
>
> which seems to always set the modified flag, irrespective of real
> changes being done. When I comment out this line or surround it with
> (org-with-silent-modifications ... ), then the buffer remains clean.
> However both solutions likely introduce other problems.
>
> I guess the proper solution would be to improve org-table-align to not
> unnecessarily set the "modified" flag, but I would not know how to do
> this.
It sounds rather plausible. AFAIR, org-table basically deletes and redraws
the table (but I didn’t check the code), which would modify the buffer.
Perhaps org-table-align could run in a temporary buffer and only inserted
the "new" table if it the result differs from what’s already in the
buffer.
Andreas, do you want to try to fix this issue?
Thanks,
Rasmus
--
In theory, practice and theory are the same. In practice they are not
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: problem with org-table-export
2016-05-28 9:24 ` Rasmus
@ 2016-05-28 11:59 ` Nicolas Goaziou
2016-05-28 19:39 ` Andreas Amann
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-05-28 11:59 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> It sounds rather plausible. AFAIR, org-table basically deletes and redraws
> the table (but I didn’t check the code), which would modify the buffer.
> Perhaps org-table-align could run in a temporary buffer and only inserted
> the "new" table if it the result differs from what’s already in the
> buffer.
IIRC I fixed it already some time ago. Besides, I'm not able to
reproduce the problem.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: problem with org-table-export
2016-05-28 11:59 ` Nicolas Goaziou
@ 2016-05-28 19:39 ` Andreas Amann
2016-05-29 8:24 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Amann @ 2016-05-28 19:39 UTC (permalink / raw)
To: Nicolas Goaziou, Rasmus; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
> IIRC I fixed it already some time ago. Besides, I'm not able to
> reproduce the problem.
The problem I reported exists with current master, but maybe I did not
describe it well enough. Let me try once more with a specific file which
shows the problem. Open the attached file "table.org" in emacs. Then
do
M-x org-table-export
you will then be prompted with "Export table to:" for a filename, where
you wish to export to. Note that already at this point two stars appear
in the emacs status line, which indicate that the buffer has been
modified. This is a bug, as no real modification of the buffer
has happened at this point.
The attached patch solves the problem for me by only calling
org-table-align if both org-table-automatic-realign and
org-table-may-need-update. However, I am not completely sure if this is
the correct solution though, I simply used the same idiom as is used in
org-table-next-field and org-table-previous-field functions.
Regards,
Andreas
[-- Attachment #2: table.org --]
[-- Type: text/plain, Size: 9 bytes --]
| test |
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-org-table-export-fix-problem-with-modified-flags.patch --]
[-- Type: text/x-diff, Size: 1113 bytes --]
From 1aa422b0008af1c0375037eac2f075db8d4ef23c Mon Sep 17 00:00:00 2001
From: Andreas Amann <andreas.amann@web.de>
Date: Sat, 28 May 2016 20:23:52 +0100
Subject: [PATCH] org-table-export: fix problem with modified flags
org-table-export did always set the modified flags of a buffer, even
if no modification happens during export. Fix by only calling
org-table-align if required.
---
lisp/org-table.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index c6a84b8..89677cc 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -662,7 +662,9 @@ extension of the given file name, and finally on the variable
`org-table-export-default-format'."
(interactive)
(unless (org-at-table-p) (user-error "No table at point"))
- (org-table-align) ; Make sure we have everything we need.
+ (if (and org-table-automatic-realign
+ org-table-may-need-update)
+ (org-table-align))
(let ((file (or file (org-entry-get (point) "TABLE_EXPORT_FILE" t))))
(unless file
(setq file (read-file-name "Export table to: "))
--
2.8.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: problem with org-table-export
2016-05-28 19:39 ` Andreas Amann
@ 2016-05-29 8:24 ` Nicolas Goaziou
2016-05-29 18:12 ` Andreas Amann
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-05-29 8:24 UTC (permalink / raw)
To: Andreas Amann; +Cc: emacs-orgmode, Rasmus
Hello,
Andreas Amann <a.amann@ucc.ie> writes:
> The problem I reported exists with current master, but maybe I did not
> describe it well enough. Let me try once more with a specific file which
> shows the problem. Open the attached file "table.org" in emacs. Then
> do
>
> M-x org-table-export
>
> you will then be prompted with "Export table to:" for a filename, where
> you wish to export to. Note that already at this point two stars appear
> in the emacs status line, which indicate that the buffer has been
> modified.
Again, I do not observe this behaviour. Could you make sure you are
using latest Org?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: problem with org-table-export
2016-05-29 8:24 ` Nicolas Goaziou
@ 2016-05-29 18:12 ` Andreas Amann
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Amann @ 2016-05-29 18:12 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Rasmus
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Again, I do not observe this behaviour. Could you make sure you are
> using latest Org?
Strangely enough I indeed cannot reproduce the problem anymore with
latest master. Sorry for the e-noise. (I think my confusion might have
been caused by "make vanilla" still seeing the installed org version?
After "make compile" and then "make vanilla" the bug is gone.)
Thanks!
Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-05-29 18:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-27 22:44 problem with org-table-export Andreas Amann
2016-05-28 9:24 ` Rasmus
2016-05-28 11:59 ` Nicolas Goaziou
2016-05-28 19:39 ` Andreas Amann
2016-05-29 8:24 ` Nicolas Goaziou
2016-05-29 18:12 ` Andreas Amann
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.