emacs-devel
[Top][All Lists]
Advanced

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

Re: current-word without arg may return nil?


From: Yoichi NAKAYAMA
Subject: Re: current-word without arg may return nil?
Date: Sun, 04 Jul 2004 13:26:07 +0900
User-agent: Wanderlust/2.11.30 (Wonderwall) EMIKO/1.14.1 (Choanoflagellata) LIMIT/1.14.8 (土師の里) APEL/10.6 Emacs/21.3.50 (i686-pc-linux-gnu) MULE/5.0 (賢木)

At Sat, 03 Jul 2004 14:22:57 -0400,
Richard Stallman wrote:
> Yes, it can.  I will update the doc string.

At Fri, 02 Jul 2004 00:03:18 +0900,
Yoichi NAKAYAMA wrote:
> Then, some files still assume the return value is string, e.g.
> finder.el (finder-select), man.el (Man-follow-manual-reference)
> may cause wrong-type-argument error.

Fix against these follows.
  * finder.el (finder-current-item): Cause error on empty line.
  * man.el (Man-follow-manual-reference): If current-word returns
  nil, use "".

Regards,
-- 
Yoichi NAKAYAMA

Index: lisp/finder.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/finder.el,v
retrieving revision 1.59
diff -u -r1.59 finder.el
--- lisp/finder.el      26 Mar 2004 14:54:17 -0000      1.59
+++ lisp/finder.el      4 Jul 2004 04:24:07 -0000
@@ -301,11 +301,13 @@
     (finder-summary)))
 
 (defun finder-current-item ()
-  (if (and finder-headmark (< (point) finder-headmark))
-      (error "No keyword or filename on this line")
-    (save-excursion
-      (beginning-of-line)
-      (current-word))))
+  (let ((key (save-excursion
+              (beginning-of-line)
+              (current-word))))
+    (if (or (and finder-headmark (< (point) finder-headmark))
+           (= (length key) 0))
+       (error "No keyword or filename on this line")
+      key)))
 
 (defun finder-select ()
   "Select item on current line in a finder buffer."
Index: lisp/man.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/man.el,v
retrieving revision 1.136
diff -u -r1.136 man.el
--- lisp/man.el 26 Jun 2004 09:44:56 -0000      1.136
+++ lisp/man.el 4 Jul 2004 04:24:07 -0000
@@ -1263,7 +1263,7 @@
        (error "There are no references in the current man page")
      (list (let* ((default (or
                            (car (all-completions
-                                 (let ((word (Man-possibly-hyphenated-word)))
+                                 (let ((word (or 
(Man-possibly-hyphenated-word) "")))
                                    ;; strip a trailing '-':
                                    (if (string-match "-$" word)
                                        (substring word 0




reply via email to

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