From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27405: 25.2; Make eshell-next-prompt more reliable Date: Tue, 11 Jul 2017 22:16:38 -0400 Message-ID: <87zicae6wp.fsf@users.sourceforge.net> References: <20170617090813.GA889@gmail.com> <87zid6qn3b.fsf@users.sourceforge.net> <20170618132932.GA2617@gmail.com> <87vantqu7m.fsf@users.sourceforge.net> <20170618141959.GB2617@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1499825786 17061 195.159.176.226 (12 Jul 2017 02:16:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Jul 2017 02:16:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 27405@debbugs.gnu.org To: Pierre Neidhardt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 12 04:16:20 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dV7CG-0003kN-W8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Jul 2017 04:16:13 +0200 Original-Received: from localhost ([::1]:49875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV7CK-0004RA-V3 for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Jul 2017 22:16:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV7CA-0004On-30 for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 22:16:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV7C6-00030D-PD for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 22:16:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60087) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dV7C6-000303-Kt for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 22:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dV7C6-0003sM-Fz for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 22:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Jul 2017 02:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27405 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 27405-submit@debbugs.gnu.org id=B27405.149982571514827 (code B ref 27405); Wed, 12 Jul 2017 02:16:02 +0000 Original-Received: (at 27405) by debbugs.gnu.org; 12 Jul 2017 02:15:15 +0000 Original-Received: from localhost ([127.0.0.1]:34530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dV7BL-0003r0-1V for submit@debbugs.gnu.org; Tue, 11 Jul 2017 22:15:15 -0400 Original-Received: from mail-io0-f170.google.com ([209.85.223.170]:36647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dV7BI-0003qh-SV; Tue, 11 Jul 2017 22:15:14 -0400 Original-Received: by mail-io0-f170.google.com with SMTP id z62so5400510ioi.3; Tue, 11 Jul 2017 19:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=552PFjjW5Ztxp1MASS87z0WJhC4PCjsaRA6di8D5HDg=; b=Q9rihxJrHfb73TUadbQbdgtR4tte3QjlDU24Vr0p6U2gbwNdblmIhMKBMpyYC+7QBO tfGtUNx+jcbw+J89RHowZd9G0+kff55xQtzd6hKVP4yP5vOWpij4DZzb3y0mpSbfkMvs vTfOJ0UgRWdHpcpcKw0+QlK0F98UWeZdiyp3NmrkbKZgPFxUmHv3z3A4W6jN2dgTc4An 51cV/Cr5J/1wpIUF/6G/RB55nXDSvSQaOX6VvyfwQya5GQ4q0iKokiL9Tt4942vDMtDm vg4rENWYk0/G8orLskVxVeBAyH2fl+4dSHU/xxOFSAsVkCdDYo6NEBSQpW3RQ3qL8ago 5GYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=552PFjjW5Ztxp1MASS87z0WJhC4PCjsaRA6di8D5HDg=; b=GKYgp0WQpSlZd4zSfqzTmxfsLz0ZFxpPWV1AvrIdGgBZwzgS9PJqP7nqg8z7m+awPx mgJlrf5LF7VhR/GfqQWQJhvB0hlwqTH+KPAmb+zf7WZWbFds1JGpEQabEc/IoY9pwoLf rTGRBTrrOskgVFwC9JMvneoBPkcThAH3tedFwHgI2GIcbc3S9+X2JhgwywOerkct5Any j3b5M6pzfp3IZBlpeNKMpYtr82cAbYoYMRQZlt+hVe19gG13WJTi9xXDYBpRYUyaFPQs 5XAzgl0bDmK/oZ+5a/b2+JPsMao42nbdY/fzl+n7in3TeZvMzb2oBypU3v+Uiq/Hyuux jI4A== X-Gm-Message-State: AIVw110+Oh1rOD+7M1hIEqTL0VhxO5aEJAnCOL27u8cjvW08Y0jXV2rQ Aw9V8E84/rbAgTRO X-Received: by 10.107.18.19 with SMTP id a19mr3053992ioj.93.1499825707205; Tue, 11 Jul 2017 19:15:07 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id t18sm583917ita.25.2017.07.11.19.15.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jul 2017 19:15:06 -0700 (PDT) In-Reply-To: <20170618141959.GB2617@gmail.com> (Pierre Neidhardt's message of "Sun, 18 Jun 2017 15:19:59 +0100") 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:134448 Archived-At: --=-=-= Content-Type: text/plain tags 27405 + patch quit Pierre Neidhardt writes: >> >> Hmm, maybe beginning-of-line would make more sense? If I have point on >> the same line of the prompt I can get to the beginning of the prompted >> line with C-a, so C-c C-p probably means I want to go farther back. > > Agreed. Please make the change and add a comment. I think also that doing the text property check following the regexp search doesn't really make sense, one or the other should be used, not both: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v2-0001-Make-eshell-next-prompt-more-reliable-Bug-27405.patch Content-Description: patch >From 1dd9644f1322d3b40ba98482d4aca0105db56d81 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 11 Jul 2017 22:11:19 -0400 Subject: [PATCH v2] Make eshell-next-prompt more reliable (Bug#27405) * lisp/eshell/em-prompt.el (eshell-next-prompt): Search for `eshell-prompt-regexp' (and `read-only' text-property if `eshell-highlight-prompt' is set) rather than trying to use `forward-paragraph'. (eshell-previous-prompt): Don't count prompt on current line. --- lisp/eshell/em-prompt.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index 8c81b43b1f..2fd1db2113 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el @@ -161,14 +161,25 @@ (defun eshell-next-prompt (n) "Move to end of Nth next prompt in the buffer. See `eshell-prompt-regexp'." (interactive "p") - (forward-paragraph n) + (if eshell-highlight-prompt + (progn + (while (< n 0) + (while (and (re-search-backward eshell-prompt-regexp nil t) + (not (get-text-property (match-beginning 0) 'read-only)))) + (setq n (1+ n))) + (while (> n 0) + (while (and (re-search-forward eshell-prompt-regexp nil t) + (not (get-text-property (match-beginning 0) 'read-only)))) + (setq n (1- n)))) + (re-search-forward eshell-prompt-regexp nil t n)) (eshell-skip-prompt)) (defun eshell-previous-prompt (n) "Move to end of Nth previous prompt in the buffer. See `eshell-prompt-regexp'." (interactive "p") - (eshell-next-prompt (- (1+ n)))) + (beginning-of-line) ; Don't count prompt on current line. + (eshell-next-prompt (- n))) (defun eshell-skip-prompt () "Skip past the text matching regexp `eshell-prompt-regexp'. -- 2.11.1 --=-=-=--