aboutsummaryrefslogtreecommitdiff
path: root/hcel.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-21 12:52:31 +1000
committerYuchen Pei <hi@ypei.me>2022-09-21 12:53:21 +1000
commit1b0817abd54e4ff050240bee47b28e66e843eb66 (patch)
treebbcc42d8e14d2fbe2cb268e3b64b77a01c64c1ca /hcel.el
parent8632869b89a60f4cd0a4d3f0975469512fb76087 (diff)
Patch from Stefan Monnier.
https://lists.gnu.org/archive/html/emacs-devel/2022-09/msg01378.html
Diffstat (limited to 'hcel.el')
-rw-r--r--hcel.el60
1 files changed, 60 insertions, 0 deletions
diff --git a/hcel.el b/hcel.el
new file mode 100644
index 0000000..bdfe65c
--- /dev/null
+++ b/hcel.el
@@ -0,0 +1,60 @@
+;;; hcel.el --- Haskell codebase explorer -*- lexical-binding: t; -*-
+
+;; Author: Yuchen Pei <id@ypei.org>
+;; Maintainer: Yuchen Pei <id@ypei.org>
+;; Created: 2022
+;; Version: 0
+;; Keywords: haskell
+;; Package-Requires: ((emacs "28"))
+;; Package-Type: multi
+;; Homepage: https://g.ypei.me/hcel.git
+
+;; Copyright (C) 2022 Yuchen Pei.
+;;
+;; This file is part of hcel.
+;;
+;; hcel is free software: you can redistribute it and/or modify it under
+;; the terms of the GNU Affero General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; hcel is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
+;; Public License for more details.
+;;
+;; You should have received a copy of the GNU Affero General Public
+;; License along with hcel. If not, see <https://www.gnu.org/licenses/>.
+
+(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)
+;;; hcel.el ends here.