Skip to content

Commit

Permalink
Minor refactoring to more apt names
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed Jan 2, 2019
1 parent 30f1e1e commit a471449
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ emacs-batch:
@echo ""
@echo "$(ORG_FILE) ::"
@$(EMACS) --batch --eval "(progn\
(setenv \"OX_HUGO_ELPA\" \"$(OX_HUGO_TMP_DIR)\")\
(setenv \"OX_HUGO_TMP_DIR\" \"$(OX_HUGO_TMP_DIR)\")\
(setenv \"TEST_ENABLED\" \"$(TEST_ENABLED)\")\
(load-file (expand-file-name \"setup-ox-hugo.el\" \"$(OX_HUGO_TEST_DIR)\"))\
)" $(ORG_FILE) \
Expand All @@ -140,7 +140,7 @@ ifeq ("$(EMACS_exists)","")
endif
@echo "Emacs binary used: $(EMACS)"
@$(EMACS) --batch --eval "(progn\
(setenv \"OX_HUGO_ELPA\" \"$(OX_HUGO_TMP_DIR)\")\
(setenv \"OX_HUGO_TMP_DIR\" \"$(OX_HUGO_TMP_DIR)\")\
(load-file (expand-file-name \"setup-ox-hugo.el\" \"$(OX_HUGO_TEST_DIR)\"))\
(message \"[Version check] Emacs %s\" emacs-version)\
(message \"[Version check] %s\" (org-version nil :full))\
Expand Down
14 changes: 7 additions & 7 deletions test/setup-ox-hugo.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;; Time-stamp: <2018-11-01 00:37:59 kmodi>
;; Time-stamp: <2019-01-02 17:54:59 kmodi>

;; Setup to export Org files to Hugo-compatible Markdown using
;; `ox-hugo' in an "emacs -Q" environment.
Expand Down Expand Up @@ -29,7 +29,7 @@ minimum requirement for `ox-hugo'. So set the environment
variable OX_HUGO_DEFAULT_ORG to a value like 1 if using emacs 26
or newer.")

(defvar ox-hugo-elpa (let ((dir (getenv "OX_HUGO_ELPA")))
(defvar ox-hugo-tmp-dir (let ((dir (getenv "OX_HUGO_TMP_DIR")))
(unless dir
(setq dir
(let* ((dir-1 (file-name-as-directory (expand-file-name user-login-name temporary-file-directory)))
Expand All @@ -39,7 +39,7 @@ or newer.")
(make-directory dir :parents)
dir))
(when ox-hugo-test-setup-verbose
(message "ox-hugo-elpa: %s" ox-hugo-elpa))
(message "ox-hugo-tmp-dir: %s" ox-hugo-tmp-dir))

(defvar ox-hugo-packages '(toc-org))
(when ox-hugo-install-org-from-elpa
Expand Down Expand Up @@ -87,13 +87,13 @@ even if they are found as dependencies."
(advice-add 'package-compute-transaction :filter-return #'ox-hugo-package-dependency-check-ignore)
;; (advice-remove 'package-compute-transaction #'ox-hugo-package-dependency-check-ignore)

(if (and (stringp ox-hugo-elpa)
(file-exists-p ox-hugo-elpa))
(if (and (stringp ox-hugo-tmp-dir)
(file-exists-p ox-hugo-tmp-dir))
(progn
;; Load newer version of .el and .elc if both are available
(setq load-prefer-newer t)

(setq package-user-dir (format "%selpa_%s/" ox-hugo-elpa emacs-major-version))
(setq package-user-dir (format "%selpa_%s/" ox-hugo-tmp-dir emacs-major-version))

;; Below require will auto-create `package-user-dir' it doesn't exist.
(require 'package)
Expand Down Expand Up @@ -141,7 +141,7 @@ to be installed.")
(message "Installing `%s' .." p)
(package-install p))
(setq ox-hugo-missing-packages '())))
(error "The environment variable OX_HUGO_ELPA needs to be set"))
(error "The environment variable OX_HUGO_TMP_DIR needs to be set"))

;; Remove Org that ships with Emacs from the `load-path' if installing
;; it from Elpa.
Expand Down

0 comments on commit a471449

Please sign in to comment.