From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id MF22DGDlYGZpPQEAA41jLg (envelope-from ) for ; Thu, 06 Jun 2024 00:23:28 +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 UFomB2DlYGZj2AAA62LTzQ (envelope-from ) for ; Thu, 06 Jun 2024 00:23:28 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WtV7raK4; 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=1717626207; 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=pO62RxAT4gakPMafdJ7B486NgtFT6ulBt8O6dPtyGuo=; b=nLyi/AF0QSX15Upsv48/q4sobIF3BtZ+3xk4bB7by8THNIYgo1Zbxym2mKj4h6JF5Ctnt8 I0x5WcAduozynz+kU8MB3JznZXnVYgQAyz8KLnJC8NSoKMyoN+pDZglQcl54JL7u10HVqp 8SWkHKWCjaOmkLm0Q6VAPMmcreNJHJ7LwohXGVACgy9qEY/MYhTg8Hkp0CKbynJxZmWmTM yqUxzdih+Q8nhUQjGya+Fik9dIF7ZVDYiKhBGF3/WufMA5TM+f/RdoXwqwZeDqqtsch44F m9lAhxTlwLgJSK/yD2oB1KtvfQ//Q0lTsYd/fG1b4vIRpA4HPz/sN4bh5J18MQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717626207; a=rsa-sha256; cv=none; b=OILuQ3JFy/U/X5942GnrfQueEOh7hWOpqHBARUodr6Mt59qsG5wFhrwLHUl2QzSkz30k6B 5hXls72Kx3uGpKfGdwxOkVdeyGb2KZw84sB4Flaj+lx0OqfjArW0VtLiQC/1Pt5kdZuP/5 Lk8aheenahitNTokCGugb39QXnD0QcOW/2+99l6ywUjbJauN0PCzx3EL0MEYrDEozrb+Ad xiHSEgIXKj2utyKOC3ONpSZtoFXshOlTNktpPr8FJ3dA3PpK2Qn0GqC6JNR9GvmZ6hB1zn iPMdbblc8zotMSzSpsU5O5BYYoTXTzU1ezQYaoDUhZoH+57kF92ZhxCtdCM51Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WtV7raK4; 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 C9F3F72CC1 for ; Thu, 06 Jun 2024 00:23:27 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEz1J-00049j-PK; Wed, 05 Jun 2024 18:22:13 -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 1sEz1F-00048m-LZ for emacs-orgmode@gnu.org; Wed, 05 Jun 2024 18:22:09 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEz1D-0008SM-Pz for emacs-orgmode@gnu.org; Wed, 05 Jun 2024 18:22:09 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1f6ab88dfaeso3029595ad.2 for ; Wed, 05 Jun 2024 15:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717626126; x=1718230926; 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=pO62RxAT4gakPMafdJ7B486NgtFT6ulBt8O6dPtyGuo=; b=WtV7raK428hEdPQ7tNbPMnGVRla8Om9Dnup39fxmyNd4nhODjZdcTErw/Idb4+t6Mi +7uIP0X+JhFMIYYi/lAx4DfsuAajY4DKrDaj09OcLkbLMQ7nhNfusq7CPuiJ34IxJ/Wr 0aIhConZ6rv0nVaaqwpKUVeAPao1ApLlaeJBzJS/DuB/iM2zu0dVjj5mPhZnUeI3VJ2G 25T0dwaW3HVth247Dxa0A+HUKY5yjNHPHHEqPVYUrm4LbxfNGRFLFT84jXhHz9SymfuI cMQtTKQCMa73/q3stzFzPQ7keoXv74eQ1hSUF/wo+3PwVlPEP4OM8JIK2mLODmbctTpp YtGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717626126; x=1718230926; 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=pO62RxAT4gakPMafdJ7B486NgtFT6ulBt8O6dPtyGuo=; b=rJ8G6AHP294a0QCop7+zgjMj4SC9as0LJW4RnEv+ENX1uZrYpLqsBXA/+L3TM2jVGe F8Y9ABBQPj/df8AfqJYr3rTtfnXR09bw1YWFXj701FRBWuySu4ODWPmZvLlLFJK8BRSb Hzjno6WpfhKrEzSDTfSX6NxX6uFCjhGxTBXk3AfZr9fi6ycYiIkbFLEhYm/idkcp3K+/ p19EcFVXbWCvFLkKa7XoybBVep2DiRlDAJySHbCmBzUfPMy+vVaZcGzvdlCNTAYW0CJU 3GFt/sV5Rs6Rj3HKnOrhG2iNHlMGr+4jOyWkCKpd+QicjVG633O9qYX+LCD98LW5qqZR wrFA== X-Forwarded-Encrypted: i=1; AJvYcCXektBveLOxEzQ1wu2QqfpzDP/3/gUDI9ezPxzyypBT0KBbbI0PSPln04nCNVghtrM6fGEL96JlKvkeL6cCnICsvpjViMw= X-Gm-Message-State: AOJu0Yw28IHBpE9FYmnMVKAnK2A+ii+SJNPaVqIAojlNq//01qBIJAXw VAzUyCXan4yeRkHf49U2chxwLzVkQl0ZRKtYfOa08uzGkQFzeaBhne2a/Q== X-Google-Smtp-Source: AGHT+IEt/EDEMYRt7+e/u9x/Re0IB+Gx5peyLueLzxT38WdFxwV2QtWYxKt4K7TNoNuLQrPCIs5ySA== X-Received: by 2002:a17:902:cecb:b0:1f6:a5ad:45f4 with SMTP id d9443c01a7336-1f6a5ad460dmr41640405ad.60.1717626125416; Wed, 05 Jun 2024 15:22:05 -0700 (PDT) Received: from storimasta ([2804:14c:5bb1:5200::f0d3]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7fdd5esm379435ad.287.2024.06.05.15.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 15:22:03 -0700 (PDT) From: Bruno Cardoso To: Max Nikulin , 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> <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> <87eda5yib3.fsf@gmail.com> Date: Wed, 05 Jun 2024 19:21:59 -0300 Message-ID: <87sexrvxmg.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=cardoso.bc@gmail.com; helo=mail-pl1-x631.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, T_SCC_BODY_TEXT_LINE=-0.01 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: -5.17 X-Spam-Score: -5.17 X-Migadu-Queue-Id: C9F3F72CC1 X-Migadu-Scanner: mx11.migadu.com X-TUID: 84p14fA9pXk2 --=-=-= Content-Type: text/plain On 2024-06-05, 22:37 +0700, Max Nikulin wrote: > > A couple of notes that unlikely affect real life usage. > >> + (defun org-link--store-shortdoc (&optional _interactive?) >> + "Store \"shortdoc\" type link." >> + (when (eq major-mode 'shortdoc-mode) > > `derived-mode-p' is more reliable in general. Fixed. The attached patch is now rebased to new Org version. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ol-support-for-shortdoc-link-type.patch >From 43de471e577d530ea76dc48460efea12864b5675 Mon Sep 17 00:00:00 2001 From: bruno Date: Wed, 5 Jun 2024 19:14:36 -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 170eea506..e931e1cc1 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -3393,6 +3393,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 @@ -3434,6 +3443,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 4b0b77ca8..a8f3a37f6 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -40,6 +40,11 @@ all the references are resolved in the generated png. # This also includes changes in function behavior from Elisp perspective. +*** =ol.el=: Support for =shortdoc= link type + +Add support for storing and inserting links to =shortdoc= documentation +groups for Emacs Lisp functions. + ** Miscellaneous * Version 9.7 diff --git a/lisp/ol.el b/lisp/ol.el index 20f1b89c0..4cda0cb60 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 (derived-mode-p 'org-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.1 --=-=-=--