all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] org-src.el Do not ask to revert unmodified buffers
@ 2021-03-08 22:57 pillule
  2021-03-08 23:03 ` pillule
  2021-03-21 20:33 ` Kyle Meyer
  0 siblings, 2 replies; 7+ messages in thread
From: pillule @ 2021-03-08 22:57 UTC (permalink / raw)
  To: emacs-orgmode


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.

-- 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] org-src.el Do not ask to revert unmodified buffers
  2021-03-08 22:57 [PATCH] org-src.el Do not ask to revert unmodified buffers pillule
@ 2021-03-08 23:03 ` pillule
  2021-03-08 23:06   ` pillule
  2021-03-21 20:33 ` Kyle Meyer
  1 sibling, 1 reply; 7+ messages in thread
From: pillule @ 2021-03-08 23:03 UTC (permalink / raw)
  To: pillule; +Cc: emacs-orgmode


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.


-- 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] org-src.el Do not ask to revert unmodified buffers
  2021-03-08 23:03 ` pillule
@ 2021-03-08 23:06   ` pillule
  0 siblings, 0 replies; 7+ messages in thread
From: pillule @ 2021-03-08 23:06 UTC (permalink / raw)
  To: pillule; +Cc: emacs-orgmode

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



-- 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] org-src.el Do not ask to revert unmodified buffers
  2021-03-08 22:57 [PATCH] org-src.el Do not ask to revert unmodified buffers pillule
  2021-03-08 23:03 ` pillule
@ 2021-03-21 20:33 ` Kyle Meyer
  2021-03-26  3:10   ` pillule
  1 sibling, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2021-03-21 20:33 UTC (permalink / raw)
  To: pillule; +Cc: emacs-orgmode

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] org-src.el Do not ask to revert unmodified buffers
  2021-03-21 20:33 ` Kyle Meyer
@ 2021-03-26  3:10   ` pillule
  2021-05-01 10:55     ` Timothy
  0 siblings, 1 reply; 7+ messages in thread
From: pillule @ 2021-03-26  3:10 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: pillule, emacs-orgmode


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.


-- 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] org-src.el Do not ask to revert unmodified buffers
  2021-03-26  3:10   ` pillule
@ 2021-05-01 10:55     ` Timothy
  2021-05-01 10:58       ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Timothy @ 2021-05-01 10:55 UTC (permalink / raw)
  To: pillule; +Cc: Kyle Meyer, emacs-orgmode


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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] org-src.el Do not ask to revert unmodified buffers
  2021-05-01 10:55     ` Timothy
@ 2021-05-01 10:58       ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2021-05-01 10:58 UTC (permalink / raw)
  To: Timothy; +Cc: pillule, Kyle Meyer, emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> Hi pillule, should we consider this patch cancelled?

It is already :)

-- 
 Bastien


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-01 10:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-08 22:57 [PATCH] org-src.el Do not ask to revert unmodified buffers pillule
2021-03-08 23:03 ` pillule
2021-03-08 23:06   ` pillule
2021-03-21 20:33 ` Kyle Meyer
2021-03-26  3:10   ` pillule
2021-05-01 10:55     ` Timothy
2021-05-01 10:58       ` Bastien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.