[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
w3m-expand-url
- From: Naohiro Aota <nao.aota@xxxxxxxxx>
- Date: Wed, 16 May 2007 23:53:57 +0900 (JST)
- X-ml-name: emacs-w3m
- X-mail-count: 09441
青田です。
(w3m-expand-url "?" "http://example.com/?foo=bar")
=> "http://example.com/?foo=bar"
(w3m-expand-url "foo.cgi?#hoge" "http://example.com/")
=> "http://example.com/foo.cgi?#hoge"
となりますが、それぞれ
(w3m-expand-url "?" "http://example.com/?foo=bar")
=> "http://example.com/"
(w3m-expand-url "foo.cgi?#hoge" "http://example.com/")
=> "http://example.com/foo.cgi#hoge"
となるべきではないでしょうか?
実際にGMailは上の場合にクエリをクリアしたURLを取得することを期待しているようで、
今のemacs-w3mでは検索がうまく動かないことがあります。
URLが"?"で始まる時以外は、結果的にうまくクエリをクリアできているようなので、
URLが"?"で始まる時だけにURLの先頭に"./"を追加することで対処しています。
Index: ChangeLog
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3008
diff -u -r1.3008 ChangeLog
--- ChangeLog 16 May 2007 11:26:57 -0000 1.3008
+++ ChangeLog 16 May 2007 14:36:29 -0000
@@ -1,3 +1,8 @@
+2007-05-16 Naohiro Aota <nao.aota@xxxxxxxxx>
+
+ * w3m.el (w3m-expand-url): Remove query strings when expanding URL like
+ "foo.cgi?#bar".Add "./" to top of URL when expanding "?hoge".
+
2007-05-16 Katsumi Yamaoka <yamaoka@xxxxxxx>
* w3m-ems.el (w3m-switch-to-buffer): Work just like switch-to-buffer.
Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.1278
diff -u -r1.1278 w3m.el
--- w3m.el 11 May 2007 00:56:17 -0000 1.1278
+++ w3m.el 16 May 2007 14:36:55 -0000
@@ -5928,10 +5928,17 @@
(= (match-beginning 9) (length url)))
(setq url (substring url 0 (match-beginning 8)))
(w3m-string-match-url-components url))
+ (when (eq ?? (aref url 0))
+ (setq url (concat "./" url))
+ (w3m-string-match-url-components url))
;; Remove an empty query part.
(when (and (match-beginning 6)
- (= (match-beginning 7) (length url)))
- (setq url (substring url 0 (match-beginning 6)))
+ (= (match-beginning 7) (or (match-beginning 8)
+ (length url))))
+ (setq url (concat (substring url 0 (match-beginning 6))
+ (if (match-beginning 8)
+ (substring url (match-beginning 8))
+ "")))
(w3m-string-match-url-components url))
(cond
((match-beginning 1)