In my directory I keep on winding up with dozens of files with names like these:


The content of which is this:

Week-agenda (W20):
Monday     11 May 2015 W20
Tuesday    12 May 2015
Wednesday  13 May 2015
Thursday   14 May 2015
Friday     15 May 2015
Saturday   16 May 2015
Sunday     17 May 2015

I believe they're getting created when I run save-some-buffers, which I do to save all open files I'm working with.

I'm trying to get Emacs to ignore my org-agenda files when saving, but my attempt isn't working:


  • 3
    I don't think this is default behaviour. You're probably using an ill-defined function that saves all buffers. – Malabarba May 17 '15 at 21:02
  • You're right. I figured out they're getting saved when I run save-some-buffers. I'm updating the question. – incandescentman May 18 '15 at 4:06
  • 1
    Copy org-save-all-org-buffers to your *scratch* buffer, and rename it to peter-org-save-all-org-buffers. Replace (lambda () (derived-mode-p 'org-mode)) with your own lambda function that does what you want [either you or another forum participant will need to write this function]. Save your new function in your .emacs or the equivalent thereof if you are using Aquamacs still. Change your hook so that it refers to your new function instead of the stock function. Restart Emacs. You can find the stock function with M-x find-function – lawlist May 19 '15 at 19:32
  • 1
    If you are using save-some-buffers separately (e.g., with a keyboard shortcut), then your second argument to that function -- i.e., PRED -- will need to be modified to suit your needs (perhaps by using a lambda function similar to what you use in the above-comment). You probably do not want to run org-save-all-org-buffers or peter-org-save-all-org-buffers every single time an org-mode buffer gets opened -- i.e., I would not recommend using an org-mode-hook or an org-agenda-mode-hook with that function. – lawlist May 19 '15 at 19:42
  • 1
    I added another example to an existing thread that I believe is related entitled how to silently “Save All Buffers” in Emacs?: stackoverflow.com/a/30468232/2112489 It is not designed to be used with any hooks (although it could be), but instead to be called interactively with a keyboard shortcut or with M-x . . . – lawlist May 26 '15 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.