(require 'compile) (require 'super) (require 'close) (require 'mode-line) ;; (setq makefile-mode-hook nil) (defun makefile-mode-hook-f () (enable-line-mode) (disable-super-global-keys) ) (add-hook 'makefile-mode-hook #'makefile-mode-hook-f) (defun compile-with-prompt () "Use this if there are sudos in the Makefile." (interactive) (compile compile-command t) ) ;; looks (setq compilation-scroll-output t) (add-hook 'compilation-mode-hook #'visual-line-mode) ;; the command (setq compile-command "make -j 4 -s -k") (setq compilation-read-command nil) (defun goto-next-number () (interactive) (forward-char 1) (re-search-forward "[[:digit:]]" (point-max) t) ; NOERROR (backward-char 1) ) (defun goto-prev-number () (interactive) (re-search-backward "[[:digit:]]" (point-min) t) ) ; NOERROR (defun goto-line-from-elisp (line-number) (interactive) (goto-char (point-min)) (forward-line (1- line-number)) ) (defun goto-line-other-window () (interactive) (let ((line-number (thing-at-point 'number))) (if (numberp line-number) (progn (other-window 1) (goto-line-from-elisp line-number) (other-window 1) ) (error "Does not compute: no number at point.") ))) (let ((the-map compilation-mode-map)) (set-close-key the-map) (disable-super-global-keys the-map) (define-key the-map "f" #'goto-line-other-window) (define-key the-map "l" #'goto-next-number) (define-key the-map "j" #'goto-prev-number) ) (provide 'compile-my)