(defconst initz-list-new-file-provided-message
"Module is already provided.")
-(defconst initz-list-new-file-comment-message-format
+(defconst initz-list-new-file-header-message-format
";;; %s --- init file for %s.\n\n\n\n")
-(defconst initz-list-new-file-provide-message-format
- "(provide '%s)\n")
+(defconst initz-list-new-file-footer-message-format
+ "(provide '%s)\n\n;;; %s ends here\n")
(defconst initz-list-click-message-format
"Click %s on the module name to select it.\n")
(defun initz-list-input-dir (&optional default)
"Input the dir."
- (let* ((completing-list (mapcar #'(lambda (list)
- (symbol-name (car list)))
- initz-init-alist))
- (default (if (stringp default) default "misc")))
+ (let ((completing-list (mapcar #'(lambda (list)
+ (symbol-name (car list)))
+ initz-init-alist))
+ (default (if (stringp default) default "misc")))
(completing-read
(format initz-list-input-dir-message-format
initz-directory default)
(when (integer-or-marker-p start)
(goto-char start))))
-(defun initz-list-previous-line ()
+(defun initz-list-previous-line (&optional arg)
(interactive)
- (initz-list-next-line -1))
+ (if (integerp arg)
+ (initz-list-next-line (- 0 arg))
+ (initz-list-next-line -1)))
(defun initz-list-print-file ()
"Print the file name under point."
(defun initz-list-load-file ()
"Load the file under point."
(interactive)
- (let* ((file (get-text-property (point) :file)))
- (when (and (initz-list-byte-compile-file)
- (initz-load-file (initz-get-correspondence-file file)))
- (setq initz-load-error-files
- (delete file initz-load-error-files)))))
+ (let ((file (get-text-property (point) :file)))
+ (when (and (initz-list-byte-compile-file)
+ (initz-load-file (initz-get-correspondence-file file)))
+ (setq initz-load-error-files
+ (delete file initz-load-error-files)))))
;;;###autoload
(defun initz-list-new-file ()
(string-match (concat "^" initz-module-regexp "$") module)))
(message initz-list-new-file-illegal-message)
(setq module (initz-trim-separator module))
- (let* ((startup-file (expand-file-name
- (concat initz-prefix
- (if (string= module initz-null-string)
- initz-null-string
- initz-separator-string)
- module ".el")
- (initz-startup-directory (intern dir)))))
+ (let ((startup-file (expand-file-name
+ (concat initz-prefix
+ (if (string= module initz-null-string)
+ initz-null-string
+ initz-separator-string)
+ module ".el")
+ (initz-startup-directory (intern dir)))))
(if (file-exists-p startup-file)
(message initz-list-new-file-exists-message)
(let ((base-name (initz-get-base-name startup-file)))
(message initz-list-new-file-provided-message)
(initz-list-insert-file dir startup-file)
(find-file-other-window startup-file)
- (insert (format initz-list-new-file-comment-message-format
- (file-name-nondirectory startup-file)
- (if (string= module initz-null-string)
- initz-prefix
- module)))
- (insert (format initz-list-new-file-provide-message-format
- base-name))
+ (let ((file-name (file-name-nondirectory startup-file)))
+ (insert (format initz-list-new-file-header-message-format
+ file-name
+ (if (string= module initz-null-string)
+ initz-prefix
+ module)))
+ (insert (format initz-list-new-file-footer-message-format
+ base-name file-name)))
(save-buffer)
(goto-char (point-min))
(search-forward "\n\n"))))))))