aboutsummaryrefslogtreecommitdiff
path: root/lisp/hc.el
blob: 907a3d7839d54a23bef179cb80c179a68f7e17ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)