unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: go to next unsaved buffer
       [not found]   ` <87sn311iqf.fsf@jidanni.org>
@ 2002-07-03 12:16     ` Paul Stoeber
       [not found]     ` <20020703121653.GA179@xyz>
  1 sibling, 0 replies; 7+ messages in thread
From: Paul Stoeber @ 2002-07-03 12:16 UTC (permalink / raw)
  Cc: bug-gnu-emacs, emacs-devel

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

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

* Re: go to next unsaved buffer
       [not found]     ` <20020703121653.GA179@xyz>
@ 2002-07-03 18:57       ` Andreas Schwab
  2002-07-04  6:59       ` Dan Jacobson
  2002-07-04 18:24       ` Richard Stallman
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2002-07-03 18:57 UTC (permalink / raw)
  Cc: Dan Jacobson, bug-gnu-emacs, emacs-devel

Paul Stoeber <paul.stoeber@stud.tu-ilmenau.de> writes:

|> C-r puts you into view-mode.  Does this cause the problem?
|> It can be turned off with M-x view-mode.

Or just type `e' (View-exit).

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: go to next unsaved buffer
       [not found] <87y9cuzgzt.fsf@jidanni.org>
       [not found] ` <20020702103800.GA179@xyz>
@ 2002-07-03 20:57 ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2002-07-03 20:57 UTC (permalink / raw)
  Cc: emacs-devel

    The proposed "go to next unwritten file command", which merely goes
    down the buffer list looking for files that are modified but not
    written, will come in handy when:

This could be useful, perhaps for M-] in the buffer list.
If someone wants to write it.

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

* Re: go to next unsaved buffer
       [not found]     ` <20020703121653.GA179@xyz>
  2002-07-03 18:57       ` Andreas Schwab
@ 2002-07-04  6:59       ` Dan Jacobson
  2002-07-04 18:24       ` Richard Stallman
  2 siblings, 0 replies; 7+ messages in thread
From: Dan Jacobson @ 2002-07-04  6:59 UTC (permalink / raw)
  Cc: bug-gnu-emacs, emacs-devel

>>>>> "P" == Paul Stoeber <paul.stoeber@stud.tu-ilmenau.de> writes:

P> 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.

P> The prompt "Save file /tmp/1? (y, n, !, ., q, C-r or C-h)"
P> mentions C-r, and C-h explains it.

not good enough.  I want to know what I am in for before I press the
key, that's only fair and square.  What if all the C-s features were
only learnable once one was already searching.  [p.s. not talking
about reading Info here, just C-h k]

>> 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.

>> idea is simpler in that you aren't under the gun of being in the
>> middle of answering the question of saving each buffer.

P> I've tried your idea, and it's actually more comfortable than the
P> the dialog with `save-some-buffers'.

P> A problem is: what is an "unsaved buffer"?

i mean the kind that C-x s would ask about, with files attached.
Oh, and then there's some gnus draft buffers too...

P> (defun switch-to-next-unsaved-buffer ()

a quick test of your function seems that it does it all... hope to see
it in emacs soon, along with an official keybinding.  Pretty darn
handy actually.

uh oh, want to exclude modified *scratch* type buffers... and some
users would want *shell* to be included which seems not to now...
ok, this all should have customization instructions...
better yet, a handy 'only-if-file-associated 'processes[-too]
.... etc. predicates list...
-- 
http://jidanni.org/ Taiwan(04)25854780

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

* Re: go to next unsaved buffer
       [not found]     ` <20020703121653.GA179@xyz>
  2002-07-03 18:57       ` Andreas Schwab
  2002-07-04  6:59       ` Dan Jacobson
@ 2002-07-04 18:24       ` Richard Stallman
  2002-07-04 20:02         ` Paul Stoeber
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2002-07-04 18:24 UTC (permalink / raw)
  Cc: jidanni, emacs-devel

switch-to-next-unsaved-buffer seems like a useful function.
I don't think we can afford to give it a global key binding, though.
The name is rather long; I think switch-to-unsaved-buffer
would be better.

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

* Re: go to next unsaved buffer
  2002-07-04 18:24       ` Richard Stallman
@ 2002-07-04 20:02         ` Paul Stoeber
  2002-07-05 22:05           ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Stoeber @ 2002-07-04 20:02 UTC (permalink / raw)
  Cc: jidanni

On Thu, Jul 04, 2002 at 12:24:33PM -0600, Richard Stallman wrote:
> switch-to-next-unsaved-buffer seems like a useful function.
> I don't think we can afford to give it a global key binding, though.

Default key bindings are irrelevant anyway, once the user
learns .emacs and global-set-key (cf. the C-x C-q discussion :-)

> The name is rather long; I think switch-to-unsaved-buffer
> would be better.

No problem.  defalias is our friend.

[Hmm, wouldn't it be nice to have software where _all_ debates
are pointless by design?]

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

* Re: go to next unsaved buffer
  2002-07-04 20:02         ` Paul Stoeber
@ 2002-07-05 22:05           ` Richard Stallman
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2002-07-05 22:05 UTC (permalink / raw)
  Cc: emacs-devel, jidanni

Default key bindings and other defaults are very important issues.
What makes Emacs powerful is the design that enables users to change
many things in a very general way.  However, what makes Emacs
convenient is the fact that we have configured a lot of convenient
things in advance.

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

end of thread, other threads:[~2002-07-05 22:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87y9cuzgzt.fsf@jidanni.org>
     [not found] ` <20020702103800.GA179@xyz>
     [not found]   ` <87sn311iqf.fsf@jidanni.org>
2002-07-03 12:16     ` go to next unsaved buffer Paul Stoeber
     [not found]     ` <20020703121653.GA179@xyz>
2002-07-03 18:57       ` Andreas Schwab
2002-07-04  6:59       ` Dan Jacobson
2002-07-04 18:24       ` Richard Stallman
2002-07-04 20:02         ` Paul Stoeber
2002-07-05 22:05           ` Richard Stallman
2002-07-03 20:57 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).