From b008007c6a90f2f6f081c1b72395141ab6e56dfa Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 22 Mar 2004 15:24:49 +0000 Subject: (checkdoc-error): Dont' assume point-min == 1. (debug-ignored-errors): Add an entry. --- lisp/emacs-lisp/checkdoc.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp/checkdoc.el') diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 05f0bb0977d..8e68cb428dc 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1,6 +1,6 @@ ;;; checkdoc.el --- check documentation strings for style requirements -;;; Copyright (C) 1997, 1998, 2001 Free Software Foundation +;;; Copyright (C) 1997, 1998, 2001, 2004 Free Software Foundation ;; Author: Eric M. Ludlam ;; Version: 0.6.2 @@ -2657,7 +2657,7 @@ function called to create the messages." (setq checkdoc-pending-errors t) (checkdoc-output-to-error-buffer "\n" (checkdoc-buffer-label) ":" - (int-to-string (count-lines (point-min) (or point 1))) ": " + (int-to-string (count-lines (point-min) (or point (point-min)))) ": " msg)) (defun checkdoc-output-to-error-buffer (&rest text) @@ -2692,6 +2692,8 @@ function called to create the messages." (add-to-list 'debug-ignored-errors "Argument `.*' should appear (as .*) in the doc string") +(add-to-list 'debug-ignored-errors + "Lisp symbol `.*' should appear in quotes") (add-to-list 'debug-ignored-errors "Disambiguate .* by preceding .*") (provide 'checkdoc) -- cgit v1.2.3 From 96ef1febd290979a5d1be6ddf0a885c68c83e625 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 14 Apr 2004 17:49:43 +0000 Subject: (checkdoc-output-mode-map, checkdoc-find-error-mouse, checkdoc-find-error): Use posn-set-point to merge the mouse and non-mouse case. --- lisp/ChangeLog | 22 ++++++++++++++++++++++ lisp/emacs-lisp/checkdoc.el | 23 ++++++++--------------- 2 files changed, 30 insertions(+), 15 deletions(-) (limited to 'lisp/emacs-lisp/checkdoc.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b3cada9ab06..d7c2e3d3144 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,25 @@ +2004-04-14 Stefan Monnier + + * pcvs-info.el (cvs-status-map): Update binding name. + + * pcvs.el (cvs-mode-toggle-mark): Rename from cvs-mouse-toggle-mark. + Make it work for non-mouse events. + + * subr.el (posn-set-point): New function. + + * mouse.el (mouse-set-point): Use it. + + * progmodes/compile.el (compile-goto-error): Use it. + + * smerge-mode.el (smerge-popup-context-menu): Use it. + + * emacs-lisp/checkdoc.el (checkdoc-output-mode-map) + (checkdoc-find-error-mouse, checkdoc-find-error): Use it to merge the + mouse and non-mouse case. + + * diff-mode.el (diff-goto-source): Make it work for mouse bindings. + (diff-mouse-goto-source): Make it an alias of diff-goto-source. + 2004-04-14 Jesper Harder * info.el (info-apropos): Don't clobber Info-history-list. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 8e68cb428dc..fddab94dfd4 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -653,8 +653,7 @@ style." (sit-for 2)) (setq err-list (cdr err-list)))) (beginning-of-defun) - (let ((pe (car err-list)) - (ne (funcall findfunc nil))) + (let ((ne (funcall findfunc nil))) (if ne (setq err-list (cons ne err-list)) (cond ((not err-list) @@ -900,7 +899,7 @@ Prefix argument TAKE-NOTES means to continue through the whole buffer and save warnings in a separate buffer. Second optional argument START-POINT is the starting location. If this is nil, `point-min' is used instead." (interactive "P") - (let ((wrong nil) (msg nil) (errors nil) + (let ((wrong nil) (msg nil) ;; Assign a flag to spellcheck flag (checkdoc-spellcheck-documentation-flag (car (memq checkdoc-spellcheck-documentation-flag @@ -2598,14 +2597,13 @@ This function will not modify `match-data'." (setq checkdoc-output-mode-map (make-sparse-keymap)) (if (not (string-match "XEmacs" emacs-version)) (define-key checkdoc-output-mode-map [mouse-2] - 'checkdoc-find-error-mouse)) + 'checkdoc-find-error)) (define-key checkdoc-output-mode-map "\C-c\C-c" 'checkdoc-find-error) (define-key checkdoc-output-mode-map "\C-m" 'checkdoc-find-error)) (defun checkdoc-output-mode () "Create and setup the buffer used to maintain checkdoc warnings. -\\\\[checkdoc-find-error] - Go to this error location -\\[checkdoc-find-error-mouse] - Goto the error clicked on." +\\\\[checkdoc-find-error] - Go to this error location." (if (get-buffer checkdoc-diagnostic-buffer) (get-buffer checkdoc-diagnostic-buffer) (save-excursion @@ -2619,16 +2617,11 @@ This function will not modify `match-data'." (run-hooks 'checkdoc-output-mode-hook) (current-buffer)))) -(defun checkdoc-find-error-mouse (e) - ;; checkdoc-params: (e) - "Call `checkdoc-find-error' where the user clicks the mouse." - (interactive "e") - (mouse-set-point e) - (checkdoc-find-error)) - -(defun checkdoc-find-error () +(defalias 'checkdoc-find-error-mouse 'checkdoc-find-error) +(defun checkdoc-find-error (&optional event) "In a checkdoc diagnostic buffer, find the error under point." - (interactive) + (interactive (list last-input-event)) + (if event (posn-set-point (event-end e))) (beginning-of-line) (if (looking-at "\\(\\(\\w+\\|\\s_\\)+\\.el\\):\\([0-9]+\\):") (let ((l (string-to-int (match-string 3))) -- cgit v1.2.3 From 780b142e2da585a583a7a4008dc4a615d96d8145 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 21 Apr 2004 20:54:03 +0000 Subject: (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. --- lisp/emacs-lisp/checkdoc.el | 49 ++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'lisp/emacs-lisp/checkdoc.el') 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'." (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 @@ This function will not modify `match-data'." (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." -- cgit v1.2.3 From f578d9f8aa08fb6ab2ac44b8f5527abb7b563156 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 23 Apr 2004 22:25:17 +0000 Subject: (checkdoc-output-error-regex-alist): New var. (checkdoc-output-font-lock-keywords): Remove error regexp. (checkdoc-output-mode-map): Remove. (checkdoc-output-mode): Derive from compilation-mode. (checkdoc-find-error-mouse, checkdoc-find-error): Remove. --- lisp/emacs-lisp/checkdoc.el | 49 +++++++++------------------------------------ 1 file changed, 10 insertions(+), 39 deletions(-) (limited to 'lisp/emacs-lisp/checkdoc.el') diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index a4e08ef7970..67de4a96223 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2579,52 +2579,23 @@ This function will not modify `match-data'." ;;; Warning management ;; (defvar checkdoc-output-font-lock-keywords - '(("\\(\\w+\\.el\\): \\(\\w+\\)" + '(("^\\*\\*\\* \\(.+\\.el\\): \\([^ \n]+\\)" (1 font-lock-function-name-face) - (2 font-lock-comment-face)) - ("^\\(\\w+\\.el\\):" 1 font-lock-function-name-face) - (":\\([0-9]+\\):" 1 font-lock-constant-face)) + (2 font-lock-comment-face))) "Keywords used to highlight a checkdoc diagnostic buffer.") -(defvar checkdoc-output-mode-map nil - "Keymap used in `checkdoc-output-mode'.") +(defvar checkdoc-output-error-regex-alist + '(("^\\(.+\\.el\\):\\([0-9]+\\): " 1 2))) (defvar checkdoc-pending-errors nil "Non-nil when there are errors that have not been displayed yet.") -(if checkdoc-output-mode-map - nil - (setq checkdoc-output-mode-map (make-sparse-keymap)) - (if (not (string-match "XEmacs" emacs-version)) - (define-key checkdoc-output-mode-map [mouse-2] - 'checkdoc-find-error)) - (define-key checkdoc-output-mode-map "\C-c\C-c" 'checkdoc-find-error) - (define-key checkdoc-output-mode-map "\C-m" 'checkdoc-find-error)) - -(defun checkdoc-output-mode () - "Create and setup the buffer used to maintain checkdoc warnings. -\\\\[checkdoc-find-error] - Go to this error location." - (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) - "In a checkdoc diagnostic buffer, find the error under point." - (interactive (list last-input-event)) - (if event (posn-set-point (event-end e))) - (beginning-of-line) - (if (looking-at "\\(\\(\\w+\\|\\s_\\)+\\.el\\):\\([0-9]+\\):") - (let ((l (string-to-int (match-string 3))) - (f (match-string 1))) - (if (not (get-file-buffer f)) - (error "Can't find buffer %s" f)) - (switch-to-buffer-other-window (get-file-buffer f)) - (goto-line l)))) +(define-derived-mode checkdoc-output-mode compilation-mode "Checkdoc" + "Set up the major mode for the buffer containing the list of errors." + (set (make-local-variable 'compilation-error-regexp-alist) + checkdoc-output-error-regex-alist) + (set (make-local-variable 'compilation-mode-font-lock-keywords) + checkdoc-output-font-lock-keywords)) (defun checkdoc-buffer-label () "The name to use for a checkdoc buffer in the error list." -- cgit v1.2.3 From 07051573a81cc2eea9fb6db7409f37ad64842591 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 8 May 2004 16:38:33 +0000 Subject: (checkdoc-minor-mode): Doc fix. --- lisp/emacs-lisp/checkdoc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/checkdoc.el') diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 67de4a96223..2aba3ea254c 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1246,7 +1246,7 @@ generating a buffered list of errors." With prefix ARG, turn Checkdoc minor mode on iff ARG is positive. In Checkdoc minor mode, the usual bindings for `eval-defun' which is -bound to \\ \\[checkdoc-eval-defun] and `checkdoc-eval-current-buffer' are overridden to include +bound to \\\\[checkdoc-eval-defun] and `checkdoc-eval-current-buffer' are overridden to include checking of documentation strings. \\{checkdoc-minor-mode-map}" -- cgit v1.2.3