From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id yDCVAyyXMmZjAgAA62LTzQ:P1 (envelope-from ) for ; Wed, 01 May 2024 21:25:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id yDCVAyyXMmZjAgAA62LTzQ (envelope-from ) for ; Wed, 01 May 2024 21:25:32 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WWyR3IYZ; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714591531; 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=+P6REJSzIJ98begL3lfmOsS9rYhP/2gpRkBKJ2Slvp4=; b=mrmsFZDbOg6G69w0MYjXWu5yhrj+kGtm7mVAkEvZWRBX8alwzYAXhBJpj4XCHbe1micvww 58nOJ1+uPjsTTJ3+qpq6tbIydbA5S5ceyvgzDc9p2O6SjStSn6CB+hjehQoUcb3wQT6eB9 F1a1IZuAUlAj87OXsfCyBIpuLJB/fUuYQlNgLQRidq3RTD7QVtibzu2P9/Frl+Q25TmqJO 7VJP7iAtUnIrfqXyX85+1f+9cVNRHOgMEoCmne3c/uCt/6zbdQuBLyjBFAbQ/1CvUSBIXm 1wfv/anoto69/H0v/11D7HIQ31VIJy3LqfylQjpZtqq+O9Z9O65ApkaHEj7PAQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1714591531; a=rsa-sha256; cv=none; b=Zb/LkSJ11ezgRqVJ5UZ3XajQMusBl/fGOZ+a8IZeZWxLmykWMuWkNoDuz+lVOLFUeZF1Va OQbjFeuUV7RQUpVaNFxUfFkYPU/9C+k8pXnsdcyA119uUx5tnZQtsT7IeXjHkVIrktS2rr u0hLV4ADk9nHYeoqF9HxUmCQsV9lkpbVGvUU/PezTx+NyccqF34YfxBFO+B5mJitceAw7j p1e6AWplsXKa86uGAgnCnFDbC2CbPqp93gU0BiL+DAg9nYbsQHIKLBVlSS0eO+DZ/CqgMv v4qTwdaZWVpnJGW2kZNdsEu3HDDBKrOYmpDf60oFGq5oU2y7NzXcb/hUakV7eQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WWyR3IYZ; dmarc=pass (policy=none) header.from=gmail.com; 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" 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 ABBE55F77 for ; Wed, 01 May 2024 21:25:31 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2FZG-0007PJ-UZ; Wed, 01 May 2024 15:24:38 -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 1s2FZC-0007Li-LX for emacs-orgmode@gnu.org; Wed, 01 May 2024 15:24:35 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2FZA-0004hF-77 for emacs-orgmode@gnu.org; Wed, 01 May 2024 15:24:34 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e9ffd3f96eso58351945ad.3 for ; Wed, 01 May 2024 12:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714591470; x=1715196270; 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=+P6REJSzIJ98begL3lfmOsS9rYhP/2gpRkBKJ2Slvp4=; b=WWyR3IYZXg4AOIzcj/3SDXfXvBSEaBzLJEYxOxER6xWGaK4yS0A5lpTeCQFCZ2vKcf l5xtQLgiVX9lFu7v2YXByqqFAMWvNg2y5c3xQRvYtfSCs2DMX2/ToKBgIAJldlPdg7c8 hGPINlV5EEQi0yKU0TrRxV5p159Lp3+/h+yebseUdgHOp2lyiT7o5vXNtv0MCviWkei/ FURdvuBFKpOMt3DBwqnhT+oG9/Lwi6tDB+MsAzcSMJPsL2m0QOI3Bb4bpXHNwksjd8Rt B7xCjT7C2KME1WvmRIcMflH7xzps+A0v2SXBCWX4m1V5q1Yut/HDjcDFn10PRwbcHH5e vy1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714591470; x=1715196270; 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=+P6REJSzIJ98begL3lfmOsS9rYhP/2gpRkBKJ2Slvp4=; b=T3DfBa4Kf41/Ut0NMukUF0P2mLZCeaT2wMl16phZlkTBRAWEKhe6ZYkpHWd9Ki7N7k GQQr5+BjkYFy2Gt63pLt0lpxgqSBK4MLeS/AU6+hQ+Jru58uj3TUOvFSkumuX1eTcPEw HuBkT9fNg8Lo7HjkCgpClaXsTfPCGPaXvq8Z0O1p0+eYEiD3dxqbNL9YuFVyjqYFWdtU Nw2eIoBBTf9YmZxRuhZoXnVIfndpY/76SbEXr4L2yHiDKJfjcDF4I2Y+f0gHv23bzCPM 3OAj96ZuRWPqERv7uToicw6ee61MgkEoTWtmVyqcNa/YBPWhXE1fD3DgzR5m0MzAU7tI U9NA== X-Gm-Message-State: AOJu0YwMF+1EXpZMHUFQ9AQClNjUqVMGjUlGeRviuYc0QB1xOs0bxmvL KyLX2VWU1S4DOZ+sunCy3jeM5cqe+orwmJsdLU2NNaaMUsB+JsN8ThACPA== X-Google-Smtp-Source: AGHT+IG02DotGvjZtBwg+QZpYNQMrqTjq5h0bP9HERbSaOAdippE6sBynZi8L80FaYw09/clIc6wyA== X-Received: by 2002:a17:902:f541:b0:1e3:f012:568d with SMTP id h1-20020a170902f54100b001e3f012568dmr4223123plf.15.1714591469905; Wed, 01 May 2024 12:24:29 -0700 (PDT) Received: from storimasta ([2804:14c:5bb1:5200::3186]) by smtp.gmail.com with ESMTPSA id b3-20020a170902650300b001ea2838fa5dsm16015461plk.76.2024.05.01.12.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 12:24:29 -0700 (PDT) From: Bruno Cardoso To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Add support for shortdoc link type In-Reply-To: <875xvxs9hi.fsf@localhost> References: <87zftatdkr.fsf@gmail.com> <87v83xer0d.fsf@localhost> <87wmodtqxt.fsf@gmail.com> <875xvxs9hi.fsf@localhost> Date: Wed, 01 May 2024 16:24:26 -0300 Message-ID: <87ttjhtjx1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=cardoso.bc@gmail.com; helo=mail-pl1-x632.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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.71 X-Spam-Score: -6.71 X-Migadu-Queue-Id: ABBE55F77 X-Migadu-Scanner: mx11.migadu.com X-TUID: gqdJy1JCKbim --=-=-= Content-Type: text/plain On 2024-05-01, 17:55 +0000, Ihor Radchenko wrote: > Bruno Cardoso writes: > >> Thanks for your comments. See attached the updated patch. > > Thanks for the update! > >> +- =shortdoc= :: >> + >> + Link to short documentation summary for a function group. > > Might be useful to throw a link to Emacs manual here - [[info:emacs#Name Help]] > >> +*** =ol.el=: Support for ~shortdoc~ link type >> +Add support for storing and inserting links to ~shortdoc~ groups. > > =shortdoc= I think. It is not ~code~, but rather =verbatim=. > >> + (defun org-link--store-shortdoc (&optional _interactive?) >> + (when (eq major-mode 'shortdoc-mode) >> + (let* ((buffer (buffer-name)) >> + (group (when (string-match "*Shortdoc \\(.*\\)\\*" buffer) >> + (match-string 1 buffer)))) >> + (when (assoc (intern group) shortdoc--groups) > > This will err when GROUP is nil (string-match does not match). > >> + (org-link-set-parameters "shortdoc" >> + :follow #'org-link--open-shortdoc >> + :store #'org-link--store-shortdoc)) > > Maybe also implement :complete parameter? It should be relatively easy. > Thanks Ihor, here is the updated patch. --=-=-= 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..15b79ae21 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,7 @@ options: | irc | =irc:/irc.com/#emacs/bob= | | help | =help:org-store-link= | | info | =info:org#External links= | +| shortdoc | =shortdoc:text-properties= | | 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 8dbc3292d..b0f4cb287 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -1357,6 +1357,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 f6d656982..dd95f5d4c 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1597,6 +1597,37 @@ PATH is a symbol name, as a string." (org-link-set-parameters "help" :follow #'org-link--open-help :store #'org-link--store-help) +;;;; "shortdoc" link type +(when (version< "27" emacs-version) + (defun org-link--open-shortdoc (group _) + "Open a \"shortdoc\" type link. +GROUP is a symbol name." + (if (assoc (intern group) shortdoc--groups) + (shortdoc-display-group group) + (user-error "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 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")) --=-=-=--