diff options
| author | Eric Hanchrow | 2015-11-12 17:23:37 -0800 |
|---|---|---|
| committer | John Wiegley | 2015-11-12 17:38:06 -0800 |
| commit | 9463abf4cc7571cf125bf1a637abe1a34241e83d (patch) | |
| tree | c46ea5d546115588acff754dc3b42f66a4ead9d5 | |
| parent | 6e5186e8a7ccfb9b8fb35b5f4f0371e4f4a68162 (diff) | |
| download | emacs-9463abf4cc7571cf125bf1a637abe1a34241e83d.tar.gz emacs-9463abf4cc7571cf125bf1a637abe1a34241e83d.zip | |
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.
| -rw-r--r-- | 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 58deaea6f53..23e2dc1f874 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -203,6 +203,13 @@ cid: URL as the argument.") | |||
| 203 | (goto-char begin) | 203 | (goto-char begin) |
| 204 | (shr-insert-document dom)))) | 204 | (shr-insert-document dom)))) |
| 205 | 205 | ||
| 206 | (defun have-fringes-p () | ||
| 207 | "Return t if fringe-columns is bound, and either (fringe-columns 'left) or | ||
| 208 | \(fringe-columns 'right) returns nonzero." | ||
| 209 | (and (fboundp 'fringe-columns) | ||
| 210 | (or (not (zerop (fringe-columns 'right))) | ||
| 211 | (not (zerop (fringe-columns 'left)))))) | ||
| 212 | |||
| 206 | ;;;###autoload | 213 | ;;;###autoload |
| 207 | (defun shr-insert-document (dom) | 214 | (defun shr-insert-document (dom) |
| 208 | "Render the parsed document DOM into the current buffer. | 215 | "Render the parsed document DOM into the current buffer. |
| @@ -230,19 +237,13 @@ DOM should be a parse tree as generated by | |||
| 230 | (if (not shr-use-fonts) | 237 | (if (not shr-use-fonts) |
| 231 | (- (window-body-width) 1 | 238 | (- (window-body-width) 1 |
| 232 | (if (and (null shr-width) | 239 | (if (and (null shr-width) |
| 233 | (or (zerop | 240 | (not (have-fringes-p))) |
| 234 | (fringe-columns 'right)) | ||
| 235 | (zerop | ||
| 236 | (fringe-columns 'left)))) | ||
| 237 | 0 | 241 | 0 |
| 238 | 1)) | 242 | 1)) |
| 239 | (- (window-body-width nil t) | 243 | (- (window-body-width nil t) |
| 240 | (* 2 (frame-char-width)) | 244 | (* 2 (frame-char-width)) |
| 241 | (if (and (null shr-width) | 245 | (if (and (null shr-width) |
| 242 | (or (zerop | 246 | (not (have-fringes-p))) |
| 243 | (fringe-columns 'right)) | ||
| 244 | (zerop | ||
| 245 | (fringe-columns 'left)))) | ||
| 246 | (* (frame-char-width) 2) | 247 | (* (frame-char-width) 2) |
| 247 | 0)))))) | 248 | 0)))))) |
| 248 | (shr-descend dom) | 249 | (shr-descend dom) |
| @@ -466,8 +467,7 @@ size, and full-buffer size." | |||
| 466 | ;; to usurp one column for the | 467 | ;; to usurp one column for the |
| 467 | ;; continuation glyph. | 468 | ;; continuation glyph. |
| 468 | (if (and (null shr-width) | 469 | (if (and (null shr-width) |
| 469 | (or (zerop (fringe-columns 'right)) | 470 | (not (have-fringes-p))) |
| 470 | (zerop (fringe-columns 'left)))) | ||
| 471 | (* (frame-char-width) 2) | 471 | (* (frame-char-width) 2) |
| 472 | 0)))) | 472 | 0)))) |
| 473 | (shr-insert text) | 473 | (shr-insert text) |