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

Use hierarchical menus instead of a flat one #97

Merged
merged 2 commits into from
Nov 24, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions elisp/haskell-ide-engine.el
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ association lists and count on HIE to use default values there."

(defun hie-get-context (context)
(let ((start (save-excursion (if (use-region-p) (goto-char (region-beginning)))
(list (line-number-at-pos) (current-column))))
`(("line" . ,(line-number-at-pos)) ("col" . ,(current-column)))))
(end (save-excursion (if (use-region-p) (goto-char (region-end)))
(list (line-number-at-pos) (current-column))))
`(("line" . ,(line-number-at-pos)) ("col" . ,(current-column)))))
(filename (buffer-file-name)))
`(("file" . (("file" . ,filename)))
("start_pos" . (("pos" . ,(apply 'vector start))))
("end_pos" . (("pos" . ,(apply 'vector end)))))))
("start_pos" . ,end)
("end_pos" . ,start))))

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

(let ((menu-items
(apply #'append
(mapcar
(lambda (plugin)
(mapcar
(lambda (command)
(vector (cdr (assq 'ui_description command)) (list 'hie-run-command (symbol-name (car plugin)) (cdr (assq 'name command)))))
(cdr plugin)))
(cdr (assq 'plugins json))))))
(mapcar
(lambda (plugin)
(cons (symbol-name (car plugin))
(mapcar
(lambda (command)
(vector (cdr (assq 'ui_description command)) (list 'hie-run-command (symbol-name (car plugin)) (cdr (assq 'name command)))))
(cdr plugin))))
(cdr (assq 'plugins json)))))
(setq haskell-ide-engine-plugins (cdr (assq 'plugins json)))
(easy-menu-define hie-menu hie-mode-map
"Menu for Haskell IDE Engine"
Expand Down