From 2c158c8b818901f11d92b28aeedd7e54e3bbad01 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 28 May 2020 10:10:44 -0500 Subject: [PATCH 1/4] Feat: add counsel-jq Co-authored-by: rushsteve1 --- modules/lang/json/config.el | 11 ++++++++++- modules/lang/json/doctor.el | 4 ++++ modules/lang/json/packages.el | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 modules/lang/json/doctor.el diff --git a/modules/lang/json/config.el b/modules/lang/json/config.el index 62db538af..9c847c684 100644 --- a/modules/lang/json/config.el +++ b/modules/lang/json/config.el @@ -11,4 +11,13 @@ (map! :after json-mode :map json-mode-map :localleader - "s" #'jsons-print-path)) + "p" #'jsons-print-path)) + + +(use-package! counsel-jq + :defer t + :init + (map! :after json-mode + :map json-mode-map + :localleader + "s" #'counsel-jq)) diff --git a/modules/lang/json/doctor.el b/modules/lang/json/doctor.el new file mode 100644 index 000000000..5578829e2 --- /dev/null +++ b/modules/lang/json/doctor.el @@ -0,0 +1,4 @@ +;;; lang/json/doctor.el -*- lexical-binding: t; -*- + +(unless (executable-find "jq") + (warn! "Couldn't find jq. counsel-jq won't work.")) diff --git a/modules/lang/json/packages.el b/modules/lang/json/packages.el index 69d84fb8a..95f58186d 100644 --- a/modules/lang/json/packages.el +++ b/modules/lang/json/packages.el @@ -3,3 +3,4 @@ (package! json-mode :pin "0e819e519a") (package! json-snatcher :pin "c4cecc0a50") +(package! counsel-jq :pin "b14dfc5c18") From 40e68f2a100d112e31dfb058d6ed00c3e092f0e0 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 28 May 2020 10:19:16 -0500 Subject: [PATCH 2/4] Fix: enable counsel-jq when using ivy Co-authored-by: gagbo --- modules/lang/json/packages.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/lang/json/packages.el b/modules/lang/json/packages.el index 95f58186d..267c484e2 100644 --- a/modules/lang/json/packages.el +++ b/modules/lang/json/packages.el @@ -3,4 +3,5 @@ (package! json-mode :pin "0e819e519a") (package! json-snatcher :pin "c4cecc0a50") -(package! counsel-jq :pin "b14dfc5c18") +(when (featurep! :completion ivy) + (package! counsel-jq :pin "b14dfc5c18")) From cf9e2e6463059fa98467d5bc7b7d1006c7e6334e Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 28 May 2020 18:11:11 -0500 Subject: [PATCH 3/4] Fix: ivy-gate counsel-jq --- modules/lang/json/config.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/lang/json/config.el b/modules/lang/json/config.el index 9c847c684..56aacfddd 100644 --- a/modules/lang/json/config.el +++ b/modules/lang/json/config.el @@ -14,10 +14,12 @@ "p" #'jsons-print-path)) -(use-package! counsel-jq - :defer t - :init - (map! :after json-mode - :map json-mode-map - :localleader - "s" #'counsel-jq)) + +(when (featurep! :completion ivy) + (use-package! counsel-jq + :defer t + :init + (map! :after json-mode + :map json-mode-map + :localleader + "s" #'counsel-jq))) From 71c2932786a79877e7037512eb2a9d5acbe685a1 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Mon, 1 Jun 2020 16:13:30 -0500 Subject: [PATCH 4/4] Use :when instead of (when ...) --- modules/lang/json/config.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/lang/json/config.el b/modules/lang/json/config.el index 56aacfddd..627e76051 100644 --- a/modules/lang/json/config.el +++ b/modules/lang/json/config.el @@ -15,11 +15,11 @@ -(when (featurep! :completion ivy) - (use-package! counsel-jq - :defer t - :init - (map! :after json-mode - :map json-mode-map - :localleader - "s" #'counsel-jq))) +(use-package! counsel-jq + :when (featurep! :completion ivy) + :defer t + :init + (map! :after json-mode + :map json-mode-map + :localleader + "s" #'counsel-jq))