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

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.