From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#40896: 27.0.91; Moving point fails sometimes in shell-command Date: Mon, 27 Apr 2020 19:50:57 +0200 Message-ID: <87lfmgyfzy.fsf@gmx.de> References: <877dy1miy4.fsf@gmx.de> <83v9ll3s68.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="9199"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 40896@debbugs.gnu.org, tino.calancha@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 27 19:53:13 2020 Return-path: Envelope-to: geb-bug-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 1jT7wO-0002IJ-IM for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 19:53:12 +0200 Original-Received: from localhost ([::1]:56716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jT7wM-0003nN-CF for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 13:53:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59666) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jT7vI-0003hl-3J for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 13:52:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jT7vH-0004pi-Af for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 13:52:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jT7vG-0004pa-3X for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 13:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jT7vG-0003l4-05 for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 13:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Apr 2020 17:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40896 X-GNU-PR-Package: emacs Original-Received: via spool by 40896-submit@debbugs.gnu.org id=B40896.158800987114373 (code B ref 40896); Mon, 27 Apr 2020 17:52:01 +0000 Original-Received: (at 40896) by debbugs.gnu.org; 27 Apr 2020 17:51:11 +0000 Original-Received: from localhost ([127.0.0.1]:38053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jT7uQ-0003jl-Rp for submit@debbugs.gnu.org; Mon, 27 Apr 2020 13:51:11 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:46609) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jT7uM-0003jA-Ll for 40896@debbugs.gnu.org; Mon, 27 Apr 2020 13:51:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1588009859; bh=oUA2ik3RJ4wwS+a6eWe/foFQEdSnFRdePdg3TJ3J7oE=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=bJ6zOJ2uHpssb2ry/d8lYxndQf0EOHzdsk17Ck912MnXtCzf7iN8ILY7JC9l/Y17o Xi502cXuGZzM8dgXciTskajVjUBAffuh6wbaG6ap8yxoZNutiVavtLU6LdxJAJXrx+ 5gB7pS5IskNl5ZUaTYdTKGxAVTMvakpZLB1UDY9Y= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.86.61.231]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mr9G2-1io2Gz0s7i-00oEPE; Mon, 27 Apr 2020 19:50:59 +0200 In-Reply-To: <83v9ll3s68.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 27 Apr 2020 17:43:43 +0300") X-Provags-ID: V03:K1:1Lv1GE111BK+4jf8qv+w/Keits81tO0kgizGsbcxN2Rh07GlXd3 NJHPmwHMWeokOpMk3LG3dC6pQHYtDlvDMcQysCjyHCqZHUpEhKHiFYU9Dyo4XuYjUqOA4lz CYw5/LJH52San3jiMZTW84TNiWlpZHAyL1jmM3aiDri6pOqw4Ox2BVrxEbd6uqyoY1yPqZQ oJQviB15BEQNZOrZhMnCw== X-UI-Out-Filterresults: notjunk:1;V03:K0:QHKsilRFFdU=:M4ax3+L7cMihOEQlh0tEcH QCCmlz4eP+rH7D4APmCivOpA0QXPgGf8cQrQoT74pnxhqYgRTN2DEjFOVV9hwsiL12FYLGQSJ VXczhMRdPf5SkPaM8Qth/y7PfH8jix4JIvNlzcQ/n8OHbju4IN85dSA+QQMVvEwp3WKFTs0Ht bq044eXobzTfMes2D9hBKRxP9E1GM36An69vj0AOWjnoLmf5bcC8u9G86phXOchaNZDho1Lvc etcCzC8NlGsc927+H3DtjLZ4QVusIUDBvcdaaL43RXqW6bFUTcuYWboVlI49FcUOXhfsp8Vg0 +7Rkarfw+LAFU5vrDgj3Xrwy3+6ByTxVR78S4lXnI48aweS7Ozx3K+n6LuAyXcUqLTYoeoH6M LcqhfPsY/Fsv6uV2aHwCHCTh6t1R6npZUxKMadfaE6tIJoXVLVX2SFy1j8KqhDtL++D8SCVzA ywzYA4rq7p0/dADlE89u7Ak2uIGtZxMSjIetRWkV2yZFdmE2HWhbpr12w+OMsJLDdKjNYX/Ay xK+SOefEMh7xlPenLxHzfZOp+3oPjXUJqRkO6xbjwMH7nD7T5EJacbzOLHSfIekuh48rO1pE7 GBVWiL152grE6KMstR2WE6wzJEcm7LOxlA2vKFfItawMLvSprHZlkPxmZUKq49pFT6TqkGHek UbPAqe6/6O5hnZYkufPvds3LNYwlc3gkoFphsIbyFeaD8qfeRSznigwQFebsNavSgV8Ii4NPI KtMGYeA2pj8EAOawH5hpMUZEYlep6IOntteVpfsAbRwp4kLPDfvO74csElWzKre0ZnSaOAne X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179167 Archived-At: Eli Zaretskii writes: Hi Eli, >> `shell-command' shall move the point after the output of the command, >> unless indicated otherwise by `shell-command-dont-erase-buffer'. > > Which part(s) of the documentation caused this interpretation? AFAIK, > the truth is that the output is inserted at point (i.e. point is left > _before_ the output), unless indicated otherwise by > shell-command-dont-erase-buffer. So if something we say tricks you to > think otherwise, we need to fix that text. Hmm, maybe I have been biased with the Tramp behaviour. But still, there's suspicious behaviour with shell-command: --8<---------------cut here---------------start------------->8--- ;; Don't erase if the buffer is not the current one and ;; `shell-command-dont-erase-buffer' is set to `save-point'. ;; Check point. (let ((default-directory temporary-file-directory) (shell-command-dont-erase-buffer 'save-point) buffer point) (with-temp-buffer (setq buffer (current-buffer)) (insert "foobar") (goto-char (- (point-max) 3)) (setq point (point)) (cl-assert (string-equal "foobar" (buffer-string))) (cl-assert (string-equal "foo" (buffer-substring (point-min) (point)))) (cl-assert (string-equal "bar" (buffer-substring (point) (point-max)))) (cl-assert (= (point) (- (point-max) 3))) (with-temp-buffer (shell-command "echo baz" buffer)) ;; The shell command output should be inserted between "foo" and "bar". (cl-assert (string-equal "foobaz\nbar" (buffer-string)) 'show-args) (cl-assert (= point (point)) 'show-args))) ;; Don't erase if the buffer is not the current one and ;; `shell-command-dont-erase-buffer' is set to a non-nil value. ;; Point should be before shell command output. (let ((default-directory temporary-file-directory) (shell-command-dont-erase-buffer 'random) buffer point) (with-temp-buffer (setq buffer (current-buffer)) (insert "foobar") (setq point (point)) (cl-assert (string-equal "foobar" (buffer-string))) (cl-assert (= (point) (point-max))) (with-temp-buffer (shell-command "echo baz" buffer)) (cl-assert (string-equal "foobarbaz\n" (buffer-string)) 'show-args) ;; Point should be the same. (cl-assert (= point (point)) 'show-args))) --8<---------------cut here---------------end--------------->8--- Unless I still misunderstand something, these cases should be checked. I will work on Tramp when clarified. > Thanks. Best regards, Michael.