Skip to content

Commit

Permalink
feat(init): Overwrite generated Eask file by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Sep 27, 2023
1 parent d4b5231 commit b701c3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 5 additions & 4 deletions lisp/init/cask.el
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,16 @@ Optional argument CONTENTS is used for nested directives. e.g. development."
(file (file-name-nondirectory (eask-root-del filename)))
(new-file (eask-s-replace "Cask" "Eask" file))
(new-filename (expand-file-name new-file))
(eask--cask-contents (cask--read filename)) ; Read it!
(eask--cask-contents (ignore-errors (cask--read filename))) ; Read it!
(converted))
(eask-with-progress
(format "Converting file `%s` to `%s`... " file new-file)
(eask-with-verbosity 'debug
(cond ((not (string-prefix-p "Cask" file))
(eask-debug "✗ Invalid Cask filename, the file should start with `Cask`"))
((file-exists-p new-filename)
(eask-debug "✗ The file `%s` already presented" new-file))
(t
(with-current-buffer (find-file new-filename)
(erase-buffer)
(goto-char (point-min))

;; XXX: Newline to look nicer!
Expand Down Expand Up @@ -164,7 +163,9 @@ Optional argument CONTENTS is used for nested directives. e.g. development."
(files (if (stringp files) files (-flatten files))))
(insert "(files")
(dolist (file files)
(insert "\n \"" file "\""))
(if (stringp file)
(insert "\n \"" file "\"")
(insert "\n " (eask-2str file))))
(insert ")\n"))

(when-let ((pkg-desc (eask--cask-package-descriptor)))
Expand Down
5 changes: 2 additions & 3 deletions lisp/init/keg.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,16 @@ If no found the Keg file, returns nil."
(file (file-name-nondirectory (eask-root-del filename)))
(new-file (eask-s-replace "Keg" "Eask" file))
(new-filename (expand-file-name new-file))
(contents (eask--keg-file-read filename)) ; Read it!
(contents (ignore-errors (eask--keg-file-read filename))) ; Read it!
(converted))
(eask-with-progress
(format "Converting file `%s` to `%s`... " file new-file)
(eask-with-verbosity 'debug
(cond ((not (string-prefix-p "Keg" file))
(eask-debug "✗ Invalid Keg filename, the file should start with `Keg`"))
((file-exists-p new-filename)
(eask-debug "✗ The file `%s` already presented" new-file))
(t
(with-current-buffer (find-file new-filename)
(erase-buffer)
(goto-char (point-min))

(let* ((project-name (file-name-nondirectory (directory-file-name default-directory)))
Expand Down

0 comments on commit b701c3c

Please sign in to comment.