comparison lisp/emacs-lisp/checkdoc.el @ 54873:bbf96a27b6c5

(checkdoc-output-mode-map, checkdoc-find-error-mouse, checkdoc-find-error): Use posn-set-point to merge the mouse and non-mouse case.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 14 Apr 2004 17:48:47 +0000
parents 79d56d8a420a
children 4a1324ad659c
comparison
equal deleted inserted replaced
54872:367886fbcfd9 54873:bbf96a27b6c5
651 (progn 651 (progn
652 (message "A Fix was not available.") 652 (message "A Fix was not available.")
653 (sit-for 2)) 653 (sit-for 2))
654 (setq err-list (cdr err-list)))) 654 (setq err-list (cdr err-list))))
655 (beginning-of-defun) 655 (beginning-of-defun)
656 (let ((pe (car err-list)) 656 (let ((ne (funcall findfunc nil)))
657 (ne (funcall findfunc nil)))
658 (if ne 657 (if ne
659 (setq err-list (cons ne err-list)) 658 (setq err-list (cons ne err-list))
660 (cond ((not err-list) 659 (cond ((not err-list)
661 (message "No More Stylistic Errors.") 660 (message "No More Stylistic Errors.")
662 (sit-for 2)) 661 (sit-for 2))
898 "Find the next doc string in the current buffer which has a style error. 897 "Find the next doc string in the current buffer which has a style error.
899 Prefix argument TAKE-NOTES means to continue through the whole buffer and 898 Prefix argument TAKE-NOTES means to continue through the whole buffer and
900 save warnings in a separate buffer. Second optional argument START-POINT 899 save warnings in a separate buffer. Second optional argument START-POINT
901 is the starting location. If this is nil, `point-min' is used instead." 900 is the starting location. If this is nil, `point-min' is used instead."
902 (interactive "P") 901 (interactive "P")
903 (let ((wrong nil) (msg nil) (errors nil) 902 (let ((wrong nil) (msg nil)
904 ;; Assign a flag to spellcheck flag 903 ;; Assign a flag to spellcheck flag
905 (checkdoc-spellcheck-documentation-flag 904 (checkdoc-spellcheck-documentation-flag
906 (car (memq checkdoc-spellcheck-documentation-flag 905 (car (memq checkdoc-spellcheck-documentation-flag
907 '(buffer t)))) 906 '(buffer t))))
908 (checkdoc-autofix-flag (if take-notes 'never 907 (checkdoc-autofix-flag (if take-notes 'never
2596 (if checkdoc-output-mode-map 2595 (if checkdoc-output-mode-map
2597 nil 2596 nil
2598 (setq checkdoc-output-mode-map (make-sparse-keymap)) 2597 (setq checkdoc-output-mode-map (make-sparse-keymap))
2599 (if (not (string-match "XEmacs" emacs-version)) 2598 (if (not (string-match "XEmacs" emacs-version))
2600 (define-key checkdoc-output-mode-map [mouse-2] 2599 (define-key checkdoc-output-mode-map [mouse-2]
2601 'checkdoc-find-error-mouse)) 2600 'checkdoc-find-error))
2602 (define-key checkdoc-output-mode-map "\C-c\C-c" 'checkdoc-find-error) 2601 (define-key checkdoc-output-mode-map "\C-c\C-c" 'checkdoc-find-error)
2603 (define-key checkdoc-output-mode-map "\C-m" 'checkdoc-find-error)) 2602 (define-key checkdoc-output-mode-map "\C-m" 'checkdoc-find-error))
2604 2603
2605 (defun checkdoc-output-mode () 2604 (defun checkdoc-output-mode ()
2606 "Create and setup the buffer used to maintain checkdoc warnings. 2605 "Create and setup the buffer used to maintain checkdoc warnings.
2607 \\<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."
2608 \\[checkdoc-find-error-mouse] - Goto the error clicked on."
2609 (if (get-buffer checkdoc-diagnostic-buffer) 2607 (if (get-buffer checkdoc-diagnostic-buffer)
2610 (get-buffer checkdoc-diagnostic-buffer) 2608 (get-buffer checkdoc-diagnostic-buffer)
2611 (save-excursion 2609 (save-excursion
2612 (set-buffer (get-buffer-create checkdoc-diagnostic-buffer)) 2610 (set-buffer (get-buffer-create checkdoc-diagnostic-buffer))
2613 (kill-all-local-variables) 2611 (kill-all-local-variables)
2617 '((checkdoc-output-font-lock-keywords) t t ((?- . "w") (?_ . "w")))) 2615 '((checkdoc-output-font-lock-keywords) t t ((?- . "w") (?_ . "w"))))
2618 (use-local-map checkdoc-output-mode-map) 2616 (use-local-map checkdoc-output-mode-map)
2619 (run-hooks 'checkdoc-output-mode-hook) 2617 (run-hooks 'checkdoc-output-mode-hook)
2620 (current-buffer)))) 2618 (current-buffer))))
2621 2619
2622 (defun checkdoc-find-error-mouse (e) 2620 (defalias 'checkdoc-find-error-mouse 'checkdoc-find-error)
2623 ;; checkdoc-params: (e) 2621 (defun checkdoc-find-error (&optional event)
2624 "Call `checkdoc-find-error' where the user clicks the mouse."
2625 (interactive "e")
2626 (mouse-set-point e)
2627 (checkdoc-find-error))
2628
2629 (defun checkdoc-find-error ()
2630 "In a checkdoc diagnostic buffer, find the error under point." 2622 "In a checkdoc diagnostic buffer, find the error under point."
2631 (interactive) 2623 (interactive (list last-input-event))
2624 (if event (posn-set-point (event-end e)))
2632 (beginning-of-line) 2625 (beginning-of-line)
2633 (if (looking-at "\\(\\(\\w+\\|\\s_\\)+\\.el\\):\\([0-9]+\\):") 2626 (if (looking-at "\\(\\(\\w+\\|\\s_\\)+\\.el\\):\\([0-9]+\\):")
2634 (let ((l (string-to-int (match-string 3))) 2627 (let ((l (string-to-int (match-string 3)))
2635 (f (match-string 1))) 2628 (f (match-string 1)))
2636 (if (not (get-file-buffer f)) 2629 (if (not (get-file-buffer f))