# Save all buffers on org refile

**URL:** https://forum.systemcrafters.net/t/save-all-buffers-on-org-refile/292
**Category:** Emacs
**Created:** [February 17, 2024, 7:56am UTC](https://forum.systemcrafters.net/t/save-all-buffers-on-org-refile/292 "2024-02-17T07:56:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![summeremacs](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/summeremacs/32/15_2.png) [@summeremacs](https://forum.systemcrafters.net/u/summeremacs)
#### Post date: [February 17, 2024, 7:56am UTC](https://forum.systemcrafters.net/t/save-all-buffers-on-org-refile/292/1 "2024-02-17T07:56:55Z")

</div>

Just a quick word:

I had this bit of code I got from one of Dave’s streams to save all buffers after refiling so you wouldn’t have to save each buffer by hand.

```auto
(advice-add 'org-refile :after 'org-save-all-org-buffers)

```

Unfortunately, with org-ql, it gives an error. (It still refiles though).

So, I found the solution here:

> <https://emacs.stackexchange.com/questions/26923/org-mode-getting-errors-when-auto-saving-after-refiling>

Which is this:

```auto
(advice-add 'org-refile :after
        (lambda (&rest _)
        (org-save-all-org-buffers)))

```

I tested it with org-ql refiling and it does work perfectly. So any of you who were using that previous code and have issues with org-ql refiling, you can replace it with this and it should work.
