emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Takafumi Arakaki <aka.tkf@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix org-entry-put (trouble with org-columns-edit-value)
Date: Tue, 6 Nov 2012 20:48:40 +0100	[thread overview]
Message-ID: <CAPM+gBQ4e3n6iUE=CK1as1Z2yT8F13wzJMxXFtiQP2AXaBfa_w@mail.gmail.com> (raw)

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

I have a trouble with org-columns-edit-value; updating property using
this command breaks property formatting.

If I update MyProp_B in,

   :PROPERTIES:
   :MyProp_A: a
   :MyProp_B: b
   :END:

I end up with:

   :PROPERTIES:
   :MyProp_A: :MyProp_B: x a

   :END:


I found that (match-beginning 0) returns different value after
(delete-region (match-beginning 0) (match-end 0)).  The strange thing
is that I could not reproduce it in "plain" Emacs without loading my
init.el.

I am using a few week older version from Emacs trunk.
emacs-version: "24.2.50.1"
emacs-bzr-version: "110740 rgm@gnu.org-20121030101856-aimepc487hfjuqqs"


I will try to reproduce the bug after updating Emacs (probably to the
24.3 release branch) and org-mode later.  But I thought I'd share the
patch first.

[-- Attachment #2: org-entry-put.patch --]
[-- Type: application/octet-stream, Size: 563 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 2d2615f..dd03aeb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14765,9 +14765,10 @@ and the new value.")
 	  (goto-char (car range))
 	  (if (re-search-forward
 	       (org-re-property-keyword property) (cdr range) t)
-	      (progn
-		(delete-region (match-beginning 0) (match-end 0))
-		(goto-char (match-beginning 0)))
+	      (let ((mbeg (match-beginning 0))
+		    (mend (match-end 0)))
+		(delete-region mbeg mend)
+		(goto-char mbeg))
 	    (goto-char (cdr range))
 	    (insert "\n")
 	    (backward-char 1)

             reply	other threads:[~2012-11-06 19:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 19:48 Takafumi Arakaki [this message]
2012-11-09  8:58 ` [PATCH] Fix org-entry-put (trouble with org-columns-edit-value) Nicolas Goaziou
2012-11-09 13:08   ` Takafumi Arakaki
2012-11-09 13:25     ` Nicolas Goaziou
2012-11-09 14:34       ` Takafumi Arakaki
2012-12-02  4:52         ` Takafumi Arakaki
2012-12-02  8:39           ` Nicolas Goaziou
2012-12-07 10:51             ` Takafumi Arakaki

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='CAPM+gBQ4e3n6iUE=CK1as1Z2yT8F13wzJMxXFtiQP2AXaBfa_w@mail.gmail.com' \
    --to=aka.tkf@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).