--- Begin Message ---
Subject: |
Checkdoc doesn't perform spellchecking of docstrings. |
Date: |
15 Jul 2002 14:57:53 +0200 |
User-agent: |
Gnus 5.9 on Emacs 21.2 |
Dear people,
This concerns the 1.29 version on checkdoc.el in CVS.
Checkdoc in not documented much, so I may have misunderstood how to
use it. In that case, sorry for the inconvenience.
I tried to convince checkdoc to perform spellchecking on docstrings
(by calling `checkdoc-ispell'), but could not accomplish this. I
suspect this is due to a bug in checkdoc.
I browsed the code of checkdoc a bit and observed that spellchecking
is performed by `checkdoc-ispell-docstring-engine', which tests two
user option variables to see if spellchecking should or should not be
performed. These two are `checkdoc-spellcheck-documentation-flag' and
`checkdoc-autofix-flag'. However, these two are adjusted by let
statements in functions (indirectly) calling `checkdoc-ispell-
docstring-engine'. As a result both are always nil by the time they
reach `checkdoc-ispell-docstring-engine' when it is called for a
docstring, and spellchecking is not performed.
I think I've managed to find the reason why `checkdoc-spellcheck-
documentation-flag' is set incorrectly and fixed this in the patch
below. What exactly goes wrong with `checkdoc-autofix-flag' eludes
me, so far. The patch works around this by not letting `checkdoc-
ispell-docstring-engine' test `checkdoc-autofix-flag'.
I'm going on vacation the next couple of weeks, so I can't work on the
problem for a while. Hence, the half finished patch. I hope it's
still useful.
Regards,
Lute.
*** emacs-cvs/lisp/emacs-lisp/checkdoc.el Sun Jul 14 17:26:01 2002
--- checkdoc.el Mon Jul 15 14:15:30 2002
***************
*** 468,473 ****
(let ((status (list "Checking..." "-" "-" "-"))
(checkdoc-spellcheck-documentation-flag
! (member checkdoc-spellcheck-documentation-flag
! '(buffer interactive t)))
;; if the user set autofix to never, then that breaks the
;; obviously requested asking implied by using this function.
--- 468,473 ----
(let ((status (list "Checking..." "-" "-" "-"))
(checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(buffer interactive t))))
;; if the user set autofix to never, then that breaks the
;; obviously requested asking implied by using this function.
***************
*** 536,541 ****
(interactive "P")
(let ((checkdoc-spellcheck-documentation-flag
! (member checkdoc-spellcheck-documentation-flag
! '(interactive t))))
(checkdoc-interactive-loop start-here showstatus 'checkdoc-next-error)))
--- 536,541 ----
(interactive "P")
(let ((checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(interactive t)))))
(checkdoc-interactive-loop start-here showstatus 'checkdoc-next-error)))
***************
*** 551,556 ****
(interactive "P")
(let ((checkdoc-spellcheck-documentation-flag
! (member checkdoc-spellcheck-documentation-flag
! '(interactive t))))
(checkdoc-interactive-loop start-here showstatus
'checkdoc-next-message-error)))
--- 551,556 ----
(interactive "P")
(let ((checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(interactive t)))))
(checkdoc-interactive-loop start-here showstatus
'checkdoc-next-message-error)))
***************
*** 570,575 ****
;; Assign a flag to spellcheck flag
(checkdoc-spellcheck-documentation-flag
! (member checkdoc-spellcheck-documentation-flag
! '(buffer interactive t)))
;; Fetch the error list
(err-list (list (funcall findfunc nil)))
--- 570,575 ----
;; Assign a flag to spellcheck flag
(checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(buffer interactive t))))
;; Fetch the error list
(err-list (list (funcall findfunc nil)))
***************
*** 804,808 ****
;; Assign a flag to spellcheck flag
(let ((checkdoc-spellcheck-documentation-flag
! (memq checkdoc-spellcheck-documentation-flag '(buffer t)))
(checkdoc-autofix-flag (if take-notes 'never
checkdoc-autofix-flag))
--- 804,809 ----
;; Assign a flag to spellcheck flag
(let ((checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(buffer t))))
(checkdoc-autofix-flag (if take-notes 'never
checkdoc-autofix-flag))
***************
*** 848,853 ****
;; Assign a flag to spellcheck flag
(checkdoc-spellcheck-documentation-flag
! (member checkdoc-spellcheck-documentation-flag
! '(buffer t)))
(checkdoc-autofix-flag (if take-notes 'never
checkdoc-autofix-flag))
--- 849,854 ----
;; Assign a flag to spellcheck flag
(checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(buffer t))))
(checkdoc-autofix-flag (if take-notes 'never
checkdoc-autofix-flag))
***************
*** 892,897 ****
(error "Can only check comments for a file buffer"))
(let* ((checkdoc-spellcheck-documentation-flag
! (member checkdoc-spellcheck-documentation-flag
! '(buffer t)))
(checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag))
(e (checkdoc-file-comments-engine))
--- 893,898 ----
(error "Can only check comments for a file buffer"))
(let* ((checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(buffer t))))
(checkdoc-autofix-flag (if take-notes 'never checkdoc-autofix-flag))
(e (checkdoc-file-comments-engine))
***************
*** 972,977 ****
(skip-chars-forward " \n\t")
(let* ((checkdoc-spellcheck-documentation-flag
! (member checkdoc-spellcheck-documentation-flag
! '(defun t)))
(beg (save-excursion (beginning-of-defun) (point)))
(end (save-excursion (end-of-defun) (point)))
--- 973,978 ----
(skip-chars-forward " \n\t")
(let* ((checkdoc-spellcheck-documentation-flag
! (car (memq checkdoc-spellcheck-documentation-flag
! '(defun t))))
(beg (save-excursion (beginning-of-defun) (point)))
(end (save-excursion (end-of-defun) (point)))
***************
*** 2053,2057 ****
;; If the user wants no questions or fixing, then we must
;; disable spell checking as not useful.
! (not checkdoc-autofix-flag)
(eq checkdoc-autofix-flag 'never))
nil
--- 2054,2062 ----
;; If the user wants no questions or fixing, then we must
;; disable spell checking as not useful.
! ;; FIXME: Somehow, `checkdoc-autofix-flag' is always nil
! ;; when `checkdoc-ispell-docstring-engine' is called to be
! ;; used on a docstring. As a workround, I commented out the
! ;; next line.
! ;; (not checkdoc-autofix-flag)
(eq checkdoc-autofix-flag 'never))
nil
--
Lute Kamstra <Lute.Kamstra@cwi.nl>
CWI department PNA4
--- End Message ---