aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2010-11-08 15:01:01 -0500
committerStefan Monnier2010-11-08 15:01:01 -0500
commit1398b795ef5edce34320a58d276f34cd5eee8f29 (patch)
tree43eb7b06f2ae51f4b95e5f7f4b937169545ca30d /lisp
parentdb94771e2329c5943559c8e2dd5ee1e35172b26f (diff)
downloademacs-1398b795ef5edce34320a58d276f34cd5eee8f29.tar.gz
emacs-1398b795ef5edce34320a58d276f34cd5eee8f29.zip
* lisp/emacs-lisp/checkdoc.el (checkdoc-display-status-buffer)
(checkdoc-interactive-loop, checkdoc-recursive-edit): Avoid princ-list. (checkdoc-syntax-table): Initialize in the declaration. (emacs-lisp-mode-hook): Use just checkdoc-minor-mode now that it turns the mode on unconditionally.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/checkdoc.el147
2 files changed, 77 insertions, 76 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a7dc4e73d0c..0a61c68e53a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12010-11-08 Stefan Monnier <monnier@iro.umontreal.ca> 12010-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/checkdoc.el (checkdoc-display-status-buffer)
4 (checkdoc-interactive-loop, checkdoc-recursive-edit): Avoid princ-list.
5 (checkdoc-syntax-table): Initialize in the declaration.
6 (emacs-lisp-mode-hook): Use just checkdoc-minor-mode now that it turns
7 the mode on unconditionally.
8
3 * emacs-lisp/cl-macs.el (extent-data, extent-face, extent-priority) 9 * emacs-lisp/cl-macs.el (extent-data, extent-face, extent-priority)
4 (extent-end-position, extent-start-position): Remove setf method for 10 (extent-end-position, extent-start-position): Remove setf method for
5 non-existing functions (bug#7319). 11 non-existing functions (bug#7319).
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index a7fe7d02ac0..41de84748dd 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -201,9 +201,9 @@ without asking, and complex changes are made by asking the user first.
201The value `never' is the same as nil, never ask or change anything." 201The value `never' is the same as nil, never ask or change anything."
202 :group 'checkdoc 202 :group 'checkdoc
203 :type '(choice (const automatic) 203 :type '(choice (const automatic)
204 (const query) 204 (const query)
205 (const never) 205 (const never)
206 (other :tag "semiautomatic" semiautomatic))) 206 (other :tag "semiautomatic" semiautomatic)))
207 207
208(defcustom checkdoc-bouncy-flag t 208(defcustom checkdoc-bouncy-flag t
209 "Non-nil means to \"bounce\" to auto-fix locations. 209 "Non-nil means to \"bounce\" to auto-fix locations.
@@ -250,10 +250,10 @@ system. Possible values are:
250 t - Always spell-check" 250 t - Always spell-check"
251 :group 'checkdoc 251 :group 'checkdoc
252 :type '(choice (const nil) 252 :type '(choice (const nil)
253 (const defun) 253 (const defun)
254 (const buffer) 254 (const buffer)
255 (const interactive) 255 (const interactive)
256 (const t))) 256 (const t)))
257 257
258(defvar checkdoc-ispell-lisp-words 258(defvar checkdoc-ispell-lisp-words
259 '("alist" "emacs" "etags" "keymap" "paren" "regexp" "sexp" "xemacs") 259 '("alist" "emacs" "etags" "keymap" "paren" "regexp" "sexp" "xemacs")
@@ -429,19 +429,15 @@ and experimental check. Do not modify this list without setting
429the value of `checkdoc-common-verbs-regexp' to nil which cause it to 429the value of `checkdoc-common-verbs-regexp' to nil which cause it to
430be re-created.") 430be re-created.")
431 431
432(defvar checkdoc-syntax-table nil 432(defvar checkdoc-syntax-table
433 (let ((st (make-syntax-table emacs-lisp-mode-syntax-table)))
434 ;; When dealing with syntax in doc strings, make sure that - are
435 ;; encompassed in words so we can use cheap \\> to get the end of a symbol,
436 ;; not the end of a word in a conglomerate.
437 (modify-syntax-entry ?- "w" checkdoc-syntax-table)
438 st)
433 "Syntax table used by checkdoc in document strings.") 439 "Syntax table used by checkdoc in document strings.")
434 440
435(if checkdoc-syntax-table
436 nil
437 (setq checkdoc-syntax-table (copy-syntax-table emacs-lisp-mode-syntax-table))
438 ;; When dealing with syntax in doc strings, make sure that - are encompassed
439 ;; in words so we can use cheap \\> to get the end of a symbol, not the
440 ;; end of a word in a conglomerate.
441 (modify-syntax-entry ?- "w" checkdoc-syntax-table)
442 )
443
444
445;;; Compatibility 441;;; Compatibility
446;; 442;;
447(defalias 'checkdoc-make-overlay 443(defalias 'checkdoc-make-overlay
@@ -515,12 +511,11 @@ CHECK is a list of four strings stating the current status of each
515test; the nth string describes the status of the nth test." 511test; the nth string describes the status of the nth test."
516 (let (temp-buffer-setup-hook) 512 (let (temp-buffer-setup-hook)
517 (with-output-to-temp-buffer "*Checkdoc Status*" 513 (with-output-to-temp-buffer "*Checkdoc Status*"
518 (princ-list 514 (mapc #'princ
519 "Buffer comments and tags: " (nth 0 check) "\n" 515 (list "Buffer comments and tags: " (nth 0 check)
520 "Documentation style: " (nth 1 check) "\n" 516 "\nDocumentation style: " (nth 1 check)
521 "Message/Query text style: " (nth 2 check) "\n" 517 "\nMessage/Query text style: " (nth 2 check)
522 "Unwanted Spaces: " (nth 3 check) 518 "\nUnwanted Spaces: " (nth 3 check)))))
523 )))
524 (shrink-window-if-larger-than-buffer 519 (shrink-window-if-larger-than-buffer
525 (get-buffer-window "*Checkdoc Status*")) 520 (get-buffer-window "*Checkdoc Status*"))
526 (message nil) 521 (message nil)
@@ -623,7 +618,7 @@ style."
623 (recenter (/ (- (window-height) l) 2)))) 618 (recenter (/ (- (window-height) l) 2))))
624 (recenter)) 619 (recenter))
625 (message "%s (C-h,%se,n,p,q)" (checkdoc-error-text 620 (message "%s (C-h,%se,n,p,q)" (checkdoc-error-text
626 (car (car err-list))) 621 (car (car err-list)))
627 (if (checkdoc-error-unfixable (car (car err-list))) 622 (if (checkdoc-error-unfixable (car (car err-list)))
628 "" "f,")) 623 "" "f,"))
629 (save-excursion 624 (save-excursion
@@ -713,20 +708,21 @@ style."
713 (delete-window (get-buffer-window "*Checkdoc Help*")) 708 (delete-window (get-buffer-window "*Checkdoc Help*"))
714 (kill-buffer "*Checkdoc Help*")) 709 (kill-buffer "*Checkdoc Help*"))
715 (with-output-to-temp-buffer "*Checkdoc Help*" 710 (with-output-to-temp-buffer "*Checkdoc Help*"
716 (princ-list 711 (with-current-buffer standard-output
717 "Checkdoc Keyboard Summary:\n" 712 (insert
718 (if (checkdoc-error-unfixable (car (car err-list))) 713 "Checkdoc Keyboard Summary:\n"
719 "" 714 (if (checkdoc-error-unfixable (car (car err-list)))
720 (concat 715 ""
721 "f, y - auto Fix this warning without asking (if\ 716 (concat
717 "f, y - auto Fix this warning without asking (if\
722 available.)\n" 718 available.)\n"
723 " Very complex operations will still query.\n") 719 " Very complex operations will still query.\n")
724 ) 720 )
725 "e - Enter recursive Edit. Press C-M-c to exit.\n" 721 "e - Enter recursive Edit. Press C-M-c to exit.\n"
726 "SPC, n - skip to the Next error.\n" 722 "SPC, n - skip to the Next error.\n"
727 "DEL, p - skip to the Previous error.\n" 723 "DEL, p - skip to the Previous error.\n"
728 "q - Quit checkdoc.\n" 724 "q - Quit checkdoc.\n"
729 "C-h - Toggle this help buffer.")) 725 "C-h - Toggle this help buffer.")))
730 (shrink-window-if-larger-than-buffer 726 (shrink-window-if-larger-than-buffer
731 (get-buffer-window "*Checkdoc Help*")))))) 727 (get-buffer-window "*Checkdoc Help*"))))))
732 (if cdo (checkdoc-delete-overlay cdo))))) 728 (if cdo (checkdoc-delete-overlay cdo)))))
@@ -826,9 +822,9 @@ assumes that the cursor is already positioned to perform the fix."
826 "Enter recursive edit to permit a user to fix some error checkdoc has found. 822 "Enter recursive edit to permit a user to fix some error checkdoc has found.
827MSG is the error that was found, which is displayed in a help buffer." 823MSG is the error that was found, which is displayed in a help buffer."
828 (with-output-to-temp-buffer "*Checkdoc Help*" 824 (with-output-to-temp-buffer "*Checkdoc Help*"
829 (princ-list 825 (mapc #'princ
830 "Error message:\n " msg 826 (list "Error message:\n " msg
831 "\n\nEdit to fix this problem, and press C-M-c to continue.")) 827 "\n\nEdit to fix this problem, and press C-M-c to continue.")))
832 (shrink-window-if-larger-than-buffer 828 (shrink-window-if-larger-than-buffer
833 (get-buffer-window "*Checkdoc Help*")) 829 (get-buffer-window "*Checkdoc Help*"))
834 (message "When you're done editing press C-M-c to continue.") 830 (message "When you're done editing press C-M-c to continue.")
@@ -947,14 +943,14 @@ if there is one."
947 (interactive "P") 943 (interactive "P")
948 (if take-notes (checkdoc-start-section "checkdoc-comments")) 944 (if take-notes (checkdoc-start-section "checkdoc-comments"))
949 (if (not buffer-file-name) 945 (if (not buffer-file-name)
950 (error "Can only check comments for a file buffer")) 946 (error "Can only check comments for a file buffer"))
951 (let* ((checkdoc-spellcheck-documentation-flag 947 (let* ((checkdoc-spellcheck-documentation-flag
952 (car (memq checkdoc-spellcheck-documentation-flag 948 (car (memq checkdoc-spellcheck-documentation-flag
953 '(buffer t)))) 949 '(buffer t))))
954 (checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag)) 950 (checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag))
955 (e (checkdoc-file-comments-engine)) 951 (e (checkdoc-file-comments-engine))
956 (checkdoc-generate-compile-warnings-flag 952 (checkdoc-generate-compile-warnings-flag
957 (or take-notes checkdoc-generate-compile-warnings-flag))) 953 (or take-notes checkdoc-generate-compile-warnings-flag)))
958 (if e (error "%s" (checkdoc-error-text e))) 954 (if e (error "%s" (checkdoc-error-text e)))
959 (checkdoc-show-diagnostics) 955 (checkdoc-show-diagnostics)
960 e)) 956 e))
@@ -970,8 +966,8 @@ Optional argument INTERACT permits more interactive fixing."
970 (if take-notes (checkdoc-start-section "checkdoc-rogue-spaces")) 966 (if take-notes (checkdoc-start-section "checkdoc-rogue-spaces"))
971 (let* ((checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag)) 967 (let* ((checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag))
972 (e (checkdoc-rogue-space-check-engine nil nil interact)) 968 (e (checkdoc-rogue-space-check-engine nil nil interact))
973 (checkdoc-generate-compile-warnings-flag 969 (checkdoc-generate-compile-warnings-flag
974 (or take-notes checkdoc-generate-compile-warnings-flag))) 970 (or take-notes checkdoc-generate-compile-warnings-flag)))
975 (if (not (called-interactively-p 'interactive)) 971 (if (not (called-interactively-p 'interactive))
976 e 972 e
977 (if e 973 (if e
@@ -1210,34 +1206,34 @@ generating a buffered list of errors."
1210;; Add in a menubar with easy-menu 1206;; Add in a menubar with easy-menu
1211 1207
1212(easy-menu-define 1208(easy-menu-define
1213 nil checkdoc-minor-mode-map "Checkdoc Minor Mode Menu" 1209 nil checkdoc-minor-mode-map "Checkdoc Minor Mode Menu"
1214 '("CheckDoc" 1210 '("CheckDoc"
1215 ["Interactive Buffer Style Check" checkdoc t] 1211 ["Interactive Buffer Style Check" checkdoc t]
1216 ["Interactive Buffer Style and Spelling Check" checkdoc-ispell t] 1212 ["Interactive Buffer Style and Spelling Check" checkdoc-ispell t]
1217 ["Check Buffer" checkdoc-current-buffer t] 1213 ["Check Buffer" checkdoc-current-buffer t]
1218 ["Check and Spell Buffer" checkdoc-ispell-current-buffer t] 1214 ["Check and Spell Buffer" checkdoc-ispell-current-buffer t]
1219 "---" 1215 "---"
1220 ["Interactive Style Check" checkdoc-interactive t] 1216 ["Interactive Style Check" checkdoc-interactive t]
1221 ["Interactive Style and Spelling Check" checkdoc-ispell-interactive t] 1217 ["Interactive Style and Spelling Check" checkdoc-ispell-interactive t]
1222 ["Find First Style Error" checkdoc-start t] 1218 ["Find First Style Error" checkdoc-start t]
1223 ["Find First Style or Spelling Error" checkdoc-ispell-start t] 1219 ["Find First Style or Spelling Error" checkdoc-ispell-start t]
1224 ["Next Style Error" checkdoc-continue t] 1220 ["Next Style Error" checkdoc-continue t]
1225 ["Next Style or Spelling Error" checkdoc-ispell-continue t] 1221 ["Next Style or Spelling Error" checkdoc-ispell-continue t]
1226 ["Interactive Message Text Style Check" checkdoc-message-interactive t] 1222 ["Interactive Message Text Style Check" checkdoc-message-interactive t]
1227 ["Interactive Message Text Style and Spelling Check" 1223 ["Interactive Message Text Style and Spelling Check"
1228 checkdoc-ispell-message-interactive t] 1224 checkdoc-ispell-message-interactive t]
1229 ["Check Message Text" checkdoc-message-text t] 1225 ["Check Message Text" checkdoc-message-text t]
1230 ["Check and Spell Message Text" checkdoc-ispell-message-text t] 1226 ["Check and Spell Message Text" checkdoc-ispell-message-text t]
1231 ["Check Comment Style" checkdoc-comments buffer-file-name] 1227 ["Check Comment Style" checkdoc-comments buffer-file-name]
1232 ["Check Comment Style and Spelling" checkdoc-ispell-comments 1228 ["Check Comment Style and Spelling" checkdoc-ispell-comments
1233 buffer-file-name] 1229 buffer-file-name]
1234 ["Check for Rogue Spaces" checkdoc-rogue-spaces t] 1230 ["Check for Rogue Spaces" checkdoc-rogue-spaces t]
1235 "---" 1231 "---"
1236 ["Check Defun" checkdoc-defun t] 1232 ["Check Defun" checkdoc-defun t]
1237 ["Check and Spell Defun" checkdoc-ispell-defun t] 1233 ["Check and Spell Defun" checkdoc-ispell-defun t]
1238 ["Check and Evaluate Defun" checkdoc-eval-defun t] 1234 ["Check and Evaluate Defun" checkdoc-eval-defun t]
1239 ["Check and Evaluate Buffer" checkdoc-eval-current-buffer t] 1235 ["Check and Evaluate Buffer" checkdoc-eval-current-buffer t]
1240 )) 1236 ))
1241;; XEmacs requires some weird stuff to add this menu in a minor mode. 1237;; XEmacs requires some weird stuff to add this menu in a minor mode.
1242;; What is it? 1238;; What is it?
1243 1239
@@ -2657,8 +2653,7 @@ function called to create the messages."
2657 (setq checkdoc-pending-errors nil) 2653 (setq checkdoc-pending-errors nil)
2658 nil))) 2654 nil)))
2659 2655
2660(custom-add-option 'emacs-lisp-mode-hook 2656(custom-add-option 'emacs-lisp-mode-hook 'checkdoc-minor-mode)
2661 (lambda () (checkdoc-minor-mode 1)))
2662 2657
2663(add-to-list 'debug-ignored-errors 2658(add-to-list 'debug-ignored-errors
2664 "Argument `.*' should appear (as .*) in the doc string") 2659 "Argument `.*' should appear (as .*) in the doc string")