# HG changeset patch # User Stefan Monnier # Date 1082580843 0 # Node ID 4a1324ad659cd87e72af0ecec5923a1b13edad6c # Parent fa9573e2db2a4e11672e2db0fe798e953c26791e (checkdoc-output-mode): Make it a normal major mode. (checkdoc-buffer-label): Make sure the file name is meaningful. (checkdoc-output-to-error-buffer): Remove. (checkdoc-error, checkdoc-start-section): Rewrite. diff -r fa9573e2db2a -r 4a1324ad659c lisp/emacs-lisp/checkdoc.el --- a/lisp/emacs-lisp/checkdoc.el Wed Apr 21 20:53:35 2004 +0000 +++ b/lisp/emacs-lisp/checkdoc.el Wed Apr 21 20:54:03 2004 +0000 @@ -2604,18 +2604,13 @@ (defun checkdoc-output-mode () "Create and setup the buffer used to maintain checkdoc warnings. \\\\[checkdoc-find-error] - Go to this error location." - (if (get-buffer checkdoc-diagnostic-buffer) - (get-buffer checkdoc-diagnostic-buffer) - (save-excursion - (set-buffer (get-buffer-create checkdoc-diagnostic-buffer)) - (kill-all-local-variables) - (setq mode-name "Checkdoc" - major-mode 'checkdoc-output-mode) - (set (make-local-variable 'font-lock-defaults) - '((checkdoc-output-font-lock-keywords) t t ((?- . "w") (?_ . "w")))) - (use-local-map checkdoc-output-mode-map) - (run-hooks 'checkdoc-output-mode-hook) - (current-buffer)))) + (kill-all-local-variables) + (setq mode-name "Checkdoc" + major-mode 'checkdoc-output-mode) + (set (make-local-variable 'font-lock-defaults) + '((checkdoc-output-font-lock-keywords) t t ((?- . "w") (?_ . "w")))) + (use-local-map checkdoc-output-mode-map) + (run-mode-hooks 'checkdoc-output-mode-hook)) (defalias 'checkdoc-find-error-mouse 'checkdoc-find-error) (defun checkdoc-find-error (&optional event) @@ -2634,31 +2629,31 @@ (defun checkdoc-buffer-label () "The name to use for a checkdoc buffer in the error list." (if (buffer-file-name) - (file-name-nondirectory (buffer-file-name)) + (file-relative-name (buffer-file-name)) (concat "#"))) (defun checkdoc-start-section (check-type) "Initialize the checkdoc diagnostic buffer for a pass. Create the header so that the string CHECK-TYPE is displayed as the function called to create the messages." - (checkdoc-output-to-error-buffer - "\n\n\C-l\n*** " - (checkdoc-buffer-label) ": " check-type " V " checkdoc-version)) + (let ((dir default-directory) + (label (checkdoc-buffer-label))) + (with-current-buffer (get-buffer-create checkdoc-diagnostic-buffer) + (checkdoc-output-mode) + (setq default-directory dir) + (goto-char (point-max)) + (insert "\n\n\C-l\n*** " label ": " check-type " V " checkdoc-version)))) (defun checkdoc-error (point msg) "Store POINT and MSG as errors in the checkdoc diagnostic buffer." (setq checkdoc-pending-errors t) - (checkdoc-output-to-error-buffer - "\n" (checkdoc-buffer-label) ":" - (int-to-string (count-lines (point-min) (or point (point-min)))) ": " - msg)) - -(defun checkdoc-output-to-error-buffer (&rest text) - "Place TEXT into the checkdoc diagnostic buffer." - (save-excursion - (set-buffer (checkdoc-output-mode)) - (goto-char (point-max)) - (apply 'insert text))) + (let ((text (list "\n" (checkdoc-buffer-label) ":" + (int-to-string + (count-lines (point-min) (or point (point-min)))) + ": " msg))) + (with-current-buffer (get-buffer checkdoc-diagnostic-buffer) + (goto-char (point-max)) + (apply 'insert text)))) (defun checkdoc-show-diagnostics () "Display the checkdoc diagnostic buffer in a temporary window."