1

I have my idle timer which saves the current buffer automatically just once when idle for three seconds. It's handy but when I stop typing while in helm, it opens up a prompt that asks me where to save the helm buffer, since it's not an already existing text file. And I don't want to save helm buffers in the first place. I want this behavior to stop, i.e. I'd like this idle timer to work only in org-mode. How can I do this?

stacko
  • 1,577
  • 1
  • 11
  • 18
  • Did you consider checking the mode in the idle timer code? Alternatively, define a buffer-local variable and set it to a timer inside another function that is run via a mode-specific hook. – wasamasa Jul 30 '16 at 10:05
  • Consider using the variable or function *both* named`buffer-file-name` to test for the existence of a file-visiting buffer. A non-file-visiting buffer generally does not set `buffer-file-name`, so it returns `nil`. You can also use `(file-exists-p buffer-file-name)` to test if a buffer is visiting a particular file and then do not ask to save if that is the case: `(if (file-exists-p buffer-file-name) (save-buffer))` There are modes that already have configurable options to save buffers at certain intervals, so there is no need to reinvent the wheel unless you enjoy doing so. – lawlist Jul 30 '16 at 16:08

0 Answers0