* bug#13466: find-file-noselect scrolls current buffer
@ 2013-01-16 18:27 Michael Brand
2013-01-16 23:10 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Michael Brand @ 2013-01-16 18:27 UTC (permalink / raw
To: 13466
Hi all
Although the issue seems to be independent of the mode it becomes
mainly annoying when an Org mode buffer scrolls unwantedly when a link
to an other Org mode buffer is followed. It depends on that the target
buffer has a mode hook that moves point, in my case to search a
file-specific config that I have to process myself. I was able to
drill down the issue to a find-file-noselect with a simple mode hook
with only end-of-buffer. I tried with org-mode-hook and
text-mode-hook, both show the issue. All GNU Emacs I had easily
available have the issue: GNU/Linux: 23.1.1. 23.3.1 24.2.1 24.2.92.1,
OS X: 23.3.1 24.1.1 24.2.2.
Minimal test to reproduce with text-mode-hook:
$ yes | nl | head -999 > /tmp/n
$ cp /tmp/n /tmp/m.txt
$ emacs -q /tmp/n
M-: (scroll-up)
M-: (add-hook 'text-mode-hook 'end-of-buffer)
M-: (find-file-noselect "/tmp/m.txt")
During the last step the buffer /tmp/n is scrolled which I consider a
bug. Note that when /tmp/m.txt is small this scrolling does not occur.
The same happens with find-file-other-window.
Is there a workaround how to use the hook? The save-excursion I have
around moving the point in the mode hook anyway is not enough.
Michael
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#13466: find-file-noselect scrolls current buffer
2013-01-16 18:27 bug#13466: find-file-noselect scrolls current buffer Michael Brand
@ 2013-01-16 23:10 ` Stefan Monnier
2013-01-17 18:44 ` Michael Brand
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2013-01-16 23:10 UTC (permalink / raw
To: Michael Brand; +Cc: 13466
> $ yes | nl | head -999 > /tmp/n
> $ cp /tmp/n /tmp/m.txt
> $ emacs -q /tmp/n
> M-: (scroll-up)
> M-: (add-hook 'text-mode-hook 'end-of-buffer)
> M-: (find-file-noselect "/tmp/m.txt")
The problem is end-of-buffer, which affects the selected-window, even if
it does not display the current-buffer. Of course, its docstring says
not to use it from Lisp, so we could argue it's not quite a bug.
I.e. use
M-: (add-hook 'text-mode-hook (lambda () (goto-char (point-max))))
-- Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#13466: find-file-noselect scrolls current buffer
2013-01-16 23:10 ` Stefan Monnier
@ 2013-01-17 18:44 ` Michael Brand
0 siblings, 0 replies; 3+ messages in thread
From: Michael Brand @ 2013-01-17 18:44 UTC (permalink / raw
To: Stefan Monnier; +Cc: 13466
Hi Stefan
Thank you for looking into this.
On Thu, Jan 17, 2013 at 12:10 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> The problem is end-of-buffer, which affects the selected-window, even if
> it does not display the current-buffer. Of course, its docstring says
> not to use it from Lisp,
Interesting. I didn’t consider reading the docstring of
end-of-buffer...
> so we could argue it's not quite a bug.
Agreed, please close this “bug”.
> I.e. use
> M-: (add-hook 'text-mode-hook (lambda () (goto-char (point-max))))
Yes, done. It uncovers an issue which I prefer to address on
emacs-orgmode@gnu.org:
“Follow link scrolls current buffer when table aligns”
http://lists.gnu.org/archive/html/emacs-orgmode/2013-01/msg00700.html
Michael
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-17 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 18:27 bug#13466: find-file-noselect scrolls current buffer Michael Brand
2013-01-16 23:10 ` Stefan Monnier
2013-01-17 18:44 ` Michael Brand
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.