[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Your last change to browse-url is bogus.
From: |
Johannes Weiner |
Subject: |
Re: Your last change to browse-url is bogus. |
Date: |
Wed, 12 Sep 2007 13:25:36 +0200 |
User-agent: |
Mutt/1.5.16 (2007-06-11) |
Hi Micha,
On Wed, Sep 12, 2007 at 01:09:57PM +0200, Michaël Cadilhac wrote:
> > Ah, okay. So what about an (&optional filename) for this function?
> > And if it's true, the character set to be translated is "[*\"()',=;? ]" and
> > percent is also encoded. If ommited (nil), just "[,)$]" will be translated.
> >
> > How does that sound?
>
> Yeah, it seems like a good idea : I already added encode-percent, which
> had this role but didn't integrate the regexps.
Yep.
> Great, so we're now here :
> --- browse-url.el 12 Sep 2007 10:49:04 +0200 1.61
> +++ browse-url.el 12 Sep 2007 13:04:52 +0200
> @@ -619,16 +619,19 @@
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; URL encoding
>
> -(defun browse-url-encode-url (url)
> - "Encode all `confusing' characters in URL."
> - (let ((encoded-url (copy-sequence url)))
> - (while (string-match "%" encoded-url)
> - (setq encoded-url (replace-match "%25" t t encoded-url)))
> - (while (string-match "[*\"()',=;? ]" encoded-url)
> +(defun browse-url-encode-url (url &optional filename-p)
> + "Encode all `confusing' characters in URL.
> +If FILENAME-P is nil, the confusing characters are [,)$].
> +Otherwise, the confusing characters are [*\"()',=;?% ]."
> + (let ((conf-char (if filename-p "[*\"()',=;?% ]" "[,)$]"))
> + (encoded-url (copy-sequence url))
> + (s 0))
> + (while (setq s (string-match conf-char encoded-url s))
> (setq encoded-url
> (replace-match (format "%%%x"
> (string-to-char (match-string 0
> encoded-url)))
> - t t encoded-url)))
> + t t encoded-url)
> + s (1+ s)))
> encoded-url))
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> @@ -703,7 +706,7 @@
> (or file-name-coding-system
> default-file-name-coding-system))))
> (if coding (setq file (encode-coding-string file coding))))
> - (setq file (browse-url-encode-url file))
> + (setq file (browse-url-encode-url file 'url-is-filename))
> (dolist (map browse-url-filename-alist)
> (when (and map (string-match (car map) file))
> (setq file (replace-match (cdr map) t nil file))))
Ack. Thank you!
Hannes
signature.asc
Description: Digital signature
- Your last change to browse-url is bogus., Michaël Cadilhac, 2007/09/12
- Re: Your last change to browse-url is bogus., YAMAMOTO Mitsuharu, 2007/09/12
- Re: Your last change to browse-url is bogus., Michaël Cadilhac, 2007/09/12
- Re: Your last change to browse-url is bogus., YAMAMOTO Mitsuharu, 2007/09/12
- Re: Your last change to browse-url is bogus., Michaël Cadilhac, 2007/09/12
- Re: Your last change to browse-url is bogus., YAMAMOTO Mitsuharu, 2007/09/17
- Re: Your last change to browse-url is bogus., Michaël Cadilhac, 2007/09/17
- Re: Your last change to browse-url is bogus., Stephen J. Turnbull, 2007/09/12
- Re: Your last change to browse-url is bogus., Stefan Monnier, 2007/09/12
- Re: Your last change to browse-url is bogus., Stephen J. Turnbull, 2007/09/13