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

[PATCH] w3m-form-input should put readonly input value on kill ring


If you have a readonly input with a short size, like this:

<input type="text" value="a long string" size="3" readonly />

There is no quick way to copy the value of the input. Pressing RET on
the input only displays the message READONLY INPUT in the echo area.

The attached patch makes w3m-form-input put the value on the kill ring
in addition to the echo area. This is similar to what
w3m-print-current-url does.

Index: ChangeLog
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3588
diff -u -p -u -r1.3588 ChangeLog
--- ChangeLog	28 Jun 2017 00:53:11 -0000	1.3588
+++ ChangeLog	30 Jun 2017 07:18:01 -0000
@@ -1,3 +1,8 @@
+2017-06-30  Vladimir Sedach  <vas@xxxxxxxxxx>
+	* w3m-form.el (w3m-form-input): If input is readonly, put the input
+	value on the kill ring in addition to displaying it in the echo area.
 2017-06-28  Katsumi Yamaoka  <yamaoka@xxxxxxx>

 	* mime-w3m.el, w3m-antenna.el, w3m-bookmark.el, w3m-cookie.el,
Index: w3m-form.el
RCS file: /storage/cvsroot/emacs-w3m/w3m-form.el,v
retrieving revision 1.199
diff -u -p -u -r1.199 w3m-form.el
--- w3m-form.el	28 Jun 2017 00:53:11 -0000	1.199
+++ w3m-form.el	30 Jun 2017 07:18:02 -0000
@@ -990,7 +990,9 @@ If optional REUSE-FORMS is non-nil, reus
 (defun w3m-form-input (form id name type width maxlength value)
   (let ((fvalue (w3m-form-get form id)))
     (if (get-text-property (point) 'w3m-form-readonly)
-	(w3m-message "READONLY %s: %s" (upcase type) fvalue)
+        (progn
+          (kill-new fvalue)
+          (w3m-message "READONLY %s: %s" (upcase type) fvalue))
 	(let ((input (save-excursion
 		       (read-from-minibuffer (concat (upcase type) ": ") fvalue)))