From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id mMi3I3TuHmWqzQAAG6o9tA:P1 (envelope-from ) for ; Thu, 05 Oct 2023 19:12:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id mMi3I3TuHmWqzQAAG6o9tA (envelope-from ) for ; Thu, 05 Oct 2023 19:12:20 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ECA0D3EF08 for ; Thu, 5 Oct 2023 19:12:19 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=aHFGXfCz; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696525940; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=6R8kzEnQTJaichvpN6bHNwBa9VyylZBHSZBkDrsAglc=; b=JHCPjnPRhvn/RVXvSfizDj5RaBdI8d1E2qn8ygNwVCJk3WCKVFgMXLHhHOqpkTm+pJO1zI NB1Al5n4ZknszvzR5WiuLllC7er7EFzu3kvoJSlEt1dTBMDbmpOp97kbsmFpq/MQBxkcSm Y5EYiubBGX5wV2CCh0LIcSHFw0l1dLbhO0+xqMuFGkXRnWq3N2EbVO7AtvA7fitBGSrqzf 9IUNKxHMvIi3nroXNnZJyl/k3ixUoc2aKSqB3158iN10/fJyGE3UQ3MeMsFaUi1280ng+5 lw+wPHeRExzRrOZ5AtlkGrDNwwLbFmIGNYC1vETzqIeMvXycBM4oGxUvOOztuQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696525940; a=rsa-sha256; cv=none; b=B2ZaVNYGCQx9Xeml18WAsaSoH6xthwksUyJ+DvFGZc5w06nMUxRGIoRzLZDEskfAwwl+5u e3yQ44xguvuyelSz+4gy5/WrGxJuUq2ZmbxoJthIdT6clc1ri5rMSdrAUMLyz67jXpU+cR OksYiAQppnvKy2cbvktMyOnrFbAWrw78joNV19AwgMCjKWZmAlUMy6MepplmmiobXo3K0m Z7Ep4HX+oUlgfoTfw9SDXX0UV41sCA7BR33u7SB9wK8pGorIv9XewGhL6nwgLIQoogP4ws swv/okzr+0agIpCeFJcy/nFLBJYqTToES0/QuU7Zztg1QqwEqmDC6BRpsA8jsQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=aHFGXfCz; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoRse-0005Ji-LE; Thu, 05 Oct 2023 13:11:20 -0400 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 1qoRsc-0005Iu-Ki; Thu, 05 Oct 2023 13:11:18 -0400 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 1qoRsc-00040o-Bm; Thu, 05 Oct 2023 13:11:18 -0400 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=6R8kzEnQTJaichvpN6bHNwBa9VyylZBHSZBkDrsAglc=; b=aHFGXfCzSLd7 lzaqUuqwhwDPtdeGnvlLCDGmdu0BX4jQB9skNc+XIK/Om8uorxnGyYsA0qXUfGavw2/BpUE1n0Fcz hILLeBYy6YjoNGSh13f+jwicuG4RfyJDUr12sPy8muhx3kEchj5/R/00CizA9BfqraXYQJOxmrG/0 1UTZpLW8T90L4UUnmetwccOXVse8b5+D4VMKncem1T29/8Dy53eA4z26HVnauezMaR4mm6r7DAzzd E/9TEws/XhjlGECi7RqmBNbq7CNOf116/o4bsybIIKcyZc28e5f+ydDZ1gsu2g8BtSdnp2aiv2Bdg hpueb9hrJoSd7Vn9zYLeCw==; Date: Thu, 05 Oct 2023 20:11:26 +0300 Message-Id: <83mswx2dvl.fsf@gnu.org> From: Eli Zaretskii To: Ihor Radchenko Cc: manikulin@gmail.com, emacs-orgmode@gnu.org, emacs-devel@gnu.org In-Reply-To: <87sf6pggd6.fsf@localhost> (message from Ihor Radchenko on Thu, 05 Oct 2023 16:53:57 +0000) Subject: Re: Completion of links to man pages References: <87sf6pi9fn.fsf@localhost> <838r8h3w3f.fsf@gnu.org> <87zg0xgimp.fsf@localhost> <83ttr52fmx.fsf@gnu.org> <87sf6pggd6.fsf@localhost> X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -10.86 X-Migadu-Spam-Score: -10.86 X-Migadu-Scanner: mx1.migadu.com X-Migadu-Queue-Id: ECA0D3EF08 X-TUID: uUDWEPqaIIS2 > From: Ihor Radchenko > Cc: manikulin@gmail.com, emacs-orgmode@gnu.org, emacs-devel@gnu.org > Date: Thu, 05 Oct 2023 16:53:57 +0000 > > Eli Zaretskii writes: > > >> > How is it different from the "M-x man" completion we already have? > >> > >> M-x man will display the man page, while we just need `completing-read' > >> from the same source M-x man or M-x woman use. > > > > Sorry, I don't understand: "M-x man" does provide completion. > > 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. > > And what do you mean by "`completing-read' from the same source M-x > > man or M-x woman use"? > > > > IOW, I think I have no clue of what are you trying to accomplish, > > sorry. > > We aim to create Org links like [[man:ls]]. > To create a link in Org, the interface is C-c C-l (org-insert-link), > which then prompts for link type (man:) and link path (ls). > When querying for the path, we want to have the same completion > COLLECTION as M-x man/woman has. 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? > 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. > What I am asking here is to provide a stable Elisp API for the above use > case. Currently, we have to rely on implementation details. >From where I stand, we have already a stable API tested by years of use. What is maybe missing is some documentation to allow its easier use, that's all.