Skip to content

Commit 7100260

Browse files
committed
code: add more parsing rule
1 parent 6c8cf8a commit 7100260

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lisp/_prepare.el

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ Eask file in the workspace."
584584

585585
(defvar eask-package nil)
586586
(defvar eask-package-file nil)
587+
(defvar eask-package-desc nil)
587588
(defvar eask-files nil)
588589
(defvar eask-depends-on nil)
589590
(defvar eask-depends-on-dev nil)
@@ -606,7 +607,15 @@ Eask file in the workspace."
606607
"Set package file."
607608
(if eask-package-file
608609
(eask-error "Multiple definition of `package-file'")
609-
(setq eask-package-file (expand-file-name file))))
610+
(setq eask-package-file (expand-file-name file))
611+
(if (file-exists-p eask-package-file)
612+
(progn
613+
(with-temp-buffer
614+
(insert-file-contents eask-package-file)
615+
(setq eask-package-desc (ignore-errors (package-buffer-info))))
616+
(unless eask-package-desc
617+
(eask-warn "Failed to construct buffer-info, try to lint the package-file `%s'" file)))
618+
(eask-warn "Missing the package-file `%s'" file))))
610619

611620
(defun eask-files (&rest patterns)
612621
"Set files patterns."
@@ -680,7 +689,7 @@ Eask file in the workspace."
680689
(defun eask-source (name &optional location)
681690
"Add archive NAME with LOCATION."
682691
(when (assoc name package-archives)
683-
(eask-error "Multiple definition of `(source \"%s\")'" name))
692+
(eask-error "Multiple definition of source `%s'" name))
684693
(setq location (or location (cdr (assq (intern name) eask-source-mapping))))
685694
(unless location (eask-error "Unknown package archive `%s'" name))
686695
(when (and location
@@ -729,7 +738,7 @@ Eask file in the workspace."
729738
(let ((msg (eask--ansi 'warn (apply #'format-message args))))
730739
(eask--unsilent (eask-msg "%s" msg))
731740
(run-hook-with-args 'eask-on-warning-hook 'warn msg))
732-
(apply fnc args))
741+
(eask--silent (apply fnc args)))
733742

734743
(advice-add 'warn :around #'eask--warn)
735744

0 commit comments

Comments
 (0)