emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Amann <a.amann@ucc.ie>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>, Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: problem with org-table-export
Date: Sat, 28 May 2016 20:39:50 +0100	[thread overview]
Message-ID: <87a8jarmyh.fsf@msstf091.ucc.ie> (raw)
In-Reply-To: <87a8jao0k5.fsf@saiph.selenimh>

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


  reply	other threads:[~2016-05-28 19:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-05-29  8:24       ` Nicolas Goaziou
2016-05-29 18:12         ` Andreas Amann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8jarmyh.fsf@msstf091.ucc.ie \
    --to=a.amann@ucc.ie \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).