From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.bugs 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 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1465698327 10001 80.91.229.3 (12 Jun 2016 02:25:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Jun 2016 02:25:27 +0000 (UTC) Cc: Samuel =?UTF-8?Q?L=C3=AA?= To: 23749@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 12 04:25:18 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bBv5P-0002n1-KF for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Jun 2016 04:25:15 +0200 Original-Received: from localhost ([::1]:49370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBv5O-0007pP-EO for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Jun 2016 22:25:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBv5I-0007nw-I2 for bug-gnu-emacs@gnu.org; Sat, 11 Jun 2016 22:25:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBv5C-0008JJ-Hr for bug-gnu-emacs@gnu.org; Sat, 11 Jun 2016 22:25:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBv5C-0008JF-EB for bug-gnu-emacs@gnu.org; Sat, 11 Jun 2016 22:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bBv5C-00083C-AH for bug-gnu-emacs@gnu.org; Sat, 11 Jun 2016 22:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Mastro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Jun 2016 02:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23749-submit@debbugs.gnu.org id=B23749.146569827630908 (code B ref 23749); Sun, 12 Jun 2016 02:25:02 +0000 Original-Received: (at 23749) by debbugs.gnu.org; 12 Jun 2016 02:24:36 +0000 Original-Received: from localhost ([127.0.0.1]:37532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBv4m-00082S-2y for submit@debbugs.gnu.org; Sat, 11 Jun 2016 22:24:36 -0400 Original-Received: from mail-yw0-f170.google.com ([209.85.161.170]:34012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBv4k-00082C-85 for 23749@debbugs.gnu.org; Sat, 11 Jun 2016 22:24:34 -0400 Original-Received: by mail-yw0-f170.google.com with SMTP id c72so99349448ywb.1 for <23749@debbugs.gnu.org>; Sat, 11 Jun 2016 19:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=D5S4SNqD8KnG0PIVZ5503t9IHOH5mCvTtZZrqlZncys=; b=UZ+t/4QfJN5GP2v2cIDa1lJScIXXJJET0n1DTfUCYIPWwuik8KeecfGICjw2eUpssu aM9XRFmTJcNbBAU5AZWmWWoYlQWQMMNlILmpB7k/ZrymxmYU13QI0J3BV5X/yVom/2p9 ofN/sGn3vj0NPii8t+J5WJMvVv9bwyz0yZFZZEDCYY7ti5Ze1vVUEAdTq0Inurr7PzZE MycOMWaR1H0dh+6tvTlCVeCP3Hyuc1LoTdlZBNiVsZdxRo+lLLDoE7AGPr7+vFozFWdn WR8HDvB9Y+Q6S6sr58uh6waRyFpaLjaDUSWGMEQQg9ufnLYuf/3cUmPohZFabUvwMNn7 E/NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=D5S4SNqD8KnG0PIVZ5503t9IHOH5mCvTtZZrqlZncys=; b=ImAwIOz6du3ML8mkWR56tLtIgQqjb+6PFQhyclxPKLxwaqDEFNQEY9HTFE7T2L1m3N 7Zt4+uNpsWqKAz9w7hQvsOyclgLd0DiwGTS8PsI+b3EsUXI1/0D+ZTEUwnR9ftV0Fi3Q vt/QBWvqr4BfScbkJ1bSGNSuZp6T6aHHul69kSvK0KW891HW4u9cNt1RTODc9kfj5BpO zixZHjZXsO7uiribeaDLeR6ElNvqj4bq902nSFg3PWR8tHfEDB1Rmj7ItOWGGftYiGjH NTbihkahusuOi7yEg/9IISObE5xfVoH2FV15ExoacO6aLf7rb3FdBxKT4j2nC55UCz4Y SDBg== X-Gm-Message-State: ALyK8tIXc1Ug9Nbws1sLeujSBfMfoogOgbeUmiTcaF1D0FZxD+8iqFaYG9yJxwP3RY9cGJ/DU3Rk36PTDsw9UA== X-Received: by 10.13.230.87 with SMTP id p84mr4812666ywe.125.1465698268814; Sat, 11 Jun 2016 19:24:28 -0700 (PDT) Original-Received: by 10.37.98.136 with HTTP; Sat, 11 Jun 2016 19:24:09 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119438 Archived-At: Samuel L=C3=AA 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