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

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

Division by zero in `apropos-score-doc'.


From: Lute Kamstra
Subject: Division by zero in `apropos-score-doc'.
Date: Fri, 11 Feb 2005 14:11:05 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

When I do C-h a RET, I get an "Arithmetic error" due to a division by
zero in `apropos-score-doc'.  The patch below fixes this bug.  If
nobody objects, I'll commit it in a few days.


Lute.



*** lisp/apropos.el     17 Dec 2004 15:17:22 -0000      1.100
--- lisp/apropos.el     11 Feb 2005 12:55:01 -0000
***************
*** 322,334 ****
  
  (defun apropos-score-doc (doc)
    "Return apropos score for documentation string DOC."
!   (if doc
!       (let ((score 0)
!           (l (length doc))
!           i)
!       (dolist (s (apropos-calc-scores doc apropos-all-words) score)
!         (setq score (+ score 50 (/ (* (- l s) 50) l)))))
!       0))
  
  (defun apropos-score-symbol (symbol &optional weight)
    "Return apropos score for SYMBOL."
--- 322,334 ----
  
  (defun apropos-score-doc (doc)
    "Return apropos score for documentation string DOC."
!   (let ((l (length doc)))
!     (if (> l 0)
!       (let ((score 0)
!             i)
!         (dolist (s (apropos-calc-scores doc apropos-all-words) score)
!           (setq score (+ score 50 (/ (* (- l s) 50) l)))))
!       0)))
  
  (defun apropos-score-symbol (symbol &optional weight)
    "Return apropos score for SYMBOL."




reply via email to

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