[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add support for shortdoc link type
From: |
Bruno Cardoso |
Subject: |
Re: [PATCH] Add support for shortdoc link type |
Date: |
Fri, 03 May 2024 18:41:18 -0300 |
On 2024-05-02, 17:41 +0700, Max Nikulin <manikulin@gmail.com> wrote:
> `condition-case' may help to avoid the internal `shortdoc--groups'
> variable here. As to completion, it is better to ask for public API.
> However emacs developers likely will decline such request.
>
> Consider the following just as ideas.
>
> - Support of search options. Buttons in help pages move point to
> specific functions.
>
> <shortdoc:file::#find-file>
>
> - At first I considered adding shortdoc to help links that may call
> either `describe-function' or `describe-variable', but it is unlikely
> possible.
Hi Max,
Thanks for your suggestions. Indeed `condition-case' might be better there.
I implemented the search option by borrowing the regexp from `ol-info':
(defun org-link--open-shortdoc (path _)
"Open a \"shortdoc\" type link.
PATH is a group name or \"group::#function\"."
(string-match "\\`\\([^#:]*\\)\\(?:[#:]:?\\(.*\\)\\)?\\'" path)
(let ((group (match-string 1 path))
(fn (match-string 2 path)))
(condition-case nil
(progn
(shortdoc-display-group group)
(when fn
(re-search-forward (concat "^(" (string-remove-prefix "#" fn))
nil t)
(beginning-of-line)))
(error (message "Unknown shortdoc group: %s" group)))))
It works, but I'm not quite sure if this is the best approach.
It curently matches all the cases below, as I got confused about the correct
link syntax:
shortdoc:text-properties:get-pos-property
shortdoc:text-properties::get-pos-property
shortdoc:text-properties#get-pos-property
shortdoc:text-properties:#get-pos-property
shortdoc:text-properties::#get-pos-property
Best,
Bruno.
- Re: [PATCH] Add support for shortdoc link type, Ihor Radchenko, 2024/05/01
- Re: [PATCH] Add support for shortdoc link type, Bruno Cardoso, 2024/05/01
- Re: [PATCH] Add support for shortdoc link type, Ihor Radchenko, 2024/05/01
- Re: [PATCH] Add support for shortdoc link type, Bruno Cardoso, 2024/05/01
- Re: [PATCH] Add support for shortdoc link type, Max Nikulin, 2024/05/02
- Re: [PATCH] Add support for shortdoc link type,
Bruno Cardoso <=
- Re: [PATCH] Add support for shortdoc link type, Max Nikulin, 2024/05/04
- Re: [PATCH] Add support for shortdoc link type, Bruno Cardoso, 2024/05/04
- Re: [PATCH] Add support for shortdoc link type, Max Nikulin, 2024/05/05
- Re: [PATCH] Add support for shortdoc link type, Bruno Cardoso, 2024/05/05
- Re: [PATCH] Add support for shortdoc link type, Max Nikulin, 2024/05/06
- Re: [PATCH] Add support for shortdoc link type, Bruno Cardoso, 2024/05/07
- Re: [PATCH] Add support for shortdoc link type, Max Nikulin, 2024/05/08
- Re: [PATCH] Add support for shortdoc link type, Bruno Cardoso, 2024/05/08
- Re: [PATCH] Add support for shortdoc link type, Max Nikulin, 2024/05/10
- Re: [PATCH] Add support for shortdoc link type, Bruno Cardoso, 2024/05/11