|
30 | 30 |
|
31 | 31 | (require 'cider-doc)
|
32 | 32 | (require 'cl-lib)
|
| 33 | +(require 'map) |
33 | 34 | (require 'seq)
|
34 | 35 |
|
35 | 36 | (defconst cider-cheatsheet-hierarchy
|
@@ -548,24 +549,18 @@ This list is supposed to have the following format:
|
548 | 549 | (mapcar #'symbol-name vars)
|
549 | 550 | (mapcar (lambda (var) (format "%s/%s" ns var)) vars))))
|
550 | 551 |
|
551 |
| -(defun cider-cheatsheet--select-var (var-list) |
552 |
| - "Expand the symbols in VAR-LIST to fully-qualified var names. |
553 |
| -
|
554 |
| -The list can hold one or more lists inside - one per each namespace." |
555 |
| - (let ((namespaced-vars (seq-mapcat #'cider-cheatsheet--expand-vars var-list))) |
556 |
| - (cider-doc-lookup (completing-read "Select var: " namespaced-vars)))) |
557 |
| - |
558 | 552 | ;;;###autoload
|
559 | 553 | (defun cider-cheatsheet-select ()
|
560 | 554 | "Navigate cheatsheet sections and show documentation for selected var."
|
561 | 555 | (interactive)
|
562 |
| - (let ((cheatsheet-data cider-cheatsheet-hierarchy)) |
563 |
| - (while (stringp (caar cheatsheet-data)) |
564 |
| - (let* ((sections (mapcar #'car cheatsheet-data)) |
565 |
| - (sel-section (completing-read "Select cheatsheet section: " sections)) |
566 |
| - (section-data (seq-find (lambda (elem) (equal (car elem) sel-section)) cheatsheet-data))) |
567 |
| - (setq cheatsheet-data (cdr section-data)))) |
568 |
| - (cider-cheatsheet--select-var cheatsheet-data))) |
| 556 | + (let ((hierarchy cider-cheatsheet-hierarchy)) |
| 557 | + (while (stringp (caar hierarchy)) |
| 558 | + (let* ((sections (mapcar #'car hierarchy)) |
| 559 | + (section (completing-read "Select section: " sections))) |
| 560 | + (setq hierarchy (map-elt hierarchy section)))) |
| 561 | + (let* ((vars (seq-mapcat #'cider-cheatsheet--expand-vars hierarchy)) |
| 562 | + (var (completing-read "Select var: " vars))) |
| 563 | + (cider-doc-lookup var)))) |
569 | 564 |
|
570 | 565 | (cl-defun cider-cheatsheet--insert-hierarchy (hierarchy &optional (level 0))
|
571 | 566 | "Insert HIERARCHY with visual indentation for LEVEL."
|
|
0 commit comments