From: Eli Zaretskii <eliz@gnu.org>
To: David Bremner <david@tethera.net>
Cc: 24950@debbugs.gnu.org
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 [thread overview]
Message-ID: <83inri9kv0.fsf@gnu.org> (raw)
In-Reply-To: <87y40kw3f2.fsf@tethera.net> (message from David Bremner on Tue, 15 Nov 2016 22:42:57 -0400)
> From: David Bremner <david@tethera.net>
> 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))))))
next prev parent reply other threads:[~2016-11-20 16:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 2:42 bug#24950: 25.1; shr-string-pixel-width cannot be called from a dedicated buffer David Bremner
2016-11-20 16:28 ` Eli Zaretskii [this message]
2016-11-20 18:35 ` David Bremner
2016-11-20 19:10 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83inri9kv0.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=24950@debbugs.gnu.org \
--cc=david@tethera.net \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).