unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Kill all visited buffers
@ 2015-11-21 20:28 Tim Johnson
  2015-11-21 20:43 ` Drew Adams
  2015-11-21 20:48 ` Tim Johnson
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Johnson @ 2015-11-21 20:28 UTC (permalink / raw)
  To: Emacs


Google has failed me. I'm looking for a way to programmatically kill
all _visited_ buffers. 

Any recommendations?

(emacs GNU Emacs 24.3.1)
thanks
-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com



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

* RE: Kill all visited buffers
  2015-11-21 20:28 Kill all visited buffers Tim Johnson
@ 2015-11-21 20:43 ` Drew Adams
  2015-11-21 20:48 ` Tim Johnson
  1 sibling, 0 replies; 4+ messages in thread
From: Drew Adams @ 2015-11-21 20:43 UTC (permalink / raw)
  To: Tim Johnson, Emacs

> Google has failed me. I'm looking for a way to programmatically kill
> all _visited_ buffers.

Filter (buffer-list) with function `buffer-file-name'.  E.g.:

(dolist (buf  (cl-remove-if-not #'buffer-file-name (buffer-list)))
  (kill-buffer buf))



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

* Re: Kill all visited buffers
       [not found] <mailman.404.1448137712.31583.help-gnu-emacs@gnu.org>
@ 2015-11-21 20:44 ` Pascal J. Bourguignon
  0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2015-11-21 20:44 UTC (permalink / raw)
  To: help-gnu-emacs


Tim Johnson <tim@akwebsoft.com> writes:

> Google has failed me. I'm looking for a way to programmatically kill
> all _visited_ buffers. 
>
> Any recommendations?

(require 'cl)
(mapc (function kill-buffer)
      (remove-if-not (lambda (buffer)
                       (and (buffer-file-name buffer)
                            (file-exists-p (buffer-file-name buffer))))
                     (buffer-list)))

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: Kill all visited buffers
  2015-11-21 20:28 Kill all visited buffers Tim Johnson
  2015-11-21 20:43 ` Drew Adams
@ 2015-11-21 20:48 ` Tim Johnson
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Johnson @ 2015-11-21 20:48 UTC (permalink / raw)
  To: help-gnu-emacs

* Tim Johnson <tim@akwebsoft.com> [151121 11:34]:
> 
> Google has failed me. I'm looking for a way to programmatically kill
> all _visited_ buffers. 
> 
> Any recommendations?
<...> 
Thank you Drew and Pascal
  (and nice code examples too)
cheers
-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com



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

end of thread, other threads:[~2015-11-21 20:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-21 20:28 Kill all visited buffers Tim Johnson
2015-11-21 20:43 ` Drew Adams
2015-11-21 20:48 ` Tim Johnson
     [not found] <mailman.404.1448137712.31583.help-gnu-emacs@gnu.org>
2015-11-21 20:44 ` Pascal J. Bourguignon

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