all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Hanchrow <eric.hanchrow@gmail.com>
To: 21895@debbugs.gnu.org
Subject: bug#21895: [PATCH] shr: don't invoke unbound function (Bug#21895)
Date: Fri, 13 Nov 2015 01:35:47 +0000	[thread overview]
Message-ID: <CAHZoxq99vkbTHZLnLaJzqZpX0gC48REiOdq6_aLajh8F+X50Pw@mail.gmail.com> (raw)
In-Reply-To: <CAHZoxq-4ozwi2kFMyPJghWbTDzjD811Pco4bbwLGfs-doLwJsg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3079 bytes --]

Again, but as an attachment.

On Thu, Nov 12, 2015 at 5:29 PM Eric Hanchrow <eric.hanchrow@gmail.com>
wrote:

> * lisp/net/shr.el (fringes-p):
> New function.
> (shr-insert-document, shr-fill-text): Use it.
> ---
>  lisp/net/shr.el | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/lisp/net/shr.el b/lisp/net/shr.el
> index 58deaea..853b2fd 100644
> --- a/lisp/net/shr.el
> +++ b/lisp/net/shr.el
> @@ -203,6 +203,12 @@ cid: URL as the argument.")
>        (goto-char begin)
>        (shr-insert-document dom))))
>
> +(defun 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 +236,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 (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 (fringes-p)))
>                                           (* (frame-char-width) 2)
>                                         0))))))
>      (shr-descend dom)
> @@ -466,8 +466,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 (fringes-p)))
>                                         (* (frame-char-width) 2)
>                                       0))))
>   (shr-insert text)
> --
> 2.6.3
>
>
> On Thu, Nov 12, 2015 at 4:17 PM Eric Hanchrow <eric.hanchrow@gmail.com>
> wrote:
>
>> twb points out that I can (require 'fringe) to make the problem go away.
>>
>

[-- Attachment #1.2: Type: text/html, Size: 4965 bytes --]

[-- Attachment #2: 0001-shr-don-t-invoke-unbound-function-Bug-21895.patch --]
[-- Type: application/octet-stream, Size: 2931 bytes --]

From ffe294d70617f1f5331f7fab93a29cafd0ee0787 Mon Sep 17 00:00:00 2001
From: Eric Hanchrow <eric.hanchrow@gmail.com>
Date: Thu, 12 Nov 2015 17:23:37 -0800
Subject: [PATCH] shr: don't invoke unbound function (Bug#21895)
To: 21895@debbugs.gnu.org

* lisp/net/shr.el (fringes-p):
New function.
(shr-insert-document, shr-fill-text): Use it.
---
 lisp/net/shr.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 58deaea..853b2fd 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -203,6 +203,12 @@ cid: URL as the argument.")
       (goto-char begin)
       (shr-insert-document dom))))
 
+(defun 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 +236,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 (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 (fringes-p)))
                                          (* (frame-char-width) 2)
                                        0))))))
     (shr-descend dom)
@@ -466,8 +466,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 (fringes-p)))
                                        (* (frame-char-width) 2)
                                      0))))
 	(shr-insert text)
-- 
2.6.3


  reply	other threads:[~2015-11-13  1:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13  0:06 bug#21895: 25.0.50; eww: Lisp error: (void-function fringe-columns) Eric Hanchrow
2015-11-13  0:17 ` bug#21895: easy workaround Eric Hanchrow
2015-11-13  1:29   ` bug#21895: [PATCH] shr: don't invoke unbound function (Bug#21895) Eric Hanchrow
2015-11-13  1:35     ` Eric Hanchrow [this message]
2015-11-13  1:48       ` John Wiegley
2015-11-13  3:16     ` Glenn Morris
2015-11-13  3:24       ` Glenn Morris
2015-11-13  9:24       ` Eli Zaretskii
2015-11-13  8:04     ` martin rudalics
2015-11-13  8:23       ` Eli Zaretskii
2015-11-13 10:01         ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHZoxq99vkbTHZLnLaJzqZpX0gC48REiOdq6_aLajh8F+X50Pw@mail.gmail.com \
    --to=eric.hanchrow@gmail.com \
    --cc=21895@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.