diff lisp/menubar-items.el @ 4382:12ff8dc2b57e

Create the containing directory for the custom and init files if necessary. 2008-01-03 Aidan Kehoe <kehoea@parhasard.net> * cus-edit.el (custom-save-all): If the directory containing the custom file doesn't exist, try to create it. Fixes Nick's Crabtree's bug of 5fb265820712140145w512fa3bbh355cf76f7e2cf792@mail.gmail.com ; thank you Nick. * menubar-items.el (default-menubar): In the code to edit the user's init file, try to create the containing directory if it doesn't exist.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 03 Jan 2008 12:45:44 +0100
parents ebb35ddea76a
children e29fcfd8df5f
line wrap: on
line diff
--- a/lisp/menubar-items.el	Thu Jan 03 01:33:59 2008 -0800
+++ b/lisp/menubar-items.el	Thu Jan 03 12:45:44 2008 +0100
@@ -1441,10 +1441,16 @@
      ["Edit I%_nit File"
       ;; #### there should be something that holds the name that the init
       ;; file should be created as, when it's not present.
-      (let ((el-file (or user-init-file "~/.xemacs/init.el")))
+      (let ((el-file (or user-init-file "~/.xemacs/init.el"))
+            el-file-directory)
 	(if (string-match "\\.elc$" el-file)
 	    (setq el-file
 		  (substring user-init-file 0 (1- (length el-file)))))
+        (unless (file-directory-p
+                 (setq el-file-directory (file-name-directory el-file)))
+          (message "Creating %s... " el-file-directory)
+          (make-directory el-file-directory t)
+          (message "Creating %s... done." el-file-directory))
 	(find-file el-file)
 	(or (eq major-mode 'emacs-lisp-mode)
 	    (emacs-lisp-mode)))]