unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* checkdoc and compile
@ 2004-04-23 18:22 Stefan Monnier
  2004-04-23 22:14 ` Re[1]: " Eric M. Ludlam
  2004-04-25 18:08 ` Richard Stallman
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2004-04-23 18:22 UTC (permalink / raw)
  Cc: emacs-devel


Any objection to my installing the following patch into Emacs's
CVS repository?


        Stefan


--- orig/lisp/emacs-lisp/checkdoc.el
+++ mod/lisp/emacs-lisp/checkdoc.el
@@ -2583,52 +2583,23 @@
 ;;; 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-output-mode-map>\\[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."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re[1]: checkdoc and compile
  2004-04-23 18:22 checkdoc and compile Stefan Monnier
@ 2004-04-23 22:14 ` Eric M. Ludlam
  2004-04-23 22:56   ` Miles Bader
  2004-04-25 18:08 ` Richard Stallman
  1 sibling, 1 reply; 4+ messages in thread
From: Eric M. Ludlam @ 2004-04-23 22:14 UTC (permalink / raw)
  Cc: emacs-devel

A clever enhancement.  That looks great.  Thanks for asking.

Eric

>>> Stefan Monnier <monnier@iro.umontreal.ca> seems to think that:
>
>Any objection to my installing the following patch into Emacs's
>CVS repository?
>
>
>        Stefan
>
>
>--- orig/lisp/emacs-lisp/checkdoc.el
>+++ mod/lisp/emacs-lisp/checkdoc.el
>@@ -2583,52 +2583,23 @@
> ;;; 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-output-mode-map>\\[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."
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: checkdoc and compile
  2004-04-23 22:14 ` Re[1]: " Eric M. Ludlam
@ 2004-04-23 22:56   ` Miles Bader
  0 siblings, 0 replies; 4+ messages in thread
From: Miles Bader @ 2004-04-23 22:56 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel

BTW, please don't quote the entire message you're replying to, unless
there's a reason to do so.

Thanks,

-Miles
-- 
Ich bin ein Virus. Mach' mit und kopiere mich in Deine .signature.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: checkdoc and compile
  2004-04-23 18:22 checkdoc and compile Stefan Monnier
  2004-04-23 22:14 ` Re[1]: " Eric M. Ludlam
@ 2004-04-25 18:08 ` Richard Stallman
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2004-04-25 18:08 UTC (permalink / raw)
  Cc: zappo, emacs-devel

    Any objection to my installing the following patch into Emacs's
    CVS repository?

Could you describe the intended user-visible result of the change?
It's hard work trying to figure that out from the code.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-25 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-23 18:22 checkdoc and compile Stefan Monnier
2004-04-23 22:14 ` Re[1]: " Eric M. Ludlam
2004-04-23 22:56   ` Miles Bader
2004-04-25 18:08 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).