unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* C-x C-c
@ 2002-12-24  5:21 tcp
  2002-12-24 17:08 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: tcp @ 2002-12-24  5:21 UTC (permalink / raw)


hi,

  Is there a way to map the C-x C-c to close all opened files and frame but
not exiting emacs.
  Thank!

---
tcp

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

* Re: C-x C-c
  2002-12-24  5:21 C-x C-c tcp
@ 2002-12-24 17:08 ` Kevin Rodgers
  2002-12-24 22:55   ` tcp
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2002-12-24 17:08 UTC (permalink / raw)


tcp wrote:

>   Is there a way to map the C-x C-c to close all opened files and frame but
> not exiting emacs.

You asked for it:


(defun close-all-files ()
   "Kill all buffers that are visiting a file."
   (interactive)
   (let ((buffers (buffer-list)))
     (while buffers
       (if (buffer-file-name (car buffers))
	  (kill-buffer (car buffers)))
       (setq buffers (cdr buffers)))))

(define-key "\C-x\C-c"
   (lambda ()
     "Run `\\[close-all-files]' and `\\[delete-frame\\]'."
     (interactive)
     (close-all-files)
     (delete-frame)))

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: C-x C-c
  2002-12-24 17:08 ` Kevin Rodgers
@ 2002-12-24 22:55   ` tcp
  2002-12-26 16:24     ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: tcp @ 2002-12-24 22:55 UTC (permalink / raw)


Hi Kevin,

Thanks. I have this problem when I add

the following two function into my .emacs

Wrong number of arguments: #<subr define-key>, 2

Also, if I have multiple frames up, it does not

seem to delete all the open frames.

Thanks!

"Kevin Rodgers" <kevin.rodgers@ihs.com> wrote in message
news:3E0894A8.6050506@ihs.com...
> tcp wrote:
>
> >   Is there a way to map the C-x C-c to close all opened files and frame
but
> > not exiting emacs.
>
> You asked for it:
>
>
> (defun close-all-files ()
>    "Kill all buffers that are visiting a file."
>    (interactive)
>    (let ((buffers (buffer-list)))
>      (while buffers
>        (if (buffer-file-name (car buffers))
>   (kill-buffer (car buffers)))
>        (setq buffers (cdr buffers)))))
>
> (define-key "\C-x\C-c"
>    (lambda ()
>      "Run `\\[close-all-files]' and `\\[delete-frame\\]'."
>      (interactive)
>      (close-all-files)
>      (delete-frame)))
>
> --
> <a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>
>

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

* Re: C-x C-c
  2002-12-24 22:55   ` tcp
@ 2002-12-26 16:24     ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2002-12-26 16:24 UTC (permalink / raw)


[Please don't top-post.]

tcp wrote:

> Thanks. I have this problem when I add
> 
> the following two function into my .emacs
> 
> Wrong number of arguments: #<subr define-key>, 2


Oops, `define-key' should be `global-set-key'.


> Also, if I have multiple frames up, it does not
> 
> seem to delete all the open frames.

Oh, I interpreted "opened frame" to mean "selected frame".  Just put

	(delete-other-frames)

between

	(close-all-files)
and
	(delete-frame)

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2002-12-26 16:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-24  5:21 C-x C-c tcp
2002-12-24 17:08 ` Kevin Rodgers
2002-12-24 22:55   ` tcp
2002-12-26 16:24     ` Kevin Rodgers

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