aboutsummaryrefslogtreecommitdiff
path: root/lisp/hc.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-05 15:27:00 +1000
committerYuchen Pei <hi@ypei.me>2022-09-05 15:27:00 +1000
commitbf28ac7e4e8a80daae955fba5b02bbd2b0ea5d67 (patch)
tree74b7304932036020c4a240686023430319a1d13b /lisp/hc.el
parented46b9055bd5fbb05dc35fe0d41d73dd3c785e3d (diff)
Adding elisp client.
Diffstat (limited to 'lisp/hc.el')
-rw-r--r--lisp/hc.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/lisp/hc.el b/lisp/hc.el
new file mode 100644
index 0000000..907a3d7
--- /dev/null
+++ b/lisp/hc.el
@@ -0,0 +1,31 @@
+;; -*- lexical-binding: t; -*-
+(require 'hcel-source)
+(require 'hcel-outline)
+(require 'hcel-results)
+(require 'hcel-utils)
+
+(defun hcel-package (package-id)
+ "Select a package, followed by selecting a module to display the source."
+ (interactive
+ (list
+ (completing-read "Select package: "
+ (mapcar 'hcel-format-package-id
+ (hcel-api-packages)))))
+ (call-interactively (hcel-module-selector (hcel-parse-package-id package-id))))
+
+(defun hcel-module ()
+ "Select a module to display source."
+ (interactive)
+ (call-interactively
+ (hcel-module-selector hcel-package-id)))
+
+(defun hcel-module-selector (package-id)
+ (lambda (module-path)
+ (interactive
+ (list
+ (completing-read "Select module: "
+ (hcel-list-modules package-id))))
+ (switch-to-buffer
+ (hcel-load-module-source package-id module-path))))
+
+(provide 'hc)