diff options
author | Lute Kamstra <lute@gnu.org> | 2005-02-11 16:09:50 +0000 |
---|---|---|
committer | Lute Kamstra <lute@gnu.org> | 2005-02-11 16:09:50 +0000 |
commit | b7a2a69670f86564c37c89044ca6646ed6c50187 (patch) | |
tree | 1d0234b63546421bd2de9ca8e4ad446ac1ee6309 /lisp/apropos.el | |
parent | df21b47d2f82d84385e366730286b44acb936ac5 (diff) | |
download | emacs-b7a2a69670f86564c37c89044ca6646ed6c50187.tar.gz |
(apropos-score-doc): Prevent division by zero.
Diffstat (limited to 'lisp/apropos.el')
-rw-r--r-- | lisp/apropos.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el index 1befefe8814..ae8a4ad628c 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -1,6 +1,6 @@ ;;; apropos.el --- apropos commands for users and programmers -;; Copyright (C) 1989,94,1995,2001,02,03,2004 Free Software Foundation, Inc. +;; Copyright (C) 1989,94,1995,2001,02,03,04,2005 Free Software Foundation, Inc. ;; Author: Joe Wells <jbw@bigbird.bu.edu> ;; Rewritten: Daniel Pfeiffer <occitan@esperanto.org> @@ -322,13 +322,13 @@ Value is a list of offsets of the words into the string." (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)) + (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." |