GNU bug report logs -
#23749
24.3.50; can't make the cursor to the end of a buffer when that buffer is visible
Previous Next
Reported by: Samuel Lê <samuel.le <at> gmail.com>
Date: Sun, 12 Jun 2016 02:02:01 UTC
Severity: normal
Tags: notabug
Found in version 24.3.50
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23749 in the body.
You can then email your comments to 23749 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23749
; Package
emacs
.
(Sun, 12 Jun 2016 02:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Samuel Lê <samuel.le <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 12 Jun 2016 02:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
- run "emacs -Q" from command line.
- split emacs screen (C-x 2)
- on one side open an elisp code (say test.el)
- on the other side put the *scratch* buffer
- in test.el, enter (with-current-buffer "*scratch* (insert "test\n")
(goto-char (point-max)))
- then press C-x e to evaluate that command
- it inserts "test" in *scratch* buffer but doesnt go at the end of the
- buffer.
It works fine when buffer *scratch* is not visible.
Thanks!
In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
of 2013-08-17 on debianSam
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description: Debian GNU/Linux 8.4 (jessie)
Configured using:
`configure --prefix=/opt/emacs24'
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Emacs-Lisp
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
C-x b <return> C-x 2 C-x C-f t e s t . <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> t e s t . e l <return> ( w i t h - c u
r r e n t - b u f f e r SPC " * s c r a t c h * " SPC
( i n s e r t SPC " t e s t \ n " ) SPC ( g o t o -
c h a t SPC ( p o i n t m <backspace> - m a x ) ) )
C-x C-e C-x k <return> <S-up> <down> C-k <S-up> C-x
o <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <backspace>
r C-e C-x C-e <help-echo> M-x r e p o r t M-/ - e m
a c s - b u g <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Entering debugger...
Mark set [2 times]
198
Auto-saving...
Scanning for dabbrevs...done
user-error: No dynamic expansion for `report' found
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils dabbrev help-mode easymenu debug time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23749
; Package
emacs
.
(Sun, 12 Jun 2016 02:25:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 23749 <at> debbugs.gnu.org (full text, mbox):
Samuel Lê <samuel.le <at> gmail.com> wrote:
> - run "emacs -Q" from command line.
> - split emacs screen (C-x 2)
> - on one side open an elisp code (say test.el)
> - on the other side put the *scratch* buffer
> - in test.el, enter (with-current-buffer "*scratch* (insert "test\n")
> (goto-char (point-max)))
> - then press C-x e to evaluate that command
> - it inserts "test" in *scratch* buffer but doesnt go at the end of the
> - buffer.
>
> It works fine when buffer *scratch* is not visible.
I confirmed that the behavior is the same in Emacs 25.0.94, but I
suspect this is not a bug because there's also a concept of "window
point" (see `window-point').
Adding `with-selected-window' will cause point to move as you expected:
(with-current-buffer "*scratch*"
(with-selected-window (get-buffer-window (current-buffer))
(insert "test\n")
(goto-char (point-max))))
However, if the buffer isn't shown in a window, `get-buffer-window' will
return nil and `with-selected-window' will thus signal an error. So the
right fix really depends on the context and ultimate goal.
John
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23749
; Package
emacs
.
(Sun, 12 Jun 2016 02:26:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 23749 <at> debbugs.gnu.org (full text, mbox):
tag 23749 + notabug
quit
On Sat, Jun 11, 2016 at 10:01 PM, Samuel Lê <samuel.le <at> gmail.com> wrote:
> - run "emacs -Q" from command line.
> - split emacs screen (C-x 2)
> - on one side open an elisp code (say test.el)
> - on the other side put the *scratch* buffer
> - in test.el, enter (with-current-buffer "*scratch* (insert "test\n")
> (goto-char (point-max)))
> - then press C-x e to evaluate that command
> - it inserts "test" in *scratch* buffer but doesnt go at the end of the
> - buffer.
>
> It works fine when buffer *scratch* is not visible.
>
> Thanks!
>
> In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
I see the same with 25.0.95. I think it's not a bug, it's simply that
the window point is stored separately. You can use
(with-current-buffer "*scratch*"
(insert "test\n")
(set-window-point (get-buffer-window) (point-max)))
to set it. Or if there are multiple windows and you want to set the
point in all of them:
(with-current-buffer "*scratch*"
(insert "test\n")
(dolist (w (get-buffer-window-list))
(set-window-point w (point-max))))
Added tag(s) notabug.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Sun, 12 Jun 2016 02:26:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23749
; Package
emacs
.
(Sun, 12 Jun 2016 15:45:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 23749 <at> debbugs.gnu.org (full text, mbox):
I managed to do what I wanted with:
(defun insert-into-buffer (buffer text)
(let ((buffer-window (get-buffer-window buffer)))
(if (not buffer-window)
(with-current-buffer buffer
(beginning-of-line)
(insert text)
(goto-char (point-max)))
(with-current-buffer buffer
(beginning-of-line)
(insert text)
(set-window-point (get-buffer-window) (point-max))))))
Thanks!
On 6/12/16, Noam Postavsky <npostavs <at> users.sourceforge.net> wrote:
> tag 23749 + notabug
> quit
>
> On Sat, Jun 11, 2016 at 10:01 PM, Samuel Lê <samuel.le <at> gmail.com> wrote:
>> - run "emacs -Q" from command line.
>> - split emacs screen (C-x 2)
>> - on one side open an elisp code (say test.el)
>> - on the other side put the *scratch* buffer
>> - in test.el, enter (with-current-buffer "*scratch* (insert "test\n")
>> (goto-char (point-max)))
>> - then press C-x e to evaluate that command
>> - it inserts "test" in *scratch* buffer but doesnt go at the end of the
>> - buffer.
>>
>> It works fine when buffer *scratch* is not visible.
>>
>> Thanks!
>>
>> In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
>
> I see the same with 25.0.95. I think it's not a bug, it's simply that
> the window point is stored separately. You can use
>
> (with-current-buffer "*scratch*"
> (insert "test\n")
> (set-window-point (get-buffer-window) (point-max)))
>
> to set it. Or if there are multiple windows and you want to set the
> point in all of them:
>
> (with-current-buffer "*scratch*"
> (insert "test\n")
> (dolist (w (get-buffer-window-list))
> (set-window-point w (point-max))))
>
Reply sent
to
Noam Postavsky <npostavs <at> users.sourceforge.net>
:
You have taken responsibility.
(Sun, 12 Jun 2016 15:52:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Samuel Lê <samuel.le <at> gmail.com>
:
bug acknowledged by developer.
(Sun, 12 Jun 2016 15:52:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 23749-done <at> debbugs.gnu.org (full text, mbox):
Cool, could be compacted a little:
(defun insert-into-buffer (buffer text)
(with-current-buffer buffer
(beginning-of-line)
(insert text)
(let ((buffer-window (get-buffer-window)))
(if buffer-window
(set-window-point buffer-window (point-max))
(goto-char (point-max))))))
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 11 Jul 2016 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 66 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.