all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@jurta.org>
Cc: Gergely Risko <gergely@risko.hu>, emacs-devel@gnu.org
Subject: Re: find-file-hook, recenter, scroll-conservatively and save-place
Date: Fri, 01 Feb 2019 10:04:47 +0100	[thread overview]
Message-ID: <5C540BAF.3000602@gmx.at> (raw)
In-Reply-To: <878sz0o9nd.fsf@mail.linkov.net>

 > I don't like the default recentering too.  I had to fix it with
 > a lot of customization, e.g.
 >
 > (add-hook 'xref-after-jump-hook 'reposition-window)
 > (add-hook 'xref-after-return-hook 'reposition-window)
 > (add-hook 'find-function-after-hook 'reposition-window)

Once you get used to recentering you probably like it.  I never
managed to like it.  It's a consequence of our insistence to keep
point on-screen.

 >> That is, provide 'window-point' and 'window-start' action alist entries
 >> with the former allowing the 'switch-to-buffer-preserve-window-point'
 >> logic (among others) and the latter optionally allowing to recenter.
 >
 > Like switch-to-buffer-preserve-window-point used in dired-find-file?

More like we handle 'display-buffer-mark-dedicated' now.  That is,
'switch-to-buffer-preserve-window-point' would be respected by
'display-buffer' unless explicitly overridden by a 'window-point'
entry.  But I dislike the idea of adding yet another variable that
will be eventually handled like an alist entry.

 > Interesting question.  Maybe introduce two new buffer-local variables
 > 'window-point' and 'window-start' that a hook could set and then
 > display-buffer could read and call functions window-point and window-start?
 > These buffer-local values should be used only once and should be reverted
 > to nil after the first use.

Basically, anyone who wants to customize the behavior may bind
'display-buffer-alist' appropriately around the 'find-file' call.  But
this is awkward.  Alists are not very suitable to "affect just this
'display-buffer' call".

 > BTW, a related question: should save-place save window-start as well?
 > It should be easy to implement after this problem is solved.

I have no practice with 'save-place-mode' so I can't tell.  From my
experience I can only tell that it's disorienting when reverting a
buffer doesn't preserve window start.

martin



  parent reply	other threads:[~2019-02-01  9:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31  9:46 find-file-hook, recenter, scroll-conservatively and save-place Gergely Risko
2019-01-31 13:46 ` Gergely Risko
2019-01-31 14:43   ` Eli Zaretskii
2019-01-31 15:31     ` Gergely Risko
2019-01-31 13:49 ` martin rudalics
2019-01-31 14:32   ` Eli Zaretskii
2019-01-31 18:44     ` martin rudalics
2019-01-31 23:47       ` Gergely Risko
2019-02-01  9:05         ` martin rudalics
2019-01-31 20:57   ` Juri Linkov
2019-01-31 22:45     ` Gergely Risko
2019-02-01  9:05       ` martin rudalics
2019-02-02 21:03       ` Juri Linkov
2019-02-03 20:18         ` Juri Linkov
2019-02-01  9:04     ` martin rudalics [this message]
2019-02-01 11:18       ` Gergely Risko
2019-02-02  9:30         ` 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=5C540BAF.3000602@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=gergely@risko.hu \
    --cc=juri@jurta.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.