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

w3m-process-y-or-n-p



青田です。

さっそくというかまたというか、少し気になる点を見つけました。
w3m-process-y-or-n-p() は、その性質上ユーザに予想しにくいタイミングで呼
ばれます。そのため、運が悪いと別のページをスクロールしようと [space] を
押したところに prompt がでてきて確認もできずに y と答えたことになってし
まうということが起こりえます。(というか、実際に自分の身に起こったので気
がついたのです ^ ^;)

n ならばやりなおせるのでともかく y だと w3m-process-accept-alist に記録
されてしまうためやりなおすのも大変ですし、質問内容も SSL 関連なので
[space] を無視するように変更したほうがより安全だと思います。
# そこまで気にする人もあまりいないかなぁ…とは思いつつ。

> 山岡さん、白井さん
こちらこそ未熟な点も多々ありますがよろしくお願いします。
# 白井さんが、すぐ近く(1、2時間圏内?)にいらっしゃるようで驚きました。
# 機会がありましたらお会いしたいものです。 :-)

Index: ChangeLog
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3086
diff -u -r1.3086 ChangeLog
--- ChangeLog	29 Nov 2007 10:25:19 -0000	1.3086
+++ ChangeLog	29 Nov 2007 23:51:03 -0000
@@ -1,3 +1,8 @@
+2007-11-30  Naohiro Aota  <nao.aota@xxxxxxxxx>
+
+	* w3m-proc.el (w3m-process-y-or-n-p): Ignore space to avoid answering y
+	without intention.
+
 2007-11-29  Katsumi Yamaoka  <yamaoka@xxxxxxx>
 
 	* w3m.el (w3m-goto-url-new-session): Use
Index: w3m-proc.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-proc.el,v
retrieving revision 1.66
diff -u -r1.66 w3m-proc.el
--- w3m-proc.el	26 Nov 2007 09:31:45 -0000	1.66
+++ w3m-proc.el	29 Nov 2007 23:51:05 -0000
@@ -760,23 +760,28 @@
 NOTE: This function is designed to avoid annoying questions.  So when
 the same questions is reasked, its previous answer is reused without
 prompt."
-  (let (elem answer (root (w3m-get-server-hostname url)))
-    (if (setq elem (assoc root w3m-process-accept-alist))
-	(if (member prompt (cdr elem))
-	    ;; When the same question has been asked, the previous
-	    ;; answer is reused.
-	    (setq answer t)
-	  ;; When any question for the same server has been asked,
-	  ;; regist the pair of this question and its answer to
-	  ;; `w3m-process-accept-alist'.
-	  (when (setq answer (y-or-n-p prompt))
-	    (setcdr elem (cons prompt (cdr elem)))))
-      ;; When no question for the same server has been asked, regist
-      ;; the 3-tuple of the server, the question and its answer to
-      ;; `w3m-process-accept-alist'.
-      (when (setq answer (y-or-n-p prompt))
-	(push (cons root (list prompt)) w3m-process-accept-alist)))
-    answer))
+  (let ((root (w3m-get-server-hostname url))
+	(map (copy-keymap query-replace-map))
+	elem answer)
+    ;; ignore [space] to avoid answering y without intention.
+    (define-key map " " 'ignore)
+    (let ((query-replace-map map))
+      (if (setq elem (assoc root w3m-process-accept-alist))
+	  (if (member prompt (cdr elem))
+	      ;; When the same question has been asked, the previous
+	      ;; answer is reused.
+	      (setq answer t)
+	    ;; When any question for the same server has been asked,
+	    ;; regist the pair of this question and its answer to
+	    ;; `w3m-process-accept-alist'.
+	    (when (setq answer (y-or-n-p prompt))
+	      (setcdr elem (cons prompt (cdr elem)))))
+	;; When no question for the same server has been asked, regist
+	;; the 3-tuple of the server, the question and its answer to
+	;; `w3m-process-accept-alist'.
+	(when (setq answer (y-or-n-p prompt))
+	  (push (cons root (list prompt)) w3m-process-accept-alist)))
+      answer)))
 
 ;; Silence the byte compiler complaining against `gensym' like:
 ;; "Warning: the function `gensym' might not be defined at runtime."