diff options
| author | Stefan Monnier | 2004-04-21 20:54:03 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-04-21 20:54:03 +0000 |
| commit | 780b142e2da585a583a7a4008dc4a615d96d8145 (patch) | |
| tree | 7a04071f8943ae34bb2dc1ffc7756af8dedbfb23 | |
| parent | e5780ae17ec1b3ef148e26911bff2b2baa4dbe8c (diff) | |
| download | emacs-780b142e2da585a583a7a4008dc4a615d96d8145.tar.gz emacs-780b142e2da585a583a7a4008dc4a615d96d8145.zip | |
(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.
| -rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index fddab94dfd4..a4e08ef7970 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el | |||
| @@ -2604,18 +2604,13 @@ This function will not modify `match-data'." | |||
| 2604 | (defun checkdoc-output-mode () | 2604 | (defun checkdoc-output-mode () |
| 2605 | "Create and setup the buffer used to maintain checkdoc warnings. | 2605 | "Create and setup the buffer used to maintain checkdoc warnings. |
| 2606 | \\<checkdoc-output-mode-map>\\[checkdoc-find-error] - Go to this error location." | 2606 | \\<checkdoc-output-mode-map>\\[checkdoc-find-error] - Go to this error location." |
| 2607 | (if (get-buffer checkdoc-diagnostic-buffer) | 2607 | (kill-all-local-variables) |
| 2608 | (get-buffer checkdoc-diagnostic-buffer) | 2608 | (setq mode-name "Checkdoc" |
| 2609 | (save-excursion | 2609 | major-mode 'checkdoc-output-mode) |
| 2610 | (set-buffer (get-buffer-create checkdoc-diagnostic-buffer)) | 2610 | (set (make-local-variable 'font-lock-defaults) |
| 2611 | (kill-all-local-variables) | 2611 | '((checkdoc-output-font-lock-keywords) t t ((?- . "w") (?_ . "w")))) |
| 2612 | (setq mode-name "Checkdoc" | 2612 | (use-local-map checkdoc-output-mode-map) |
| 2613 | major-mode 'checkdoc-output-mode) | 2613 | (run-mode-hooks 'checkdoc-output-mode-hook)) |
| 2614 | (set (make-local-variable 'font-lock-defaults) | ||
| 2615 | '((checkdoc-output-font-lock-keywords) t t ((?- . "w") (?_ . "w")))) | ||
| 2616 | (use-local-map checkdoc-output-mode-map) | ||
| 2617 | (run-hooks 'checkdoc-output-mode-hook) | ||
| 2618 | (current-buffer)))) | ||
| 2619 | 2614 | ||
| 2620 | (defalias 'checkdoc-find-error-mouse 'checkdoc-find-error) | 2615 | (defalias 'checkdoc-find-error-mouse 'checkdoc-find-error) |
| 2621 | (defun checkdoc-find-error (&optional event) | 2616 | (defun checkdoc-find-error (&optional event) |
| @@ -2634,31 +2629,31 @@ This function will not modify `match-data'." | |||
| 2634 | (defun checkdoc-buffer-label () | 2629 | (defun checkdoc-buffer-label () |
| 2635 | "The name to use for a checkdoc buffer in the error list." | 2630 | "The name to use for a checkdoc buffer in the error list." |
| 2636 | (if (buffer-file-name) | 2631 | (if (buffer-file-name) |
| 2637 | (file-name-nondirectory (buffer-file-name)) | 2632 | (file-relative-name (buffer-file-name)) |
| 2638 | (concat "#<buffer "(buffer-name) ">"))) | 2633 | (concat "#<buffer "(buffer-name) ">"))) |
| 2639 | 2634 | ||
| 2640 | (defun checkdoc-start-section (check-type) | 2635 | (defun checkdoc-start-section (check-type) |
| 2641 | "Initialize the checkdoc diagnostic buffer for a pass. | 2636 | "Initialize the checkdoc diagnostic buffer for a pass. |
| 2642 | Create the header so that the string CHECK-TYPE is displayed as the | 2637 | Create the header so that the string CHECK-TYPE is displayed as the |
| 2643 | function called to create the messages." | 2638 | function called to create the messages." |
| 2644 | (checkdoc-output-to-error-buffer | 2639 | (let ((dir default-directory) |
| 2645 | "\n\n\C-l\n*** " | 2640 | (label (checkdoc-buffer-label))) |
| 2646 | (checkdoc-buffer-label) ": " check-type " V " checkdoc-version)) | 2641 | (with-current-buffer (get-buffer-create checkdoc-diagnostic-buffer) |
| 2642 | (checkdoc-output-mode) | ||
| 2643 | (setq default-directory dir) | ||
| 2644 | (goto-char (point-max)) | ||
| 2645 | (insert "\n\n\C-l\n*** " label ": " check-type " V " checkdoc-version)))) | ||
| 2647 | 2646 | ||
| 2648 | (defun checkdoc-error (point msg) | 2647 | (defun checkdoc-error (point msg) |
| 2649 | "Store POINT and MSG as errors in the checkdoc diagnostic buffer." | 2648 | "Store POINT and MSG as errors in the checkdoc diagnostic buffer." |
| 2650 | (setq checkdoc-pending-errors t) | 2649 | (setq checkdoc-pending-errors t) |
| 2651 | (checkdoc-output-to-error-buffer | 2650 | (let ((text (list "\n" (checkdoc-buffer-label) ":" |
| 2652 | "\n" (checkdoc-buffer-label) ":" | 2651 | (int-to-string |
| 2653 | (int-to-string (count-lines (point-min) (or point (point-min)))) ": " | 2652 | (count-lines (point-min) (or point (point-min)))) |
| 2654 | msg)) | 2653 | ": " msg))) |
| 2655 | 2654 | (with-current-buffer (get-buffer checkdoc-diagnostic-buffer) | |
| 2656 | (defun checkdoc-output-to-error-buffer (&rest text) | 2655 | (goto-char (point-max)) |
| 2657 | "Place TEXT into the checkdoc diagnostic buffer." | 2656 | (apply 'insert text)))) |
| 2658 | (save-excursion | ||
| 2659 | (set-buffer (checkdoc-output-mode)) | ||
| 2660 | (goto-char (point-max)) | ||
| 2661 | (apply 'insert text))) | ||
| 2662 | 2657 | ||
| 2663 | (defun checkdoc-show-diagnostics () | 2658 | (defun checkdoc-show-diagnostics () |
| 2664 | "Display the checkdoc diagnostic buffer in a temporary window." | 2659 | "Display the checkdoc diagnostic buffer in a temporary window." |