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

Long buffer name under MS Windows



Dear Bug Team!

A few days ago I've installed w3m for use in Emacs, and here is a
problem with responding to a post from a Google group: when I press
C-c C-c in order to commit the buffer to the textarea, Emacs complains
about "Invalid argument"; this argument was, in my case, the buffer
name
d:/cygwin/home/Sergio/.w3m/.textarea/http___groups.google.com_group_soc.culture.esperanto_post_hl=en&inreplyto=b2b0ab0c3d632603&reply_to=group&_done=%2Fgroup%2Fsoc.culture.esperanto%2Fbrowse_thread%2Fthread%2F28f5fa36af3f801f%3Fhl%3Den%26&-fid=2_type=textarea_name=body_id=24.txt

In fact, when I tried to save the buffer under this same name
manually, I received the very same error message; I guess the name is
too long for the Windows.

I've added two lines into the w3m-form-input-textarea-filename
function of w3m-form.el, trimming the filename length; and my problem
has gone:

(defun w3m-form-input-textarea-filename (url id)
  (let ((file "")
        (l-url (length url)); <++++++++++++++++++++++
	;; Interdit chars of Windows
	(replace (regexp-opt '("\\" "/" ":" "*" "?" "\"" "<" ">" "|"))))
    (if (> l-url 77) (setq url (substring url (- l-url 77))));
<++++++++++++++++++
    (while (string-match replace url)
      (setq file (concat file (substring url 0 (match-beginning 0)) "_"))
      (setq url (substring url (match-end 0))))
    (setq file (concat file url "-"))
    (while (string-match replace id)
      (setq file (concat file (substring id 0 (match-beginning 0)) "_"))
      (setq id (substring id (match-end 0))))
    (setq file (concat file id ".txt"))
    (convert-standard-filename file)))


================================================================

System Info to help track down your bug:
---------------------------------------
emacs-w3m-version
 => "1.4.4"
emacs-version
 => "GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600)\n of 2008-06-06 on BTW50800"
mule-version
 => "5.0 (SAKAKI)"
system-type
 => windows-nt
w3m-version
 => "w3m/0.5.1"
w3m-type
 => w3m-m17n
w3m-compile-options
 => ("lang=en" "m17n" "image" "color" "ansi-color" "mouse" "menu"
"cookie" "ssl" "ssl-verify" "external-uri-loader" "w3mmailer" "nntp"
"alarm" "mark")
w3m-language
 => nil
w3m-command-arguments
 => nil
w3m-command-arguments-alist
 => nil
w3m-command-environment
 => (("CYGWIN" . "binmode tty"))
w3m-input-coding-system
 => utf-8
w3m-output-coding-system
 => utf-8
w3m-use-mule-ucs
 => nil


-- 
Sergio