[gnus git] branch master updated: m0-7-53-g12e45ad =1= (eww-tag-input): Implement submit buttons.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  12e45ad1adef95972f6e2a1a33d745b757268f65 (commit)
      from  7cc26a4cea66f5cb484eaa74f76428a5134a535e (commit)


- Log -----------------------------------------------------------------
commit 12e45ad1adef95972f6e2a1a33d745b757268f65
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Mon Jun 10 22:14:37 2013 +0200

    (eww-tag-input): Implement submit buttons.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 693bb92..cfab73f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,7 @@
 2013-06-10  Lars Magne Ingebrigtsen  <[email protected]>
 
 	* eww.el (eww-submit): Make form submission work.
+	(eww-tag-input): Implement submit buttons.
 
 	* shr.el (shr-descend): Allow other packages to override (or provide)
 	rendering of elements.
diff --git a/lisp/eww.el b/lisp/eww.el
index 63ad6fd..d8aa052 100644
--- a/lisp/eww.el
+++ b/lisp/eww.el
@@ -174,8 +174,19 @@
 		       'eww-form eww-form)))
 
 (defun eww-tag-input (cont)
-  (let ((start (point))
-	(widget (list
+  (let* ((start (point))
+	 (type (downcase (or (cdr (assq :type cont))
+			     "text")))
+	 (widget
+	  (cond
+	   ((equal type "submit")
+	    (list
+	     'push-button
+	     :notify 'eww-submit
+	     :eww-form eww-form
+	     (or (cdr (assq :value cont)) "Submit")))
+	   (t
+	    (list
 		 'editable-field
 		 :size (string-to-number
 			(or (cdr (assq :size cont))
@@ -183,12 +194,12 @@
 		 :value (or (cdr (assq :value cont)) "")
 		 :action 'eww-submit
 		 :name (cdr (assq :name cont))
-		 :eww-form eww-form)))
+	     :eww-form eww-form)))))
     (apply 'widget-create widget)
     (shr-generic cont)
     (put-text-property start (point) 'eww-widget widget)))
 
-(defun eww-submit (widget dummy)
+(defun eww-submit (widget &optional dummy dummy)
   (let ((form (getf (cdr widget) :eww-form))
 	values)
     (dolist (overlay (overlays-in (point-min) (point-max)))
@@ -219,7 +230,8 @@
       (goto-char start)
       (delete-region start (next-single-property-change start 'eww-widget))
       (apply 'widget-create widget)
-      (put-text-property start (point) 'not-read-only t))
+      (when (equal (car widget) 'push-button)
+	(put-text-property start (point) 'local-map widget-keymap)))
     (widget-setup)))
 
 (provide 'eww)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    1 +
 lisp/eww.el    |   36 ++++++++++++++++++++++++------------
 2 files changed, 25 insertions(+), 12 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.