From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Paul Stoeber Newsgroups: gmane.emacs.devel Subject: Re: go to next unsaved buffer Date: Wed, 3 Jul 2002 12:16:53 +0000 Sender: emacs-devel-admin@gnu.org Message-ID: References: <87y9cuzgzt.fsf@jidanni.org> <20020702103800.GA179@xyz> <87sn311iqf.fsf@jidanni.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1025698747 13840 127.0.0.1 (3 Jul 2002 12:19:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 3 Jul 2002 12:19:07 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17Pj6B-0003b7-00 for ; Wed, 03 Jul 2002 14:19:07 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17PjBg-0000AO-00 for ; Wed, 03 Jul 2002 14:24:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17Pj5E-0006jr-00; Wed, 03 Jul 2002 08:18:08 -0400 Original-Received: from manelan061.rz.tu-ilmenau.de ([141.24.132.61] helo=xyz) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 17Pj4G-0006im-00; Wed, 03 Jul 2002 08:17:08 -0400 Original-Received: from q by xyz with local (Exim 3.12 #1 (Debian)) id 17Pj41-00004T-00; Wed, 03 Jul 2002 12:16:53 +0000 Original-To: Dan Jacobson Content-Disposition: inline In-Reply-To: <87sn311iqf.fsf@jidanni.org> Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:5399 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:5399 On Wed, Jul 03, 2002 at 01:30:16PM +0800, Dan Jacobson wrote: > Paul> `save-some-buffers' already has this: C-r. Type C-M-c to exit from > Paul> the recursive edit. > > It is a bug that C-h k C-x s does not mention this. The prompt "Save file /tmp/1? (y, n, !, ., q, C-r or C-h)" mentions C-r, and C-h explains it. > By the way I just tired what you mentioned. Seems like a great way to > get all confused. I ended up with lots of [[[ ]]] in the modeline and > I had to hit exit-recursive-edit several times to get out. C-r puts you into view-mode. Does this cause the problem? It can be turned off with M-x view-mode. > Anyway, my > idea is simpler in that you aren't under the gun of being in the > middle of answering the question of saving each buffer. I've tried your idea, and it's actually more comfortable than the the dialog with `save-some-buffers'. A problem is: what is an "unsaved buffer"? ;; This function should be factored out of `save-some-buffers', ;; which is a moving target (see the thread ;; "[jidanni@deadspam.com: modeline doesn't divulge buffer will go bye bye]" ;; on emacs-devel). (defun buffer-unsaved-p (buffer) "The definition of \"unsaved buffer\" for `switch-to-next-unsaved-buffer'." (and (buffer-modified-p buffer) (or (buffer-file-name buffer) (not (string-match "\\`[ *]" (buffer-name buffer)))))) (defun switch-to-next-unsaved-buffer () "Switch to next unsaved buffer if any. The function `buffer-unsaved-p' defines \"unsaved buffer\"." (interactive) (catch 'return (if (buffer-unsaved-p (current-buffer)) (bury-buffer (current-buffer))) (dolist (buffer (buffer-list)) (if (buffer-unsaved-p buffer) (if (eq buffer (current-buffer)) (error "No other unsaved buffers") (switch-to-buffer buffer) (throw 'return nil)))) (error "No unsaved buffers")))