From: John Mastro <john.b.mastro@gmail.com>
To: 23749@debbugs.gnu.org
Cc: "Samuel Lê" <samuel.le@gmail.com>
Subject: bug#23749: 24.3.50; can't make the cursor to the end of a buffer when that buffer is visible
Date: Sat, 11 Jun 2016 19:24:09 -0700 [thread overview]
Message-ID: <CAOj2CQT_iU1+kUtenNBY+u1OOXD4Mn6z3gE6yrcpiQHnfmPF6A@mail.gmail.com> (raw)
In-Reply-To: <CABEr5BuPdLpzbBGvDJAcLm7znvvYr4_MJ68tP5bfsY_ZiRnB+w@mail.gmail.com>
Samuel Lê <samuel.le@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
next prev parent reply other threads:[~2016-06-12 2:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-12 2:01 bug#23749: 24.3.50; can't make the cursor to the end of a buffer when that buffer is visible Samuel Lê
2016-06-12 2:24 ` John Mastro [this message]
2016-06-12 2:25 ` Noam Postavsky
2016-06-12 15:44 ` Samuel Lê
2016-06-12 15:51 ` Noam Postavsky
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOj2CQT_iU1+kUtenNBY+u1OOXD4Mn6z3gE6yrcpiQHnfmPF6A@mail.gmail.com \
--to=john.b.mastro@gmail.com \
--cc=23749@debbugs.gnu.org \
--cc=samuel.le@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).