Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind RET to follow Markdown links in issue buffers #53

Conversation

Miciah
Copy link

@Miciah Miciah commented Dec 30, 2018

  • lisp/forge-topic.el (forge-topic-mode-map): Remap magit-visit-thing to markdown-follow-link-at-point.

* lisp/forge-topic.el (forge-topic-mode-map): Remap magit-visit-thing to
markdown-follow-link-at-point.
@vermiculus
Copy link
Contributor

Any way this keybind could be added to the link itself instead of everywhere? I can definitely imagine trying to RET on a user name or something.

@tarsius
Copy link
Member

tarsius commented Dec 30, 2018

Yes, we cannot just bind this in forge-topic-mode-map. Doing it properly will probably be quite a bit of work. This also came up in #45.

@tarsius tarsius closed this Dec 30, 2018
@Miciah
Copy link
Author

Miciah commented Dec 30, 2018

I almost went with a wrapper instead of binding markdown-follow-link-at-point directly, something like the following:

(defun forge-issue-visit-thing ()
  "Visit the current link using a browser."
  (interactive)
  (cond ((markdown-link-p)
         (markdown-follow-link-at-point))
        ((markdown-wiki-link-p)
         (markdown-follow-wiki-link-at-point))
        ;; TODO Handle @username and #123.
        (t (user-error "Nothing to follow at point"))))

In the end I went with bindingmarkdown-follow-link-at-point directly because refactoring is the easy part (compared to implementing the TODO), but I can amend my change to use the above function; please let me know if that would be an acceptable starting point.

Another option would be to scan for properties or regexes for Markdown links and using make-text-button or similar to linkify them. Please let me know if you would be interested in that approach.

@tarsius
Copy link
Member

tarsius commented Dec 30, 2018

I'm undecided. Reopening to keep track of this.

@tarsius tarsius reopened this Dec 30, 2018
@tarsius
Copy link
Member

tarsius commented Feb 18, 2019

Another option would be to scan for properties or regexes for Markdown links and using make-text-button or similar to linkify them. Please let me know if you would be interested in that approach.

I think we should use this approach.

@tarsius tarsius closed this Feb 24, 2019
tarsius added a commit that referenced this pull request Jan 1, 2022
It would be better only bind this command in a keymap
specified by the `keymap' property of the link itself.

See #53.
Closes #452.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants