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: Thu, 31 Oct 2024 14:15:55 -0400 Message-ID: References: Reply-To: Stefan Monnier 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="29313"; 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 Thu Oct 31 19:17:21 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 1t6ZjU-0007Me-DR for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Oct 2024 19:17:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6ZjF-0007Hy-BS; Thu, 31 Oct 2024 14:17:05 -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 1t6ZjD-0007Hd-57 for bug-gnu-emacs@gnu.org; Thu, 31 Oct 2024 14:17:03 -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 1t6ZjC-0001SK-Sd for bug-gnu-emacs@gnu.org; Thu, 31 Oct 2024 14:17: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=B1/zF5f5vfnV2ukJ+diqsiaO9sQD7MnQ1AdBDx5GIs4=; b=f5KYPvt4n7dU2V6XyBLWhuzZiL+3CPpQlmWJBirdIe6jghZUBXAkJqKtwPA6KHVtOD3H0q8gDzbqnNsRznmv3kYXra5UBzGryLahjKA2OfmYS9Vq7N/G0yS6zRNL0p1Gy9rhOb00Fjjaj75YZOMZAWPHciff+ihrJHw4KSkD7A7yRIFn2MNNYCUzkyl68GR3cQoL/4PT6f1DVwoN2FQyB1Zz3MG86/v7WwDJLEtQBMUosWbuzLRdAOzAQzMLfxv5xv1zgwjzSM5keNChSGqi88nAW9xg4K9Zxk3fOvJVwBFCdAqD78fVgsuMy35uqYJb9mO82PD1+AcB9Q1OwBtkxw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6ZjC-0001gJ-Cj for bug-gnu-emacs@gnu.org; Thu, 31 Oct 2024 14:17: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: Thu, 31 Oct 2024 18:17: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.17303985726443 (code B ref 73656); Thu, 31 Oct 2024 18:17:02 +0000 Original-Received: (at 73656) by debbugs.gnu.org; 31 Oct 2024 18:16:12 +0000 Original-Received: from localhost ([127.0.0.1]:43484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6ZiL-0001fn-Qe for submit@debbugs.gnu.org; Thu, 31 Oct 2024 14:16:12 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4858) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6ZiG-0001fO-0f for 73656@debbugs.gnu.org; Thu, 31 Oct 2024 14:16:07 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AE614100180; Thu, 31 Oct 2024 14:15:57 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1730398557; bh=+QOPOfeWajyKJm+Yz/OLZ4/8p+qyop2Nb0JC2xJx7Vg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=TQvL3dwcgOv6QQB8Y68iLw7FgCrHPjfj8E3yu3BZifAe6yPrEve7Lqv8WkOYZzVJR 0gOzgSxaNCnxCGApsfd/MqCxu0cW01/vueSR9yqYogGZGLIQiqW7S2v/zKgDIdkdkW Ad42YmmuSJmjFetdfbgP8jbhuVRK2taf2J2ZnPNxJb3LgAB3FCA7Hb+MKVFCCze0JQ D4Rb4mzF4Uhh5spAVdUm/ILV4XdPwGb0WGeZ6vwLjQGpjgpQe/tfWjeFXrzcNEfgvg kr8f6SqPXTNQYn30KzUT08WtTK+xpfI0E8ZvzA5A2+Gv2t3UwdJ/w2MMJg0fUXl0WP owRhNVepZkbjg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EE1FA100043; Thu, 31 Oct 2024 14:15:56 -0400 (EDT) Original-Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BFDB71204C5; Thu, 31 Oct 2024 14:15:56 -0400 (EDT) In-Reply-To: (Van Ly's message of "Fri, 25 Oct 2024 05:34:28 +0000") 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:294634 Archived-At: --=-=-= Content-Type: text/plain >>> + (if (eq system-type 'berkeley-unix) "-l") > As gap filler, the following change does not misbehave on deb or netbsd. I don't think we need a gap filler. How 'bout the patch below? Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=man.patch diff --git a/lisp/man.el b/lisp/man.el index 816c75d749c..ebf4646d133 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 (>= (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 @@ -1009,7 +1009,10 @@ (ignore-errors (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 +1024,7 @@ ;; 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 --=-=-=--