From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id QHtDFY5xNmZkEQEAqHPOHw:P1 (envelope-from ) for ; Sat, 04 May 2024 19:34:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id QHtDFY5xNmZkEQEAqHPOHw (envelope-from ) for ; Sat, 04 May 2024 19:34:06 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LX3MaefX; 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=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714844046; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=sGepNf4/3IzNSAM8H7ZUQg1IhnpEhOmjx6+5ci22wRc=; b=cP+xNNIS0VIPj+qycUIY8e6BSUg/Wj7spJBqgpObQezgAyRmPPIb+No7Et77s1JcNpRH39 WnNv1uY23cH5AUjVYnWlnkn1KcRjqMwiAXmolH4nA9b327UdyotixEKra7jKTgil8bYmwd ISFzEDfZkAyUUMiB+GvD1B4/herBiizh3Nzl4U+gGrUHlEIY0GRDFZ9WXlr911MHkOTnwM 8Dfdi6GXYduCiVwQTwNWhXl4CSJbTqkUQgaczu5Duyt0yZW4k+3ut4F7rsP2Lir1Bqcqyt bDroDOJWbiPcsg1xt4QdcVe1o1gtZmme82DLFEmChdrhzY9TiLWDhXSnLAuHow== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LX3MaefX; 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=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1714844046; a=rsa-sha256; cv=none; b=nlGfGqPKDvgfLjYPgTn/OZaB2q1wq5OQs934OLylwieWfJiaxweZZZrNn8pk6tAvG8Wer3 vaMtjCacznOY7lfEbESCgcGOfXAGQWHx/lHllrXooUTNwJcYa5Y7YV3zubeXWCmmaQ7I7W 5TP0+MhFssc7D3m8N2+AeHJcuyboPL7zLef3cPZkpaVWSqZDXVfqjjMMSRfyV57zgoOZLR OhleeOosVRXvCCPQa8b5skcdxdAJ675Pi/YfNpkR1dMfjBEmu5Y0EpzOFMBrtRwfyrm/DB cKZKXEsLurD2Yq6fsx9vzCtfJEPYrelJWk4ZlUzezKw4cwO6BKqtFqyf4jLw6g== 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 035EF9354 for ; Sat, 4 May 2024 19:34:06 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3JG8-0002Y6-CJ; Sat, 04 May 2024 13:33:16 -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 1s3JG6-0002Xr-MA for emacs-orgmode@gnu.org; Sat, 04 May 2024 13:33:14 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3JG4-0000g2-DH for emacs-orgmode@gnu.org; Sat, 04 May 2024 13:33:14 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6f45f1179c3so329833b3a.3 for ; Sat, 04 May 2024 10:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714843990; x=1715448790; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=sGepNf4/3IzNSAM8H7ZUQg1IhnpEhOmjx6+5ci22wRc=; b=LX3MaefXqdk31QLg93O+pL3sW8rguccffbuJo+sMUK02Skdst5GxcEpzkzDPbXWZgU /zcl/AcMEOJITl+fRyYLa4ujE1HBv8MTUQl/kBdIiFD9znrVvSPedEheM/mMXv7JqcJz ARpuPffXgHfQ1OT0TZlwmwp1o6ahyzQcMW7BqBW7PJQ10N14M7Y0+rjAD6K/glrsm/Zb BUorj6NfgDBP+/2jq1kR58sddk/HqrGRcUe1bq0Xd1Y2awxB8uOPorCLE1yHau56bonW e1YdxNil1mG0gjPWM1LUEUtLbkJYgEUzIMDNZFb2EtkfrIkcRPyQi1CKYrjRxX1NN/13 QzkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714843990; x=1715448790; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sGepNf4/3IzNSAM8H7ZUQg1IhnpEhOmjx6+5ci22wRc=; b=taLP1WT/a2L2GIVNtflOpD8LNH+fHJ2x6axX9MzP6Aam5BKHmzhbsxU37QcQpuIq9h bVa2BN8QsRGRc7dSAWV3Rp5XdoAKRZZZC37fDw6BVuQEKosglbpPEk+q49VqDTV5ZfRu 8heeTECqkdqXCxhVGnlykY50UN4ZWMGT8crH7V7l1NEq+x4GElrx5OBHBt/OisGNMXG8 Ge6hYigbDHT/7d6A8r4R565uConHtbWgZ2l6IWaeksYuQfcUJuJHwRUk2hoSPOxR66bh jJXf99r+zbPpNV0GpvReXiaToTNUtQaWCExZmm4sNu5h39JatO4jKv7nRmlymuEF3KS0 AGsA== X-Gm-Message-State: AOJu0Yx/Ymov+kcjqktS+yskTMQUqmnJtjAD+w4GH+6SSdMB1493z3z/ SzYU9htzbbqDwo/Z/GJhEoLLMa1z71YWxEH/t9jHybyzX6JTRlsjl6SRRg== X-Google-Smtp-Source: AGHT+IEBjLKiXKs0Gd5tElXsAEoKnoz3ctmSH6xOHYEbYeJ0RNuhOqHJDJQ7SJloeLW5FSUF8JpHsw== X-Received: by 2002:a05:6a00:13a1:b0:6f0:f54a:4e7a with SMTP id t33-20020a056a0013a100b006f0f54a4e7amr8005502pfg.2.1714843989865; Sat, 04 May 2024 10:33:09 -0700 (PDT) Received: from storimasta ([2804:14c:5bb1:5200::3186]) by smtp.gmail.com with ESMTPSA id fi39-20020a056a0039a700b006f3f9e4dfd4sm4972941pfb.60.2024.05.04.10.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 10:33:09 -0700 (PDT) From: Bruno Cardoso To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Add support for shortdoc link type In-Reply-To: References: <87zftatdkr.fsf@gmail.com> <87v83xer0d.fsf@localhost> <87wmodtqxt.fsf@gmail.com> <875xvxs9hi.fsf@localhost> <87ttjhtjx1.fsf@gmail.com> <4b69d3b8-cfe7-4ba2-b9b5-872bcaeb6fe6@gmail.com> <87v83uefpd.fsf@gmail.com> Date: Sat, 04 May 2024 14:33:05 -0300 Message-ID: <87h6fdeb3i.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=cardoso.bc@gmail.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: -9.71 X-Migadu-Queue-Id: 035EF9354 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -9.71 X-TUID: 5GTsfKQzAQ3l --=-=-= Content-Type: text/plain On 2024-05-04, 14:38 +0700, Max Nikulin wrote: > It is necessary to maintain backward compatibility for `ol-info'. I do > not know what kind of separator was added earlier: "::" or "#". I > suppose, for new link type, rules more close to file: links may be used, see > (info "(org) Search Options") > https://orgmode.org/manual/Search-Options.html > > That is why I suggested shortdoc:GROUP::#FUNCTION. This way > shrotdoc:GROUP::SEARCH_STRING is possible as well. I see, thanks for pointing it out. I modified the regexp to match this pattern. > Notice that `shortdoc-display-group' has optional FUNCTION argument. Yes, I completely missed that. I updated the patch to use the optional function argument instead. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ol-support-for-shortdoc-link-type.patch diff --git a/doc/org-manual.org b/doc/org-manual.org index d66d95a22..61ee0c63d 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -3372,6 +3372,10 @@ Here is the full set of built-in link types: Execute a shell command upon activation. +- =shortdoc= :: + +Link to short documentation summary for a function group. For more information, see [[info:emacs#Name Help][Help by Command or Variable Name]]. + For =file:= and =id:= links, you can additionally specify a line number, or a text search string, separated by =::=. In Org files, you @@ -3413,6 +3417,8 @@ options: | irc | =irc:/irc.com/#emacs/bob= | | help | =help:org-store-link= | | info | =info:org#External links= | +| shortdoc | =shortdoc:text-properties= | +| | =shortdoc:text-properties::#get-pos-property= | | shell | =shell:ls *.org= | | elisp | =elisp:(find-file "Elisp.org")= (Elisp form to evaluate) | | | =elisp:org-agenda= (interactive Elisp command) | diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 87ebed751..f90c59ed3 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -1369,6 +1369,10 @@ place the entry in the ~Misc~ category if ~TEXINFO_DIR_CATEGORY~ is missing. =TEXINFO_DIR_TITLE= is renamed to =TEXINFO_DIR_NAME=. The old name is obsolete. +*** =ol.el=: Support for =shortdoc= link type + +Add support for storing and inserting links to =shortdoc= groups. + ** New functions and changes in function arguments *** New optional argument =UPDATE-HEADING= for ~org-bibtex-yank~ diff --git a/lisp/ol.el b/lisp/ol.el index bc9682e4a..19ec7a32a 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1582,6 +1582,41 @@ PATH is a symbol name, as a string." :follow #'org-link--open-help :store #'org-link--store-help) +;;;; "shortdoc" link type +(when (version< "27" emacs-version) + (defun org-link--open-shortdoc (path _) + "Open a \"shortdoc\" type link. +PATH is a group name or \"group::#function\"." + (string-match "\\`\\([^#:]*\\)\\(::#?\\(.*\\)\\)?\\'" path) + (let ((group (match-string 1 path)) + (fn (match-string 3 path))) + (condition-case nil + (shortdoc-display-group group (intern-soft fn)) + (error (message "Unknown shortdoc group: %s" group))))) + + (defun org-link--store-shortdoc (&optional _interactive?) + "Store \"shortdoc\" type link." + (when (eq major-mode 'shortdoc-mode) + (let* ((buffer (buffer-name)) + (group (when (string-match "*Shortdoc \\(.*\\)\\*" buffer) + (match-string 1 buffer)))) + (if (and group (assoc (intern-soft group) shortdoc--groups)) + (org-link-store-props :type "shortdoc" + :link (format "shortdoc:%s" group) + :description nil) + (user-error "Unknown shortdoc group: %s" group))))) + + (defun org-link--complete-shortdoc () + "Create a \"shortdoc\" link using completion." + (concat "shortdoc:" + (completing-read "Shortdoc summary for functions in: " + (mapcar #'car shortdoc--groups)))) + + (org-link-set-parameters "shortdoc" + :follow #'org-link--open-shortdoc + :store #'org-link--store-shortdoc + :complete #'org-link--complete-shortdoc)) + ;;;; "http", "https", "mailto", "ftp", and "news" link types (dolist (scheme '("ftp" "http" "https" "mailto" "news")) (org-link-set-parameters scheme --=-=-=--