Hi, it is asked to the user if we want to revert changes when re-entering in a org-source buffer. Even if the buffer have no modifications. This patch ask to revert the buffer only if there are modifications to the source buffer. @@ -493,8 +493,9 @@ (old-edit-buffer (org-src--edit-buffer beg end)) (contents (or contents (nth 2 area)))) (if (and old-edit-buffer - (or (not org-src-ask-before-returning-to-edit-buffer) - (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? "))) + (or (not org-src-ask-before-returning-to-edit-buffer) + (or (not (buffer-modified-p old-edit-buffer)) + (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? ")))) ;; Move to existing buffer. (org-src-switch-to-buffer old-edit-buffer 'return) ;; Discard old edit buffer. --
hm I hope this is better.
> Hi, it is asked to the user if we want to revert changes when
> re-entering in a
> org-source buffer.
> Even if the buffer have no modifications.
>
> This patch ask to revert the buffer only if there are
> modifications to the
> source buffer.
@@ -493,8 +493,9 @@
(old-edit-buffer (org-src--edit-buffer beg end))
(contents (or contents (nth 2 area))))
(if (and old-edit-buffer
- (or (not org-src-ask-before-returning-to-edit-buffer)
- (y-or-n-p "Return to existing edit buffer ([n] will
revert changes)? ")))
+ (or (not org-src-ask-before-returning-to-edit-buffer)
+ (or (not (buffer-modified-p old-edit-buffer))
+ (y-or-n-p "Return to existing edit buffer ([n] will revert
changes)? "))))
;; Move to existing buffer.
(org-src-switch-to-buffer old-edit-buffer 'return)
;; Discard old edit buffer.
--
[-- Attachment #1: Type: text/plain, Size: 300 bytes --] hm I hope this is better.² >> Hi, it is asked to the user if we want to revert changes when >> re-entering in a >> org-source buffer. >> Even if the buffer have no modifications. >> >> This patch ask to revert the buffer only if there are >> modifications to the >> source buffer. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: don_t_ask_to_revert_unmodified_src_buffers --] [-- Type: text/x-diff, Size: 590 bytes --] @@ -493,8 +493,9 @@ (old-edit-buffer (org-src--edit-buffer beg end)) (contents (or contents (nth 2 area)))) (if (and old-edit-buffer - (or (not org-src-ask-before-returning-to-edit-buffer) - (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? "))) + (or (not org-src-ask-before-returning-to-edit-buffer) + (or (not (buffer-modified-p old-edit-buffer)) + (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? ")))) ;; Move to existing buffer. (org-src-switch-to-buffer old-edit-buffer 'return) ;; Discard old edit buffer. [-- Attachment #3: Type: text/plain, Size: 8 bytes --] --
Thanks for the patch.
pillule writes:
> Hi, it is asked to the user if we want to revert changes when
> re-entering in a org-source buffer.
> Even if the buffer have no modifications.
Hmm, that description seems to be focusing on the prompt's parenthetical
note. When org-src-ask-before-returning-to-edit-buffer is non-nil and
there's an existing source buffer, the caller is asked whether to return
to it or regenerate/overwrite it. The message warns that the second
option (i.e. answering "no, don't return to existing buffer") will
discard changes.
It looks like this patch assumes that, when the buffer is unmodified,
the answer to the above question necessarily becomes "yes, return to the
existing buffer", but it's not clear to me why that should be. With an
unmodified buffer, I suppose there's less of a difference between the
two answers, but at least with the default org-src-window-setup value,
there's still a user-visible difference in terms of window organization.
You are right I clearly missed
org-src-ask-before-returning-to-edit-buffer
Don't know how . . .
Sorry for the noise.
Kyle Meyer <kyle@kyleam.com> writes:
> Thanks for the patch.
>
> pillule writes:
>
>> Hi, it is asked to the user if we want to revert changes when
>> re-entering in a org-source buffer.
>> Even if the buffer have no modifications.
>
> Hmm, that description seems to be focusing on the prompt's
> parenthetical
> note. When org-src-ask-before-returning-to-edit-buffer is
> non-nil and
> there's an existing source buffer, the caller is asked whether
> to return
> to it or regenerate/overwrite it. The message warns that the
> second
> option (i.e. answering "no, don't return to existing buffer")
> will
> discard changes.
>
> It looks like this patch assumes that, when the buffer is
> unmodified,
> the answer to the above question necessarily becomes "yes,
> return to the
> existing buffer", but it's not clear to me why that should be.
> With an
> unmodified buffer, I suppose there's less of a difference
> between the
> two answers, but at least with the default org-src-window-setup
> value,
> there's still a user-visible difference in terms of window
> organization.
--
Hi pillule, should we consider this patch cancelled?
pillule <pillule@riseup.net> writes:
> You are right I clearly missed org-src-ask-before-returning-to-edit-buffer
> Don't know how . . .
>
> Sorry for the noise.
Timothy <tecosaur@gmail.com> writes:
> Hi pillule, should we consider this patch cancelled?
It is already :)
--
Bastien