diff options
author | Jonas Bernoulli <jonas@bernoul.li> | 2020-10-02 15:07:00 +0200 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-12-02 19:27:20 +0000 |
commit | 887cefb5cec2a8f86907339158431514c1e519e1 (patch) | |
tree | 40979c6f3642e30bbc3bbd0ad48ddb01d03fb5bc /elisp/geiser-repl.el | |
parent | 701aab2db64690e1f42725d6163291e4e0878ad2 (diff) | |
download | geiser-887cefb5cec2a8f86907339158431514c1e519e1.tar.gz geiser-887cefb5cec2a8f86907339158431514c1e519e1.tar.bz2 |
Declare keymaps using defvar explicitly
This makes it possible to re-evaluate the containing
buffers without user customizations being clobbered.
Diffstat (limited to 'elisp/geiser-repl.el')
-rw-r--r-- | elisp/geiser-repl.el | 123 |
1 files changed, 64 insertions, 59 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index c41f05d..3907455 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -822,6 +822,70 @@ buffer." (goto-char (geiser-repl--last-prompt-end))) (recenter t))) +(defvar geiser-repl-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map comint-mode-map) + + (define-key map "\C-d" 'delete-char) + (define-key map "\C-m" 'geiser-repl--maybe-send) + (define-key map [return] 'geiser-repl--maybe-send) + (define-key map "\C-j" 'geiser-repl--newline-and-indent) + (define-key map (kbd "TAB") 'geiser-repl-tab-dwim) + (define-key map [backtab] 'geiser-repl--previous-error) + + (define-key map "\C-a" 'geiser-repl--bol) + (define-key map (kbd "<home>") 'geiser-repl--bol) + + (geiser-menu--defmenu repl map + ("Complete symbol" ((kbd "M-TAB")) + completion-at-point :enable (geiser--symbol-at-point)) + ("Complete module name" ((kbd "C-.") (kbd "M-`")) + geiser-completion--complete-module :enable (geiser--symbol-at-point)) + ("Edit symbol" "\M-." geiser-edit-symbol-at-point + :enable (geiser--symbol-at-point)) + -- + ("Load scheme file..." "\C-c\C-l" geiser-load-file) + ("Switch to module..." "\C-c\C-m" switch-to-geiser-module) + ("Import module..." "\C-c\C-i" geiser-repl-import-module) + ("Add to load path..." "\C-c\C-r" geiser-add-to-load-path) + -- + ("Previous matching input" "\M-p" comint-previous-matching-input-from-input + "Previous input matching current") + ("Next matching input" "\M-n" comint-next-matching-input-from-input + "Next input matching current") + ("Previous prompt" "\C-c\C-p" geiser-repl-previous-prompt) + ("Next prompt" "\C-c\C-n" geiser-repl-next-prompt) + ("Previous input" "\C-c\M-p" comint-previous-input) + ("Next input" "\C-c\M-n" comint-next-input) + -- + ("Interrupt evaluation" ("\C-c\C-k" "\C-c\C-c") + geiser-repl-interrupt) + -- + (mode "Autodoc mode" ("\C-c\C-da" "\C-c\C-d\C-a") geiser-autodoc-mode) + ("Symbol documentation" ("\C-c\C-dd" "\C-c\C-d\C-d") + geiser-doc-symbol-at-point + "Documentation for symbol at point" :enable (geiser--symbol-at-point)) + ("Lookup symbol in manual" ("\C-c\C-di" "\C-c\C-d\C-i") + geiser-doc-look-up-manual + "Documentation for symbol at point" :enable (geiser--symbol-at-point)) + ("Module documentation" ("\C-c\C-dm" "\C-c\C-d\C-m") geiser-repl--doc-module + "Documentation for module at point" :enable (geiser--symbol-at-point)) + -- + ("Clear buffer" "\C-c\M-o" geiser-repl-clear-buffer + "Clean up REPL buffer, leaving just a lonely prompt") + ("Toggle ()/[]" ("\C-c\C-e\C-[" "\C-c\C-e[") geiser-squarify) + ("Insert λ" ("\C-c\\" "\C-c\C-\\") geiser-insert-lambda) + -- + ("Kill Scheme interpreter" "\C-c\C-q" geiser-repl-exit + :enable (geiser-repl--live-p)) + ("Restart" "\C-c\C-z" switch-to-geiser :enable (not (geiser-repl--live-p))) + + -- + (custom "REPL options" geiser-repl)) + + (define-key map [menu-bar completion] 'undefined) + map)) + (define-derived-mode geiser-repl-mode comint-mode "REPL" "Major mode for interacting with an inferior scheme repl process. \\{geiser-repl-mode-map}" @@ -853,65 +917,6 @@ buffer." ;; enabling compilation-shell-minor-mode without the annoying highlighter (compilation-setup t)) -(define-key geiser-repl-mode-map "\C-d" 'delete-char) -(define-key geiser-repl-mode-map "\C-m" 'geiser-repl--maybe-send) -(define-key geiser-repl-mode-map [return] 'geiser-repl--maybe-send) -(define-key geiser-repl-mode-map "\C-j" 'geiser-repl--newline-and-indent) -(define-key geiser-repl-mode-map (kbd "TAB") 'geiser-repl-tab-dwim) -(define-key geiser-repl-mode-map [backtab] 'geiser-repl--previous-error) - -(define-key geiser-repl-mode-map "\C-a" 'geiser-repl--bol) -(define-key geiser-repl-mode-map (kbd "<home>") 'geiser-repl--bol) - -(geiser-menu--defmenu repl geiser-repl-mode-map - ("Complete symbol" ((kbd "M-TAB")) - completion-at-point :enable (geiser--symbol-at-point)) - ("Complete module name" ((kbd "C-.") (kbd "M-`")) - geiser-completion--complete-module :enable (geiser--symbol-at-point)) - ("Edit symbol" "\M-." geiser-edit-symbol-at-point - :enable (geiser--symbol-at-point)) - -- - ("Load scheme file..." "\C-c\C-l" geiser-load-file) - ("Switch to module..." "\C-c\C-m" switch-to-geiser-module) - ("Import module..." "\C-c\C-i" geiser-repl-import-module) - ("Add to load path..." "\C-c\C-r" geiser-add-to-load-path) - -- - ("Previous matching input" "\M-p" comint-previous-matching-input-from-input - "Previous input matching current") - ("Next matching input" "\M-n" comint-next-matching-input-from-input - "Next input matching current") - ("Previous prompt" "\C-c\C-p" geiser-repl-previous-prompt) - ("Next prompt" "\C-c\C-n" geiser-repl-next-prompt) - ("Previous input" "\C-c\M-p" comint-previous-input) - ("Next input" "\C-c\M-n" comint-next-input) - -- - ("Interrupt evaluation" ("\C-c\C-k" "\C-c\C-c") - geiser-repl-interrupt) - -- - (mode "Autodoc mode" ("\C-c\C-da" "\C-c\C-d\C-a") geiser-autodoc-mode) - ("Symbol documentation" ("\C-c\C-dd" "\C-c\C-d\C-d") - geiser-doc-symbol-at-point - "Documentation for symbol at point" :enable (geiser--symbol-at-point)) - ("Lookup symbol in manual" ("\C-c\C-di" "\C-c\C-d\C-i") - geiser-doc-look-up-manual - "Documentation for symbol at point" :enable (geiser--symbol-at-point)) - ("Module documentation" ("\C-c\C-dm" "\C-c\C-d\C-m") geiser-repl--doc-module - "Documentation for module at point" :enable (geiser--symbol-at-point)) - -- - ("Clear buffer" "\C-c\M-o" geiser-repl-clear-buffer - "Clean up REPL buffer, leaving just a lonely prompt") - ("Toggle ()/[]" ("\C-c\C-e\C-[" "\C-c\C-e[") geiser-squarify) - ("Insert λ" ("\C-c\\" "\C-c\C-\\") geiser-insert-lambda) - -- - ("Kill Scheme interpreter" "\C-c\C-q" geiser-repl-exit - :enable (geiser-repl--live-p)) - ("Restart" "\C-c\C-z" switch-to-geiser :enable (not (geiser-repl--live-p))) - - -- - (custom "REPL options" geiser-repl)) - -(define-key geiser-repl-mode-map [menu-bar completion] 'undefined) - ;;; User commands |