all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Politz <politza@hochschule-trier.de>
To: 24240@debbugs.gnu.org
Subject: bug#24240: 25.1.50; window-state-put, image-mode and window scrolling
Date: Tue, 16 Aug 2016 01:05:11 +0200	[thread overview]
Message-ID: <87bn0ttyzc.fsf@hochschule-trier.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]


There is a conflict between window-state-put and image-mode and
maybe other modes.  

The function image-mode-reapply-winprops gets called as soon as
window-state-put displays the image buffer in some window via
window-configuration-change-hook and applies the image's
previously stored scroll-values.

But window-state-put is not done yet and it has it's own
understanding of how the window should be scrolled, thereby
overriding images-mode's scrolling.

I guess ideally window-state-put should be atomic in the sense
that it delays these kinds of hooks until the window is
completely restored.  Below is a recipe and I attached a
workaround.

-ap

--

Let's start with

emacs -Q

and find some image file:

C-x C-f foo.png RET

Maybe enlarge the image, such that it can be scrolled.  Move the
image (C-n), such that vscroll is greater 0.

(window-vscroll) => 37

Save the window state,

(setq wst (window-state-get))

and switch to the *scratch* buffer.

(current-buffer) => #<buffer *scratch*>

Now restore the previously saved window state

(window-state-put wst)

,which should bring back the image buffer.  But notice, how
vscroll seems to be 0, i.e. display starts at the top of image.
Finally evaluate any expression in the mini-buffer

M-: t RET

which triggers image-mode-reapply-winprops scrolling the image as
expected.



[-- Attachment #2: window-state-put-workaround.el --]
[-- Type: application/emacs-lisp, Size: 505 bytes --]

             reply	other threads:[~2016-08-15 23:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 23:05 Andreas Politz [this message]
2016-08-16 11:00 ` bug#24240: 25.1.50; window-state-put, image-mode and window scrolling martin rudalics
2016-08-16 13:51   ` Andreas Politz
2016-08-17  8:30     ` martin rudalics
2016-08-17 10:33       ` Andreas Politz
2016-08-17 15:47         ` martin rudalics
2016-08-17 16:12           ` Andreas Politz
2016-08-18  8:42             ` martin rudalics
2016-10-30  8:47               ` 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=87bn0ttyzc.fsf@hochschule-trier.de \
    --to=politza@hochschule-trier.de \
    --cc=24240@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.