unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
@ 2013-10-24 23:43 ` Rüdiger Sonderfeld
  2013-10-25 15:00   ` Ted Zlatanov
  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
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:43 UTC (permalink / raw)
  To: 15703; +Cc: Lars Magne Ingebrigtsen

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







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15704: [PATCH 2/8] EWW: Handle HTML5 input types as text input.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
  2013-10-24 23:43 ` bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox Rüdiger Sonderfeld
@ 2013-10-24 23:43 ` 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
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:43 UTC (permalink / raw)
  To: 15704; +Cc: Lars Magne Ingebrigtsen

HTML5 adds a bunch of new input types which can be treated as text.

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

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

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 989cd2e..ccc2399 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -631,12 +631,19 @@ (defun eww-form-text (cont)
 			     :name (cdr (assq :name cont))))
     (insert " ")))
 
+(defconst eww-text-input-types '("text" "password" "textarea"
+                                 "color" "date" "datetime" "datetime-local"
+                                 "email" "month" "number" "search" "tel"
+                                 "time" "url" "week")
+  "List of input types which represent a text input.
+See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
+
 (defun eww-process-text-input (beg end length)
   (let* ((form (get-text-property (min (1+ end) (point-max)) 'eww-form))
 	 (properties (text-properties-at end))
 	 (type (plist-get form :type)))
     (when (and form
-	       (member type '("text" "password" "textarea")))
+	       (member type eww-text-input-types))
       (cond
        ((zerop length)
 	;; Delete some space at the end.
-- 
1.8.4.1







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15705: [PATCH 3/8] shr: Display content for video if no poster is available.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
  2013-10-24 23:43 ` bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox Rüdiger Sonderfeld
  2013-10-24 23:43 ` bug#15704: [PATCH 2/8] EWW: Handle HTML5 input types as text input Rüdiger Sonderfeld
@ 2013-10-24 23:43 ` 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
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:43 UTC (permalink / raw)
  To: 15705; +Cc: Lars Magne Ingebrigtsen

* lisp/net/shr.el (shr-tag-video): If poster is nil display a default
  value instead.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/net/shr.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index b742172..39e0470 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1101,7 +1101,9 @@ (defun shr-tag-video (cont)
   (let ((image (cdr (assq :poster cont)))
 	(url (cdr (assq :src cont)))
 	(start (point)))
-    (shr-tag-img nil image)
+    (if image
+        (shr-tag-img nil image)
+      (shr-insert " [video] "))
     (shr-urlify start (shr-expand-url url))))
 
 (defun shr-tag-img (cont &optional url)
-- 
1.8.4.1







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15706: [PATCH 4/8] shr: Add support for <audio> tag.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
                   ` (2 preceding siblings ...)
  2013-10-24 23:43 ` bug#15705: [PATCH 3/8] shr: Display content for video if no poster is available Rüdiger Sonderfeld
@ 2013-10-24 23:43 ` 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
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:43 UTC (permalink / raw)
  To: 15706; +Cc: Lars Magne Ingebrigtsen

* lisp/net/shr.el (shr-tag-audio): New function.

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

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 39e0470..3ea2829 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1106,6 +1106,12 @@ (defun shr-tag-video (cont)
       (shr-insert " [video] "))
     (shr-urlify start (shr-expand-url url))))
 
+(defun shr-tag-audio (cont)
+  (let ((url (cdr (assq :src cont)))
+        (start (point)))
+    (shr-insert " [audio] ")
+    (shr-urlify start (shr-expand-url url))))
+
 (defun shr-tag-img (cont &optional url)
   (when (or url
 	    (and cont
-- 
1.8.4.1







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15707: [PATCH 5/8] EWW: Option to always use external-browser for certain content.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
                   ` (3 preceding siblings ...)
  2013-10-24 23:43 ` bug#15706: [PATCH 4/8] shr: Add support for <audio> tag Rüdiger Sonderfeld
@ 2013-10-24 23:44 ` 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
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:44 UTC (permalink / raw)
  To: 15707; +Cc: Lars Magne Ingebrigtsen

Emacs can not display videos and has only limited audio support.
Therefore it makes sense to call an external browser for links of that
kind.  This is also a problem because shr turns <video> and <audio>
tags into links to the media.

* lisp/net/eww.el (eww-use-external-browser-for-content-type): New
  customizable 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.

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

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index ccc2399..6335bd8 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -75,6 +75,14 @@ (defcustom eww-form-checkbox-symbol "[ ]"
                  (const "☐")            ; Unicode BALLOT BOX
                  string))
 
+(defcustom eww-use-external-browser-for-content-type
+  "\\`\\(video/\\|audio/\\|application/ogg\\)"
+  "Always use external browser for specified content-type."
+  :version "24.4"
+  :group 'eww
+  :type '(choice (const :tag "Never" nil)
+                 regexp))
+
 (defface eww-form-submit
   '((((type x w32 ns) (class color))	; Like default mode line
      :box (:line-width 2 :style released-button)
@@ -173,10 +181,14 @@ (defun eww-render (status url &optional point)
     (unwind-protect
 	(progn
 	  (cond
+           ((and eww-use-external-browser-for-content-type
+                 (string-match-p eww-use-external-browser-for-content-type
+                                 (car content-type)))
+            (eww-browse-with-external-browser url))
 	   ((equal (car content-type) "text/html")
 	    (eww-display-html charset url))
-	   ((string-match "^image/" (car content-type))
-	    (eww-display-image))
+	   ((string-match-p "\\`image/" (car content-type))
+	    (eww-display-image url))
 	   (t
 	    (eww-display-raw)))
 	  (setq eww-current-url url
@@ -929,11 +941,11 @@ (defun eww-submit ()
 	"?"
 	(mm-url-encode-www-form-urlencoded values))))))
 
-(defun eww-browse-with-external-browser ()
+(defun eww-browse-with-external-browser (&optional url)
   "Browse the current URL with an external browser.
 The browser to used is specified by the `shr-external-browser' variable."
   (interactive)
-  (funcall shr-external-browser eww-current-url))
+  (funcall shr-external-browser (or url eww-current-url)))
 
 (defun eww-copy-page-url ()
   (interactive)
-- 
1.8.4.1







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15708: [PATCH 6/8] EWW: Erase old title.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
                   ` (4 preceding siblings ...)
  2013-10-24 23:44 ` bug#15707: [PATCH 5/8] EWW: Option to always use external-browser for certain content Rüdiger Sonderfeld
@ 2013-10-24 23:44 ` Rüdiger Sonderfeld
  2013-10-26  1:17   ` Rüdiger Sonderfeld
                     ` (2 more replies)
  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
  7 siblings, 3 replies; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:44 UTC (permalink / raw)
  To: 15708; +Cc: Lars Magne Ingebrigtsen

* lisp/net/eww.el (eww-render): Set `eww-current-title' back to "".

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

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 6335bd8..55a3177 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -192,6 +192,7 @@ (defun eww-render (status url &optional point)
 	   (t
 	    (eww-display-raw)))
 	  (setq eww-current-url url
+                eww-current-title ""
 		eww-history-position 0)
 	  (eww-update-header-line-format)
 	  (cond
-- 
1.8.4.1







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15709: [PATCH 7/8] shr: Handle <source> tag for video/audio elements.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
                   ` (5 preceding siblings ...)
  2013-10-24 23:44 ` bug#15708: [PATCH 6/8] EWW: Erase old title Rüdiger Sonderfeld
@ 2013-10-24 23:44 ` Rüdiger Sonderfeld
  2013-10-24 23:44 ` bug#15710: [PATCH 8/8] * lisp/net/shr.el: Fix typo Rüdiger Sonderfeld
  7 siblings, 0 replies; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:44 UTC (permalink / raw)
  To: 15709; +Cc: Lars Magne Ingebrigtsen

* lisp/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.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/net/shr.el | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 61 insertions(+), 2 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 3ea2829..0015bd4 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1097,10 +1097,67 @@ (defun shr-tag-object (cont)
       (shr-urlify start (shr-expand-url url)))
     (shr-generic cont)))
 
+(defcustom shr-prefer-media-type-alist '(("webm" . 1.0)
+                                         ("ogv"  . 1.0)
+                                         ("ogg"  . 1.0)
+                                         ("opus" . 1.0)
+                                         ("flac" . 0.9)
+                                         ("wav"  . 0.5))
+  "Preferences for media types.
+The key element should be a regexp matched against the type of the source or
+url if no type is specified.  The value should be a float in the range 0.0 to
+1.0.  Media elements with higher value are preferred."
+  :version "24.4"
+  :group 'shr
+  :type '(alist :key-type regexp :value-type float))
+
+(defun shr--get-media-pref (elem)
+  "Determine the preference for ELEM.
+The preference is a float determined from `shr-prefer-media-type'."
+  (let ((type (cdr (assq :type elem)))
+        (p 0.0))
+    (unless type
+      (setq type (cdr (assq :src elem))))
+    (when type
+      (dolist (pref shr-prefer-media-type-alist)
+        (when (and
+               (> (cdr pref) p)
+               (string-match-p (car pref) type))
+          (setq p (cdr pref)))))
+    p))
+
+(defun shr--extract-best-source (cont &optional url pref)
+  "Extract the best `:src' property from <source> blocks in CONT."
+  (setq pref (or pref -1.0))
+  (let (new-pref)
+    (dolist (elem cont)
+      (when (and (listp elem)
+                 (not (keywordp (car elem)))) ;; skip attributes
+        (when (and (eq (car elem) 'source)
+                   (< pref
+                      (setq new-pref
+                            (shr--get-media-pref elem))))
+          (setq pref new-pref
+                url (cdr (assq :src elem)))
+          (message "new %s %s" url pref))
+        ;; libxml's html parser isn't HML5 compliant and non terminated
+        ;; source tags might end up as children.  So recursion it is...
+        (dolist (child (cdr elem))
+          (when (and (listp child)
+                     (not (keywordp (car child)))  ;; skip attributes
+                     (eq (car child) 'source))
+            (let ((ret (shr--extract-best-source (list child) url pref)))
+              (when (< pref (cdr ret))
+                (setq url (car ret)
+                      pref (cdr ret)))))))))
+  (cons url pref))
+
 (defun shr-tag-video (cont)
   (let ((image (cdr (assq :poster cont)))
-	(url (cdr (assq :src cont)))
-	(start (point)))
+        (url (cdr (assq :src cont)))
+        (start (point)))
+    (unless url
+      (setq url (car (shr--extract-best-source cont))))
     (if image
         (shr-tag-img nil image)
       (shr-insert " [video] "))
@@ -1109,6 +1166,8 @@ (defun shr-tag-video (cont)
 (defun shr-tag-audio (cont)
   (let ((url (cdr (assq :src cont)))
         (start (point)))
+    (unless url
+      (setq url (car (shr--extract-best-source cont))))
     (shr-insert " [audio] ")
     (shr-urlify start (shr-expand-url url))))
 
-- 
1.8.4.1







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15710: [PATCH 8/8] * lisp/net/shr.el: Fix typo.
       [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
                   ` (6 preceding siblings ...)
  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 ` Rüdiger Sonderfeld
  2013-12-01 15:36   ` bug#15708: " Lars Magne Ingebrigtsen
  7 siblings, 1 reply; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 23:44 UTC (permalink / raw)
  To: 15710; +Cc: Lars Magne Ingebrigtsen

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/net/shr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 0015bd4..264cf20 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1400,7 +1400,7 @@ (defun shr-tag-table (cont)
 	(if caption `((tr (td ,@caption))))
 	(if header
 	    (if footer
-		;; hader + body + footer
+		;; header + body + footer
 		(if (= nheader nbody)
 		    (if (= nbody nfooter)
 			`((tr (td (table (tbody ,@header ,@body ,@footer)))))
-- 
1.8.4.1






^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-10-24 23:43 ` bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox Rüdiger Sonderfeld
@ 2013-10-25 15:00   ` Ted Zlatanov
  2013-10-25 17:39     ` Rüdiger Sonderfeld
  2013-12-01 15:53   ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 25+ messages in thread
From: Ted Zlatanov @ 2013-10-25 15:00 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15703, Lars Magne Ingebrigtsen

On Fri, 25 Oct 2013 01:43:17 +0200 Rüdiger Sonderfeld <ruediger@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-10-25 15:00   ` Ted Zlatanov
@ 2013-10-25 17:39     ` Rüdiger Sonderfeld
  2013-10-25 18:04       ` Ted Zlatanov
  0 siblings, 1 reply; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-25 17:39 UTC (permalink / raw)
  To: 15703; +Cc: tzz, larsi

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






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-10-25 17:39     ` Rüdiger Sonderfeld
@ 2013-10-25 18:04       ` Ted Zlatanov
  2013-10-26  1:54         ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Ted Zlatanov @ 2013-10-25 18:04 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15703, larsi

On Fri, 25 Oct 2013 19:39:50 +0200 Rüdiger Sonderfeld <ruediger@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15708: [PATCH 6/8] EWW: Erase old title.
  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
  2 siblings, 0 replies; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-26  1:17 UTC (permalink / raw)
  To: 15708; +Cc: larsi

Sorry, I messed up this patch during merge.  The title should of course be 
reset before rendering the HTML.  I'll resend the patch.

Regards,
Rüdiger

On Friday 25 October 2013 01:44:11 Rüdiger Sonderfeld wrote:
> * lisp/net/eww.el (eww-render): Set `eww-current-title' back to "".
> 
> Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
> ---
>  lisp/net/eww.el | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lisp/net/eww.el b/lisp/net/eww.el
> index 6335bd8..55a3177 100644
> --- a/lisp/net/eww.el
> +++ b/lisp/net/eww.el
> @@ -192,6 +192,7 @@ (defun eww-render (status url &optional point)
>  	   (t
>  	    (eww-display-raw)))
>  	  (setq eww-current-url url
> +                eww-current-title ""
>  		eww-history-position 0)
>  	  (eww-update-header-line-format)
>  	  (cond






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-10-25 18:04       ` Ted Zlatanov
@ 2013-10-26  1:54         ` Stefan Monnier
  2013-11-03 11:40           ` Ted Zlatanov
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2013-10-26  1:54 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15703, larsi

> 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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15708: [PATCH] EWW: Erase old title.
  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   ` Rüdiger Sonderfeld
  2013-12-01 15:47   ` bug#15708: [PATCH 6/8] " Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 25+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-26 11:04 UTC (permalink / raw)
  To: 15708; +Cc: larsi

* lisp/net/eww.el (eww-render): Set `eww-current-title' back to "".

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

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 6335bd8..e264606 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -180,6 +180,7 @@ (defun eww-render (status url &optional point)
 	 (data-buffer (current-buffer)))
     (unwind-protect
 	(progn
+          (setq eww-current-title "")
 	  (cond
            ((and eww-use-external-browser-for-content-type
                  (string-match-p eww-use-external-browser-for-content-type
-- 
1.8.4.1






^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-10-26  1:54         ` Stefan Monnier
@ 2013-11-03 11:40           ` Ted Zlatanov
  2013-11-04  1:50             ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Ted Zlatanov @ 2013-11-03 11:40 UTC (permalink / raw)
  To: 15703

On Fri, 25 Oct 2013 21:54:12 -0400 Stefan Monnier <monnier@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






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-11-03 11:40           ` Ted Zlatanov
@ 2013-11-04  1:50             ` Stefan Monnier
  2013-11-04 16:23               ` Ted Zlatanov
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2013-11-04  1:50 UTC (permalink / raw)
  To: 15703

>>> 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






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-11-04  1:50             ` Stefan Monnier
@ 2013-11-04 16:23               ` Ted Zlatanov
  2013-11-04 17:51                 ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Ted Zlatanov @ 2013-11-04 16:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15703

On Sun, 03 Nov 2013 20:50:56 -0500 Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-11-04 16:23               ` Ted Zlatanov
@ 2013-11-04 17:51                 ` Stefan Monnier
  0 siblings, 0 replies; 25+ messages in thread
From: Stefan Monnier @ 2013-11-04 17:51 UTC (permalink / raw)
  To: 15703

> 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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15708: bug#15710: [PATCH 8/8] * lisp/net/shr.el: Fix typo.
  2013-10-24 23:44 ` bug#15710: [PATCH 8/8] * lisp/net/shr.el: Fix typo Rüdiger Sonderfeld
@ 2013-12-01 15:36   ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 25+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-01 15:36 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15708, 15710

Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes:

> -		;; hader + body + footer
> +		;; header + body + footer

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15704: [PATCH 2/8] EWW: Handle HTML5 input types as text input.
  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
  0 siblings, 0 replies; 25+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-01 15:38 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15708, 15704

Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes:

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

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15707: [PATCH 5/8] EWW: Option to always use external-browser for certain content.
  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
  0 siblings, 0 replies; 25+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-01 15:44 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15708, 15707

Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes:

> Emacs can not display videos and has only limited audio support.
> Therefore it makes sense to call an external browser for links of that
> kind.  This is also a problem because shr turns <video> and <audio>
> tags into links to the media.
>
> * lisp/net/eww.el (eww-use-external-browser-for-content-type): New
>   customizable 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.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15708: bug#15706: [PATCH 4/8] shr: Add support for <audio> tag.
  2013-10-24 23:43 ` bug#15706: [PATCH 4/8] shr: Add support for <audio> tag Rüdiger Sonderfeld
@ 2013-12-01 15:46   ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 25+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-01 15:46 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15708, 15706

Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes:

> * lisp/net/shr.el (shr-tag-audio): New function.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15708: bug#15705: [PATCH 3/8] shr: Display content for video if no poster is available.
  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   ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 25+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-01 15:46 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15708, 15705

Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes:

> * lisp/net/shr.el (shr-tag-video): If poster is nil display a default
>   value instead.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15708: [PATCH 6/8] EWW: Erase old title.
  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   ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 25+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-01 15:47 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15708

Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes:

> * lisp/net/eww.el (eww-render): Set `eww-current-title' back to "".

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox.
  2013-10-24 23:43 ` bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox Rüdiger Sonderfeld
  2013-10-25 15:00   ` Ted Zlatanov
@ 2013-12-01 15:53   ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 25+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-01 15:53 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 15703, 15708

Rüdiger Sonderfeld <ruediger@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2013-12-01 15:53 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1382658061.git.ruediger@c-plusplus.de>
2013-10-24 23:43 ` bug#15703: [PATCH 1/8] EWW: Support user defined representation for checkbox Rüdiger Sonderfeld
2013-10-25 15:00   ` 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

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).