Skip to content

Commit f79abf3

Browse files
authored
Make affe optional, but still default if available (#8)
1 parent 8a1253b commit f79abf3

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ This packaage provides these commands.
88

99
### consult-ghq-find
1010

11-
Select a repository from the [ghq](https://github.com/x-motemen/ghq) list and then find repository files using [affe-find](https://github.com/minad/affe) (similar to consult-find).
11+
Select a repository from the [ghq](https://github.com/x-motemen/ghq) list and then find repository files using [affe-find](https://github.com/minad/affe) (if installed) or consult-find.
1212

13-
If you want to use consult-find instead, you can change like below:
13+
If you want to use consult-find despite having affe installed, you can change like below:
1414

1515
```elisp
1616
(setq consult-ghq-find-function #'consult-find)

consult-ghq.el

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
;; Version: 0.0.4
77
;; Homepage: https://github.com/tomoya/consult-ghq
88
;; Keywords: convenience, usability, consult, ghq
9-
;; Package-Requires: ((emacs "26.1") (consult "0.8") (affe "0.1"))
9+
;; Package-Requires: ((emacs "26.1") (consult "0.8"))
1010
;; License: GPL-3.0-or-later
1111

1212
;; This program is free software; you can redistribute it and/or modify
@@ -27,15 +27,15 @@
2727
;; This packaage provides ghq interface using Consult.
2828
;;
2929
;; Its main entry points are the commands `consult-ghq-find' and
30-
;; `consult-ghq-grep`. Default find-function is affe-find. If you
31-
;; want to use consult-find instead, you can change like below:
30+
;; `consult-ghq-grep`. Default find-function is affe-find, if it's
31+
;; installed, otherwise consult-find. If you want to use consult-find
32+
;; despite having affe installed, you can change like below:
3233
;;
3334
;; (setq consult-ghq-find-function #'consult-find)
3435

3536
;;; Code:
3637

3738
(require 'consult)
38-
(require 'affe)
3939

4040
(defgroup consult-ghq nil
4141
"Ghq interface using consult."
@@ -48,12 +48,16 @@
4848
:type 'string
4949
:group 'consult-ghq)
5050

51-
(defcustom consult-ghq-find-function #'affe-find
51+
(defcustom consult-ghq-find-function (if (fboundp 'affe-find)
52+
#'affe-find
53+
#'consult-find)
5254
"Find function that find files after selected repo."
5355
:type 'function
5456
:group 'consult-ghq)
5557

56-
(defcustom consult-ghq-grep-function #'affe-grep
58+
(defcustom consult-ghq-grep-function (if (fboundp 'affe-grep)
59+
#'affe-grep
60+
#'consult-grep)
5761
"Grep function that find files after selected repo."
5862
:type 'function
5963
:group 'consult-ghq)

0 commit comments

Comments
 (0)