From df4d188d3f0bbaffeef0e474de5581e714fdcc23 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 8 Apr 2020 11:16:00 -0700 Subject: [PATCH] Fix diminishing minor modes when reloading libraries --- .gitlab-ci.yml | 42 +++++++++++++++++++++++++ oni-company.el | 6 ++-- oni-counsel.el | 4 +-- oni-gui.el | 4 +-- oni-ivy.el | 6 ++-- oni-paredit.el | 4 +-- oni-yasnippet.el | 4 +-- test/integration/oni-company.bats | 48 +++++++++++++++++++++++++++++ test/integration/oni-counsel.bats | 32 +++++++++++++++++++ test/integration/oni-gui.bats | 29 +++++++++++++++++ test/integration/oni-ivy.bats | 48 +++++++++++++++++++++++++++++ test/integration/oni-paredit.bats | 32 +++++++++++++++++++ test/integration/oni-yasnippet.bats | 29 +++++++++++++++++ 13 files changed, 274 insertions(+), 14 deletions(-) create mode 100644 test/integration/oni-company.bats create mode 100644 test/integration/oni-counsel.bats create mode 100644 test/integration/oni-gui.bats create mode 100644 test/integration/oni-ivy.bats create mode 100644 test/integration/oni-paredit.bats create mode 100644 test/integration/oni-yasnippet.bats diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02cd3e7..77ddc61 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -225,6 +225,13 @@ integration-test-oni-bats: - package script: make integration-test-oni-bats TEST_ARCHIVE=$(realpath bin/) +integration-test-oni-company: + stage: integration-test + image: registry.gitlab.com/ryuslash/emacs-config + dependencies: + - package + script: make integration-test-oni-company TEST_ARCHIVE=$(realpath bin/) + integration-test-oni-conf: stage: integration-test image: registry.gitlab.com/ryuslash/emacs-config @@ -232,6 +239,13 @@ integration-test-oni-conf: - package script: make integration-test-oni-conf TEST_ARCHIVE=$(realpath bin/) +integration-test-oni-counsel: + stage: integration-test + image: registry.gitlab.com/ryuslash/emacs-config + dependencies: + - package + script: make integration-test-oni-counsel TEST_ARCHIVE=$(realpath bin/) + integration-test-oni-csharp: stage: integration-test image: registry.gitlab.com/ryuslash/emacs-config @@ -290,6 +304,13 @@ integration-test-oni-fish: - package script: make integration-test-oni-fish TEST_ARCHIVE=$(realpath bin/) +integration-test-oni-gui: + stage: integration-test + image: registry.gitlab.com/ryuslash/emacs-config + dependencies: + - package + script: make integration-test-oni-gui TEST_ARCHIVE=$(realpath bin/) + integration-test-oni-haskell: stage: integration-test image: registry.gitlab.com/ryuslash/emacs-config @@ -297,6 +318,13 @@ integration-test-oni-haskell: - package script: make integration-test-oni-haskell TEST_ARCHIVE=$(realpath bin/) +integration-test-oni-ivy: + stage: integration-test + image: registry.gitlab.com/ryuslash/emacs-config + dependencies: + - package + script: make integration-test-oni-ivy TEST_ARCHIVE=$(realpath bin/) + integration-test-oni-json: stage: integration-test image: registry.gitlab.com/ryuslash/emacs-config @@ -304,6 +332,13 @@ integration-test-oni-json: - package script: make integration-test-oni-json TEST_ARCHIVE=$(realpath bin/) +integration-test-oni-paredit: + stage: integration-test + image: registry.gitlab.com/ryuslash/emacs-config + dependencies: + - package + script: make integration-test-oni-paredit TEST_ARCHIVE=$(realpath bin/) + integration-test-oni-prescient: stage: integration-test image: registry.gitlab.com/ryuslash/emacs-config @@ -318,6 +353,13 @@ integration-test-oni-scheme: - package script: make integration-test-oni-scheme TEST_ARCHIVE=$(realpath bin/) +integration-test-oni-yasnippet: + stage: integration-test + image: registry.gitlab.com/ryuslash/emacs-config + dependencies: + - package + script: make integration-test-oni-yasnippet TEST_ARCHIVE=$(realpath bin/) + deploy: only: - master diff --git a/oni-company.el b/oni-company.el index 23b7ec3..53ff9fb 100644 --- a/oni-company.el +++ b/oni-company.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0302.092855 +;; Version: 2020.0408.110439 ;; Package-Requires: (company oni-prescient company-posframe diminish company-prescient) ;; This program is free software; you can redistribute it and/or modify @@ -58,8 +58,8 @@ (company-prescient-mode) -(diminish 'company-mode) -(diminish 'company-posframe-mode) +(with-eval-after-load 'company (diminish 'company-mode)) +(with-eval-after-load 'company-posframe (diminish 'company-posframe-mode)) ;;;###autoload(with-eval-after-load 'company (require 'oni-company)) diff --git a/oni-counsel.el b/oni-counsel.el index 2788db2..973be7a 100644 --- a/oni-counsel.el +++ b/oni-counsel.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0224.214110 +;; Version: 2020.0408.104838 ;; Package-Requires: (counsel diminish helpful) ;; This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ (rx (or (and bos ".") (and ".zwc" eos)))) -(diminish 'counsel-mode) +(with-eval-after-load 'counsel (diminish 'counsel-mode)) (setq counsel-describe-function-function 'helpful-callable) (setq counsel-describe-variable-function 'helpful-variable) diff --git a/oni-gui.el b/oni-gui.el index 9e02110..8acd706 100644 --- a/oni-gui.el +++ b/oni-gui.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0328.120150 +;; Version: 2020.0408.103604 ;; Package-Requires: (oni-ui oni-hydra yoshi-theme diminish) ;; This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ (add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-15")) (add-to-list 'default-frame-alist '(internal-border-width . 15)) -(set-face-font 'variable-pitch "Montserrat-14") +(set-face-font 'variable-pitch "Comic Neue-14") (set-fontset-font t ? "Font Awesome 5 Free Solid") (set-fontset-font t ? "Font Awesome 5 Free Solid") diff --git a/oni-ivy.el b/oni-ivy.el index c5848f3..c5600de 100644 --- a/oni-ivy.el +++ b/oni-ivy.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0305.221151 +;; Version: 2020.0408.103313 ;; Package-Requires: (ivy oni-prescient oni-hydra ivy-hydra diminish ivy-posframe ivy-prescient) ;; This program is free software; you can redistribute it and/or modify @@ -56,8 +56,8 @@ (ivy-posframe-mode) (ivy-prescient-mode) -(diminish 'ivy-posframe-mode) -(diminish 'ivy-mode) +(with-eval-after-load 'ivy-posframe (diminish 'ivy-posframe-mode)) +(with-eval-after-load 'ivy (diminish 'ivy-mode)) ;;;###autoload(with-eval-after-load 'ivy (require 'oni-ivy)) diff --git a/oni-paredit.el b/oni-paredit.el index 575f3aa..f25bc3c 100644 --- a/oni-paredit.el +++ b/oni-paredit.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0408.110825 +;; Version: 2020.0408.111251 ;; Package-Requires: (paredit diminish) ;; This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ (require 'diminish) -(diminish 'paredit-mode) +(with-eval-after-load 'paredit (diminish 'paredit-mode)) ;;;###autoload(with-eval-after-load 'paredit (require 'oni-paredit)) diff --git a/oni-yasnippet.el b/oni-yasnippet.el index 079a38e..b6b8755 100644 --- a/oni-yasnippet.el +++ b/oni-yasnippet.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210855 +;; Version: 2020.0408.105714 ;; Package-Requires: (yasnippet yasnippet-snippets diminish) ;; This program is free software; you can redistribute it and/or modify @@ -29,7 +29,7 @@ (require 'yasnippet) (require 'diminish) -(diminish 'yas-minor-mode) +(with-eval-after-load 'yasnippet (diminish 'yas-minor-mode)) (define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand) (define-key yas-minor-mode-map (kbd "TAB") nil) diff --git a/test/integration/oni-company.bats b/test/integration/oni-company.bats new file mode 100644 index 0000000..edb135a --- /dev/null +++ b/test/integration/oni-company.bats @@ -0,0 +1,48 @@ +#!/usr/bin/env bats + +@test "Opening Emacs loads oni-company" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (featurep 'oni-company))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening Emacs diminishes company-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (string-empty-p (car (alist-get 'company-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading company diminishes company-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(load-library \"company\")" \ + -eval "(prin1 (string-empty-p (car (alist-get 'company-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening Emacs diminishes company-posframe-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (string-empty-p (car (alist-get 'company-posframe-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading company-posframe diminishes company-posframe-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(load-library \"company-posframe\")" \ + -eval "(prin1 (string-empty-p (car (alist-get 'company-posframe-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} diff --git a/test/integration/oni-counsel.bats b/test/integration/oni-counsel.bats new file mode 100644 index 0000000..99050b5 --- /dev/null +++ b/test/integration/oni-counsel.bats @@ -0,0 +1,32 @@ +#!/usr/bin/env bats + +@test "Loading counsel loads oni-counsel" { + run emacs -batch -l package -f package-initialize \ + -l counsel \ + -eval "(prin1 (featurep 'oni-counsel))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Loading counsel diminishes counsel-mode" { + run emacs -batch -l package -f package-initialize \ + -l counsel \ + -eval "(prin1 (string-empty-p (car (alist-get 'counsel-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading counsel diminishes counsel-mode" { + run emacs -batch -l package -f package-initialize \ + -l counsel \ + -eval "(load-library \"counsel\")" \ + -eval "(prin1 (string-empty-p (car (alist-get 'counsel-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} diff --git a/test/integration/oni-gui.bats b/test/integration/oni-gui.bats new file mode 100644 index 0000000..1731faa --- /dev/null +++ b/test/integration/oni-gui.bats @@ -0,0 +1,29 @@ +#!/usr/bin/env bats + +@test "Opening emacs loads oni-gui" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (featurep 'oni-gui))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening emacs diminishes isearch-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (string= \" \" (car (alist-get 'isearch-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading isearch diminishes isearch-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(load-library \"isearch\")" \ + -eval "(prin1 (string= \" \" (car (alist-get 'isearch-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} diff --git a/test/integration/oni-ivy.bats b/test/integration/oni-ivy.bats new file mode 100644 index 0000000..df68095 --- /dev/null +++ b/test/integration/oni-ivy.bats @@ -0,0 +1,48 @@ +#!/usr/bin/env bats + +@test "Opening emacs loads oni-ivy" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (featurep 'oni-ivy))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening emacs diminishes ivy-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (string-empty-p (car (alist-get 'ivy-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading ivy diminishes ivy-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(load-library \"ivy\")" \ + -eval "(prin1 (string-empty-p (car (alist-get 'ivy-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening emacs diminishes ivy-posframe-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (string-empty-p (car (alist-get 'ivy-posframe-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading ivy-posframe diminishes ivy-posframe-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(load-library \"ivy-posframe\")" \ + -eval "(prin1 (string-empty-p (car (alist-get 'ivy-posframe-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} diff --git a/test/integration/oni-paredit.bats b/test/integration/oni-paredit.bats new file mode 100644 index 0000000..63b36a8 --- /dev/null +++ b/test/integration/oni-paredit.bats @@ -0,0 +1,32 @@ +#!/usr/bin/env bats + +@test "Loading paredit loads oni-paredit" { + run emacs -batch -l package -f package-initialize \ + -l paredit \ + -eval "(prin1 (featurep 'oni-paredit))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Loading paredit diminishes paredit-mode" { + run emacs -batch -l package -f package-initialize \ + -l paredit \ + -eval "(prin1 (string-empty-p (car (alist-get 'paredit-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading paredit diminishes paredit-mode" { + run emacs -batch -l package -f package-initialize \ + -l paredit \ + -eval "(load-library \"paredit\")" \ + -eval "(prin1 (string-empty-p (car (alist-get 'paredit-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} diff --git a/test/integration/oni-yasnippet.bats b/test/integration/oni-yasnippet.bats new file mode 100644 index 0000000..4784cb8 --- /dev/null +++ b/test/integration/oni-yasnippet.bats @@ -0,0 +1,29 @@ +#!/usr/bin/env bats + +@test "Opening Emacs loads oni-yasnippet" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (featurep 'oni-yasnippet))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening Emacs diminishes yas-minor-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(prin1 (string-empty-p (car (alist-get 'yas-minor-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Reloading yasnippet diminishes yas-minor-mode" { + run emacs -batch -l package -f package-initialize \ + -eval "(load-library \"yasnippet\")" \ + -eval "(prin1 (string-empty-p (car (alist-get 'yas-minor-mode minor-mode-alist))))" + + echo "$output" + + [[ "$output" == *"t" ]] +}