From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir Date: Sat, 16 Nov 2024 15:43:59 +0200 Message-ID: <86cyivguow.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40247"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73656@debbugs.gnu.org To: van.ly@SDF.ORG, Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 16 14:47:30 2024 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 1tCJ95-000AEt-Ef for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Nov 2024 14:47:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCJ8i-0004CE-7h; Sat, 16 Nov 2024 08:47:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCJ8g-0004BS-Ld for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 08:47:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tCJ8g-0003kY-68 for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 08:47:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=nl4ky4oUc7XiHwnzk1YYylN8UJgBkyk06/pBbM5JXxE=; b=oH7rZzkSfUEpVFoTqpYj2n7RFdNDIT7jh6YD1Z+jr0i9wA0i6/uj/veNoRPRCY79NF62HG+eqs6y44VBaV5DTxoVUz35X0mwhawYaVeJ/ozmPErgB8CdapZcBmB4hy/b/aWhKqirHvu+Sy51uptCkWzzA79NrNblO49uZQ/VFruW7e3lDO2WimubfraxtXpYnMixxQjIelCh5Pp51hoUa6TAkkHXLOiyfZ/ZfOpfa8+zyJb9Myi/CwCP805w9oTnYpsCqOBfaHD3xH8CGX6H/kkzPDsxudB0aUPCAiSjiXKxXJwg+9YjF9FanK/TY3lTX7zZHjkWs6XAKjguRzIM5A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCJ8g-0003Rv-0F for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 08:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Nov 2024 13:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73656 X-GNU-PR-Package: emacs Original-Received: via spool by 73656-submit@debbugs.gnu.org id=B73656.173176478213188 (code B ref 73656); Sat, 16 Nov 2024 13:47:01 +0000 Original-Received: (at 73656) by debbugs.gnu.org; 16 Nov 2024 13:46:22 +0000 Original-Received: from localhost ([127.0.0.1]:52524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCJ81-0003QV-N5 for submit@debbugs.gnu.org; Sat, 16 Nov 2024 08:46:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCJ80-0003QD-7p for 73656@debbugs.gnu.org; Sat, 16 Nov 2024 08:46:20 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCJ5m-00039n-R0; Sat, 16 Nov 2024 08:44:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nl4ky4oUc7XiHwnzk1YYylN8UJgBkyk06/pBbM5JXxE=; b=Rugy1cEzsFVg slRIbK42GM1z9/e9Jf+ba1V81Zh/arJFX5w1L+umxfia94uG8+QfRxj8c8ssCnJCC7k6NgshyYqRh Y+VaP6/sC/v8AhNhbOtAoLdGxPBbwzLJbB5SSePXOIVX9xxM7qabfZpq4n2CPEKIWit+w/hHtRggj fZTDdT/dhmfEMWwKpirrAneqpl68JaoFCuf0kjguncW/IOn6kf3sK1CyLRHKVzy5SAkrLqrGFaSNQ ANHY9EVgvoSNA3y2h2IshgcE/K9qw915KQEiD0yl02bK9XgYmjLLBWKdApMbQf42fmjdbnZscrrCJ ee1wCnxHxbGJ8IVdNbBOKA==; In-Reply-To: (message from Stefan Monnier on Fri, 01 Nov 2024 13:52:55 -0400) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295457 Archived-At: Ping! Can you try this patch? If it solves the problem, I'd like us to install it. > From: Stefan Monnier > Cc: eliz@gnu.org, 73656@debbugs.gnu.org > Date: Fri, 01 Nov 2024 13:52:55 -0400 > > > On NetBSD the patch fails to generate the icomplete-vertical-mode > > autocomplete for "chd" when invoked in "emacs -Q" session. The man.elc > > file was byte recompiled. > > I meant for the patch to be read rather than applied. > Also, what value do you get for `Man-man-k-flags`? > > > On debian the patch also fails. > > Yes, there was a trivial error. Fixed in the patch below. > > > Stefan > > > diff --git a/lisp/man.el b/lisp/man.el > index 816c75d749c..d5ac8b93d99 100644 > --- a/lisp/man.el > +++ b/lisp/man.el > @@ -973,6 +973,27 @@ Man-parse-man-k > (search-forward-regexp "\\=, *\\([^ \t,]+\\)" bound t))))) > (nreverse table))) > > +(defvar Man-man-k-flags > + ;; It's not clear which man page will "always" be available, `man -k man' > + ;; seems like the safest choice, but `man -k apropos' seems almost as safe > + ;; and usually returns a much shorter output. > + (with-temp-buffer > + (with-demoted-errors "%S" (call-process "man" nil t nil "-k" "apropos")) > + (let ((lines (count-lines (point-min) (point-max))) > + (completions (Man-parse-man-k))) > + (if (>= (length completions) lines) > + '("-k") ;; "-k" seems to return sane results: look no further! > + (erase-buffer) > + ;; Try "-k -l" (bug#73656). > + (with-demoted-errors "%S" (call-process "man" nil t nil > + "-k" "-l" "apropos")) > + (let ((lines (count-lines (point-min) (point-max))) > + (completions (Man-parse-man-k))) > + (if (and (> lines 0) (>= (length completions) lines)) > + '("-k" "-l") ;; "-k -l" seems to return sane results. > + '("-k")))))) > + "List of arguments to pass to get the expected \"man -k\" output.") > + > (defun Man-completion-table (string pred action) > (cond > ;; This ends up returning t for pretty much any string, and hence leads to > @@ -1007,9 +1028,13 @@ Man-completion-table > ;; error later. > (when (eq 0 > (ignore-errors > - (process-file > + (apply > + #'process-file > manual-program nil '(t nil) nil > - "-k" (concat (when (or Man-man-k-use-anchor > + ;; FIXME: When `process-file' runs on a remote hosts, > + ;; `Man-man-k-flags' may be wrong. > + `(,@Man-man-k-flags > + ,(concat (when (or Man-man-k-use-anchor > (string-equal prefix "")) > "^") > (if (string-equal prefix "") > @@ -1021,7 +1046,7 @@ Man-completion-table > ;; But we don't have that, and > ;; shell-quote-argument does > ;; the job... > - (shell-quote-argument prefix)))))) > + (shell-quote-argument prefix))))))) > (setq table (Man-parse-man-k))))) > ;; Cache the table for later reuse. > (when table > >