Created
July 30, 2023 20:08
-
-
Save zkytony/b0af383bbc3f7b6d6b0bff5aa7f8f470 to your computer and use it in GitHub Desktop.
custom mode for navigating mypy output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; mypy-mode.el --- Navigate Mypy Output in Emacs | |
;; Copyright (C) 2023 Kaiyu Zheng | |
;; Author: Your Name <[email protected]> | |
;; Keywords: convenience | |
;; Version: 0.0.1 | |
;; Package-Requires: ((emacs "24.3")) | |
;;; Commentary: | |
;; This package provides a major mode for navigating mypy output in Emacs. | |
;; It is similar to `compilation-mode`, but the 'g' keybinding is changed to | |
;; reload the current buffer from disk (using `revert-buffer`) rather than | |
;; rerunning the compilation command. | |
;;; Code: | |
(defun mypy-revert-buffer () | |
"Reload the current buffer from disk." | |
(interactive) | |
(revert-buffer t t)) | |
(define-derived-mode mypy-report-mode compilation-mode "Mypy" | |
"Major mode for navigating Mypy output.") | |
(define-key mypy-report-mode-map (kbd "g") 'mypy-revert-buffer) | |
(provide 'mypy-report-mode) | |
;;; mypy-report-mode.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Configuration
Load the mode
Make screen splits the screen into top and bottom sections by default
Load the mode by default when opening
mypy_report
(where mypy output is dumped)(add-to-list 'auto-mode-alist '("mypy_report" . mypy-report-mode))