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.
1.1 --- a/lisp/ChangeLog Thu Jan 03 01:33:59 2008 -0800
1.2 +++ b/lisp/ChangeLog Thu Jan 03 12:45:44 2008 +0100
1.3 @@ -1,3 +1,14 @@
1.4 +2008-01-03 Aidan Kehoe <kehoea@parhasard.net>
1.5 +
1.6 + * cus-edit.el (custom-save-all):
1.7 + If the directory containing the custom file doesn't exist, try to
1.8 + create it. Fixes Nick's Crabtree's bug of
1.9 + 5fb265820712140145w512fa3bbh355cf76f7e2cf792@mail.gmail.com ;
1.10 + thank you Nick.
1.11 + * menubar-items.el (default-menubar):
1.12 + In the code to edit the user's init file, try to create the
1.13 + containing directory if it doesn't exist.
1.14 +
1.15 2008-01-02 Aidan Kehoe <kehoea@parhasard.net>
1.16
1.17 * gtk-init.el (init-post-gtk-win):
2.1 --- a/lisp/cus-edit.el Thu Jan 03 01:33:59 2008 -0800
2.2 +++ b/lisp/cus-edit.el Thu Jan 03 12:45:44 2008 +0100
2.3 @@ -3766,7 +3766,13 @@
2.4 (custom-save-variables)
2.5 (custom-save-faces)
2.6 (let ((find-file-hooks nil)
2.7 - (auto-mode-alist))
2.8 + (auto-mode-alist)
2.9 + custom-file-directory)
2.10 + (unless (file-directory-p (setq custom-file-directory
2.11 + (file-name-directory custom-file)))
2.12 + (message "Creating %s... " custom-file-directory)
2.13 + (make-directory custom-file-directory t)
2.14 + (message "Creating %s... done." custom-file-directory))
2.15 (with-current-buffer (find-file-noselect custom-file)
2.16 (save-buffer)))))
2.17
3.1 --- a/lisp/menubar-items.el Thu Jan 03 01:33:59 2008 -0800
3.2 +++ b/lisp/menubar-items.el Thu Jan 03 12:45:44 2008 +0100
3.3 @@ -1441,10 +1441,16 @@
3.4 ["Edit I%_nit File"
3.5 ;; #### there should be something that holds the name that the init
3.6 ;; file should be created as, when it's not present.
3.7 - (let ((el-file (or user-init-file "~/.xemacs/init.el")))
3.8 + (let ((el-file (or user-init-file "~/.xemacs/init.el"))
3.9 + el-file-directory)
3.10 (if (string-match "\\.elc$" el-file)
3.11 (setq el-file
3.12 (substring user-init-file 0 (1- (length el-file)))))
3.13 + (unless (file-directory-p
3.14 + (setq el-file-directory (file-name-directory el-file)))
3.15 + (message "Creating %s... " el-file-directory)
3.16 + (make-directory el-file-directory t)
3.17 + (message "Creating %s... done." el-file-directory))
3.18 (find-file el-file)
3.19 (or (eq major-mode 'emacs-lisp-mode)
3.20 (emacs-lisp-mode)))]