GNU bug report logs -
#15703
[PATCH 1/8] EWW: Support user defined representation for checkbox.
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15703 in the body.
You can then email your comments to 15703 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Thu, 24 Oct 2013 23:44:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 24 Oct 2013 23:44:06 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Fri, 25 Oct 2013 15:01:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 15703 <at> debbugs.gnu.org (full text, mbox):
On Fri, 25 Oct 2013 01:43:17 +0200 Rüdiger Sonderfeld <ruediger <at> c-plusplus.de> wrote:
RS> +(defcustom eww-form-checkbox-selected-symbol "[X]"
RS> + "Symbol used to represent a selected checkbox.
RS> +See also `eww-form-checkbox-symbol'."
RS> + :version "24.4"
RS> + :group 'eww
RS> + :type '(choice (const "[X]")
RS> + (const "☒") ; Unicode BALLOT BOX WITH X
RS> + (const "☑") ; Unicode BALLOT BOX WITH CHECK
RS> + string))
RS> +
RS> +(defcustom eww-form-checkbox-symbol "[ ]"
RS> + "Symbol used to represent a checkbox.
RS> +See also `eww-form-checkbox-selected-symbol'."
RS> + :version "24.4"
RS> + :group 'eww
RS> + :type '(choice (const "[ ]")
RS> + (const "☐") ; Unicode BALLOT BOX
RS> + string))
RS> +
This seems very specific just for eww... maybe it should just use the recently
added `prettify-symbols-mode'?
Ted
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Fri, 25 Oct 2013 17:41:01 GMT)
Full text and
rfc822 format available.
Message #13 received at submit <at> debbugs.gnu.org (full text, mbox):
On Friday 25 October 2013 11:00:20 Ted Zlatanov wrote:
> This seems very specific just for eww... maybe it should just use the
> recently added `prettify-symbols-mode'?
`prettify-symbols-mode' only works with font-lock-mode and it would be
complicated to determine whether the [ ] or [x] are input-elements or literal
text. (Or can `prettify-symbols-mode' also match properties?)
Regards,
Rüdiger
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Fri, 25 Oct 2013 17:41:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Fri, 25 Oct 2013 18:05:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 15703 <at> debbugs.gnu.org (full text, mbox):
On Fri, 25 Oct 2013 19:39:50 +0200 Rüdiger Sonderfeld <ruediger <at> c-plusplus.de> wrote:
RS> On Friday 25 October 2013 11:00:20 Ted Zlatanov wrote:
>> This seems very specific just for eww... maybe it should just use the
>> recently added `prettify-symbols-mode'?
RS> `prettify-symbols-mode' only works with font-lock-mode
Ah, OK, I see. But it seems like kind of the same ideas, so maybe a
generic facility would be useful... not a font-lock interaction, but for
keeping the record of "this string maps to this Unicode symbol"?
Basically a big hashtable with some user control. Then
`prettify-symbols-mode' could use that facility too.
RS> and it would be complicated to determine whether the [ ] or [x] are
RS> input-elements or literal text. (Or can `prettify-symbols-mode'
RS> also match properties?)
It can't, but this theoretical generic facility could filter by property
as well, not just by string. Something like:
(setq output (generic-unicode-symbol-replace "input-string-with-properties"))
and the record would be: key "[]", value: '(:symbol unicode-checkmark :properties (...))
I'm just thinking out loud. Sorry if this looks like overengineering
the problem, but it seems to me that this would be generally useful.
Oh, for example Gnus has special functionality to draw the thread trees.
Users like to control that kind of customization.
Another example: I would use ◐◑◒◓◔◕ in many places that show progress if
I could. But perhaps that's too arcane :)
Ted
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Sat, 26 Oct 2013 01:55:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 15703 <at> debbugs.gnu.org (full text, mbox):
> Ah, OK, I see. But it seems like kind of the same ideas, so maybe a
> generic facility would be useful... not a font-lock interaction, but for
> keeping the record of "this string maps to this Unicode symbol"?
> Basically a big hashtable with some user control. Then
> `prettify-symbols-mode' could use that facility too.
I think it'd be easier to go the other way around: provide an
replacement to use if/when the display font doesn't provide a glyph for
that characters.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Sun, 03 Nov 2013 11:41:02 GMT)
Full text and
rfc822 format available.
Message #25 received at submit <at> debbugs.gnu.org (full text, mbox):
On Fri, 25 Oct 2013 21:54:12 -0400 Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> Ah, OK, I see. But it seems like kind of the same ideas, so maybe a
>> generic facility would be useful... not a font-lock interaction, but for
>> keeping the record of "this string maps to this Unicode symbol"?
>> Basically a big hashtable with some user control. Then
>> `prettify-symbols-mode' could use that facility too.
SM> I think it'd be easier to go the other way around: provide an
SM> replacement to use if/when the display font doesn't provide a glyph for
SM> that characters.
That doesn't help with drawing trees in Unicode, for example. What I'm
suggesting is more like an installable icon set. The user would be able
to say "install my personal tree glyphs and checkbox glyphs and box
drawing glyphs" and all code using the proposed facility would pick up
the user's preference for tree and checkbox and box glyphs.
For a typical use case that a package has implemented ad-hoc, see
http://permalink.gmane.org/gmane.emacs.gnus.general/83790
(setq cfw:fchar-junction ?┼
cfw:fchar-vertical-line ?│
cfw:fchar-horizontal-line ?─
cfw:fchar-left-junction ?├
cfw:fchar-right-junction ?┤
cfw:fchar-top-junction ?┬
cfw:fchar-top-left-corner ?╭
cfw:fchar-top-right-corner ?╮)
Thanks
Ted
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Mon, 04 Nov 2013 01:52:02 GMT)
Full text and
rfc822 format available.
Message #28 received at submit <at> debbugs.gnu.org (full text, mbox):
>>> Ah, OK, I see. But it seems like kind of the same ideas, so maybe a
>>> generic facility would be useful... not a font-lock interaction, but for
>>> keeping the record of "this string maps to this Unicode symbol"?
>>> Basically a big hashtable with some user control. Then
>>> `prettify-symbols-mode' could use that facility too.
SM> I think it'd be easier to go the other way around: provide an
SM> replacement to use if/when the display font doesn't provide a glyph for
SM> that characters.
> That doesn't help with drawing trees in Unicode, for example.
I think this case is quite different: none of the proposals so far can
handle it. And I don't think it can be handled purely locally
(i.e. without knowing that those chars are put together to represent
a tree).
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Mon, 04 Nov 2013 16:24:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 15703 <at> debbugs.gnu.org (full text, mbox):
On Sun, 03 Nov 2013 20:50:56 -0500 Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>>>> Ah, OK, I see. But it seems like kind of the same ideas, so maybe a
>>>> generic facility would be useful... not a font-lock interaction, but for
>>>> keeping the record of "this string maps to this Unicode symbol"?
>>>> Basically a big hashtable with some user control. Then
>>>> `prettify-symbols-mode' could use that facility too.
SM> I think it'd be easier to go the other way around: provide an
SM> replacement to use if/when the display font doesn't provide a glyph for
SM> that characters.
>> That doesn't help with drawing trees in Unicode, for example.
SM> I think this case is quite different: none of the proposals so far can
SM> handle it. And I don't think it can be handled purely locally
SM> (i.e. without knowing that those chars are put together to represent
SM> a tree).
OK. My proposal is to do something about that need at the Emacs core
level so packages don't have to invent their own glyph mapping
facilities. Should I take it to emacs-devel or do you want to keep the
discussion here? And do you agree there's a need?
Ted
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Mon, 04 Nov 2013 17:53:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 15703 <at> debbugs.gnu.org (full text, mbox):
> OK. My proposal is to do something about that need at the Emacs core
> level so packages don't have to invent their own glyph mapping
> facilities. Should I take it to emacs-devel or do you want to keep the
> discussion here? And do you agree there's a need?
Move it to emacs-devel. But if you want it to work for "multi-glyph"
situations (such as trees), then the main problem will be how to
design it. So, rather than discuss, it might be better to try and come
up with a preliminary implementation.
The situation for EWW (and Custom) is fairly different since relative
alignment is not that important, so the mapping can be done for each
glyph individually, so the system can be fairly simple.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15703
; Package
emacs
.
(Sun, 01 Dec 2013 15:54:01 GMT)
Full text and
rfc822 format available.
Message #37 received at 15703 <at> debbugs.gnu.org (full text, mbox):
Rüdiger Sonderfeld <ruediger <at> c-plusplus.de> writes:
> 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'.
Thanks; applied.
Having a more general mechanism for specifying alternate symbols work be
nice, but since Emacs doesn't have that yet, this is OK, I think.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 01 Dec 2013 15:54:08 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 24.4, send any further explanations to
15708 <at> debbugs.gnu.org and Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 01 Dec 2013 15:54:10 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 30 Dec 2013 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 230 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.