emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master e6b40fe 1/2: Don't have savehist-save bug out on no


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master e6b40fe 1/2: Don't have savehist-save bug out on non-existing directory
Date: Sat, 13 Jul 2019 11:20:21 -0400 (EDT)

branch: master
commit e6b40fe511f86524c0e1aa84abc9aef1cab5d706
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Don't have savehist-save bug out on non-existing directory
    
    * lisp/savehist.el (savehist-save): Ensure that the directory
    exists before saving (bug#31348).
---
 lisp/savehist.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/savehist.el b/lisp/savehist.el
index 7e6ccd9..8359131 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -299,7 +299,11 @@ If AUTO-SAVE is non-nil, compare the saved contents to the 
one last saved,
        ;; kill-emacs-hook, and also that multiple Emacs instances
        ;; could write to this file at once.
        (let ((file-precious-flag t)
-             (coding-system-for-write savehist-coding-system))
+             (coding-system-for-write savehist-coding-system)
+              (dir (file-name-directory savehist-file)))
+          ;; Ensure that the directory exists before saving.
+          (unless (file-exists-p dir)
+            (make-directory dir t))
          (write-region (point-min) (point-max) savehist-file nil
                        (unless (called-interactively-p 'interactive) 'quiet)))
        (when savehist-file-modes



reply via email to

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