window-end
関数を使用すると、再表示を強制することなく または Cソースコードを変更せずに window-scroll-functions
フックは https://www.gnu.org/software/emacs /manual/html_node/elisp/Window-Hooks.html#Window-Hooks [注記:再表示を強制すると、目に見えない(2番目の分割のために)未完成の商品が表示されることがあります。たとえば、新しいオーバーレイにはまだ削除/配置されていません。]
CAVEAT: Beware that the window-scroll-functions
hook fires sometimes more than once during each command loop (while redisplay performs its job), and the first values for window-start
and window-end win t
are not always correct, and the last values are not always correct either -- e.g., when inserting/yanking, or when using goto
. [Fn 1.] When the window-scroll-functions
hook runs multiple times, the function attached to the hook can cause significant performance issues depending upon the complexity of said function. And, as mentioned, sometimes the user is simply out of luck -- i.e., correct values can never be obtained. Using pos-visible-in-window-p
can be helpful as a workaround to set up some checks to prevent the function attached to the hook from fully running its course if point
is not yet fully visible; and, a variable can be set up to test for whether the function has already fully run one time during that command loop (so that it doesn't keep running).
私は自分の個人設定で正しい window-start
と window-end
を得るために使っているCソースコードに、 em>中を再表示します。しかし、私はプログラマーではなく、本当に動機づけられている唯一の人なので、それは決して主流に進まないかもしれません。 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22404 これは window-start-end-hook
と呼ばれます。しかし、それはユーザがパッチのドラフトを試してソースからEmacsをビルドしたい場合にのみ利用可能です。私のドラフトパッチは、ウインドウのスクロールにかかわらず動作します。例えば、可視ウィンドウ内でポイントを動かすと動作します。 goto
を使用するときに機能します。それは挿入/ヤンクするときに機能します。スクロールするときに機能します。そのコンセプトを開発することに興味がある人は、機能要求22404への投稿を自由にお寄せください。
関連するスレッドも参照してください。
再表示を呼び出さずにウィンドウ開始を更新する方法
https://stackoverflow.com/questions/23923371/ emacs-calculated-new-window-start-end-without-redisplay/24216247#24216247
NOTE: Debugging functions that run during redisplay may require using a feature called trace-redisplay
(after launching Emacs from the command line) that is available when building Emacs from source with options such as: ./configure --enable-checking='glyphs'
.
[Fn. 1.]: When working with Bug #22637, Eli Z. on the Emacs development team explained that the reason the window-scroll-functions
hook does not yield correct results for inserting/yanking or goto
is because it was never designed for those scenarios: "The reason window-scroll-functions aren't run in both of these test cases is that what happens there is not considered 'scrolling'. Scrolling is informally defined as either an explicit call to a function that scrolls the window, or a pseudo-scroll done by the display engine when it detects that some part of the window's previous display is still present, but in a different vertical position. Moving point to an arbitrary location is neither." https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22637#35