From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Andreas_R=c3=b6hler?= Newsgroups: gmane.emacs.help Subject: Re: Behavior of with-current-buffer Date: Wed, 15 Apr 2020 10:37:05 +0200 Message-ID: <7094a788-2e8d-faa5-8158-33c162e22726@easy-emacs.de> References: <7821ac97-3e73-c38f-a5ad-6094c0c92a06@easy-emacs.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="49524"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 To: Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 15 10:37:37 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jOdY9-000Cmr-Bc for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 15 Apr 2020 10:37:37 +0200 Original-Received: from localhost ([::1]:46142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOdY8-0001JS-EM for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 15 Apr 2020 04:37:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58267) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOdXi-0001JJ-GE for help-gnu-emacs@gnu.org; Wed, 15 Apr 2020 04:37:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOdXh-00011p-Ch for help-gnu-emacs@gnu.org; Wed, 15 Apr 2020 04:37:10 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.133]:42739) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jOdXh-00010N-3n for help-gnu-emacs@gnu.org; Wed, 15 Apr 2020 04:37:09 -0400 Original-Received: from [192.168.178.43] ([94.134.177.56]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MSI6i-1jrD2Z0zEG-00SgFp for ; Wed, 15 Apr 2020 10:37:07 +0200 In-Reply-To: <7821ac97-3e73-c38f-a5ad-6094c0c92a06@easy-emacs.de> Content-Language: en-US X-Provags-ID: V03:K1:kCZSWGj96hbXewFuoNfhMUWpijbGVA+Hs66r5nwvOiqKND77qxg eu4z7+HCCm8wN8j9d7/l0SK9cLSbMVSw3uYLxUf4+HM1fxF0Qu56/XCM2IMMsp+xK1B/0wW oJDeutBjMUy57utrZnhTGmUmGKBxslweKUod5DR21fbSdDzxINRbvehCxakF2g5cO1kNInA Mqy45pjOPxm5BLVck8TWw== X-UI-Out-Filterresults: notjunk:1;V03:K0:guW20tdWBZY=:K1gFeg/v5wDTgAI1nrbXdY RxySsU1c+ZIAE+8CWA96EZcoZSK8pzPuwhbJOa+XlmijJkYGjVzDYUswgl6JxlJMZFQQeW4MX 6SXpmg5k4DKiUQ4RhfQ61Ss42j0vGlwyz8zJ0FG0nSc0eTZXtHCKDZSZL05Dwx3nRU6CKL4/W pu2JiQCyv4VxBM3OVpPHz7LwrugMHNDI76gRhJRbFy9xdOxUW2IgDS3p/KhZ49La/a8xNZhqW za/qVslECk4L1CxWsqGQdWN0kkovcOa3HDXYFiNAli8DfubyZjIjb/ZqM2TOvxsYgL3f2Xbjm oGj9Ur0RoK5O0l8Z2FBa3tTSyzNQHSnQiEbriW8Wq8EujfCLR18657XlTxgldrwqeaoxNq4Pa y4/hv25pg392XE9WsOqXy0ysBdkq+6t+mYSnFqZ9ECJ7KJG12eLj1yUa07eecZJsOMO1npsOE myLDHRwJGWVatz24nwIaHpWq3QWOa+EwGEcMXWsnxJk9W6yA0+/kpDw+KLu0JCl5YNQCbIaYb u1MraL3WP1w9ygOBI3/XjcMGbrA2n1+PmY/Gxaa+nsrWDGcfVt6ERuc51U0BMszSvl39w7EO+ gaYepVDuZz2sJxzJMSEk0z4IEueA4Ys1iAiRy7PrrHedOqdozKl0F+oL2SnZ2FZFqHV/+ubxm qr6iW2K2YvPwveFsMIfCr+N3yU3qbDqtgFsUmn7yJeWxb/Xr4y59ptH8G+gmWOPdLVQ0bq/rF 8jrvensCNGhyILfCx4xkZVMwsgGzifdXsYH9XyaHGTNkNK2vGYnGHj0JgulSwF0tEhfpYB07 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.133 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122825 Archived-At: Am 15.04.20 um 09:37 schrieb Andreas Röhler: > Hi, > > have a buffer connected with a Python-process, however not in > comint-mode - for speed. See upper window in attachment > not-point-max.png. > > In the case given "import json" was sent to this buffer by a function > ‘py-fast-send-string’ which is shown partially in window below. > > This function checks for a newline-char at the end of the string - > actually an extra "\n" was sent inside this or-clause. > > After sending "\n", second-cursor in output-buffer is shown after the > newly inserted prompt at EOB. However, when or-clause returns, the > cursor jumps back to the position before the last prompt started, i.e. > at position before sending. > > An extra (goto-char (point-max)) as shown in code would help, but > shouldn't be necessary. > > Any explanation? A bug? > > Thanks, > Andreas > GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32, > cairo version 1.16.0) of 2020-04-06 > > > > Herewith two example to reproduce from Emacs -Q (defun with-current-buffer-check ()   (interactive)   (let ((oldbuf (current-buffer))     (output-buffer (shell  "With-current-buffer-Test")))     (set-buffer oldbuf)       (with-current-buffer output-buffer     (goto-char (point-max))     (insert "echo \"asdf\"")     (comint-send-input)))) (defun with-current-buffer-check-2 ()   (interactive)   (let* ((oldbuf (current-buffer))      (output-buffer (shell  "With-current-buffer-Test-2"))      (proc (get-buffer-process output-buffer))      (strg "echo \"asdf\""))     (set-buffer oldbuf)     (with-current-buffer output-buffer       (process-send-string proc strg)       (or (string-match "\n$" strg)       (process-send-string proc "\n")))))