From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.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 +CJBJggQQmZOVgAAqHPOHw:P1 (envelope-from ) for ; Mon, 13 May 2024 15:05:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id +CJBJggQQmZOVgAAqHPOHw (envelope-from ) for ; Mon, 13 May 2024 15:05:12 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=R+DB3m1o; 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=1715605512; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=QFG3oWlGfGnLy0weP7qaiBxomneN8d7pUf/cgnpkeqs=; b=KovEB0SgB82yAe/kgApcBEminfyveumSz+IHIew7io9eNYKQ6YCYiCOyhM/osr+mAvhp7v KCdTCJPJlVZMZB1DQ0dSbK0szP/JBS1aFXmnH+Uyi/RX4k2a6hpQ6uUK/C4Oc3CvZIYLFA EgIoXKA+GZ1fkkD3A1e7ozq2HiqF2C1lpDW4Eg9gq7yXb8xo0FpEnqfo2dVYymRlx/t/XF bdmWAB95/bIbdNF3JkUc3U6q29lG3+rSZ0BGSfjJK4rX7K/GDuolmOKl/XA9CpoxjIocR7 MRqOA15vcJ3amSHo8GohXoQMokbhbUyzeoPpYYjvqjO7oPG3aTrV2pJYShcJ3A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715605512; a=rsa-sha256; cv=none; b=VAs4+fl5TBOwOVEJt25bY2IUsS626R9C2Sl/mM80cbORH2D5IzyMCsNMLCEB37/nHImZv3 T7NoWE6tTBjlxuKBHVEfOA9EBc6Gx6VLSv+Hg3Qg+3EvNcKPuAI3pwLlwxJHwsJSSIa/Vw 5dYQXezrLk6OxXbdxylTWNDfZ6E3eV7yoWnOZltnhTZxD9HTRJfv6TqIOl6xwas0Cu5VmP DJLYqXwLTkgl1QYa/fC4gCMcsjpD2ebKLGr++JY9NjJ8PxaRka1DPfbYaNb2R+v2Mm9YwA JRc9//ngIOFgw6m5We4+o8TaCNt1qDcH/reF7FD+/FODMdQFf2uSl9cxUBxDvQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=R+DB3m1o; 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 396196795E for ; Mon, 13 May 2024 15:05:12 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6VLx-0002Wf-QU; Mon, 13 May 2024 09:04:29 -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 1s6VLv-0002WG-FS for emacs-orgmode@gnu.org; Mon, 13 May 2024 09:04:27 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6VLt-0001jr-J5 for emacs-orgmode@gnu.org; Mon, 13 May 2024 09:04:27 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-620e30d8f37so3680273a12.2 for ; Mon, 13 May 2024 06:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715605463; x=1716210263; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=QFG3oWlGfGnLy0weP7qaiBxomneN8d7pUf/cgnpkeqs=; b=R+DB3m1oGcpUE4Dw7y8dmOjLkMk4mywLumN58fBvlbe6bPYcrDZ7gaQaEDqu/RJq4q e4aHut/+EHTeelwzgP/SPHhPXbfL2QE6Lkz/dFF6o7i7ZCA0t31t6cwbRp7ljPJC3Oll Zyz+PIZF41F43VFSkR71ZYVjHkxqvGkA6k0Ok9eGMJtwqUbedpoVLciczTaRK//7cx2v VtDnEB8VLm4/r0H2KyGXs0e6laM3Z6n2JUDRufiOvRItd2uItxVqgnQFP7ib/dkaN13e ynLueqvNybdFtz0OhmBPcUv7mwy7yeSEtfmFeYod/H3Oxi69q8iB9wk/BTQfhVe1QRsc cKmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715605463; x=1716210263; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QFG3oWlGfGnLy0weP7qaiBxomneN8d7pUf/cgnpkeqs=; b=Hq71wKK7JuboNlARy2A+ZYTCLvxE+r0sdc7GeBOgYDyo7rc0yslLxWPo6tmYHjiNdZ d+uPxTDea3p1Hlrg/aIrNAAafN/u5Yf8aMpcGcRUIPA5/lwwDeFqUsIdNvME2UhiWNP4 02AJt7YtUew3qdr1L2kWx60KwGnN4uCzJ3UlAuXJmYny4h1BVQ6TN+6iG7yRBM5l/Y1J OzPV2xE8X4iAiexoVvgtKIXw7h6ocNA4HC1USSQi0UESVqu6M3Ca7qTbBoe3ta+QsDbl 4vWxFkq15ZYKsMKmbZda/yFH1sv/CI5uefzZzWM6IVtqfVNb8QCFKv+SByc4J+QEIp1A xVEA== X-Forwarded-Encrypted: i=1; AJvYcCWlpnd+W+jG8+xPpbEgOCdievoKAqdV1fHbdbzyE8PUWbDZCUbAFSNSk6vy53Yp5wyb4Hzr6qUiDakrp+IeIw1OYM73fa8= X-Gm-Message-State: AOJu0YyE907ML4EAb+4cYwPACAmOzGbzqxZGas3NJHqA1v29zcCQrIK8 lvcClwdIaGDe9XTgoVqAG6DcyrWaHYbosPpk2uJ3GbyT/T+6VJso8RvMBw== X-Google-Smtp-Source: AGHT+IER+b6mag35d3oeTf+VXz3YxgWByDa0XOZ/KFoMqr4WXJLaQyhpbPYe5EBO/dxSP23+Q2migw== X-Received: by 2002:a17:90a:c397:b0:2b3:28df:92bb with SMTP id 98e67ed59e1d1-2b6cc44e368mr7530425a91.13.1715605463233; Mon, 13 May 2024 06:04:23 -0700 (PDT) Received: from storimasta ([2804:14c:5bb1:5200::3186]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2b62884b837sm9750976a91.20.2024.05.13.06.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 06:04:22 -0700 (PDT) From: Bruno Cardoso To: Max Nikulin , emacs-orgmode@gnu.org Subject: Re: [PATCH] Add support for shortdoc link type In-Reply-To: <7ef51938-600d-40cf-bf93-d32b86d77f9d@gmail.com> 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> <87h6fdeb3i.fsf@gmail.com> <9f6bbe0f-7cc2-4d55-a77d-331c8f71bb2c@gmail.com> <87y18ondrt.fsf@gmail.com> <938098de-6933-4668-85b0-fbfbc02dd949@gmail.com> <87v83pnm56.fsf@gmail.com> <87seysnggb.fsf@gmail.com> <87ttj4i8u6.fsf@gmail.com> <7ef51938-600d-40cf-bf93-d32b86d77f9d@gmail.com> Date: Mon, 13 May 2024 10:04:16 -0300 Message-ID: <87eda5yib3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=cardoso.bc@gmail.com; helo=mail-pg1-x534.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.70 X-Spam-Score: -6.70 X-Migadu-Queue-Id: 396196795E X-Migadu-Scanner: mx11.migadu.com X-TUID: D2CTpZH/1zvt --=-=-= Content-Type: text/plain On 2024-05-13, 18:14 +0700, Max Nikulin wrote: > Sorry, but did you manually edit the patch? I didn't. I generated it again and applied without errors. > If you wish to use `user-error' as in earlier revisions then you may use > > (error (user-error "Unknown shortdoc group or malformed link: `%s'" > path))))) Thanks, changed it. > An alternative might be something like (feel free to ignore) > > (condition-case err > ;; ... > (error (signal 'user-error (cdr err)))) ; more ) > > to preserve message generated by `shortdoc-display-group'. The error message generated by `shortdoc-display-group' may be vague when group is empty ("No such documentation group "), which might be the result of a malformed link. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ol-support-for-shortdoc-link-type.patch >From beceb1b17d1c019cfeb987276e5a234c8f280e6b Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Date: Mon, 13 May 2024 09:42:19 -0300 Subject: [PATCH] Add support for shortdoc link type ol.el: Add support for `shortdoc' link type * lisp/ol.el (org-link--open-shortdoc org-link--store-shortdoc) (org-link--complete-shortdoc): Add support for storing and inserting links to `shortdoc' documentation groups for Emacs Lisp functions. * doc/org-manual.org (External Links): Add shortdoc link type documentation. * etc/ORG-NEWS (=ol.el=: Support for =shortdoc= link type): Document the new feature. --- doc/org-manual.org | 11 +++++++++++ etc/ORG-NEWS | 5 +++++ lisp/ol.el | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index e3a2c9b70..c4873a79b 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -3382,6 +3382,15 @@ Here is the full set of built-in link types: Execute a shell command upon activation. +- =shortdoc= :: + + Link to short documentation summary for an Emacs Lisp function group. + Since Emacs 28, user command ~shortdoc-display-group~ shows all known + documentation groups. + + For more information, see [[info:emacs#Name Help][Name Help]] + and [[info:elisp#Documentation Groups][Documentation Groups]]. + For =file:= and =id:= links, you can additionally specify a line number, or a text search string, separated by =::=. In Org files, you @@ -3423,6 +3432,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 ff58833d7..910f534ac 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -1467,6 +1467,11 @@ 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= documentation +groups for Emacs Lisp functions. + ** 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 3d64b41b0..5468a1939 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1582,6 +1582,47 @@ PATH is a symbol name, as a string." :follow #'org-link--open-help :store #'org-link--store-help) +;;;; "shortdoc" link type +(when (version<= "28.0.90" emacs-version) + (defun org-link--open-shortdoc (path _) + "Open a \"shortdoc\" type link. +PATH is a group name, \"group::#function\" or \"group::search string\"." + (string-match "\\`\\([^:]*\\)\\(?:::\\(.*\\)\\'\\)?" path) + (let* ((group (match-string 1 path)) + (str (match-string 2 path)) + (fn (and str + (eq ?# (string-to-char str)) + (intern-soft (substring str 1))))) + (condition-case nil + (progn + (shortdoc-display-group group fn) + (and str (not fn) (search-forward str nil t))) + (error (user-error "Unknown shortdoc group or malformed link: `%s'" + path))))) + + (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 -- 2.45.0 --=-=-=--