all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Stoeber <paul.stoeber@stud.tu-ilmenau.de>
Cc: bug-gnu-emacs@gnu.org, emacs-devel@gnu.org
Subject: Re: go to next unsaved buffer
Date: Wed, 3 Jul 2002 12:16:53 +0000	[thread overview]
Message-ID: <afuq3r$dgg$2@main.gmane.org> (raw)
In-Reply-To: <87sn311iqf.fsf@jidanni.org>

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")))

  parent reply	other threads:[~2002-07-03 12:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02  8:11 go to next unsaved buffer Dan Jacobson
2002-07-02 10:38 ` Paul Stoeber
2002-07-03  5:30   ` Dan Jacobson
2002-07-03 12:16     ` Paul Stoeber
2002-07-03 18:57       ` Andreas Schwab
2002-07-03 18:57       ` Andreas Schwab
2002-07-04  6:59       ` Dan Jacobson
2002-07-04  6:59       ` Dan Jacobson
2002-07-04 18:24       ` Richard Stallman
2002-07-04 20:02         ` Paul Stoeber
2002-07-04 21:46           ` more official key bindings for us follow the leader types Dan Jacobson
2002-07-05  8:54             ` Miles Bader
2002-07-05 22:05           ` go to next unsaved buffer Richard Stallman
2002-07-06  7:37             ` bind me a/k/a leadership in the key binding dept Dan Jacobson
2002-07-06 10:42               ` Miles Bader
2002-07-03 12:16     ` Paul Stoeber [this message]
2002-07-03 20:57 ` go to next unsaved buffer Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='afuq3r$dgg$2@main.gmane.org' \
    --to=paul.stoeber@stud.tu-ilmenau.de \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.