From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.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 WO5/IGvROmZsJQEAe85BDQ:P1 (envelope-from ) for ; Wed, 08 May 2024 03:12:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id WO5/IGvROmZsJQEAe85BDQ (envelope-from ) for ; Wed, 08 May 2024 03:12:11 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BrKOmGa3; 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=1715130731; 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=zb+5IwqQdjtTqFpNTxdYG5B4B0Ttg75dFeeUmfuRr9Q=; b=pJURpMmb/0RlwFXmmayVOYFKVzJ+XDH3QQbgCXsLRphOA53W2Vqcd8CEHtIWGRXykx76Fq CWT0hVRbm7c5EK0LCxVrF47N9OOMJMMW82MSwbmKdBtU9dfUe71ec6tQClF4EL1OCvGNFq qWD7ajl1goFGc7z0qbAdfsOqfuFWtOkOZKxw5+XwAPZv4JnDKIujDqagA/rsGEBRbu2IQj pYnieXRU+9tWCAnJa68ZE52r8Xws6c9MG1ILnOZxrRK7A7fd/HTnBs96earz99W4p8T9oj uWeFVLrALKhYCyYRcos9Iz8bSDXlLZifEEfeKfUdg+znCzgu1j2i6AEuK02h1Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BrKOmGa3; 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=1715130731; a=rsa-sha256; cv=none; b=lAjGgeOv/yfwU6ZNLOJyfFeGdfOhS2DwEm11E6pzeo2XgJxLOB2bpNfrlu3VWq+smV5nPC rcHNvMPTCx+VvY3dWEkgm7hnCeoMxxe5kNLP8BzqDeXsmJeIH58ufIOrvWe8XdV+66+tlJ ypBBUkpT+Bo9tAmf8ijpidFMBGS2Dxo6tEZ519i1KmR75O2BCkPr2L3ixR9Q0h1yqPsUYM MTk8M/g2YadqWZmgkc4kQ2SIphgBXsSuWzuLGfNP7aCoXdVsBoo7kIVU6DOt1cU1SrLPfA TahdCG+wOXAqXfZQk94wMGvFKWTXbGFLgk6mWJqYWF/tYR9+/ptsGYXy8KeWVA== 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 4BC1D1470A for ; Wed, 8 May 2024 03:12:11 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4Vpv-0007tl-Ce; Tue, 07 May 2024 21:11:11 -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 1s4Vpt-0007t9-Sg for emacs-orgmode@gnu.org; Tue, 07 May 2024 21:11:09 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s4Vpr-0003hP-Qh for emacs-orgmode@gnu.org; Tue, 07 May 2024 21:11:09 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6f4521ad6c0so2856783b3a.0 for ; Tue, 07 May 2024 18:11:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715130665; x=1715735465; 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=zb+5IwqQdjtTqFpNTxdYG5B4B0Ttg75dFeeUmfuRr9Q=; b=BrKOmGa31bN5+8L1yF0xytsmQe2HxZEuyq0zBDiplJ+5BzQMLQ8mxUQG/s5PIZujxw a5wGCCDr5PWzxFqnqyDihEd+k2pM2CMqvK3YfUR6jZh4kq6/ieKu2IRveo7TrWnjfFom Ip3ZedAi2OTXqHIRlvkGiEwQYH1Z7f4GxEF9xtChgNqKnvqHW0yG0dnd67OrgJ2ZhNUB 5b9Rl3KObubU692hPKkPGVuvcaRusXLKHf3Ixumzzt+ve5fzAnE7rQg2qlHWl5i86/gs UvyJYrxN0s10+YBT8v2NDosAULadG5Co/aDe8Ya/1awb2dHbnhL3pJ7ui0SF9fi6XbUH F10A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715130665; x=1715735465; 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=zb+5IwqQdjtTqFpNTxdYG5B4B0Ttg75dFeeUmfuRr9Q=; b=wnlFJkZFJXqzW+iim1wL451wrFTo8kAos+qd5EXD1J1yuIvK20ld4qYUsEv9eeTZgY O6wHKYWDWz8P8LSvUxzZaqaM8aERjrri6/W4vuWN8k8gFcNCAGDAz4ca8sAg1JTKRSDr K0dDXsXhsEMMQw/AzFoCwDuaKQmhAzOTYHl4su2PU14mfTWv30x0KPZuA0EzLgTy0FGC 2GtQ780dr1sQsFv0xnGWy6UQ5tSsTsyJYAeTHR7YREjptoZZPmSynCkWvjw24neshCdX oTbUgxFCxNTEVinvm633K4EqiQn7YHSNqVcebbqOCIFwKiGWFBbsw53qvzOnGTUYNyPd DnNA== X-Forwarded-Encrypted: i=1; AJvYcCVsKY6GyNch684jsyKNztA+IAi645uvIBpeMncXUglP5I6hliIX9GI6Kk34W0QZtZyeEPL8SLert6w8wFhckIjhlZLELLo= X-Gm-Message-State: AOJu0YwpDbZ4Hf+WAxYVqU+7aK9QUD3yNnsaJGvW5yNphVjHb6ueWlbK Mwvou5ty7yW7UT8KmEPDndxIygpVKkn7jBfaBveYAOvKCUtAvsYlAn3iYw== X-Google-Smtp-Source: AGHT+IGR+VB8Yurv5OqWK9fTzOJD1IfZoBWHd7RBNhdKITtV3uNFpKZN3vvwRisaAXRshkJHjSCP2g== X-Received: by 2002:a05:6a20:158c:b0:1aa:583d:6a72 with SMTP id adf61e73a8af0-1afc8dbdb1amr1542018637.56.1715130664885; Tue, 07 May 2024 18:11:04 -0700 (PDT) Received: from storimasta ([2804:14c:5bb1:5200::3186]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2b628ea6aadsm144675a91.50.2024.05.07.18.11.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 18:11:04 -0700 (PDT) From: Bruno Cardoso To: Max Nikulin , emacs-orgmode@gnu.org Subject: Re: [PATCH] Add support for shortdoc link type In-Reply-To: <938098de-6933-4668-85b0-fbfbc02dd949@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> Date: Tue, 07 May 2024 22:11:01 -0300 Message-ID: <87v83pnm56.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=cardoso.bc@gmail.com; helo=mail-pf1-x42b.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: 4BC1D1470A X-Migadu-Scanner: mx13.migadu.com X-TUID: 5RuR6l7W0fah --=-=-= Content-Type: text/plain On 2024-05-06, 17:55 +0700, Max Nikulin wrote: > It seems my comments have led mostly to confusion rather than > improvements. I am sorry for that. I have in mind 2 kind of links: > - that may be handled solely by > `shortdoc-display-group' with second argument. > - that should cause > (shortdoc-display-group group) > (search-forward fn nil t) ; or (word-search-forward fn nil t) I'm sure the confusion is mostly my fault :) The following now work as expected: - [[shortdoc:string]] - [[shortdoc:string::#try-completion]] - [[shortdoc:string::identical contents]] --=-=-= 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..8894f4231 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~ lists 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 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..ab6cb497a 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1582,6 +1582,46 @@ 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 (when (and str (string-match "^#" str)) + (intern-soft (string-remove-prefix "#" str))))) + (condition-case nil + (progn + (shortdoc-display-group group fn) + (when (and str (not fn)) + (search-forward str 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 --=-=-=--