bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Checkdoc doesn't perform spellchecking of docstrings.


From: Lute Kamstra
Subject: Checkdoc doesn't perform spellchecking of docstrings.
Date: 08 Aug 2002 16:05:13 +0200
User-agent: Gnus 5.9 on Emacs 21.2

Hello everybody,

I sent the following bug report concerning `checkdoc.el' a couple of
weeks ago.  Because it included a diff against the latest cvs version,
I sent it to emacs-pretest-bug@gnu.org.  This may have been somewhat
misleading as the bug was not introduced recently.  It was already
present in Emacs 20.7.

In short, checkdoc doesn't perform spell checking of docstrings and
message stings as advertised.  This can be easily observed by
introducing a few spelling errors in the docstrings of a lisp file and
doing M-x checkdoc-ispell.  (In contrast, M-x checkdoc-ispell-defun on
a defun with spelling errors in its docstring works fine.)

I was wondering if somebody has been working on this already.  Fixing
it seems rather important because that would help catching those nasty
typos in Emacs' documentation.

I've looked into it a little bit further since my previous bug report,
but haven't been able to fix the bug myself.  I do understand why the
bug occurs now, but a solution is not obvious (to me, at least).  If
someone of you is interested in working on it, I can send some more
information (will be a bit of work to explain it clearly).  Otherwise,
I will just continue to work on it myself.

Regards,

  Lute.

--- 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 ---

-- 
Lute Kamstra  <Lute.Kamstra@cwi.nl>
CWI  department PNA4
[Echelon material: IMF supercomputer CNCIS]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]