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

Package: emacs;

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.

Full log


View this message in rfc822 format

From: Samuel Lê <samuel.le <at> gmail.com>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 23749 <at> debbugs.gnu.org
Subject: bug#23749: 24.3.50; can't make the cursor to the end of a buffer when that buffer is visible
Date: Sun, 12 Jun 2016 17:44:26 +0200
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))))
>




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.