comparison 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
comparison
equal deleted inserted replaced
4381:3906442b491b 4382:12ff8dc2b57e
1439 ["Edit Fa%_ces..." (customize-face nil)] 1439 ["Edit Fa%_ces..." (customize-face nil)]
1440 "-----" 1440 "-----"
1441 ["Edit I%_nit File" 1441 ["Edit I%_nit File"
1442 ;; #### there should be something that holds the name that the init 1442 ;; #### there should be something that holds the name that the init
1443 ;; file should be created as, when it's not present. 1443 ;; file should be created as, when it's not present.
1444 (let ((el-file (or user-init-file "~/.xemacs/init.el"))) 1444 (let ((el-file (or user-init-file "~/.xemacs/init.el"))
1445 el-file-directory)
1445 (if (string-match "\\.elc$" el-file) 1446 (if (string-match "\\.elc$" el-file)
1446 (setq el-file 1447 (setq el-file
1447 (substring user-init-file 0 (1- (length el-file))))) 1448 (substring user-init-file 0 (1- (length el-file)))))
1449 (unless (file-directory-p
1450 (setq el-file-directory (file-name-directory el-file)))
1451 (message "Creating %s... " el-file-directory)
1452 (make-directory el-file-directory t)
1453 (message "Creating %s... done." el-file-directory))
1448 (find-file el-file) 1454 (find-file el-file)
1449 (or (eq major-mode 'emacs-lisp-mode) 1455 (or (eq major-mode 'emacs-lisp-mode)
1450 (emacs-lisp-mode)))] 1456 (emacs-lisp-mode)))]
1451 ["%_Save Options to Custom File" customize-save-customized] 1457 ["%_Save Options to Custom File" customize-save-customized]
1452 ) 1458 )