help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to use defadvice without infinite loop


From: Ivan Kanis
Subject: How to use defadvice without infinite loop
Date: 27 Sep 2003 17:09:18 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

I want to save VM files to _always_ be saved before calling the function
save-some buffers.

I am tired of answering 'yes' for these files when grepping, compiling
or quiting emacs.

I came up with a defadvice function but the proble is that it's
calling save-some-buffers and it produces an infinite loop. Is there a
way to avoid that?

(defadvice save-some-buffers(before my-save-some-buffers activate)
  "Ask to save buffers."
  (interactive)
  (save-some-buffers nil 'my-always-save))

(defun my-always-save()
  "Files to always save."
  (when buffer-file-name
        (when (string-match "^/home/ivank/mail" buffer-file-name)
          (save-buffer))))

-- 
/-----------------------------------------------------------------------------*
| "When a man is attempting to describe another person's |                    |
| character, he may be right or he may be wrong, but     |      Ivan Kanis    |
| in one thing he will always succeed,that is, in        | Software Developper|
| describing himself."                                   |     www.kanis.cc   |
| (Samuel Taylor Coleridge)                              |                    |
*-----------------------------------------------------------------------------/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]