comparison lisp/diff-mode.el @ 47523:78ff9bcb1a38

(diff-mode): Use compilation-minor-mode. Don't unbind compilation-last-buffer after autoload compile.el. Hide the compilation-minor-mode bindings altogether.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 18 Sep 2002 12:09:07 +0000
parents 967c2114c128
children 37645a051842
comparison
equal deleted inserted replaced
47522:a58704d2ce3f 47523:78ff9bcb1a38
887 (when (string-match "\\.rej\\'" (or buffer-file-name "")) 887 (when (string-match "\\.rej\\'" (or buffer-file-name ""))
888 (set (make-local-variable 'compilation-current-file) 888 (set (make-local-variable 'compilation-current-file)
889 (substring buffer-file-name 0 (match-beginning 0)))) 889 (substring buffer-file-name 0 (match-beginning 0))))
890 ;; Be careful not to change compilation-last-buffer when we're just 890 ;; Be careful not to change compilation-last-buffer when we're just
891 ;; doing a C-x v = (for example). 891 ;; doing a C-x v = (for example).
892 (let ((compilation-last-buffer 892 (if (boundp 'compilation-last-buffer)
893 (and (boundp 'compilation-last-buffer) 893 (let ((compilation-last-buffer compilation-last-buffer))
894 compilation-last-buffer))) 894 (compilation-minor-mode 1))
895 (compilation-shell-minor-mode 1)) 895 (compilation-minor-mode 1))
896 ;; M-RET and RET should be done by diff-mode because the `compile'
897 ;; support is significantly less good.
898 (add-to-list 'minor-mode-overriding-map-alist
899 (cons 'compilation-minor-mode (make-sparse-keymap)))
896 900
897 (when (and (> (point-max) (point-min)) diff-default-read-only) 901 (when (and (> (point-max) (point-min)) diff-default-read-only)
898 (toggle-read-only t)) 902 (toggle-read-only t))
899 ;; setup change hooks 903 ;; setup change hooks
900 (if (not diff-update-on-the-fly) 904 (if (not diff-update-on-the-fly)
901 (add-hook 'write-contents-hooks 'diff-write-contents-hooks) 905 (add-hook 'write-contents-hooks 'diff-write-contents-hooks)
902 (make-local-variable 'diff-unhandled-changes) 906 (make-local-variable 'diff-unhandled-changes)
903 (add-hook 'after-change-functions 'diff-after-change-function nil t) 907 (add-hook 'after-change-functions 'diff-after-change-function nil t)
904 (add-hook 'post-command-hook 'diff-post-command-hook nil t)) 908 (add-hook 'post-command-hook 'diff-post-command-hook nil t))
905 ;; Neat trick from Dave Love to add more bindings in read-only mode: 909 ;; Neat trick from Dave Love to add more bindings in read-only mode:
906 (add-to-list (make-local-variable 'minor-mode-overriding-map-alist) 910 (add-to-list 'minor-mode-overriding-map-alist
907 (cons 'buffer-read-only diff-mode-shared-map)) 911 (cons 'buffer-read-only diff-mode-shared-map))
908 ;; add-log support 912 ;; add-log support
909 (set (make-local-variable 'add-log-current-defun-function) 913 (set (make-local-variable 'add-log-current-defun-function)
910 'diff-current-defun) 914 'diff-current-defun)
911 (set (make-local-variable 'add-log-buffer-file-name-function) 915 (set (make-local-variable 'add-log-buffer-file-name-function)