unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
To: 15703@debbugs.gnu.org
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>
Subject: bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
Date: Fri, 25 Oct 2013 01:43:17 +0200	[thread overview]
Message-ID: <7056835.LJq9iUtOff@descartes> (raw)
In-Reply-To: <cover.1382658061.git.ruediger@c-plusplus.de>

Unicode provides BALLOT BOX* symbols to represent check boxes.

* lisp/net/eww.el (eww-form-checkbox-selected-symbol): New
  customizable variable.
  (eww-form-checkbox-symbol): New customizable variable.
  (eww-form-checkbox): Use `eww-form-checkbox-selected-symbol' and
  `eww-form-checkbox-symbol'.
  (eww-toggle-checkbox): Use `eww-form-checkbox-selected-symbol' and
  `eww-form-checkbox-symbol'.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/net/eww.el | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 573715e..989cd2e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -56,6 +56,25 @@ (defcustom eww-download-path "~/Downloads/"
   :group 'eww
   :type 'string)
 
+(defcustom eww-form-checkbox-selected-symbol "[X]"
+  "Symbol used to represent a selected checkbox.
+See also `eww-form-checkbox-symbol'."
+  :version "24.4"
+  :group 'eww
+  :type '(choice (const "[X]")
+                 (const "☒")            ; Unicode BALLOT BOX WITH X
+                 (const "☑")            ; Unicode BALLOT BOX WITH CHECK
+                 string))
+
+(defcustom eww-form-checkbox-symbol "[ ]"
+  "Symbol used to represent a checkbox.
+See also `eww-form-checkbox-selected-symbol'."
+  :version "24.4"
+  :group 'eww
+  :type '(choice (const "[ ]")
+                 (const "☐")            ; Unicode BALLOT BOX
+                 string))
+
 (defface eww-form-submit
   '((((type x w32 ns) (class color))	; Like default mode line
      :box (:line-width 2 :style released-button)
@@ -579,8 +598,8 @@ (defun eww-form-submit (cont)
 (defun eww-form-checkbox (cont)
   (let ((start (point)))
     (if (cdr (assq :checked cont))
-	(insert "[X]")
-      (insert "[ ]"))
+	(insert eww-form-checkbox-selected-symbol)
+      (insert eww-form-checkbox-symbol))
     (add-face-text-property start (point) 'eww-form-checkbox)
     (put-text-property start (point) 'eww-form
 		       (list :eww-form eww-form
@@ -801,9 +820,9 @@ (defun eww-toggle-checkbox ()
 	  (if (plist-get input :checked)
 	      (progn
 		(plist-put input :checked nil)
-		(eww-update-field "[ ]"))
+		(eww-update-field eww-form-checkbox-symbol))
 	    (plist-put input :checked t)
-	    (eww-update-field "[X]"))))
+	    (eww-update-field eww-form-checkbox-selected-symbol))))
       ;; Radio button.  Switch all other buttons off.
       (let ((name (plist-get input :name)))
 	(save-excursion
@@ -813,9 +832,9 @@ (defun eww-toggle-checkbox ()
 	      (if (not (eq (cdr elem) input))
 		  (progn
 		    (plist-put input :checked nil)
-		    (eww-update-field "[ ]"))
+		    (eww-update-field eww-form-checkbox-symbol))
 		(plist-put input :checked t)
-		(eww-update-field "[X]")))))
+		(eww-update-field eww-form-checkbox-selected-symbol)))))
 	(forward-char 1)))))
 
 (defun eww-inputs (form)
-- 
1.8.4.1







       reply	other threads:[~2013-10-24 23:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
2013-10-24 23:43 ` Rüdiger Sonderfeld [this message]
2013-10-25 15:00   ` bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox Ted Zlatanov
2013-10-25 17:39     ` Rüdiger Sonderfeld
2013-10-25 18:04       ` Ted Zlatanov
2013-10-26  1:54         ` Stefan Monnier
2013-11-03 11:40           ` Ted Zlatanov
2013-11-04  1:50             ` Stefan Monnier
2013-11-04 16:23               ` Ted Zlatanov
2013-11-04 17:51                 ` Stefan Monnier
2013-12-01 15:53   ` Lars Magne Ingebrigtsen
2013-10-24 23:43 ` bug#15704: [PATCH 2/8] EWW: Handle HTML5 input types as text input Rüdiger Sonderfeld
2013-12-01 15:38   ` Lars Magne Ingebrigtsen
2013-10-24 23:43 ` bug#15705: [PATCH 3/8] shr: Display content for video if no poster is available Rüdiger Sonderfeld
2013-12-01 15:46   ` bug#15708: " Lars Magne Ingebrigtsen
2013-10-24 23:43 ` bug#15706: [PATCH 4/8] shr: Add support for <audio> tag Rüdiger Sonderfeld
2013-12-01 15:46   ` bug#15708: " Lars Magne Ingebrigtsen
2013-10-24 23:44 ` bug#15707: [PATCH 5/8] EWW: Option to always use external-browser for certain content Rüdiger Sonderfeld
2013-12-01 15:44   ` Lars Magne Ingebrigtsen
2013-10-24 23:44 ` bug#15708: [PATCH 6/8] EWW: Erase old title Rüdiger Sonderfeld
2013-10-26  1:17   ` Rüdiger Sonderfeld
2013-10-26 11:04   ` bug#15708: [PATCH] " Rüdiger Sonderfeld
2013-12-01 15:47   ` bug#15708: [PATCH 6/8] " Lars Magne Ingebrigtsen
2013-10-24 23:44 ` bug#15709: [PATCH 7/8] shr: Handle <source> tag for video/audio elements Rüdiger Sonderfeld
2013-10-24 23:44 ` bug#15710: [PATCH 8/8] * lisp/net/shr.el: Fix typo Rüdiger Sonderfeld
2013-12-01 15:36   ` bug#15708: " Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7056835.LJq9iUtOff@descartes \
    --to=ruediger@c-plusplus.de \
    --cc=15703@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).