こんにちは、
細川と申します

j.mp を使った短縮 URL がサポートされたので使ってみているのですが、私の環境で
は短縮後の URL に余分な改行が含まれてしまいます。
もし差し支えなければ、正規表現を少し欲張りにしてもらっても良いでしょうか?

diff --git a/twittering-mode.el b/twittering-mode.el
index 615f4da..9c9c48a 100644
--- a/twittering-mode.el
+++ b/twittering-mode.el
@@ -127,7 +127,7 @@ To use 'bit.ly or 'j.mp, you have to configure 
`twittering-bitly-login' and
 (defvar twittering-tinyurl-services-map
   '((bit.ly twittering-make-http-request-for-bitly
            (lambda (service reply)
-             (if (string-match "\n\\'" reply)
+             (if (string-match "\n+\\'" reply)
                  (substring reply 0 (match-beginning 0))
                reply)))
     (goo.gl
@@ -143,7 +143,7 @@ To use 'bit.ly or 'j.mp, you have to configure 
`twittering-bitly-login' and
     (is.gd . "http://is.gd/create.php?format=simple&url=";)
     (j.mp twittering-make-http-request-for-bitly
          (lambda (service reply)
-           (if (string-match "\n\\'" reply)
+           (if (string-match "\n+\\'" reply)
                (substring reply 0 (match-beginning 0))
              reply)))
     (tinyurl . "http://tinyurl.com/api-create.php?url=";)


以前は下記の jmpv2 で使っており、レスポンスに改行は含まれませんでした。

(add-to-list 'twittering-tinyurl-services-map
             '(jmpv2 . 
"http://api.j.mp/shorten?version=2.0.1&login=LOGIN&apiKey=KEY&format=text&longUrl=";))

(add-to-list 'twittering-tinyurl-services-map
             '(jmpv3 . 
"http://api.bit.ly/v3/shorten?login=LOGIN&apiKey=KEY&format=txt&longUrl=";))

API バージョン 3 では改行が付加されるようで、私の環境(Windows の Emacs +
Cygwin の curl)では、Emacs が \n\n を受け取っているようです。

ご検討いただければ幸いです。
よろしくお願いいたします。

-- 
Yu-ji Hosokawa (細川雄司)

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users

メールによる返信