all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 2 annoying questions for `find-alternate-file`
@ 2012-07-19 16:29 Damien Cassou
  2012-07-19 18:12 ` Thien-Thi Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Damien Cassou @ 2012-07-19 16:29 UTC (permalink / raw)
  To: emacs-devel

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

Hi,

`find-alternate-file` currently asks 2 questions when the current buffer
contains unsaved changes. If you really want what you asked for, you
have to first answer no and then yes:

"Buffer %s is modified; save it first? "           -> no
"Kill and replace the buffer without saving it? "  -> yes

This is annoying. These two questions have already been changed multiple
times and there have already been discussions about it, for
example:

http://lists.gnu.org/archive/html/emacs-devel/2009-09/msg00101.html

I think that's a sign things are too complex.

I propose to replace these 2 questions by just 1 which could be along the
lines of "Do you really want to do what you asked for?". When the user
confirms, his changes are lost. When the user does not confirm, the
process is aborted, giving him a chance to save and try again.

I attach a possible patch.

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry

[-- Attachment #2: one-question-for-find-alternate-file.patch --]
[-- Type: application/octet-stream, Size: 808 bytes --]

diff -u /tmp/files-old.el /tmp/files.el
--- /tmp/files-old.el	2012-07-19 18:15:18.181231878 +0200
+++ /tmp/files.el	2012-07-19 18:14:48.653232742 +0200
@@ -1559,11 +1559,9 @@
   (unless (run-hook-with-args-until-failure 'kill-buffer-query-functions)
     (error "Aborted"))
   (when (and (buffer-modified-p) buffer-file-name)
-    (if (yes-or-no-p (format "Buffer %s is modified; save it first? "
+    (unless (yes-or-no-p (format "Buffer %s is modified; are you sure you want to continue? "
 			     (buffer-name)))
-        (save-buffer)
-      (unless (yes-or-no-p "Kill and replace the buffer without saving it? ")
-        (error "Aborted"))))
+        (error "Aborted")))
   (let ((obuf (current-buffer))
 	(ofile buffer-file-name)
 	(onum buffer-file-number)

Diff finished.  Thu Jul 19 18:15:31 2012

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

* Re: 2 annoying questions for `find-alternate-file`
  2012-07-19 16:29 2 annoying questions for `find-alternate-file` Damien Cassou
@ 2012-07-19 18:12 ` Thien-Thi Nguyen
  2012-07-20 10:09 ` Juri Linkov
  2012-10-29  1:27 ` Drew Adams
  2 siblings, 0 replies; 4+ messages in thread
From: Thien-Thi Nguyen @ 2012-07-19 18:12 UTC (permalink / raw)
  To: Damien Cassou; +Cc: emacs-devel

() Damien Cassou <damien.cassou@gmail.com>
() Thu, 19 Jul 2012 18:29:34 +0200

   I propose to replace these 2 questions by just 1 which could be along the
   lines of "Do you really want to do what you asked for?". When the user
   confirms, his changes are lost.

Why not ask this directly?

"Current buffer modified.  Continue, discarding changes?"




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

* Re: 2 annoying questions for `find-alternate-file`
  2012-07-19 16:29 2 annoying questions for `find-alternate-file` Damien Cassou
  2012-07-19 18:12 ` Thien-Thi Nguyen
@ 2012-07-20 10:09 ` Juri Linkov
  2012-10-29  1:27 ` Drew Adams
  2 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2012-07-20 10:09 UTC (permalink / raw)
  To: Damien Cassou; +Cc: emacs-devel

> -    (if (yes-or-no-p (format "Buffer %s is modified; save it first? "
> +    (unless (yes-or-no-p (format "Buffer %s is modified; are you sure you want to continue? "
>  			     (buffer-name)))
> -        (save-buffer)
> -      (unless (yes-or-no-p "Kill and replace the buffer without saving it? ")

Please state clearly in the question what the command is going to do.
So instead of

"Buffer %s is modified; are you sure you want to continue? "

use something like

"Buffer %s is modified; kill and replace it without saving? "



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

* RE: 2 annoying questions for `find-alternate-file`
  2012-07-19 16:29 2 annoying questions for `find-alternate-file` Damien Cassou
  2012-07-19 18:12 ` Thien-Thi Nguyen
  2012-07-20 10:09 ` Juri Linkov
@ 2012-10-29  1:27 ` Drew Adams
  2 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2012-10-29  1:27 UTC (permalink / raw)
  To: 'Damien Cassou', emacs-devel; +Cc: 'Juri Linkov'

This annoyance was commented on in July (this thread).  A bug (#12487) was
independently filed for the same annoyance in September.

Neither the emacs-devel thread nor the bug has been replied to yet by our
maintainers.  This was a very bad change to Emacs - contrary to all good sense
for a UI.

The confusion it introduces will cause users to _lose data_.  I, for one, have
almost been tripped up by it multiple times, in spite of the fact that I am well
aware of it now.

Can we please get this awful change reverted or otherwise reversed/fixed?
Several reasonable comments and solutions have been proposed in the bug and
emacs-devel threads.  Why is it so hard to get something so simple and so
obviously wrong fixed?

http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00431.html

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12487




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

end of thread, other threads:[~2012-10-29  1:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 16:29 2 annoying questions for `find-alternate-file` Damien Cassou
2012-07-19 18:12 ` Thien-Thi Nguyen
2012-07-20 10:09 ` Juri Linkov
2012-10-29  1:27 ` Drew Adams

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.