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

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

[debbugs-tracker] bug#20100: closed (24.4.91; Can't scroll a window whil


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#20100: closed (24.4.91; Can't scroll a window while in minibuffer)
Date: Sat, 14 Mar 2015 08:18:02 +0000

Your message dated Sat, 14 Mar 2015 09:17:04 +0100
with message-id <address@hidden>
and subject line Re: bug#20100: 24.4.91; Can't scroll a window while in 
minibuffer
has caused the debbugs.gnu.org bug report #20100,
regarding 24.4.91; Can't scroll a window while in minibuffer
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
20100: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20100
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.4.91; Can't scroll a window while in minibuffer Date: Fri, 13 Mar 2015 13:51:36 +0100
I'm trying to write a completion package using `read-from-minibuffer'
combined with `post-command-hook'.

Everything is working OK, except when I want to sync the current
completion candidate (one of buffer's lines) with the corresponding line
in the buffer.

This code, specifically `recenter', doesn't work:

(with-current-buffer buf
  (goto-char (point-min))
  (forward-line (1- num))
  (recenter))

However, this code will scroll the window (`buf' and `wnd' correspond to
each other):

(with-current-buffer buf
  (goto-char (point-min))
  (forward-line (1- num))
  (setf (window-point wnd)
        (point)))

Still, it's not a perfect solution, since even after setting
`window-point', (window-start wnd) and (window-end wnd t) will not
return the correct thing.

I'm pretty sure it's a bug and the code above should work as is, but I'd
also appreciate pointers for achieving the scrolling and window bounds
re-calculation for the current Emacs.

regards,
Oleh



--- End Message ---
--- Begin Message --- Subject: Re: bug#20100: 24.4.91; Can't scroll a window while in minibuffer Date: Sat, 14 Mar 2015 09:17:04 +0100
> Thanks, using `with-selected-window' instead of `with-current-buffer'
> solved it. I thought that they should be equivalent. Apparently they are not.

It's a trap.  Commands that implicitly work on the selected window
should not be used programmatically.  Such commands are `recenter',
`enlarge-window', `shrink-window', `split-window-below' and
`split-window-right'.  When used in applications the only way to make
them behave is to wrap them in `with-selected-window' :-(

There are also more specialized commands like `recenter-top-bottom' or
`move-to-window-line-top-bottom' whose doc-strings don't explain what
they do.  Never use them in programs!

martin, closing this bug


--- End Message ---

reply via email to

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