diff options
author | Bastien Guerry <bzg@altern.org> | 2013-03-01 15:06:28 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2013-03-01 15:06:28 +0100 |
commit | 0c40f479cd68385b1302f925819cb5434e1a0fd6 (patch) | |
tree | 79348cd3a8e0ce9864a5edd1c1c6a3473edc9ddb | |
parent | 1dfc45554aa3275499f471a93de7d02323df7b54 (diff) | |
download | org-mode-0c40f479cd68385b1302f925819cb5434e1a0fd6.tar.gz |
org-agenda.el (org-agenda-write): Ask before overwriting an existing file
* org-agenda.el (org-agenda-write): Ask before overwriting an
existing file.
Thanks to Rainer Stengele for suggesting this.
-rw-r--r-- | lisp/org-agenda.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index c1fe4f3..3b6a005 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3210,7 +3210,9 @@ the settings have already been scoped and we do not wish to overrule other, higher priority settings. If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write." (interactive "FWrite agenda to file: \nP") - (if (not (file-writable-p file)) + (if (or (not (file-writable-p file)) + (and (file-exists-p file) + (not (y-or-n-p (format "Overwrite existing file %s? " file))))) (error "Cannot write agenda to file %s" file)) (org-let (if nosettings nil org-agenda-exporter-settings) '(save-excursion |