]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow customizing the checkboxes in eww
authorRüdiger Sonderfeld <ruediger@c-plusplus.de>
Sun, 1 Dec 2013 15:52:04 +0000 (16:52 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 1 Dec 2013 15:52:04 +0000 (16:52 +0100)
* net/shr.el (shr-tag-table): Fix comment typo.

* net/eww.el (eww-text-input-types): : New const.
(eww-process-text-input): Treat input types in
`eww-text-input-types' as text.

* net/shr.el (shr-tag-video): Display content for video if no
poster is available.
(shr-tag-audio): Add support for <audio> tag.

* net/eww.el (eww-use-external-browser-for-content-type): New
variable.
(eww-render): Handle `eww-use-external-browser-for-content-type'.
Use \\` to match beginning of string instead of ^.
(eww-browse-with-external-browser): Provide optional URL parameter.
(eww-render): Set `eww-current-title' back to "".

* net/shr.el (shr-prefer-media-type-alist): : New customizable
variable.
(shr--get-media-pref): New function.
(shr--extract-best-source): New function.
(shr-tag-video, shr-tag-audio):  Use `shr--extract-best-source' when
no :src tag was specified.

* 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'.

lisp/ChangeLog
lisp/net/eww.el

index a251f1025907513aee1989d738b4b0e0d9dbb52e..9bdea147f437908e2a9d495c1b6400cb55e4823a 100644 (file)
@@ -1,5 +1,13 @@
 2013-12-01  Rüdiger Sonderfeld  <ruediger@c-plusplus.de>
 
+       * 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'.
+
        * net/shr.el (shr-prefer-media-type-alist): : New customizable
        variable.
        (shr--get-media-pref): New function.
index 467e204b978b07a5cd47b9f41b361ee0c22da2b7..d8c0010b4cee422445d4adc20e1b4250aba2af59 100644 (file)
   :type '(choice (const :tag "Never" nil)
                  regexp))
 
+(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)
@@ -614,8 +633,8 @@ appears in a <link> or <a> tag."
 (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
@@ -849,9 +868,9 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
          (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
@@ -861,9 +880,9 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
              (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)