@@ -566,6 +566,10 @@ For arguments FUNC and DEPS, see function `mapc' for more information."
566566 ((memq :vc dep)
567567 (let ((spec (cdr (memq :vc dep))))
568568 (eask-package-vc-install name spec)))
569+ ; ; Try out packages using `try' .
570+ ((memq :try dep)
571+ (let ((url-or-package (nth 2 dep)))
572+ (eask-package-try name url-or-package)))
569573 ; ; Fallback to archive install.
570574 (t (eask-package-install name)))))
571575
@@ -694,6 +698,23 @@ Argument BODY are forms for execution."
694698 " Return non-nil if package (PKG) is installable."
695699 (assq (eask-intern pkg) package-archive-contents))
696700
701+ (defun eask-package-try (pkg &optional url-or-package )
702+ " To try a package (PKG) without actually install it.
703+
704+ The optional argument URL-OR-PACKAGE is used in the function `try' ."
705+ (eask-defvc< 27 (eask-pkg-init)) ; XXX: remove this after we drop 26.x
706+ (eask-with-progress
707+ (format " - %s Trying out %s%s ... " eask--action-prefix
708+ (ansi-green (eask-2str pkg))
709+ (if url-or-package
710+ (concat " in " (ansi-yellow url-or-package))
711+ " " ))
712+ (eask-with-verbosity 'debug
713+ (eask-archive-install-packages '(" gnu" " melpa" ) 'try )
714+ (require 'try )
715+ (try (or url-or-package pkg)))
716+ " done ✓" ))
717+
697718(defun eask-package-vc-install (pkg spec )
698719 " To vc install the package (PKG) by argument SPEC."
699720 (eask-defvc< 27 (eask-pkg-init)) ; XXX: remove this after we drop 26.x
@@ -757,23 +778,24 @@ Argument BODY are forms for execution."
757778 (unless (eask-package-installable-p pkg)
758779 (eask-error " Package not installable `%s' ; make sure the package archive (source) is included" pkg))))
759780 (t
760- (eask-with-progress
761- (format " - %s%s nstalling %s (%s )... " eask--action-prefix
762- (if should-reinstall-p " Rei" " I" )
763- name version)
764- (eask-with-verbosity 'debug
765- ; ; Handle `--force` flag.
766- (when should-reinstall-p (package-delete (eask-package-desc pkg t ) t ))
767- ; ; XXX: Without ignore-errors guard, it will trigger error
768- ; ;
769- ; ; Can't find library xxxxxxx.el
770- ; ;
771- ; ; But we can remove this after Emacs 28, since function `find-library-name'
772- ; ; has replaced the function `signal' instead of the `error' .
773- ; ;
774- ; ; Install it.
775- (eask-ignore-errors (package-install pkg)))
776- " done ✓" )))))
781+ (eask--pkg-process pkg ; Second call to force refresh the data.
782+ (eask-with-progress
783+ (format " - %s%s nstalling %s (%s )... " eask--action-prefix
784+ (if should-reinstall-p " Rei" " I" )
785+ name version)
786+ (eask-with-verbosity 'debug
787+ ; ; Handle `--force` flag.
788+ (when should-reinstall-p (package-delete (eask-package-desc pkg t ) t ))
789+ ; ; XXX: Without ignore-errors guard, it will trigger error
790+ ; ;
791+ ; ; Can't find library xxxxxxx.el
792+ ; ;
793+ ; ; But we can remove this after Emacs 28, since function `find-library-name'
794+ ; ; has replaced the function `signal' instead of the `error' .
795+ ; ;
796+ ; ; Install it.
797+ (eask-ignore-errors (package-install pkg)))
798+ " done ✓" ))))))
777799
778800(defun eask-package-delete (pkg )
779801 " Delete the package (PKG)."
@@ -783,7 +805,7 @@ Argument BODY are forms for execution."
783805 ((not installed-p)
784806 (eask-msg " - %sSkipping %s (%s)... not installed ✗" eask--action-prefix name version))
785807 (t
786- (eask--pkg-process pkg
808+ (eask--pkg-process pkg ; Second call to force refresh the data.
787809 (eask-with-progress
788810 (format " - %s Uninstalling %s (%s )... " eask--action-prefix name version)
789811 (eask-with-verbosity 'debug
@@ -800,12 +822,13 @@ Argument BODY are forms for execution."
800822 (eask-msg " - %sSkipping %s (%s)... not installed ✗" eask--action-prefix name version))
801823 (t
802824 (eask-pkg-init)
803- (eask-with-progress
804- (format " - %s Reinstalling %s (%s )... " eask--action-prefix name version)
805- (eask-with-verbosity 'debug
806- (package-delete (eask-package-desc pkg t ) t )
807- (eask-ignore-errors (package-install pkg)))
808- " done ✓" )))))
825+ (eask--pkg-process pkg ; Second call to force refresh the data.
826+ (eask-with-progress
827+ (format " - %s Reinstalling %s (%s )... " eask--action-prefix name version)
828+ (eask-with-verbosity 'debug
829+ (package-delete (eask-package-desc pkg t ) t )
830+ (eask-ignore-errors (package-install pkg)))
831+ " done ✓" ))))))
809832
810833(defun eask-package-desc (name &optional current )
811834 " Build package description by its NAME.
@@ -1547,6 +1570,7 @@ argument COMMAND."
15471570 " Setup dependencies list."
15481571 (setq eask-depends-on (reverse eask-depends-on)
15491572 eask-depends-on-dev (reverse eask-depends-on-dev))
1573+ ; ; On recipe
15501574 (when eask-depends-on-recipe-p
15511575 (eask-with-progress
15521576 (format " ✓ Checking local archives %s ... "
@@ -1593,22 +1617,18 @@ ELPA)."
15931617 (eask-error " This requires Emacs %s and above!" minimum-version)
15941618 (push recipe eask-depends-on-emacs))
15951619 recipe)))
1596- ; ; No argument specify
1597- ((<= (length args) 1 )
1598- (let* ((minimum-version (car args))
1599- (recipe (list pkg minimum-version)))
1600- (unless (eask--check-depends-on recipe)
1601- (push recipe eask-depends-on))
1602- recipe))
1603- ; ; File packages
1604- ((memq :file args)
1620+ ; ; Specified packages
1621+ ((or (memq :file args) ; File packages
1622+ (memq :vc args) ; VC packages
1623+ (memq :try args)) ; Try packages
16051624 (let* ((recipe (append (list (intern pkg)) args)))
16061625 (unless (eask--check-depends-on recipe)
16071626 (push recipe eask-depends-on))
16081627 recipe))
1609- ; ; VC packages
1610- ((memq :vc args)
1611- (let* ((recipe (append (list (intern pkg)) args)))
1628+ ; ; No argument specify
1629+ ((<= (length args) 1 )
1630+ (let* ((minimum-version (car args))
1631+ (recipe (list pkg minimum-version)))
16121632 (unless (eask--check-depends-on recipe)
16131633 (push recipe eask-depends-on))
16141634 recipe))
0 commit comments