emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Rainer M Krug <Rainer@krugs.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] in Release 8.2 - editing code in indirect buffer
Date: Wed, 25 Sep 2013 09:15:29 +0200	[thread overview]
Message-ID: <61B2FF3D-CA55-4880-A7D0-6B7BE0A2B319@gmail.com> (raw)
In-Reply-To: <m28uyl9z29.fsf@krugs.de>

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


On 25.9.2013, at 08:48, Rainer M Krug <Rainer@krugs.de> wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>> Hi Rainer, hi Carsten,
>> 
>> it does not get lost - it is in my queue.  As are, unfortunately,
>> another 35 threads with possible bugs.  Help is definitely wanted.
> 
> That's what I was looking for - confirmation that is in somebodys
> processing queue. Thanks Carsten.
> 
> Unfortunately I can't hel as I have barely the elisp knowledge to
> maintain my .emacs file.
> 
>> 
>> Please see below for my comments and a possible fix.
>> 
>> On 23.9.2013, at 09:40, Rainer M Krug <Rainer@krugs.de> wrote:
>> 
>>> I just resend this bug report which has been confirmed by Ista Zahn.
>>> 
>>> Updated via git ust now:
>>> 
>>> Org-mode version 8.2 (release_8.2-14-ge5f16b @
>>> /Users/rainerkrug/.emacs.d/org-mode/lisp/)
>>> 
>>> 
>>> When starting to edit a code block via C-c ' everything works as expected
>>> and the code block is highlighted and an indirect buffer is opened.
>>> 
>>> When I click into the highlighted block, I an "send" to the indirect
>>> buffer. This behavior changes, after saving with C-s, even when nothing
>>> has been edited: the area in the original org file looses its magic, and
>>> looks normal again and can also be edited! 
>>> 
>>> The indirect buffer stays functional and, upon close via C-c ' saves the
>>> changes into the original buffer and *overwrites* changes done in this
>>> block in the org document.
>> 
>> This is a bug which is difficult to fix in all generality.  What
>> should really happen is that the text in the original buffer is made
>> read-only.  
> 
> Yup - exactly. That would be the best solution.
> 
>> But so far this does not happen in our implementation (due
>> to Dan Davison IIRC).  The reason for this is that read-only text
>> properties left by accident in a buffer are difficult to get rid of.
>> 
>> There are many things the user could go back and screw up the
>> original.  That's why Org choses to protect with highlighting with an
>> overlay.  Note that this is not a protection against editing, but it
>> is a visual warning.
> 
> Possibly because I am using the mouse most of the time to navigate in
> text and select buffers, I did not realize this.
> 
>> 
>> However, what happens during saving is indeed a problem - the overlay
>> gets lost (not really, it gets squeezed to zero by first removing the
>> source code and then inserting the modified version).
>> 
>> Could you please try this patch and test it to see if it is stable and
>> does the right thing?
> 
> Tried briefly and it seems to work:
> 
> 1) the visual overlay stays there upon C-x s from indirect buffer
> 
> 2) If I click with the mouse into it, I am redirected to the indirect
> buffer (correct terminology here?)
> 
> Let me know when you pushed it to git, than I can upgrade again.

I pushed this fix to maint and master.

- Carsten

> 
> Thanks,
> 
> Rainer
> 
>> 
>> Thank you.
>> 
>> - Carsten
>> 
>> diff --git a/lisp/org-src.el b/lisp/org-src.el
>> index 0f88174..062d2d7 100644
>> --- a/lisp/org-src.el
>> +++ b/lisp/org-src.el
>> @@ -757,6 +757,8 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
>> 	(delete-region beg (max beg end))
>> 	(unless (string-match "\\`[ \t]*\\'" code)
>> 	  (insert code))
>> +	;; Make sure the overlay stays in place
>> +	(when (eq context 'save) (move-overlay ovl beg (point)))
>> 	(goto-char beg)
>> 	(if single (just-one-space))))
>>     (if (memq t (mapcar (lambda (overlay)
>> 
>> 
> <#secure method=pgpmime mode=sign>
> 
> -- 
> Rainer M. Krug
> 
> email: RMKrug<at>gmail<dot>com
> 
> 


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2013-09-25  7:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 20:27 Release 8.2 Carsten Dominik
2013-09-20  4:32 ` Mehul Sanghvi
2013-09-20  5:07   ` Carsten Dominik
2013-09-20  9:40 ` Alexander Baier
2013-09-20 10:01   ` Carsten Dominik
2013-09-20 11:06 ` BUG?: BABEL - " Rainer M Krug
2013-09-20 11:06 ` Rainer M Krug
2013-09-21 13:54   ` Rainer M Krug
2013-09-21 15:02     ` BUG?: Org-src " Eric Schulte
2013-09-21 15:25     ` BUG?: BABEL " Ista Zahn
2013-09-20 11:17 ` Suvayu Ali
2013-09-23  7:40 ` [BUG] in Release 8.2 - editing code in indirect buffer Rainer M Krug
2013-09-24 14:01   ` Rainer M Krug
2013-09-24 16:02   ` Carsten Dominik
2013-09-24 16:17     ` Sebastien Vauban
2013-09-24 16:35       ` Carsten Dominik
     [not found]         ` <578DF849-8046-47A6-879C-FC5874BE591B-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-24 16:53           ` Sebastien Vauban
2013-09-25  6:53             ` Rainer M Krug
2013-09-25  7:09               ` Carsten Dominik
2013-09-25  7:38                 ` Rainer M Krug
2013-09-25 13:13                   ` Eric Schulte
2013-09-25 14:00                     ` Rainer M Krug
2013-09-25 19:39                     ` Andreas Leha
2013-09-26  8:11                       ` Rainer M Krug
2013-09-25  6:48     ` Rainer M Krug
2013-09-25  7:15       ` Carsten Dominik [this message]
2013-09-25  7:29         ` Rainer M Krug
2013-10-02 22:55 ` Release 8.2 Mike McLean

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=61B2FF3D-CA55-4880-A7D0-6B7BE0A2B319@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=Rainer@krugs.de \
    --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).