From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id AARQOCr8N2aljwAA62LTzQ:P1 (envelope-from ) for ; Sun, 05 May 2024 23:37:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id AARQOCr8N2aljwAA62LTzQ (envelope-from ) for ; Sun, 05 May 2024 23:37:47 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TwsP3ry9; 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=1714944963; 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=EwPAxZ/oqtRw4xnzpBbdOSYD3I+QzHebVhRFuR4WInQ=; b=sOoey5wk+mz4aORMJ0IRTSRDIadPeZezs4bSQ8iEwCLINCETuyrGAsxzrZarWLUl+MyGfv 7MWXujGBpN7VPD5foJQbYntFw6b83lARQYYGDrxmPRdGT3dxJdQ+xGsL+0A1uUZns3TuT1 vb0lEJ0HjVtruPxu2fres589HoVz2p7wDwptyuXJgOK9Mq03zKdiuGqBsqrj2BIDaueTTS 7pmfdlzRQU1DN9ld2Hnkthno09ZeaVhKGQTGv1CK4mcJ0x5+JZftNqpvyQAKX2W/i83CG+ X/uRPsbmy3Ca5QfLPM5oFNmJDYhLFIcf+jaBiXN63lt3+7U+ZYykzDfV7Am/NA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TwsP3ry9; 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=1714944963; a=rsa-sha256; cv=none; b=MJ/rhisC93vSqiq2pgnvO610E+6FAGpQ6cNe6wXlAQGAbCXLvWdBBp1Of0jzzbzmIDXXAB unOX8iOYgoQYYo5onkDYWEnB8sOnSA3Y8I5SLzGbXaGTkbGHgV32zYlSn9t/sEx5oSNdnR XsZcfIvOgQ2FdgIsDb/Bh8R3sa48wvvrEguOjlPQcclYFbm+kyxCvl1ltK99OmJ9J6CEBh 8691442Q3VT0W8VMGb88CCFAKEk8izY87WmVf8m7v64Hjkf7zFZ5ZTZEk2VdKsZQEqrXTC +a9Hxjt9/XiSwRYnpy2I9Vt2vFsbe1x1uT0Mu5j0R0/+/jWkNOX775i6bvtufQ== 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 61DE43BC05 for ; Sun, 5 May 2024 23:36:02 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3jVw-0000Kl-HS; Sun, 05 May 2024 17:35: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 1s3jVu-0000KD-37 for emacs-orgmode@gnu.org; Sun, 05 May 2024 17:35:18 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3jVr-0000mu-L3 for emacs-orgmode@gnu.org; Sun, 05 May 2024 17:35:17 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6f447260f9dso761854b3a.0 for ; Sun, 05 May 2024 14:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714944907; x=1715549707; 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=EwPAxZ/oqtRw4xnzpBbdOSYD3I+QzHebVhRFuR4WInQ=; b=TwsP3ry974o7LoNVrsQKvSprHxtYXbdxrBlU+5iBjukQI4UWKkgFH0sbIwI3PTl0Ft fVk6OZbwEmfSJQnC5CAjE6uyDYi5jklMc5kMqj8pLQnx3ZIsSIxOWdZGM3lJTJ2Bmzwd xtIHFG8V7+yiJbNVeoNnaXz9h69BlQdnhjKXB6FcqoU7n/WojKJm+0HcOmAmrVLRKeth uhJ4RiWUmdx+6iFvxb9fr4wcAkSA3naUcDA1wNr0TI0g7hHm6iCGn4KYjuaKh4tLq9QP 1PZ7o9+2LUZ0Gn0MDmStYRJgpDq6Xd+pR5qa335R2pI2UBNFafOELEavxeLgv9tGUN06 FG8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714944907; x=1715549707; 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=EwPAxZ/oqtRw4xnzpBbdOSYD3I+QzHebVhRFuR4WInQ=; b=O6YiJilz+0HV1iOQNlDBJu89iQ2nEk+1seoPff+1VjH7DE9qTv01u8iZggjNbtqvEj d/40KvEENNfOnazt1P3aNt8E9yVYKVr/RpCzVceCZYpUj0kiZFI4oOkZur8CvQHyj5dW dHP+MT++51+RwpJQojwFnF469IpH51fBl+dRy8sybvpGFtT21toS/xn7O75XWr3voXmd KaeoJawMwTrJIXDB6Xx3iyer97zQgxHEo58TfsLEbaG98qhEmESSvsRgGBaPrKqOwwto HG58ZQQfY9O6TnrsBFh2UshzPjD3QlUvPJBpQppVfGMB+zK7MBZ7m7YuzF+pnaGD0xtB /arg== X-Forwarded-Encrypted: i=1; AJvYcCULg8yWFjWBpZeQZeyfyKgGPO2mLzQ6TCBCC3VfJlAH2U3C0oqp+ngUX7vYN7OkZoWATGBEOaS6kixVfVGuPTKchTObcFI= X-Gm-Message-State: AOJu0Yzug1io/nJamYq0tzHThnCQvLF7uMiN2WMqfjjKaJEan0/vxdxN 7NePFkIsttt32xc0e+o6ItYSa18EaHYIbs0hrqFuHZ4CCie1RGJtF16TdQ== X-Google-Smtp-Source: AGHT+IFg94y1Dd6HvF758vviCIkNYbd2UQK/diReksKB29yJbpWSlEnJqnmB9WyqYxmxby8JXH4+qQ== X-Received: by 2002:a05:6a21:3943:b0:1af:8e88:2834 with SMTP id ac3-20020a056a21394300b001af8e882834mr4899975pzc.46.1714944906795; Sun, 05 May 2024 14:35:06 -0700 (PDT) Received: from storimasta ([2804:14c:5bb1:5200::3186]) by smtp.gmail.com with ESMTPSA id gd5-20020a056a00830500b006eacefd8fabsm6430488pfb.64.2024.05.05.14.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 14:35:06 -0700 (PDT) From: Bruno Cardoso To: Max Nikulin , emacs-orgmode@gnu.org Subject: Re: [PATCH] Add support for shortdoc link type In-Reply-To: <9f6bbe0f-7cc2-4d55-a77d-331c8f71bb2c@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> Date: Sun, 05 May 2024 18:35:02 -0300 Message-ID: <87y18ondrt.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=cardoso.bc@gmail.com; helo=mail-pf1-x436.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: -9.71 X-Spam-Score: -9.71 X-Migadu-Queue-Id: 61DE43BC05 X-Migadu-Scanner: mx13.migadu.com X-TUID: 68a8S2lx5qxC --=-=-= Content-Type: text/plain On 2024-05-05, 18:01 +0700, Max Nikulin wrote: > I would consider explicit mention that it is related to Emacs Lisp and > perhaps that the origin of its name is the ~shortdoc-display-group~ user > command. might be a better link. > > This line is rather long though I do not have a link where formatting > conventions are documented. I expanded the description on `org-manual.org' and 'ORG-NEWS'. >> +;;;; "shortdoc" link type >> +(when (version< "27" emacs-version) > > Is it correct? > > 2a7488d42d8 2020-10-11 05:51:16 +0200 Lars Ingebrigtsen: Add support for > displaying short documentation for function groups > > git tag --contains 2a7488d42d8 > emacs-28.0.90 Fixed. > I think, it is enough to use [^:] since next group is started from "::". > You may use use non-capturing group \\(?:::# ...\\) (requires update of > next index below) unless you are going add search code back. I am unsure > concerning your intentions. You dropped search code, but "#" after "::" > is still optional. Thanks. I updated the regexp. I had dropped the search code because I wasn't considering the search option properly. If I understand correctly, both "::" and "::#" should match a function OR a search string? (e.g.: `shortdoc:text-properties::#pos-property' will also search for "pos-property" in the shortdoc buffer). This is the current behavior in the attached patch. > I do not have strong opinion what is better here: `user-error' (used in > earlier revisions) or `error'. However I do not see the point of > capturing original error and signalling another one if it is not > `user-error'. Agreed. I replaced it with `user-error'. --=-=-= 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 1feb5ed60..dd4cb6cd0 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -3382,6 +3382,13 @@ 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~ lists all known + documentation groups. For more information, see [[info:emacs#Name Help]] + and [[info:elisp#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 +3430,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 99dd8839c..1623873c0 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -1405,6 +1405,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 bc9682e4a..ff0b56378 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1582,6 +1582,44 @@ 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)) + (fn (match-string 2 path))) + (condition-case nil + (progn + (shortdoc-display-group group (intern-soft fn)) + (unless (intern-soft fn) + (re-search-forward fn nil t))) + (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-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 --=-=-=--