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

Re: emacs-w3m cannot quit from a w3m-session



>>>>> In [emacs-w3m : No.09812] Andrea Russo wrote:

> I frequently use w3m-session.  When I try to quit from emacs-w3m with
> the `w3m-quit' command, an error happens, as you can see in the
> backtrace below, which also prevent me to quit from emacs with
> `save-buffers-kill-emacs'.

> Debugger entered--Lisp error: (args-out-of-range "" -1)
>   aref("" -1)
>   (eq (aref url (1- ...)) 47)
[...]
>   w3m-arrived-time("")
[...]
>   w3m-arrived-shutdown()
[...]
>   w3m-quit(nil)

Thank you for the report.  I guess it happens because a url that is
an empty string has been registered (or is about to be registered)
in your "~/.w3m/.arrived" file.  Isn't there a line that begins
with

 (""

in that file?  If such ones are found, there might be something
wrong that generates them in emacs-w3m.  Anyway, removing elements
beginning with  (""  will solve the problem.  An `element' means
the one which looks like:

 (""
  "PageTitle"
  nil
  (18263 30018 483795)
  nil
  nil)

But if you don't have such ones, try the attached patch below.
Though this is no more than a workaround, we will have to install
it in CVS for the moment.
--- w3m.el~	2007-12-03 22:17:55 +0000
+++ w3m.el	2007-12-06 04:42:18 +0000
@@ -2635,11 +2635,15 @@
 If SOFT is non-nil, use `intern-soft' insted."
   (let ((fn (if soft 'intern-soft 'intern))
 	(str (if (consp url)
-		 `(let ((url ,url))
-		    (if (eq (aref url (1- (length url))) ?/)
+		 `(let* ((url ,url)
+			 (len (length url)))
+		    (if (and (not (zerop len))
+			     (eq (aref url (1- len)) ?/))
 			(substring url 0 -1)
 		      url))
-	       `(if (eq (aref ,url (1- (length ,url))) ?/)
+	       `(if (let ((len (length ,url)))
+		      (and (not (zerop len))
+			   (eq (aref ,url (1- len)) ?/)))
 		    (substring ,url 0 -1)
 		  ,url))))
     `(,fn ,str w3m-arrived-db)))
Regards,