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

Add transient menu interface #121

Merged
merged 1 commit into from
Oct 20, 2024
Merged

Add transient menu interface #121

merged 1 commit into from
Oct 20, 2024

Conversation

blahgeek
Copy link
Contributor

@blahgeek blahgeek commented Apr 14, 2024

updated:

Screenshot_20240511_204632

The code may not be super polished yet, since I'm not sure if this feature will be welcomed or not. I myself have been using this for several months and liked it though. Please let me know what you think. thanks.

@sshaw
Copy link
Owner

sshaw commented Apr 25, 2024

Hi, thanks for the PR!

Is transient is a core-emacs library? Is so what version was it added and, what does it do, UI interfaces? Sorry first time hearing about it :)

@blahgeek
Copy link
Contributor Author

Is transient is a core-emacs library? Is so what version was it added

No it's not builtin. It's in ELPA https://github.com/magit/transient

and, what does it do, UI interfaces? Sorry first time hearing about it :)

Yes sort of. It's a menu like UI library that is also used by magit. Here's a random youtube video link that demonstrates transient: https://www.youtube.com/live/VLcMgIctQBg?si=6tCma4IPe4rqa27m&t=277

The functionality of this PR works in this way:

  1. Invoke git-link-dispatch (usually bind to some global key), a menu would show up (see the screenshot in above description)
  2. (optionally) modify some options ("infix" commands)
    • press "b" to choose the branch links to
    • press "c" to toggle whether link to commit
    • press "n" to toggle line number
  3. perform the final command
    • press "l" to copy the link
    • press "o" to open the link in browser

So, in a sense, all of the customization options (git-link-*) are grouped in one command, with quick keybindings to toggle or select, in a discoverable way.

@sshaw
Copy link
Owner

sshaw commented May 4, 2024

Hi, thanks for all the info. Sounds like a good idea. Only thing is it would have to be optional. If one does not have it installed this package must still work.

@sshaw
Copy link
Owner

sshaw commented May 4, 2024

In the screenshot of the transient menu there is stuff in parenthesis: (use_branch=master), etc... Is this some transient convention? Visually it looks better without. In the cases it is needed to show a selected or default value, could you display only the value, e.g., (master)?

@blahgeek
Copy link
Contributor Author

Hi,

I have reworked the PR a little bit. Now it looks like this:

Screenshot_20240511_204632

In the screenshot of the transient menu there is stuff in parenthesis: (use_branch=master), etc... Is this some transient convention? Visually it looks better without. In the cases it is needed to show a selected or default value, could you display only the value, e.g., (master)?

I have now removed the use_branch= part, see the screenshot above. (Previously it was the case because by default transient is designed for command line arguments, hence the xxx=yyy syntax. I modified this by defining our own format function.) About the parenthesis, I would prefer keeping it to be consistent with other transient UI. Let me know if you have more suggestions about the formatting.

Only thing is it would have to be optional. If one does not have it installed this package must still work.

Personally I would think that transient is a common enough package that can be added as dependency. But I see your point, we can make it optional if you want. Though I don't really know the best way to do it. Should I wrap the whole section of code in a (when (featurep ... ?

@sshaw
Copy link
Owner

sshaw commented Jun 3, 2024

I have reworked the PR a little bit. Now it looks like this:

Looks good 💪

Though I don't really know the best way to do it. Should I wrap the whole section of code in a (when (featurep ... ?

Yes

@blahgeek
Copy link
Contributor Author

(sorry for the long delay..)

Though I don't really know the best way to do it. Should I wrap the whole section of code in a (when (featurep ... ?

Yes

Correct me if I'm wrong, but to my understanding this approach would have some drawbacks:

  1. We cannot use autoload for the git-link-dispatch function
  2. This feature would only be available if transient is loaded ("require") before git-link. I don't think users would explicitly load transient because it's not a user-facing package.

Alternatively, I would propose that I move codes in this PR to a new file named git-link-transient.el. If user want to use this feature, they can call (require 'git-link-transient). Do you think this would work?

@sshaw
Copy link
Owner

sshaw commented Aug 19, 2024

Hi,

Alternatively, I would propose that I move codes in this PR to a new file named git-link-transient.el. If user want to use this feature, they can call (require 'git-link-transient). Do you think this would work?

Yes that makes sense. That may require us to update the MELPA recipe but not sure.

@sshaw
Copy link
Owner

sshaw commented Aug 19, 2024

Also rebasing against master will fix failing CI

@blahgeek
Copy link
Contributor Author

Yes that makes sense.

Updated according to above description.

That may require us to update the MELPA recipe but not sure.

No I don't think so. All *.el files should be automatically included.

@sshaw
Copy link
Owner

sshaw commented Sep 22, 2024

Thanks @blahgeek! Can you squash into a single commit?

@blahgeek
Copy link
Contributor Author

blahgeek commented Oct 8, 2024

Thanks @blahgeek! Can you squash into a single commit?

done

@sshaw
Copy link
Owner

sshaw commented Oct 20, 2024

Hi, sorry for the delays.

Looks good. Wanted to check on some older versions but don't have the time so may as well merge!

Excited to have this additions, thanks!

@sshaw sshaw merged commit e74c90c into sshaw:master Oct 20, 2024
9 checks passed
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.

2 participants