From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#38024: 27.0.50; icomplete sometimes fails to show completions after backward-killing words Date: Fri, 01 Nov 2019 22:40:10 +0100 Message-ID: <874kznwa11.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="197133"; mail-complaints-to="usenet@blaine.gmane.org" Cc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: 38024@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 01 22:41:32 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iQefi-000p98-Ho for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Nov 2019 22:41:30 +0100 Original-Received: from localhost ([::1]:43166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQefe-0004ZA-SG for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Nov 2019 17:41:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37758) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQefK-0004YA-Gm for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 17:41:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQefH-0005oQ-0s for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 17:41:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iQefG-0005nV-T7 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 17:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iQefG-0001En-HG for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 17:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Nov 2019 21:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38024 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15726444514727 (code B ref -1); Fri, 01 Nov 2019 21:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Nov 2019 21:40:51 +0000 Original-Received: from localhost ([127.0.0.1]:57391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iQef4-0001E8-Uz for submit@debbugs.gnu.org; Fri, 01 Nov 2019 17:40:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:58388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iQeez-0001Dv-NZ for submit@debbugs.gnu.org; Fri, 01 Nov 2019 17:40:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37303) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQeew-0004NM-Vk for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 17:40:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQeer-0003bz-9h for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 17:40:39 -0400 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:32842) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iQeeq-0003O0-Tz for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 17:40:37 -0400 Original-Received: by mail-wr1-x434.google.com with SMTP id s1so10945446wro.0 for ; Fri, 01 Nov 2019 14:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version; bh=uUU0EBNNhzZfz32SMhlbSl68BGrOcvyfiwyM4vj2OZU=; b=dLEh5vdRyglbutS29VFqPsgmXbWvm9Zy3/jFwoyLVcKhrKBddAhopZALdzBIUKpmqY YycJzWAWCBmUdX/1zHoOkZkz3zmLHE/G24ht7XF7ol09CP3/1FGmvBzti8/zGVAiOFjW 0/LrpY4ZjTXUh4DlAtC38I8nRIX9hTWbrEhFpT5UrK5s/NFwWO1Ky8JREyTP0ewCmhWq PaaRDPOztzgj+QjkDIkKUdeHKyRy50M2iOIg+rIKQ6VjMQ0aXbBeqKlwFeWCUm1qNI9E W0VlOfI4jj2/R/TYGzsIWqIwXWg4oEqS4BjV7BHx0jR3Vgz0ynFcqXK7SjvVwimd4oD+ 5NpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=uUU0EBNNhzZfz32SMhlbSl68BGrOcvyfiwyM4vj2OZU=; b=CWWVmG/VyGy2k9HGgKBW6FEV0CtGUgFTnAt+NCy0bgs13UQGFNRDkaHhTtoCK5RRI9 sDt0BMH8/Pjl18fsQb41eYoGVPqdRJYO6CtAODSYmOdIK1a0Eth3i7gImNCU1SL8M9SC DnKAuHlHQ3Ji69AGznZ4Ln32RyigmwGydAJz51ioc48SJHcPfldsoL8fZu75zzwe0LiP rIgQD27BgwHVr8CrMuSYgDcJPm6As+f7eQFI7GAcNTAsZ7FhiptxLTqipML+HBr9HZBx 4ywoUGQbwP0i5W8/v8BddPWBLVKoKx6z+N5g0Sjpp4rMJqSNmEBvzeAkbABKQ0KHH8J+ DHSQ== X-Gm-Message-State: APjAAAXm480PYGXqH29TUQdaYZMAFBdpHWWP8dURiL4b+7hARY9KkOCy l58qcUWralQRyDYxriNrEm0= X-Google-Smtp-Source: APXvYqyQnvg8Py+MKDYQXpWMnCMsDc6EF7EvbjhkDKZjxymFOQc4LW8xcV9OzKolGX+FQL6nD91TwQ== X-Received: by 2002:adf:e747:: with SMTP id c7mr12493812wrn.384.1572644434562; Fri, 01 Nov 2019 14:40:34 -0700 (PDT) Original-Received: from little-buster (alyon-655-1-684-117.w109-213.abo.wanadoo.fr. [109.213.245.117]) by smtp.gmail.com with ESMTPSA id y3sm12477822wro.36.2019.11.01.14.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 14:40:33 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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: 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:170692 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, tl;dr unless I'm mistaken, sometimes `while-no-input' returns t despite no input having arrived; this prevents `icomplete-exhibit' from displaying completion candidates. In more details: This is a bit of a heisenbug; hopefully someone out there will know what knobs to tweak to find more information about this. >From emacs -Q: M-x icomplete-mode RET ;; Find a way to set `default-directory' to some long-ish path, ;; e.g. with: M-x find-library RET icomplete RET C-x C-f ;; icomplete should show a bunch of completions. M-DEL M-DEL =E2=80=A6 After each `backward-kill-word', icomplete usually displays new completion candidates with no further user input; sometimes however, no candidates show up until the user does something (e.g. press TAB or start typing). Commit 5860fd3 (Make icomplete-exhibit actually work when navigating up directories) tried to fix this, but AFAICT it merely reduces the odds of the bug happening: I can still reproduce it, although less often. Also, this new call to `redisplay' causes some noticeable flickering when typing characters: the completions blink in and out as I fill in the prompt. I've tinkered with icomplete.el (commenting out the call to `redisplay' since it makes the bug harder to trigger); the closest I got to pin-pointing the cause for this issue was while goofing around in `icomplete-exhibit', specifically with the `while-no-input' part: (let* (=E2=80=A6 (text (while-no-input (icomplete-completions =E2=80=A6))) =E2=80=A6) ;; Do nothing if while-no-input was aborted. (when (stringp text) update overlay=E2=80=A6)) I replaced (when (stringp text) =E2=80=A6) with (if (stringp text) (progn = =E2=80=A6) (message "text is %s" text)): it seems that text is t when icomplete fails to show updated candidates, which according to `while-no-input' means that some input arrived=E2=80=A6 However, when I tried to debug `while-no-input', I got stumped: I tried to do some more printf-debugging[1], but all I observe is that sometimes, the code seems to be interrupted between (let ((throw-on-input ',catch-sym) val) and (setq val (or (input-pending-p) (progn ,@body))) I tried to find where exactly the code gets interrupted, but I could not get a consistent answer; sometimes it seems to be before executing body, sometimes it seems to be somewhere inside `icomplete-completions'=E2=80=A6 What would be the best way to investigate this further? Thank you for your time. [1] With this patch: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=icomplete-debug.patch diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 02eae55a19..31023d5644 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -399,8 +399,6 @@ icomplete-exhibit See `icomplete-mode' and `minibuffer-setup-hook'." (when (and icomplete-mode (icomplete-simple-completing-p)) ;Shouldn't be necessary. - (redisplay) ; FIXME: why is this sometimes needed when moving - ; up dirs in a file-finding table? (save-excursion (goto-char (point-max)) ; Insert the match-status information: @@ -430,13 +428,15 @@ icomplete-exhibit (buffer-undo-list t) deactivate-mark) ;; Do nothing if while-no-input was aborted. - (when (stringp text) - (move-overlay icomplete-overlay (point) (point) (current-buffer)) - ;; The current C cursor code doesn't know to use the overlay's - ;; marker's stickiness to figure out whether to place the cursor - ;; before or after the string, so let's spoon-feed it the pos. - (put-text-property 0 1 'cursor t text) - (overlay-put icomplete-overlay 'after-string text))))))) + (if (stringp text) + (progn + (move-overlay icomplete-overlay (point) (point) (current-buffer)) + ;; The current C cursor code doesn't know to use the overlay's + ;; marker's stickiness to figure out whether to place the cursor + ;; before or after the string, so let's spoon-feed it the pos. + (put-text-property 0 1 'cursor t text) + (overlay-put icomplete-overlay 'after-string text)) + (message "text is %s" text))))))) ;;;_ > icomplete-completions (name candidates predicate require-match) (defun icomplete-completions (name candidates predicate require-match) diff --git a/lisp/subr.el b/lisp/subr.el index b408ef0931..3610fe30f2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3727,11 +3727,14 @@ while-no-input (declare (debug t) (indent 0)) (let ((catch-sym (make-symbol "input"))) `(with-local-quit + (message "after with-local-quit") (catch ',catch-sym (let ((throw-on-input ',catch-sym) val) + (message "after catch and let") (setq val (or (input-pending-p) (progn ,@body))) + (message "after setq val") (cond ;; When input arrives while throw-on-input is non-nil, ;; kbd_buffer_store_buffered_event sets quit-flag to the @@ -3746,13 +3749,17 @@ while-no-input ;; such as discarding input etc. We return t in that case ;; because input did arrive during execution of BODY. ((eq quit-flag throw-on-input) + (message "cond: got input") (setq quit-flag nil) t) ;; This is for when the user actually QUITs during ;; execution of BODY. (quit-flag + (message "cond: got quit-flag %s" quit-flag) nil) - (t val))))))) + (t + (message "cond: return val") + val))))))) (defmacro condition-case-unless-debug (var bodyform &rest handlers) "Like `condition-case' except that it does not prevent debugging. --=-=-= Content-Type: text/plain When the bug happens, I get the following messages: after with-local-quit after catch and let text is t PS: It just occured to me that I should search debbugs for "while-no-input" in addition to "icomplete". I just did that; bug#15042 looks like it could maybe be related? In GNU Emacs 27.0.50 (build 6, i686-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2019-10-21 built on little-buster Repository revision: 61fb5214816ef3d57e676d900e499ffcd079a1f9 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) Configured using: 'configure --with-xwidgets --with-cairo' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix --=-=-=--