From 47227d087a2a839f604c102d7d45993570841436 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Thu, 30 Apr 2009 15:32:45 +0200 Subject: [PATCH] Remember: Fix auto-save issues Carsten Dominik writes: > On Apr 26, 2009, at 12:08 AM, Samuel Wales wrote: > > > I noticed the following regarding > > org-remember-backup-directory: > > > > 1) auto-saving does not save contents > > - solution: put (auto-save-mode 1) before or after (not > > sure which) the call to org-set-local in the > > following lines in org-remember: > > > > # (expand-file-name > > # (format-time-string "remember-%Y-%m-%d-%H-%M-%S") > > # org-remember-backup-directory)) > > # (save-buffer) > > # (org-set-local 'auto-save-visited-file-name t)) > > # (when (save-excursion > > Done. > > > > 2) save-buffer is called before there are any contents > > - this causes files without useful content to stick > > around in the dir if the buffer is killed or > > something. > > - solution: don't save the buffer; let auto-saving do > > that work. will this work? > > Usually, the template expansion will have filled in stuff like > links and initial contents, so I would prefer to keep the > save-buffer here and let the user deal with the extra files. > > > 3) if you have auto-save-file-name-transforms set, > > auto-saving is done according to that variable instead > > of saving in place. > > > > I am now turning that variable off, locally in the remember buffer. > > Does that fix the problem? > > - Carsten > > > - solution: is this an emacs bug? i am not sure. the > > auto-saving should be done in place, saving in > > org-remember-backup-directory and not saving in the > > place where the transforms variable tells it to save. > > perhaps each user can kludge transforms or perhaps > > emacs needs fixing? i have reached debugging ability > > limit. --- lisp/ChangeLog | 5 +++++ lisp/org-remember.el | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 244cd9659..45397b4a5 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-04-30 Carsten Dominik + + * org-remember.el (org-remember-apply-template): Improve auto-save + behavior. + 2009-04-29 Carsten Dominik * org-latex.el (org-export-latex-preprocess): Also protect diff --git a/lisp/org-remember.el b/lisp/org-remember.el index c627324d1..60d7563ee 100644 --- a/lisp/org-remember.el +++ b/lisp/org-remember.el @@ -596,12 +596,14 @@ to be run from that hook to function properly." (when org-remember-backup-directory (unless (file-directory-p org-remember-backup-directory) (make-directory org-remember-backup-directory)) + (org-set-local 'auto-save-file-name-transforms nil) (setq buffer-file-name (expand-file-name (format-time-string "remember-%Y-%m-%d-%H-%M-%S") org-remember-backup-directory)) (save-buffer) - (org-set-local 'auto-save-visited-file-name t)) + (org-set-local 'auto-save-visited-file-name t) + (auto-save-mode 1)) (when (save-excursion (goto-char (point-min)) (re-search-forward "%!" nil t))