unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* current-word without arg may return nil?
@ 2004-07-01 15:03 Yoichi NAKAYAMA
  2004-07-03 18:22 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Yoichi NAKAYAMA @ 2004-07-01 15:03 UTC (permalink / raw)


Hello,
If the function `current-word' called without argument,
it may return nil? Its old behavior was to return "" at least.
Following change by rms implies that the above is true:

2003-09-22  Richard M. Stallman  <rms@gnu.org>

        * woman.el (woman-file-name, woman-follow-word):
        If current-word returns nil, use "".

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.

Regards,
-- 
Yoichi NAKAYAMA

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: current-word without arg may return nil?
  2004-07-01 15:03 current-word without arg may return nil? Yoichi NAKAYAMA
@ 2004-07-03 18:22 ` Richard Stallman
  2004-07-04  4:26   ` Yoichi NAKAYAMA
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2004-07-03 18:22 UTC (permalink / raw)
  Cc: emacs-devel

Yes, it can.  I will update the doc string.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: current-word without arg may return nil?
  2004-07-03 18:22 ` Richard Stallman
@ 2004-07-04  4:26   ` Yoichi NAKAYAMA
  2005-03-14 12:13     ` Yoichi NAKAYAMA
  0 siblings, 1 reply; 4+ messages in thread
From: Yoichi NAKAYAMA @ 2004-07-04  4:26 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: current-word without arg may return nil?
  2004-07-04  4:26   ` Yoichi NAKAYAMA
@ 2005-03-14 12:13     ` Yoichi NAKAYAMA
  0 siblings, 0 replies; 4+ messages in thread
From: Yoichi NAKAYAMA @ 2005-03-14 12:13 UTC (permalink / raw)


I found the following problem remains, which
cause error "Wrong type argument: stringp, nil"
-- 
Yoichi Nakayama

At Sun, 04 Jul 2004 13:26:07 +0900,
Yoichi NAKAYAMA wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-14 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-01 15:03 current-word without arg may return nil? Yoichi NAKAYAMA
2004-07-03 18:22 ` Richard Stallman
2004-07-04  4:26   ` Yoichi NAKAYAMA
2005-03-14 12:13     ` Yoichi NAKAYAMA

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).