From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir Date: Fri, 01 Nov 2024 13:52:55 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20686"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: eliz@gnu.org, 73656@debbugs.gnu.org To: Van Ly Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 01 18:54:29 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 1t6vqu-0005BR-QV for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Nov 2024 18:54:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6vqW-0007lR-Nb; Fri, 01 Nov 2024 13:54:04 -0400 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 1t6vqU-0007lB-VC for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 13:54:02 -0400 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 1t6vqU-0002Jj-N0 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 13:54:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=dChJZFdMSo0qZoTGvAZWERRgu4A62Rmp2FMLvSDa/rw=; b=Hwgv/yIrkDJwjl0R23thPXUEvnjJ+7hgha2mIYr6bulLMUSvZU+VYgQeCkiyadxz569H5/7DcwjDAFYd54Act4+1E6b6ZdiehKZmhgvPM4lzuaRyIOjUaJphJrR7iv/XZxu2cH0HHi6J0uojgR/oLPT5njpLiMm6sPZPy1uT4EZixngERaVZ4K/HqyPEFtgYxL4ZYQ5lV0vcVcnds5gSMY75ltYpF7EH39QGr8gg+1rXD8FGOGk6olPKYRxixZD9O8A80a+Y/jt6d/MLHp8kvDLYuvuDuTnHNJsIdGfeZt7/jKbBYwftv89UTdQW3lz/az9fPYQZvUtLImonstCtog==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6vqU-0000mC-HA for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 13:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Nov 2024 17:54:02 +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.17304835902954 (code B ref 73656); Fri, 01 Nov 2024 17:54:02 +0000 Original-Received: (at 73656) by debbugs.gnu.org; 1 Nov 2024 17:53:10 +0000 Original-Received: from localhost ([127.0.0.1]:50966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6vpd-0000la-Mz for submit@debbugs.gnu.org; Fri, 01 Nov 2024 13:53:10 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:19928) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6vpY-0000l4-Rx for 73656@debbugs.gnu.org; Fri, 01 Nov 2024 13:53:08 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0212C80964; Fri, 1 Nov 2024 13:52:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1730483578; bh=LGsJyms5fGRWDz+paMqySUfhRGWBT4aZJ+hECIl8qJg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ikaVS4m9PI7V2GtOF0U9gRvUhGdtxN1OooLkdczulHGi6oQlebheu0sQamjY+K+ms kluOBO3+rSIc6lmYsJKaUGsVhsGSkHFK1O/km/jiq00MOjdPDm64daS/MqMnFF6eIh u0DuC/LOfdvZog4XqZi0xgXmWQgmwOu7LEIHCOk+hcXjOdG1M5kzc27a22hcaJgnV3 0l/oc/FzxkLRaxTUg8BkA0hifF+p5vBGTzE+/BgVdZWJej8f2PRT+NPfFi6nVMh0GW S2+JsC3CE1bS4yS317K4F468Mc9TZRd3ugRmfGlnEla8wnmwzXWjmvAA/FvIM2zorm /4dz9i5e4nC8Q== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 262938045E; Fri, 1 Nov 2024 13:52:58 -0400 (EDT) Original-Received: from alfajor (bras-base-mtrlpq427bw-grc-37-65-92-208-84.dsl.bell.ca [65.92.208.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F2453120306; Fri, 1 Nov 2024 13:52:57 -0400 (EDT) In-Reply-To: (Van Ly's message of "Sat, 02 Nov 2024 03:04:30 +1100") 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:294697 Archived-At: > 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