[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-i
From: |
martin rudalics |
Subject: |
Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document' |
Date: |
Sun, 17 Dec 2017 18:54:05 +0100 |
> Purely theoretically, you could always do something like
>
> (with-current-buffer (window-buffer)
> (point))
> to get at the value of point at entry into shr-pixel-column, and then
> a similar gork before exiting. But is that a good idea? It will slow
> down shr-pixel-column, which is already one of the hottest spots in
> shr.el's rendering. I don't think Lars will want to talk to me after
> that...
We could add a new function `buffer-point' to return the position of
point in an arbitrary buffer. Moreover IMO `save-window-excursion'
already eats much more time and space than `with-current-buffer'.
But I think Stefan is correct in the sense that this is a problem with
`shr-pixel-column' and the fix should be there. Something like
(defun shr-pixel-column ()
(if (not shr-use-fonts)
(current-column)
(if (not (get-buffer-window (current-buffer)))
(let ((window-point (window-point)))
(prog1
(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))))
(set-window-point nil window-point)))
(car (window-text-pixel-size nil (line-beginning-position) (point))))))
but maybe I'm completely misunderstanding the problem at hand.
martin
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', Stefan Monnier, 2017/12/16
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', Eli Zaretskii, 2017/12/16
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', Stefan Monnier, 2017/12/16
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', Eli Zaretskii, 2017/12/17
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document',
martin rudalics <=
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', Eli Zaretskii, 2017/12/17
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', martin rudalics, 2017/12/17
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', Stefan Monnier, 2017/12/17
- Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document', martin rudalics, 2017/12/18