Question: I'm very new to using lisp, so I'm sorry if this is a trivial question. I haven't been able to find solutions after a while googling, though I'm sure that this is fault on my part.

So. I'm trying to write a command which will revert all open buffers. Simple. I just do 

```
(setq revert-without-query (buffer-list))
(mapc 'revert-buffer (buffer-list))` 

```

Unfortunately, this ends up failing if there are any buffers which aren't associated with files- which is to say, always.

Doing `C-x C-b` to list-buffers prints something like

```
CRM   Buffer        Size  Mode            File
      init.el       300   Emacs-lisp      ~/.spacemacs.d/init.el
      %scratch%      30   Test            

```

Ok. Easy enough. If I was allowed to mix lisp and python, I'd do something like 

```
(setq revert-without-query [b for b in buffer-list if b.File != ""])
;; Or would I test for nil? Decisions, decisions...

```

Upon some digging, I found that there exists `remove-if`. Unfortunately, being completely new to lisp, I have no idea how to access the list, their attributes, or... well... anything. Mind helping me out?

Answer: 
One possibility would be checking `buffer-file-name` which will return nil if the buffer isn't visiting a file, eg.

```
(cl-loop for buf in (buffer-list)
   if (buffer-file-name buf)
   collect buf)

```

or

```
(cl-remove-if-not 'buffer-file-name (buffer-list))

```
You probably want to revert dired directories also. Any type of buffer can have its own specialized revert (see `revert-buffer-function`). So you probably want to check for both `buffer-file-name` and `dired-directory` being non-nil.

```
(dolist (b (buffer-list))
  (when (buffer-live-p b)
    (with-current-buffer b
      (when (or buffer-file-name dired-directory)
        (revert-buffer 'ignore-auto 'noconfirm)))))

```

You can also use the `ignore-errors` hammer, but you're probably better off fixing corner cases as you encounter them.