From d6afc5acd8dbae77f147d8b55a294cbc054a223e Mon Sep 17 00:00:00 2001 From: Dave Aitken Date: Wed, 9 Aug 2017 23:55:26 +0100 Subject: [PATCH 1/2] Include psc-package sources list in arguments too if being used --- psci.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/psci.el b/psci.el index 3f70b5b..59f57a8 100644 --- a/psci.el +++ b/psci.el @@ -128,8 +128,12 @@ Relies on .psci file for determining the project's root folder." ;; create the comint process if there is no buffer. (unless buffer (setq default-directory (psci/--project-root!)) - (apply 'make-comint-in-buffer psci/buffer-name buffer - psci-program nil psci/arguments) + (let ((full-arg-list (if (file-exists-p "psc-package.json") + (let ((psc-package-sources (split-string (shell-command-to-string "psc-package sources")))) + (append psci/arguments psc-package-sources)) + psci/arguments))) + (apply 'make-comint-in-buffer psci/buffer-name buffer + psci-program nil full-arg-list)) (psci-mode))) (psci/log "No .psci file so we cannot determine the root project folder. Please, add one."))) From b6d6081286b4aa128e6d81a200ebb5113aa0c195 Mon Sep 17 00:00:00 2001 From: Dave Aitken Date: Fri, 18 Aug 2017 20:58:38 +0100 Subject: [PATCH 2/2] Extract out a psc-package sources function --- psci.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/psci.el b/psci.el index 59f57a8..95bf211 100644 --- a/psci.el +++ b/psci.el @@ -108,6 +108,10 @@ When FILENAME is nil or not a real file, returns nil." (search-forward-regexp regexp) (match-string 1)))) +(defun psci/--get-psc-package-sources! () + (when (file-exists-p "psc-package.json") + (split-string (shell-command-to-string "psc-package sources")))) + ;; public functions ;;;###autoload @@ -128,9 +132,8 @@ Relies on .psci file for determining the project's root folder." ;; create the comint process if there is no buffer. (unless buffer (setq default-directory (psci/--project-root!)) - (let ((full-arg-list (if (file-exists-p "psc-package.json") - (let ((psc-package-sources (split-string (shell-command-to-string "psc-package sources")))) - (append psci/arguments psc-package-sources)) + (let ((full-arg-list (-if-let (psc-package-sources (psci/--get-psc-package-sources!)) + (append psci/arguments psc-package-sources) psci/arguments))) (apply 'make-comint-in-buffer psci/buffer-name buffer psci-program nil full-arg-list))