From unknown Fri Jun 20 07:12:49 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8301 <8301@debbugs.gnu.org> To: bug#8301 <8301@debbugs.gnu.org> Subject: Status: 24.0.50; non-interactive `yank' in another buffer leaves point before insertion Reply-To: bug#8301 <8301@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:12:49 +0000 retitle 8301 24.0.50; non-interactive `yank' in another buffer leaves point= before insertion reassign 8301 emacs submitter 8301 "Drew Adams" severity 8301 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 20 14:41:07 2011 Received: (at submit) by debbugs.gnu.org; 20 Mar 2011 18:41:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1NYo-0003WA-Uw for submit@debbugs.gnu.org; Sun, 20 Mar 2011 14:41:07 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1NYm-0003Vg-U8 for submit@debbugs.gnu.org; Sun, 20 Mar 2011 14:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1NYg-0002Ub-JC for submit@debbugs.gnu.org; Sun, 20 Mar 2011 14:40:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:42237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1NYg-0002UX-H1 for submit@debbugs.gnu.org; Sun, 20 Mar 2011 14:40:58 -0400 Received: from [140.186.70.92] (port=40941 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1NYf-0005MK-Bb for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 14:40:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1NYe-0002UA-1n for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 14:40:57 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:47309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1NYd-0002Td-SS for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 14:40:56 -0400 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p2KIepNb002583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 20 Mar 2011 18:40:52 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p2KIeonO025016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 20 Mar 2011 18:40:51 GMT Received: from abhmt019.oracle.com (abhmt019.oracle.com [141.146.116.28]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p2KIeo8O008680 for ; Sun, 20 Mar 2011 13:40:50 -0500 Received: from dradamslap1 (/10.159.56.246) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 20 Mar 2011 11:40:50 -0700 From: "Drew Adams" To: Subject: 24.0.50; non-interactive `yank' in another buffer leaves point before insertion Date: Sun, 20 Mar 2011 11:40:52 -0700 Message-ID: <199987D185BD48ACA3992FE98F49CC21@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Thread-Index: AcvnLlaXDanpMKNRTWurgeOfOtInEw== X-Source-IP: acsmt356.oracle.com [141.146.40.156] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090202.4D864A33.0056,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) Help me understand what I'm missing. The behavior seems consistent across Emacs releases, so I doubt that it represents a bug (?). But perhaps there is a doc bug? The behavior I see seems to contradict the doc. I cannot seem to find anything in the doc that explains what I see, and even looking at the code and following it in the debugger I don't understand. `insert' seems to not be moving point after the inserted text when `yank' is called non-interactively in another buffer. After the insertion, both point and the mark are at the insertion position (before the inserted text). emacs -Q Double-click mouse-1 on a word in buffer *scratch*, then `M-w', to have something in the kill ring. Move point to, e.g., the end of buffer *scratch*. C-x C-f foo.el Type this in foo.el, then evaluate it (`C-x C-e'). (with-current-buffer "*scratch*" (yank)) The text is inserted at the end of buffer *scratch* (i.e. at point), but point in that buffer remains before the inserted text. It's not just a difference of `window-point' or something; point is not advanced to be after the insert. Both point and mark are before the inserted text. I don't see why this is the behavior, and I don't see why it should be. Executing `yank' interactively with *scratch* current does as I would expect, and evaling `yank' non-interactively with *scratch* already current (i.e. without the `with-current-buffer') does similarly. This has nothing to do with `with-current-buffer' per se. Both `save-current-buffer' and (progn (set-buffer...)...) behave likewise. `insert' is coded in C, so I'm not sure just what is happening. I find nothing in the doc that would suggest this should be the behavior. The `yank' doc says that `yank' (with no prefix arg) puts point after the inserted text. And even with a prefix arg it is not supposed (per the doc) to leave point and mark at the same position. Similarly for the `insert' doc. What am I missing? At one point I guessed that `insert' might be doing what I expect but then something else moved point back to the original position. But I don't see this in the debugger: `insert' itself does not seem to move point forward. Please help me understand what's happening and why. Also, please let me know what I can/should use in my code to get the behavior that I expected: with the other buffer (e.g. *scratch*) current, yank the head of the kill ring at point in that buffer, putting mark at the insertion point and point at the end of the insertion. In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2011-03-07 on 3249CTO Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (4.5) --no-opt --cflags -Ic:/imagesupport/include' From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 20 16:10:38 2011 Received: (at 8301) by debbugs.gnu.org; 20 Mar 2011 20:10:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1OxS-0005Va-Ja for submit@debbugs.gnu.org; Sun, 20 Mar 2011 16:10:38 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1OxQ-0005VN-6i for 8301@debbugs.gnu.org; Sun, 20 Mar 2011 16:10:36 -0400 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p2KKAS7v029609 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <8301@debbugs.gnu.org>; Sun, 20 Mar 2011 20:10:30 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p2KKAQ61017462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <8301@debbugs.gnu.org>; Sun, 20 Mar 2011 20:10:27 GMT Received: from abhmt014.oracle.com (abhmt014.oracle.com [141.146.116.23]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p2KKAQwB016622 for <8301@debbugs.gnu.org>; Sun, 20 Mar 2011 15:10:26 -0500 Received: from dradamslap1 (/10.159.56.246) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 20 Mar 2011 13:10:26 -0700 From: "Drew Adams" To: <8301@debbugs.gnu.org> References: <199987D185BD48ACA3992FE98F49CC21@us.oracle.com> Subject: RE: bug#8301: 24.0.50; non-interactive `yank' in another buffer leaves point beforeinsertion Date: Sun, 20 Mar 2011 13:10:29 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 In-reply-to: <199987D185BD48ACA3992FE98F49CC21@us.oracle.com> Thread-Index: AcvnLlaXDanpMKNRTWurgeOfOtInEwAC/uew X-Source-IP: acsmt356.oracle.com [141.146.40.156] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090205.4D865F33.00D9,ss=1,fgs=0 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 8301 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) Sorry, I should have been clearer with my recipe. I meant `C-x 4 f foo.el', not `C-x C-f foo.el'. It seems that this makes a difference: If the buffer is visible then the behavior I described occurs. If the buffer is not visible (e.g. if you do `C-x C-f foo.el*, so *scratch* is not visible when you eval the sexp), then it behaves as I would expect (no bug). So maybe this does have something to do with `window-point' after all? Dunno. Anyway, I would like to know how to code this so that it does what I expect regardless of whether the target buffer is visible. Thx. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 20 16:18:41 2011 Received: (at 8301) by debbugs.gnu.org; 20 Mar 2011 20:18:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1P5E-0005gh-QN for submit@debbugs.gnu.org; Sun, 20 Mar 2011 16:18:41 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1P5D-0005gV-1f for 8301@debbugs.gnu.org; Sun, 20 Mar 2011 16:18:39 -0400 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p2KKIWG4006324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <8301@debbugs.gnu.org>; Sun, 20 Mar 2011 20:18:33 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p2KKIVqL029543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <8301@debbugs.gnu.org>; Sun, 20 Mar 2011 20:18:32 GMT Received: from abhmt003.oracle.com (abhmt003.oracle.com [141.146.116.12]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p2KKIPUP020374 for <8301@debbugs.gnu.org>; Sun, 20 Mar 2011 15:18:31 -0500 Received: from dradamslap1 (/10.159.56.246) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 20 Mar 2011 13:18:24 -0700 From: "Drew Adams" To: <8301@debbugs.gnu.org> References: <199987D185BD48ACA3992FE98F49CC21@us.oracle.com> Subject: RE: bug#8301: 24.0.50; non-interactive `yank' in another buffer leaves point beforeinsertion Date: Sun, 20 Mar 2011 13:18:24 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 In-reply-to: <199987D185BD48ACA3992FE98F49CC21@us.oracle.com> Thread-Index: AcvnLlaXDanpMKNRTWurgeOfOtInEwADWRjg X-Source-IP: acsmt356.oracle.com [141.146.40.156] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4D866118.004C,ss=1,fgs=0 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 8301 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) I see that calling (set-window-point the-window (point)) after yanking fixes the problem. And I probably should have realized what was involved. No bug, including no doc bug, I believe. I'll close the bug. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 20 16:20:42 2011 Received: (at control) by debbugs.gnu.org; 20 Mar 2011 20:20:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1P7C-0005k3-Cu for submit@debbugs.gnu.org; Sun, 20 Mar 2011 16:20:42 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1P79-0005jp-3P for control@debbugs.gnu.org; Sun, 20 Mar 2011 16:20:39 -0400 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p2KKKWp3008886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 20 Mar 2011 20:20:33 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p2KKKVoi030113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 20 Mar 2011 20:20:32 GMT Received: from abhmt007.oracle.com (abhmt007.oracle.com [141.146.116.16]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p2KKKVgf021391 for ; Sun, 20 Mar 2011 15:20:31 -0500 Received: from dradamslap1 (/10.159.56.246) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 20 Mar 2011 13:20:31 -0700 From: "Drew Adams" To: Subject: please close 8301 Date: Sun, 20 Mar 2011 13:20:33 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Thread-Index: AcvnPEQDFjQLyJ/7StGEWpO0BHqsXQ== X-Source-IP: acsmt356.oracle.com [141.146.40.156] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090207.4D866190.006D,ss=1,fgs=0 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) close 8301 thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 21 10:29:35 2011 Received: (at 8301) by debbugs.gnu.org; 21 Mar 2011 14:29:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1g6w-0006ia-TS for submit@debbugs.gnu.org; Mon, 21 Mar 2011 10:29:35 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1g6u-0006iL-Oe for 8301@debbugs.gnu.org; Mon, 21 Mar 2011 10:29:33 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAIv9hk1Ld/X5/2dsb2JhbAClcniITbdNhWMElWk X-IronPort-AV: E=Sophos;i="4.63,219,1299474000"; d="scan'208";a="97408700" Received: from 75-119-245-249.dsl.teksavvy.com (HELO pastel.home) ([75.119.245.249]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 21 Mar 2011 10:29:26 -0400 Received: by pastel.home (Postfix, from userid 20848) id 867AB58AF5; Mon, 21 Mar 2011 10:29:26 -0400 (EDT) From: Stefan Monnier To: "Drew Adams" Subject: Re: bug#8301: 24.0.50; non-interactive `yank' in another buffer leaves point beforeinsertion Message-ID: References: <199987D185BD48ACA3992FE98F49CC21@us.oracle.com> Date: Mon, 21 Mar 2011 10:29:26 -0400 In-Reply-To: (Drew Adams's message of "Sun, 20 Mar 2011 13:10:29 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 8301 Cc: 8301@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > So maybe this does have something to do with `window-point' after > all? Dunno. Yup. It's the same old issue of the fact that a buffer displayed in N windows has N+1 different `point's. Every time a command finishes, every buffer's `point' may get reinitialized from the `point' of one of the windows displaying the buffer. Stefan From unknown Fri Jun 20 07:12:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 19 Apr 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator