Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
On Fri, Dec 14, 2012 at 5:39 PM, Bastien b...@altern.org wrote: Le Wang l26w...@gmail.com writes: ;; Move marker with inserted text for case when src block is ;; just one empty line, i.e. beg == end. - (end (copy-marker (make-marker) t)) + (end (let ((marker (make-marker))) + (set-marker-insertion-type marker t) + marker)) There is a (make-marker) in both case, the first one is okay. Well in the first case two marker are made (make-marker, then copy-marker), in the second one is made, IIUC of course; but it's not a big deal. I just had a chance to catch up on your changes. Tests pass fine now without structured error handling. So I'm happy with the state of things. Thanks. -- Le
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Bernt, Bernt Hansen be...@norang.ca writes: I get the following error when doing C-c ' in a table Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) org-edit-src-code() org-edit-special() call-interactively(org-edit-special nil nil) I fixed this, thanks! -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
- (if (= end beg) temp - (goto-char beg) - (insert \n) - (org-edit-src-find-region-and-lang + (if (and beg end) + (if (= end beg) + temp + (goto-char beg) + (insert \n) + (org-edit-src-find-region-and-lang)) + (error Point not in src block. Note: this is (if (and beg end (= end beg)) ... ...) Let's try to optimize such tiny refactoring :) -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
On Fri, Dec 14, 2012 at 8:04 AM, Bernt Hansen be...@norang.ca wrote: I get the following error when doing C-c ' in a table --8---cut here---start-8--- Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) org-edit-src-code() org-edit-special() call-interactively(org-edit-special nil nil) --8---cut here---end---8--- I have repro of the issue. I didn't take into account the full usage org-edit-special. I'll redo this with new tests within the next few hours. -- Le
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Le, Le Wang l26w...@gmail.com writes: If I press C-' before on a line BEFORE +begin_src ..., then doing comparison with = with beg==nil and end==nil causes wrong-type-argument error. I think the check should happen before, see how I did it here: http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=81d5eb test-org-src/point-outside-block test case should fail, but because wrong-type-argument is also an error, it is passing. :( I've changed (error ... to raise an org-src specific error to facilitate testing. Commits rebased to master are attached. Using signal makes sense if our testing suite uses it, yes. Can you merge your patches and provide a ChangeLog when the change affects org-src.el (and possibly test-org-src.el too)? Thanks a lot! -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Le Wang l26w...@gmail.com writes: ;; Move marker with inserted text for case when src block is ;; just one empty line, i.e. beg == end. - (end (copy-marker (make-marker) t)) + (end (let ((marker (make-marker))) + (set-marker-insertion-type marker t) + marker)) There is a (make-marker) in both case, the first one is okay. Best, -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Bernt, thanks for chasing this down. I tried to install emacs-23.2 but it does not compile on my machine. Does this patch fixes the problem for you? My guess is that (copy-marker nil t) returns an error on emacs-23.2. It's a weird sexp anyway, make-marker and set-marker-insertion-type are cleaner IMO. Thanks for testing, diff --git a/lisp/org-src.el b/lisp/org-src.el index f91da19..d2c3e19 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -228,12 +228,11 @@ buffer. (full-info (org-babel-get-src-block-info 'light)) (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive (beg (make-marker)) - ;; Move marker with inserted text for case when src block is - ;; just one empty line, i.e. beg == end. - (end (copy-marker nil t)) + (end (make-marker)) (allow-write-back-p (null code)) block-nindent total-nindent ovl lang lang-f single lfmt buffer msg begline markline markcol line col transmitted-variables) +(set-marker-insertion-type end t) (if (not info) nil (setq beg (move-marker beg (nth 0 info)) -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Nick Dokos nicholas.do...@hp.com writes: Bernt Hansen be...@norang.ca wrote: git bisect identifies the following commit: 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 is the first bad commit commit 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 Author: Le Wang le.w...@agworld.com.au Date: Sun Nov 18 13:39:51 2012 +0800 snip Reverting this commit fixes it for me. FWIW, I cannot reproduce this and I do have the commit you fingered in my tree. Could it be the emacs version that makes a difference here? Mine is GNU Emacs 24.2.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-09-21 Nick Possibly, but this happens for me at work as well which is Windows 23.3 I think. GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11 on raven, modified by Debian Bernt
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Bernt Hansen be...@norang.ca writes: Nick Dokos nicholas.do...@hp.com writes: Bernt Hansen be...@norang.ca wrote: git bisect identifies the following commit: 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 is the first bad commit commit 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 Author: Le Wang le.w...@agworld.com.au Date: Sun Nov 18 13:39:51 2012 +0800 snip Reverting this commit fixes it for me. FWIW, I cannot reproduce this and I do have the commit you fingered in my tree. Could it be the emacs version that makes a difference here? Mine is GNU Emacs 24.2.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-09-21 Nick Possibly, but this happens for me at work as well which is Windows 23.3 I think. For the record, this is my emacs version at work with the same symptoms. GNU Emacs 23.3.1 (i386-mingw-nt5.1.2600) of 2011-03-10 on 3249CTO Thanks, Bernt GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11 on raven, modified by Debian Bernt
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Bastien b...@altern.org writes: Hi Bernt, thanks for chasing this down. I tried to install emacs-23.2 but it does not compile on my machine. Does this patch fixes the problem for you? My guess is that (copy-marker nil t) returns an error on emacs-23.2. It's a weird sexp anyway, make-marker and set-marker-insertion-type are cleaner IMO. Thanks for testing, Thanks, I'll try this patch and report back later today. Regards, Bernt
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
On Thu, Dec 13, 2012 at 9:42 PM, Bernt Hansen be...@norang.ca wrote: I'll try this patch and report back later today. That commit was from me, and I did not test against Emacs 24.2. I will submit another patch to add some tests. Do tests get automatically run on some kind of Travis CI setup? In the mean time, I think my included patch (logic identically to Bastien's) is more lisp-ly. -- Le org-src.el.le.patch Description: Binary data
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Le, Le Wang l26w...@gmail.com writes: On Thu, Dec 13, 2012 at 9:42 PM, Bernt Hansen be...@norang.ca wrote: I'll try this patch and report back later today. That commit was from me, and I did not test against Emacs 24.2. I will submit another patch to add some tests. Do tests get automatically run on some kind of Travis CI setup? No we don't. If anyone knows how to set this up for our needs, please share. In the mean time, I think my included patch (logic identically to Bastien's) is more lisp-ly. Whatever works -- we first need to make sure this fixes it and try to understand why ;) Thanks for taking care of this, -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Bastien b...@altern.org writes: Hi Bernt, thanks for chasing this down. I tried to install emacs-23.2 but it does not compile on my machine. Does this patch fixes the problem for you? My guess is that (copy-marker nil t) returns an error on emacs-23.2. It's a weird sexp anyway, make-marker and set-marker-insertion-type are cleaner IMO. Thanks for testing, Your patch fixes it for me on both versions (linux 23.2.1, windows 23.3.1) Thanks! Regards, Bernt
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Bernt, Bernt Hansen be...@norang.ca writes: Your patch fixes it for me on both versions (linux 23.2.1, windows 23.3.1) Thanks! I pushed the patch, thanks for confirming this. PS: Le, I used my version, shorter, and not that unlispy IMO. But thanks for the patch anyway! -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
On Thu, Dec 13, 2012 at 11:17 PM, Bastien b...@altern.org wrote: Hi Le, No we don't. If anyone knows how to set this up for our needs, please share. I've only done this for projects hosted on github, others may have more experience. But having a continuous integration service is definitely helpful. For example, there were 10 failures when I ran tests against master just now: 10 unexpected results: FAILED ob-exp/exports-inline FAILED ob-exp/noweb-strip-export-ensure-strips FAILED test-ob/org-babel-remove-result--results-default FAILED test-ob/org-babel-results-indented-wrap FAILED test-org-babel/combining-scalar-and-raw-result-types FAILED test-org-babel/inline-src-blocks FAILED test-org-babel/inline-src_blk-default-results-replace-line-1 FAILED test-org-babel/just-one-results-block FAILED test-org-babel/nested-code-block FAILED test-org-babel/partial-nested-code-block I haven't investigated further though. Whatever works -- we first need to make sure this fixes it and try to understand why ;) I can confirm that copy-marker does not work as I've used it on Emacs 23.3.1. Thanks for taking care of this, You're welcome. I've attached 3 patches to fix this and another bug I found while writing tests. -- Le 0001-don-t-use-copy-marker-nil-t-for-Emacs-23-compat.patch Description: Binary data 0002-fix-org-edit-src-code-invoked-outside-src-block.patch Description: Binary data 0003-add-tests-for-org-src-edit.patch Description: Binary data
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Le Wang l26w...@gmail.com writes: I haven't investigated further though. We can easily setup a mirror on github and use the platform from this repo. But I'm unsure how this would work. If someone wants to take this in charge, let me know. I've attached 3 patches to fix this and another bug I found while writing tests. Ah, our patches crossed. I superseded the first one with my patch, and just applied the third one. Can you explain the bug behind the second one? Thanks! -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
On Fri, Dec 14, 2012 at 12:25 AM, Bastien b...@altern.org wrote: I superseded the first one with my patch, and just applied the third one. Can you explain the bug behind the second one? If I press C-' before on a line BEFORE +begin_src ..., then doing comparison with = with beg==nil and end==nil causes wrong-type-argument error. test-org-src/point-outside-block test case should fail, but because wrong-type-argument is also an error, it is passing. :( I've changed (error ... to raise an org-src specific error to facilitate testing. Commits rebased to master are attached. A note: I did change this line: (end (copy-marker (make-marker) t)) (make-marker) makes a temporary new marker that's never used. ;) -- Le 0001-don-t-use-copy-marker-nil-t-for-Emacs-23-compat.patch Description: Binary data 0002-fix-org-edit-src-code-invoked-outside-src-block.patch Description: Binary data 0003-test-org-src-checks-for-org-src-generated-error.patch Description: Binary data 0004-add-org-src-error-error-condition.patch Description: Binary data 0005-remove-extraneous-if-condition.patch Description: Binary data
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
... one more to fix misuse of signal -- Le 0006-fix-mix-use-of-signal.patch Description: Binary data
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Bastien b...@altern.org writes: Hi Bernt, Bernt Hansen be...@norang.ca writes: Your patch fixes it for me on both versions (linux 23.2.1, windows 23.3.1) Thanks! I pushed the patch, thanks for confirming this. PS: Le, I used my version, shorter, and not that unlispy IMO. But thanks for the patch anyway! I get the following error when doing C-c ' in a table --8---cut here---start-8--- Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) org-edit-src-code() org-edit-special() call-interactively(org-edit-special nil nil) --8---cut here---end---8--- I'm trying to get to the table editor. GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11 on raven, modified by Debian Regards, Bernt
[O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Chong, Chong Yidong c...@gnu.org writes: Could you please take a look at Bug#12905? If it causes data loss, I think it should be fixed in the emacs-24 branch. Thanks. This is fixed, thanks for the heads up. I just merged the Org bugfix branch into emacs-24. I made one mistake: I backported Paul's fixes about whitespaces in our bugfix branch*, so those fixes are now in emacs-24 too, not in the trunk only. I hope this won't create merge conflicts. * http://orgmode.org/cgit.cgi/org-mode.git/commit/?h=maintid=e5ea08 -- Bastien
[O] bug#12905: 24.2.50; org: edit source block causes data loss
On Wed 12 Dec 2012, Bastien wrote: This is fixed, thanks for the heads up. I just merged the Org bugfix branch into emacs-24. I can confirm the bug is fixed for emacs-24 after this merge. Thanks Bastien, AndyM
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Bastien, I'm not sure if this is related or not - I don't have time to track down the offending commit right now. org-edit-special (C-c ') is currently broken in master. I get the following backtrace --8---cut here---start-8--- Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil) copy-marker(nil t) org-edit-src-code() org-edit-special() call-interactively(org-edit-special nil nil) --8---cut here---end---8--- GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11 on raven, modified by Debian Org-mode version 7.9.2 (release_7.9.2-664-gb1f369 @ /home/bernt/git/org-mode/lisp/) Thanks, Bernt Bastien b...@altern.org writes: Hi Chong, Chong Yidong c...@gnu.org writes: Could you please take a look at Bug#12905? If it causes data loss, I think it should be fixed in the emacs-24 branch. Thanks. This is fixed, thanks for the heads up. I just merged the Org bugfix branch into emacs-24. I made one mistake: I backported Paul's fixes about whitespaces in our bugfix branch*, so those fixes are now in emacs-24 too, not in the trunk only. I hope this won't create merge conflicts. * http://orgmode.org/cgit.cgi/org-mode.git/commit/?h=maintid=e5ea08
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
On 12 December 2012 16:05, Bernt Hansen be...@norang.ca wrote: Hi Bastien, I'm not sure if this is related or not - I don't have time to track down the offending commit right now. org-edit-special (C-c ') is currently broken in master. I get the same thing when trying (C-c ') on the #+begin_src line. When trying it within the body of the source block it works properly I get the following backtrace --8---cut here---start-8--- Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil) copy-marker(nil t) org-edit-src-code() org-edit-special() call-interactively(org-edit-special nil nil) --8---cut here---end---8--- GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11 on raven, modified by Debian Org-mode version 7.9.2 (release_7.9.2-664-gb1f369 @ /home/bernt/git/org-mode/lisp/) Thanks, Bernt Regards, Jon Bastien b...@altern.org writes: Hi Chong, Chong Yidong c...@gnu.org writes: Could you please take a look at Bug#12905? If it causes data loss, I think it should be fixed in the emacs-24 branch. Thanks. This is fixed, thanks for the heads up. I just merged the Org bugfix branch into emacs-24. I made one mistake: I backported Paul's fixes about whitespaces in our bugfix branch*, so those fixes are now in emacs-24 too, not in the trunk only. I hope this won't create merge conflicts. * http://orgmode.org/cgit.cgi/org-mode.git/commit/?h=maintid=e5ea08
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
For me it occurs both inside the block (begin_src or begin_example) and on the first line. Regards, Bernt Jonathan Leech-Pepin jonathan.leechpe...@gmail.com writes: On 12 December 2012 16:05, Bernt Hansen be...@norang.ca wrote: Hi Bastien, I'm not sure if this is related or not - I don't have time to track down the offending commit right now. org-edit-special (C-c ') is currently broken in master. I get the same thing when trying (C-c ') on the #+begin_src line. When trying it within the body of the source block it works properly I get the following backtrace --8---cut here---start-8--- Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil) copy-marker(nil t) org-edit-src-code() org-edit-special() call-interactively(org-edit-special nil nil) --8---cut here---end---8--- GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11 on raven, modified by Debian Org-mode version 7.9.2 (release_7.9.2-664-gb1f369 @ /home/bernt/git/org-mode/lisp/) Thanks, Bernt Regards, Jon Bastien b...@altern.org writes: Hi Chong, Chong Yidong c...@gnu.org writes: Could you please take a look at Bug#12905? If it causes data loss, I think it should be fixed in the emacs-24 branch. Thanks. This is fixed, thanks for the heads up. I just merged the Org bugfix branch into emacs-24. I made one mistake: I backported Paul's fixes about whitespaces in our bugfix branch*, so those fixes are now in emacs-24 too, not in the trunk only. I hope this won't create merge conflicts. * http://orgmode.org/cgit.cgi/org-mode.git/commit/?h=maintid=e5ea08
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Bernt, Bernt Hansen be...@norang.ca writes: I'm not sure if this is related or not - I don't have time to track down the offending commit right now. There is nothing new regarding editing source code in master, except Eric's last few patches. org-edit-special (C-c ') is currently broken in master. I get the following backtrace Mhh.. I can't reproduce this. Org-mode version 7.9.2 (release_7.9.2-664-gb1f369 @ /home/bernt/git/org-mode/lisp/) I'm on release_7.9.2-692-g627d57 ^^^ Are you sure you are using master HEAD? Thanks, -- Bastien
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Bastien b...@altern.org writes: Hi Bernt, Bernt Hansen be...@norang.ca writes: I'm not sure if this is related or not - I don't have time to track down the offending commit right now. There is nothing new regarding editing source code in master, except Eric's last few patches. org-edit-special (C-c ') is currently broken in master. I get the following backtrace Mhh.. I can't reproduce this. Org-mode version 7.9.2 (release_7.9.2-664-gb1f369 @ /home/bernt/git/org-mode/lisp/) I'm on release_7.9.2-692-g627d57 ^^^ Are you sure you are using master HEAD? I think so. I just updated and have the same behaviour Org-mode version 7.9.2 (release_7.9.2-693-g8c04fb @ /home/bernt/git/org-mode/lisp/) I'll try and locate the problem commit. Regards, Bernt
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Bernt Hansen be...@norang.ca writes: Bastien b...@altern.org writes: Hi Bernt, Bernt Hansen be...@norang.ca writes: I'm not sure if this is related or not - I don't have time to track down the offending commit right now. There is nothing new regarding editing source code in master, except Eric's last few patches. org-edit-special (C-c ') is currently broken in master. I get the following backtrace Mhh.. I can't reproduce this. Org-mode version 7.9.2 (release_7.9.2-664-gb1f369 @ /home/bernt/git/org-mode/lisp/) I'm on release_7.9.2-692-g627d57 ^^^ Are you sure you are using master HEAD? I think so. I just updated and have the same behaviour Org-mode version 7.9.2 (release_7.9.2-693-g8c04fb @ /home/bernt/git/org-mode/lisp/) I'll try and locate the problem commit. git bisect identifies the following commit: --8---cut here---start-8--- 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 is the first bad commit commit 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 Author: Le Wang le.w...@agworld.com.au Date: Sun Nov 18 13:39:51 2012 +0800 org-src: Fix org-edit-src-code for empty blocks and block with just an empty line * lisp/org-src.el (org-edit-src-code): Use marker with insertion type t to track end and remove hack requiring delete from beg to (1- end). :04 04 91825ba365592800804e652e3ad66db0f8302772 25f089bf9456b306afd2a0e538bcbfefc4a124f0 M lisp --8---cut here---end---8--- I'm just trying to edit a lisp source block --8---cut here---start-8--- * test [2012-12-09 Sun 20:53] #+begin_src lisp (defun bh/show-org-agenda () (interactive) (switch-to-buffer *Org Agenda*) (delete-other-windows)) ; Use the current window for C-c ' source editing (setq org-src-window-setup 'current-window) #+end_src --8---cut here---end---8--- using C-c ' inside the block. Reverting this commit fixes it for me. Regards, Bernt
Re: [O] bug#12905: 24.2.50; org: edit source block causes data loss
Bernt Hansen be...@norang.ca wrote: Bernt Hansen be...@norang.ca writes: Bastien b...@altern.org writes: Hi Bernt, Bernt Hansen be...@norang.ca writes: I'm not sure if this is related or not - I don't have time to track down the offending commit right now. There is nothing new regarding editing source code in master, except Eric's last few patches. org-edit-special (C-c ') is currently broken in master. I get the following backtrace Mhh.. I can't reproduce this. Org-mode version 7.9.2 (release_7.9.2-664-gb1f369 @ /home/bernt/git/org-mode/lisp/) I'm on release_7.9.2-692-g627d57 ^^^ Are you sure you are using master HEAD? I think so. I just updated and have the same behaviour Org-mode version 7.9.2 (release_7.9.2-693-g8c04fb @ /home/bernt/git/org-mode/lisp/) I'll try and locate the problem commit. git bisect identifies the following commit: 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 is the first bad commit commit 206257aa7eb83a0a62f297e7cf0e3a7c32ff6f05 Author: Le Wang le.w...@agworld.com.au Date: Sun Nov 18 13:39:51 2012 +0800 org-src: Fix org-edit-src-code for empty blocks and block with just an empty line * lisp/org-src.el (org-edit-src-code): Use marker with insertion type t to track end and remove hack requiring delete from beg to (1- end). :04 04 91825ba365592800804e652e3ad66db0f8302772 25f089bf9456b306afd2a0e538bcbfefc4a124f0 Mlisp I'm just trying to edit a lisp source block * test [2012-12-09 Sun 20:53] #+begin_src lisp (defun bh/show-org-agenda () (interactive) (switch-to-buffer *Org Agenda*) (delete-other-windows)) ; Use the current window for C-c ' source editing (setq org-src-window-setup 'current-window) #+end_src using C-c ' inside the block. Reverting this commit fixes it for me. FWIW, I cannot reproduce this and I do have the commit you fingered in my tree. Could it be the emacs version that makes a difference here? Mine is GNU Emacs 24.2.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-09-21 Nick
[O] bug#12905: 24.2.50; org: edit source block causes data loss
Hi Bastien, Could you please take a look at Bug#12905? If it causes data loss, I think it should be fixed in the emacs-24 branch. Thanks.