Commit e9145444 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/net/shr.el (shr-insert-document): Remove unused var

`shr-preliminary-table-render'.
(shr-rescale-image): Remove unused arg `force'.
(shr-put-image): Update calls accordingly.
(shr-tag-a): Use `cont' rather than dyn-bound `dom'.
parent 5556c0ce
2013-12-17 Stefan Monnier <monnier@iro.umontreal.ca>
* net/shr.el (shr-insert-document): Remove unused var
`shr-preliminary-table-render'.
(shr-rescale-image): Remove unused arg `force'.
(shr-put-image): Update calls accordingly.
(shr-tag-a): Use `cont' rather than dyn-bound `dom'.
2013-12-17 Dmitry Gutov <dgutov@yandex.ru> 2013-12-17 Dmitry Gutov <dgutov@yandex.ru>
* emacs-lisp/smie.el (smie-indent--rule): Extract `smie-indent--rule-1'. * emacs-lisp/smie.el (smie-indent--rule): Extract `smie-indent--rule-1'.
......
...@@ -196,7 +196,6 @@ DOM should be a parse tree as generated by ...@@ -196,7 +196,6 @@ DOM should be a parse tree as generated by
(shr-state nil) (shr-state nil)
(shr-start nil) (shr-start nil)
(shr-base nil) (shr-base nil)
(shr-preliminary-table-render 0)
(shr-width (or shr-width (1- (window-width))))) (shr-width (or shr-width (1- (window-width)))))
(shr-descend (shr-transform-dom dom)) (shr-descend (shr-transform-dom dom))
(shr-remove-trailing-whitespace start (point)))) (shr-remove-trailing-whitespace start (point))))
...@@ -380,8 +379,7 @@ size, and full-buffer size." ...@@ -380,8 +379,7 @@ size, and full-buffer size."
(setq shr-stylesheet (nconc (shr-parse-style style) (setq shr-stylesheet (nconc (shr-parse-style style)
shr-stylesheet)) shr-stylesheet))
(setq style nil))) (setq style nil)))
;; If we have a display:none, then just ignore this part of the ;; If we have a display:none, then just ignore this part of the DOM.
;; DOM.
(unless (equal (cdr (assq 'display shr-stylesheet)) "none") (unless (equal (cdr (assq 'display shr-stylesheet)) "none")
(if (fboundp function) (if (fboundp function)
(funcall function (cdr dom)) (funcall function (cdr dom))
...@@ -754,10 +752,10 @@ element is the data blob and the second element is the content-type." ...@@ -754,10 +752,10 @@ element is the data blob and the second element is the content-type."
:format content-type)) :format content-type))
((eq size 'full) ((eq size 'full)
(ignore-errors (ignore-errors
(shr-rescale-image data t content-type))) (shr-rescale-image data content-type)))
(t (t
(ignore-errors (ignore-errors
(shr-rescale-image data nil content-type)))))) (shr-rescale-image data content-type))))))
(when image (when image
;; When inserting big-ish pictures, put them at the ;; When inserting big-ish pictures, put them at the
;; beginning of the line. ;; beginning of the line.
...@@ -779,11 +777,10 @@ element is the data blob and the second element is the content-type." ...@@ -779,11 +777,10 @@ element is the data blob and the second element is the content-type."
image) image)
(insert alt))) (insert alt)))
(defun shr-rescale-image (data &optional force content-type) (defun shr-rescale-image (data &optional content-type)
"Rescale DATA, if too big, to fit the current buffer. "Rescale DATA, if too big, to fit the current buffer."
If FORCE, rescale the image anyway." (if (not (and (fboundp 'imagemagick-types)
(if (or (not (fboundp 'imagemagick-types)) (get-buffer-window (current-buffer))))
(not (get-buffer-window (current-buffer))))
(create-image data nil t :ascent 100) (create-image data nil t :ascent 100)
(let ((edges (window-inside-pixel-edges (let ((edges (window-inside-pixel-edges
(get-buffer-window (current-buffer))))) (get-buffer-window (current-buffer)))))
...@@ -964,13 +961,13 @@ ones, in case fg and bg are nil." ...@@ -964,13 +961,13 @@ ones, in case fg and bg are nil."
(shr-generic cont) (shr-generic cont)
(shr-colorize-region start (point) fgcolor bgcolor))) (shr-colorize-region start (point) fgcolor bgcolor)))
(defun shr-tag-style (cont) (defun shr-tag-style (_cont)
) )
(defun shr-tag-script (cont) (defun shr-tag-script (_cont)
) )
(defun shr-tag-comment (cont) (defun shr-tag-comment (_cont)
) )
(defun shr-dom-to-xml (dom) (defun shr-dom-to-xml (dom)
...@@ -1079,7 +1076,7 @@ ones, in case fg and bg are nil." ...@@ -1079,7 +1076,7 @@ ones, in case fg and bg are nil."
shr-start) shr-start)
(shr-generic cont) (shr-generic cont)
(when (and shr-target-id (when (and shr-target-id
(equal (cdr (assq :name (cdr dom))) shr-target-id)) (equal (cdr (assq :name cont)) shr-target-id))
;; We have a zero-length <a name="foo"> element, so just ;; We have a zero-length <a name="foo"> element, so just
;; insert... something. ;; insert... something.
(when (= start (point)) (when (= start (point))
...@@ -1326,7 +1323,7 @@ The preference is a float determined from `shr-prefer-media-type'." ...@@ -1326,7 +1323,7 @@ The preference is a float determined from `shr-prefer-media-type'."
(defun shr-tag-h6 (cont) (defun shr-tag-h6 (cont)
(shr-heading cont)) (shr-heading cont))
(defun shr-tag-hr (cont) (defun shr-tag-hr (_cont)
(shr-ensure-newline) (shr-ensure-newline)
(insert (make-string shr-width shr-hr-line) "\n")) (insert (make-string shr-width shr-hr-line) "\n"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment