From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#54374: 29.0.50; previous-completion fails at beginning of completions buffer Date: Mon, 14 Mar 2022 14:12:40 +0000 Message-ID: <87fsnk39nr.fsf@posteo.net> References: <86h782b3zk.fsf@mail.linkov.net> <871qz5k2na.fsf@posteo.net> <86bky99c7r.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23631"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54374@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 14 15:17:28 2022 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 1nTlVl-0005oj-47 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 15:17:25 +0100 Original-Received: from localhost ([::1]:41570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTlVj-0000X8-P0 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 10:17:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTlRX-0002le-In for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 10:13:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTlRX-0008KD-B3 for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 10:13:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nTlRW-0004fp-5i for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 10:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Mar 2022 14:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54374 X-GNU-PR-Package: emacs Original-Received: via spool by 54374-submit@debbugs.gnu.org id=B54374.164726717017945 (code B ref 54374); Mon, 14 Mar 2022 14:13:02 +0000 Original-Received: (at 54374) by debbugs.gnu.org; 14 Mar 2022 14:12:50 +0000 Original-Received: from localhost ([127.0.0.1]:45911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTlRJ-0004fM-Ml for submit@debbugs.gnu.org; Mon, 14 Mar 2022 10:12:49 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:59777) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTlRI-0004f9-24 for 54374@debbugs.gnu.org; Mon, 14 Mar 2022 10:12:48 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id DCF2A240026 for <54374@debbugs.gnu.org>; Mon, 14 Mar 2022 15:12:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1647267161; bh=QPuQ0GwmmD1qqzVjVppD7SrRpZHmFTNIpVVKbavTA38=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=RBo/yWqvoyB6oQUcBGkLPj1CvEeM/eAnurJPJY5Ss0iPvUIG1ZXP6Ii29E7F1SS3K YZqCyUfreCmQsbsQfZZeWlrHnua4WBjNA6LrkWLRLntIc/bD5gw1QwyZJD+d6o5uMD KJzUhNHrp/AqjkPMBKGwkD4IoGHKi80sFlgoOGIukQCw7gI4UrK3Lif5BJ3U9JpfT4 ULOIHFNI5liaGvG6tlp6zXrx/TCITnfb2c37v72awPj8+WuW1QZnJ3DtI+abqvVfZd VE9Q4Qm68TVmvjQZFzwwdlUo/H6VAQN5QEE8Y60h0zdVwPmP4dxgg6Az5+WasAKklr tV5SIBdPWxnsQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4KHJQd1KnMz6tmS; Mon, 14 Mar 2022 15:12:40 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB In-Reply-To: <86bky99c7r.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 14 Mar 2022 10:30:56 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:228366 Archived-At: --=-=-= Content-Type: text/plain Juri Linkov writes: >> This seems to fix it: >> >> diff --git a/lisp/simple.el b/lisp/simple.el >> index accc119e2b..7d47aba1ee 100644 >> --- a/lisp/simple.el >> +++ b/lisp/simple.el >> @@ -9125,7 +9125,7 @@ next-completion >> (unless (get-text-property (point) 'mouse-face) >> (goto-char (next-single-property-change (point) 'mouse-face nil end))) >> (setq n (1- n))) >> - (while (< n 0) >> + (while (and (< n 0) (< 1 (point))) >> (let ((prop (get-text-property (1- (point)) 'mouse-face))) >> ;; If in a completion, move to the start of it. >> (when (and prop (eq prop (get-text-property (point) 'mouse-face))) > > Thanks, I confirm that it doesn't fail. > > However, there is some strange behaviour: when point is at the beginning > of the completion buffer, then previous-completion switches to the minibuffer. > But if point is at the first completion, then previous-completion wraps > to the last completion. Shouldn't point at the beginning of the buffer > wrap to the last completion as well? I didn't notice that, because completion-auto-select was enabled on my end. How about this: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/simple.el b/lisp/simple.el index accc119e2b..5fba27b868 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9108,6 +9108,13 @@ next-completion With prefix argument N, move N items (negative N means move backward)." (interactive "p") + (let ((prev (previous-single-property-change (point) 'mouse-face))) + (goto-char (cond + ((not prev) + (1- (next-single-property-change (point) 'mouse-face))) + ((/= prev (point)) + (point)) + (t prev)))) (let ((beg (point-min)) (end (point-max))) (catch 'bound (while (> n 0) --=-=-= Content-Type: text/plain (Note that this also fixes the "issue" jumping back to the beginning of the same completion option, if the point is not at the beginning of said option.) -- Philip Kaludercic --=-=-=--