From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?R=C3=BCdiger?= Sonderfeld Newsgroups: gmane.emacs.bugs Subject: bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox. Date: Fri, 25 Oct 2013 01:43:17 +0200 Message-ID: <7056835.LJq9iUtOff@descartes> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1382658261 8331 80.91.229.3 (24 Oct 2013 23:44:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Oct 2013 23:44:21 +0000 (UTC) Cc: Lars Magne Ingebrigtsen To: 15703@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 25 01:44:24 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VZUZj-0005fk-PG for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 Oct 2013 01:44:23 +0200 Original-Received: from localhost ([::1]:56649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZUZj-000626-DN for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Oct 2013 19:44:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZUZZ-00060P-AU for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 19:44:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZUZS-00073j-7s for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 19:44:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZUZS-00073f-4e for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 19:44:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VZUZR-0005t3-VC for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 19:44:06 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?R=C3=BCdiger?= Sonderfeld Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Oct 2013 23:44:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15703 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138265823222500 (code B ref -1); Thu, 24 Oct 2013 23:44:05 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Oct 2013 23:43:52 +0000 Original-Received: from localhost ([127.0.0.1]:41997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZUZC-0005qp-Pl for submit@debbugs.gnu.org; Thu, 24 Oct 2013 19:43:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59087) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZUZA-0005qU-TD for submit@debbugs.gnu.org; Thu, 24 Oct 2013 19:43:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZUYy-0006gQ-Ny for submit@debbugs.gnu.org; Thu, 24 Oct 2013 19:43:43 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZUYy-0006gL-KT for submit@debbugs.gnu.org; Thu, 24 Oct 2013 19:43:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZUYs-0005ta-Ds for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 19:43:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZUYm-0006bq-Cx for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 19:43:30 -0400 Original-Received: from ptmx.org ([178.63.28.110]:41389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZUYm-0006bk-2j for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 19:43:24 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by ptmx.org (Postfix) with ESMTP id 8C7042B155; Fri, 25 Oct 2013 01:43:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at ptmx.org Original-Received: from ptmx.org ([127.0.0.1]) by localhost (ptmx.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NNxWYzp7Zmbd; Fri, 25 Oct 2013 01:43:21 +0200 (CEST) Original-Received: from descartes.localnet (chello080108246092.7.14.vie.surfer.at [80.108.246.92]) by ptmx.org (Postfix) with ESMTPSA id 69BDB2AEE8; Fri, 25 Oct 2013 01:43:21 +0200 (CEST) User-Agent: KMail/4.11.2 (Linux/3.11.0-12-generic; KDE/4.11.2; x86_64; ; ) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79608 Archived-At: 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=C3=BCdiger Sonderfeld --- 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) =20 +(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 "=E2=98=92") ; Unicode BALLOT BOX W= ITH X + (const "=E2=98=91") ; Unicode BALLOT BOX W= ITH 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 "=E2=98=90") ; Unicode BALLOT BOX + string)) + (defface eww-form-submit '((((type x w32 ns) (class color))=09; 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)) -=09(insert "[X]") - (insert "[ ]")) +=09(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 =09=09 (list :eww-form eww-form @@ -801,9 +820,9 @@ (defun eww-toggle-checkbox () =09 (if (plist-get input :checked) =09 (progn =09=09(plist-put input :checked nil) -=09=09(eww-update-field "[ ]")) +=09=09(eww-update-field eww-form-checkbox-symbol)) =09 (plist-put input :checked t) -=09 (eww-update-field "[X]")))) +=09 (eww-update-field eww-form-checkbox-selected-symbol)))) ;; Radio button. Switch all other buttons off. (let ((name (plist-get input :name))) =09(save-excursion @@ -813,9 +832,9 @@ (defun eww-toggle-checkbox () =09 (if (not (eq (cdr elem) input)) =09=09 (progn =09=09 (plist-put input :checked nil) -=09=09 (eww-update-field "[ ]")) +=09=09 (eww-update-field eww-form-checkbox-symbol)) =09=09(plist-put input :checked t) -=09=09(eww-update-field "[X]"))))) +=09=09(eww-update-field eww-form-checkbox-selected-symbol))))) =09(forward-char 1))))) =20 (defun eww-inputs (form) --=20 1.8.4.1