emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 9463abf: shr: don't invoke unbound function (Bug#21


From: John Wiegley
Subject: [Emacs-diffs] master 9463abf: shr: don't invoke unbound function (Bug#21895)
Date: Fri, 13 Nov 2015 01:48:30 +0000

branch: master
commit 9463abf4cc7571cf125bf1a637abe1a34241e83d
Author: Eric Hanchrow <address@hidden>
Commit: John Wiegley <address@hidden>

    shr: don't invoke unbound function (Bug#21895)
    
    * lisp/net/shr.el (have-fringes-p): New function.
      (shr-insert-document, shr-fill-text): Use it.
---
 lisp/net/shr.el |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 58deaea..23e2dc1 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -203,6 +203,13 @@ cid: URL as the argument.")
       (goto-char begin)
       (shr-insert-document dom))))
 
+(defun have-fringes-p ()
+  "Return t if fringe-columns is bound, and either (fringe-columns 'left) or
+\(fringe-columns 'right) returns nonzero."
+  (and (fboundp 'fringe-columns)
+       (or (not (zerop (fringe-columns 'right)))
+           (not (zerop (fringe-columns 'left))))))
+
 ;;;###autoload
 (defun shr-insert-document (dom)
   "Render the parsed document DOM into the current buffer.
@@ -230,19 +237,13 @@ DOM should be a parse tree as generated by
                                (if (not shr-use-fonts)
                                    (- (window-body-width) 1
                                        (if (and (null shr-width)
-                                                (or (zerop
-                                                     (fringe-columns 'right))
-                                                    (zerop
-                                                     (fringe-columns 'left))))
+                                                (not (have-fringes-p)))
                                            0
                                          1))
                                  (- (window-body-width nil t)
                                      (* 2 (frame-char-width))
                                      (if (and (null shr-width)
-                                              (or (zerop
-                                                   (fringe-columns 'right))
-                                                  (zerop
-                                                   (fringe-columns 'left))))
+                                              (not (have-fringes-p)))
                                          (* (frame-char-width) 2)
                                        0))))))
     (shr-descend dom)
@@ -466,8 +467,7 @@ size, and full-buffer size."
                                    ;; to usurp one column for the
                                    ;; continuation glyph.
                                    (if (and (null shr-width)
-                                            (or (zerop (fringe-columns 'right))
-                                                (zerop (fringe-columns 
'left))))
+                                            (not (have-fringes-p)))
                                        (* (frame-char-width) 2)
                                      0))))
        (shr-insert text)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]