Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 829275b

Browse files
committed
Merge pull request #97 from cocreature/emacs-hierarchical-menus
Use hierarchical menus instead of a flat one
2 parents 08e01e4 + a9c689a commit 829275b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

elisp/haskell-ide-engine.el

+12-12
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ association lists and count on HIE to use default values there."
165165

166166
(defun hie-get-context (context)
167167
(let ((start (save-excursion (if (use-region-p) (goto-char (region-beginning)))
168-
(list (line-number-at-pos) (current-column))))
168+
`(("line" . ,(line-number-at-pos)) ("col" . ,(current-column)))))
169169
(end (save-excursion (if (use-region-p) (goto-char (region-end)))
170-
(list (line-number-at-pos) (current-column))))
170+
`(("line" . ,(line-number-at-pos)) ("col" . ,(current-column)))))
171171
(filename (buffer-file-name)))
172172
`(("file" . (("file" . ,filename)))
173-
("start_pos" . (("pos" . ,(apply 'vector start))))
174-
("end_pos" . (("pos" . ,(apply 'vector end)))))))
173+
("start_pos" . ,end)
174+
("end_pos" . ,start))))
175175

176176
(defun hie-run-command (plugin command)
177177
(setq haskell-ide-engine-process-handle-message
@@ -186,14 +186,14 @@ association lists and count on HIE to use default values there."
186186
"Handle first plugins call."
187187

188188
(let ((menu-items
189-
(apply #'append
190-
(mapcar
191-
(lambda (plugin)
192-
(mapcar
193-
(lambda (command)
194-
(vector (cdr (assq 'ui_description command)) (list 'hie-run-command (symbol-name (car plugin)) (cdr (assq 'name command)))))
195-
(cdr plugin)))
196-
(cdr (assq 'plugins json))))))
189+
(mapcar
190+
(lambda (plugin)
191+
(cons (symbol-name (car plugin))
192+
(mapcar
193+
(lambda (command)
194+
(vector (cdr (assq 'ui_description command)) (list 'hie-run-command (symbol-name (car plugin)) (cdr (assq 'name command)))))
195+
(cdr plugin))))
196+
(cdr (assq 'plugins json)))))
197197
(setq haskell-ide-engine-plugins (cdr (assq 'plugins json)))
198198
(easy-menu-define hie-menu hie-mode-map
199199
"Menu for Haskell IDE Engine"

0 commit comments

Comments
 (0)