From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: Completion of links to man pages Date: Thu, 05 Oct 2023 17:36:53 +0000 Message-ID: <87il7lgedm.fsf@localhost> References: <87sf6pi9fn.fsf@localhost> <838r8h3w3f.fsf@gnu.org> <87zg0xgimp.fsf@localhost> <83ttr52fmx.fsf@gnu.org> <87sf6pggd6.fsf@localhost> <83mswx2dvl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12290"; mail-complaints-to="usenet@ciao.gmane.io" Cc: manikulin@gmail.com, emacs-orgmode@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 05 19:36:24 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qoSGr-0002qp-OW for ged-emacs-devel@m.gmane-mx.org; Thu, 05 Oct 2023 19:36:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoSFy-00061y-FB; Thu, 05 Oct 2023 13:35:26 -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 1qoSFw-00061C-5B for emacs-devel@gnu.org; Thu, 05 Oct 2023 13:35:24 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoSFs-0002c3-6l for emacs-devel@gnu.org; Thu, 05 Oct 2023 13:35:23 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 86204240027 for ; Thu, 5 Oct 2023 19:35:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1696527317; bh=/s88FNPH9RmjBkwgmU/XI6MmwuUOMN8raTTG3cjzO8g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=D6p4zq66LH7NoVULM17Lq/vy1piI47kNfKqKIi8lED0+xMX33AxWDhYhryJCR8mR2 k5/VMQlXmy5pWQ/Fj2yzJ7UrRJXfvjrcV3dpDOc0UJiZjzth/a5jzY3BbFNKEaGraq 8JbSIpzZj6/Uc3FBPRF0AvF53orw9E5tIlLSfBBcoFuemj+HCczYbpxmDDeATprB4F cF2e2+PrNhl11eQf1fatQxzy2KepSPOsn8kI/oqCvu4ZrHugzHvs1K6nJqY9PAKLtN 0uqtAnbQ3l7q79B8OCIUwWmAYJuTIWKpDPqcTuVrU204goG+IW/Gc9WY7S71wPYhPv gB1gc68/6GH8g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4S1dxJ5kwjz9rxH; Thu, 5 Oct 2023 19:35:16 +0200 (CEST) In-Reply-To: <83mswx2dvl.fsf@gnu.org> Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311312 gmane.emacs.orgmode:157599 Archived-At: Eli Zaretskii writes: >> Yes, but one cannot replicate the same completion dialogue >> programmatically in future-compatible way. > > What do you mean by that? "M-x man" does this: > > (interactive > (list (let* ((default-entry (Man-default-man-entry)) > ;; ignore case because that's friendly for bizarre > ;; caps things like the X11 function names and because > ;; "man" itself is case-insensitive on the command line > ;; so you're accustomed not to bother about the case > ;; ("man -k" is case-insensitive similarly, so the > ;; table has everything available to complete) > (completion-ignore-case t) > Man-completion-cache ;Don't cache across calls. > (input (completing-read > (format-prompt "Manual entry" > (and (not (equal default-entry "")) > default-entry)) > 'Man-completion-table > nil nil nil 'Man-topic-history default-entry))) > > This uses completing-read, as I think you wanted. > ... > Why cannot you reuse Man-completion-table? > >> For now, as you can see in the quoted code from my initial message, we >> have to partially replicate the code from man.el and woman.el: >> >> (defun org-man--complete-man (prompt) >> (require 'man) >> (let (Man-completion-cache) ;; <- implementation detail in man.el >> (completing-read >> prompt >> 'Man-completion-table))) > > And why is that a problem? Because we also need to bind (completion-ignore-case t) and (Man-completion-cache nil). Ideally, these details should not be something we need to know. It would be better if man.el provided some kind of API function like `man-completing-read' that takes care about these details, which are apparently necessary to avoid bug#13160 and bug#3717. >> However, `Man-completion-table' is not documented (no docstring), > > If the only thing that's missing is its doc string, that is easy to > add. Docstring would certainly help. Otherwise, we have to guess what that function does. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at