bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24950: 25.1; shr-string-pixel-width cannot be called from a dedicate


From: Eli Zaretskii
Subject: bug#24950: 25.1; shr-string-pixel-width cannot be called from a dedicated buffer
Date: Sun, 20 Nov 2016 18:28:19 +0200

> From: David Bremner <address@hidden>
> Date: Tue, 15 Nov 2016 22:42:57 -0400
> 
> 1) emacs -Q
> 2) in *scratch*, evaluate the following code
> (require 'shr)
> (toggle-debug-on-error)
> (set-window-dedicated-p (selected-window) t)
> (shr-string-pixel-width "-")
> 
> you get an error from set-window-buffer complaining that the window is
> dedicated to *scratch*.

Thanks for the recipe.  Does the patch below solve your problem?

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 2c8ff79..18bc7b8 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -518,6 +518,9 @@ shr-pixel-column
       (current-column)
     (if (not (get-buffer-window (current-buffer)))
        (save-window-excursion
+          ;; Avoid errors if the selected window is a dedicated one,
+          ;; and they just want to insert a document into it.
+          (set-window-dedicated-p nil nil)
          (set-window-buffer nil (current-buffer))
          (car (window-text-pixel-size nil (line-beginning-position) (point))))
       (car (window-text-pixel-size nil (line-beginning-position) (point))))))





reply via email to

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