Skip to content

Make keymap definition more consistent #1143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2016
Merged
Show file tree
Hide file tree
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
26 changes: 15 additions & 11 deletions haskell-debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,25 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Mode

(defvar haskell-debug-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "g") 'haskell-debug/refresh)
(define-key map (kbd "s") 'haskell-debug/step)
(define-key map (kbd "t") 'haskell-debug/trace)
(define-key map (kbd "d") 'haskell-debug/delete)
(define-key map (kbd "b") 'haskell-debug/break-on-function)
(define-key map (kbd "a") 'haskell-debug/abandon)
(define-key map (kbd "c") 'haskell-debug/continue)
(define-key map (kbd "p") 'haskell-debug/previous)
(define-key map (kbd "n") 'haskell-debug/next)
(define-key map (kbd "RET") 'haskell-debug/select)
map)
"Keymap for `haskell-debug-mode'.")

(define-derived-mode haskell-debug-mode
text-mode "Debug"
"Major mode for debugging Haskell via GHCi.")

(define-key haskell-debug-mode-map (kbd "g") 'haskell-debug/refresh)
(define-key haskell-debug-mode-map (kbd "s") 'haskell-debug/step)
(define-key haskell-debug-mode-map (kbd "t") 'haskell-debug/trace)
(define-key haskell-debug-mode-map (kbd "d") 'haskell-debug/delete)
(define-key haskell-debug-mode-map (kbd "b") 'haskell-debug/break-on-function)
(define-key haskell-debug-mode-map (kbd "a") 'haskell-debug/abandon)
(define-key haskell-debug-mode-map (kbd "c") 'haskell-debug/continue)
(define-key haskell-debug-mode-map (kbd "p") 'haskell-debug/previous)
(define-key haskell-debug-mode-map (kbd "n") 'haskell-debug/next)
(define-key haskell-debug-mode-map (kbd "RET") 'haskell-debug/select)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Globals

Expand Down
5 changes: 2 additions & 3 deletions haskell-indent.el
Original file line number Diff line number Diff line change
Expand Up @@ -1524,9 +1524,8 @@ One indentation cycle is used."
(let ((map (current-local-map)))
(while (and map (not (eq map haskell-indent-map)))
(setq map (keymap-parent map)))
(if map
;; haskell-indent-map is already active: nothing to do.
nil
;; if haskell-indent-map is already active: there's nothing to do.
(unless map
;; Put our keymap on top of the others. We could also put it in
;; second place, or in a minor-mode. The minor-mode approach would be
;; easier, but it's harder for the user to override it. This approach
Expand Down
9 changes: 5 additions & 4 deletions haskell-indentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ positions are allowed."
:group 'haskell-indentation)

(defconst haskell-indentation-mode-map
(let ((keymap (make-sparse-keymap)))
(define-key keymap (kbd "RET") 'haskell-indentation-newline-and-indent)
(define-key keymap (kbd "<backtab>") 'haskell-indentation-indent-backwards)
keymap))
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") 'haskell-indentation-newline-and-indent)
(define-key map (kbd "<backtab>") 'haskell-indentation-indent-backwards)
map)
"Keymap for `haskell-indentation-mode'.")

;;;###autoload
(define-minor-mode haskell-indentation-mode
Expand Down
2 changes: 1 addition & 1 deletion haskell-interactive-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interference with prompts that look like haskell expressions."
(define-key map (kbd "TAB") 'haskell-interactive-mode-tab)
(define-key map (kbd "<C-S-backspace>") 'haskell-interactive-mode-kill-whole-line)
map)
"Interactive Haskell mode map.")
"Keymap used in `haskell-interactive-mode'")

(define-derived-mode haskell-interactive-mode fundamental-mode "Interactive-Haskell"
"Interactive mode for Haskell.
Expand Down
11 changes: 8 additions & 3 deletions haskell-menu.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
(switch-to-buffer-other-window (get-buffer haskell-menu-buffer-name))
(haskell-menu-revert-function nil nil))

(defvar haskell-menu-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "n") 'next-line)
(define-key map (kbd "p") 'previous-line)
(define-key map (kbd "RET") 'haskell-menu-mode-ret)
map)
"Keymap for `haskell-menu-mode'.")

(define-derived-mode haskell-menu-mode special-mode "Haskell Session Menu"
"Major mode for managing Haskell sessions.
Each line describes one session.
Expand All @@ -59,9 +67,6 @@ Letters do not insert themselves; instead, they are commands."
(haskell-menu-revert-function nil t))

(suppress-keymap haskell-menu-mode-map t)
(define-key haskell-menu-mode-map (kbd "n") 'next-line)
(define-key haskell-menu-mode-map (kbd "p") 'previous-line)
(define-key haskell-menu-mode-map (kbd "RET") 'haskell-menu-mode-ret)

(defun haskell-menu-revert-function (_arg1 _arg2)
"Function to refresh the display."
Expand Down
2 changes: 1 addition & 1 deletion haskell-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ be set to the preferred literate style."
(define-key map (kbd "C-c C-i") 'haskell-mode-enable-process-minor-mode)
(define-key map (kbd "C-c C-s") 'haskell-mode-toggle-scc-at-point)
map)
"Keymap used in Haskell mode.")
"Keymap used in `haskell-mode'.")


(defvar haskell-ghc-supported-extensions
Expand Down
13 changes: 7 additions & 6 deletions haskell-presentation-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
(require 'haskell-mode)
(require 'haskell-session)

(defvar haskell-presentation-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "q") 'quit-window)
(define-key map (kbd "c") 'haskell-presentation-clear)
map)
"Keymap for `haskell-presentation-mode'.")

(define-derived-mode haskell-presentation-mode
haskell-mode "Presentation"
"Major mode for viewing Haskell snippets.
Expand All @@ -42,12 +49,6 @@
"-- Hit `q' to close this window; `c' to clear.\n\n"
"Hint message appered in Haskell Presentation buffer.")

(easy-mmode-defmap
haskell-presentation-mode-map
`(("q" . quit-window)
("c" . haskell-presentation-clear))
"The base key map for `haskell-presentation-mode'.")

(defun haskell-presentation-buffer ()
"Return Haskell Presentaion buffer.
Return current presenation buffer or create new one if absent.
Expand Down
2 changes: 1 addition & 1 deletion haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
(define-key map (kbd "M-p") 'haskell-goto-prev-error)
(define-key map (kbd "C-c M-p") 'haskell-goto-first-error)
map)
"Keymap for using haskell-interactive-mode.")
"Keymap for using `interactive-haskell-mode'.")

;;;###autoload
(define-minor-mode interactive-haskell-mode
Expand Down
2 changes: 1 addition & 1 deletion inf-haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ we load it."
(define-key map (kbd "C-c C-d") 'inferior-haskell-find-haddock)
(define-key map (kbd "C-c C-v") 'haskell-check)
map)
"Keymap for using inf-haskell.")
"Keymap for using `inf-haskell-mode'.")

;;;###autoload
(define-minor-mode inf-haskell-mode
Expand Down