diff --git a/mattermost.el b/mattermost.el index a47ba1b..b7552c5 100644 --- a/mattermost.el +++ b/mattermost.el @@ -156,15 +156,6 @@ if the user is not present" (let ((url (format "/channels/%s/posts" channel-id))) (mattermost-request "GET" url))) -;; ToDo: define this better -(defvar mattermost-root-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 "q") #'bury-buffer) - map) - "The keymap for mattermost-root-mode") - (defun mattermost-insert-channel (channel) "Inserts a channel button in the current buffer" (let* ((channel-display-name (plist-get channel :display_name)) @@ -198,6 +189,15 @@ if the user is not present" (mattermost-root-mode) (beginning-of-buffer))) +(defvar mattermost-root-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 "q") #'bury-buffer) + (define-key map (kbd "g") #'show-root) + map) + "The keymap for mattermost-root-mode") + (define-derived-mode mattermost-root-mode fundamental-mode "Mattermost Root" "Mode to list the Mattermost teams and channels to allow the user to check their status and select between them")