# HG changeset patch # User Aidan Kehoe # Date 1199360744 -3600 # Node ID 12ff8dc2b57efb9adce6e948572be056d629c5ee # Parent 3906442b491b42211630c8b8cd8a8cc05060ce4a Create the containing directory for the custom and init files if necessary. 2008-01-03 Aidan Kehoe * 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. diff -r 3906442b491b -r 12ff8dc2b57e lisp/ChangeLog --- a/lisp/ChangeLog Thu Jan 03 01:33:59 2008 -0800 +++ b/lisp/ChangeLog Thu Jan 03 12:45:44 2008 +0100 @@ -1,3 +1,14 @@ +2008-01-03 Aidan Kehoe + + * 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. + 2008-01-02 Aidan Kehoe * gtk-init.el (init-post-gtk-win): diff -r 3906442b491b -r 12ff8dc2b57e lisp/cus-edit.el --- a/lisp/cus-edit.el Thu Jan 03 01:33:59 2008 -0800 +++ b/lisp/cus-edit.el Thu Jan 03 12:45:44 2008 +0100 @@ -3766,7 +3766,13 @@ (custom-save-variables) (custom-save-faces) (let ((find-file-hooks nil) - (auto-mode-alist)) + (auto-mode-alist) + custom-file-directory) + (unless (file-directory-p (setq custom-file-directory + (file-name-directory custom-file))) + (message "Creating %s... " custom-file-directory) + (make-directory custom-file-directory t) + (message "Creating %s... done." custom-file-directory)) (with-current-buffer (find-file-noselect custom-file) (save-buffer))))) diff -r 3906442b491b -r 12ff8dc2b57e lisp/menubar-items.el --- 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)))]