Fork me on GitHub
#emacs
<
2024-05-10
>
andrea.crotti09:05:36

maybe it's too much magic, but it would be amazing if I could have a way to jump from a line in a file in my repository to the github repo where it was last changed

andrea.crotti09:05:13

atm I would get the SHA, then look at that SHA in the git log, and hopefully find out what PR it was merged with

andrea.crotti09:05:40

but well if Emacs knows about all the PRs merged with forge maybe there is a faster way

djm09:05:33

I don’t understand exactly what you mean, but https://github.com/sshaw/git-link might be somewhat similar

andrea.crotti09:05:52

well I already had github-browse-file to open a file on github, and I can open PRs with forge etc

andrea.crotti09:05:18

would be nice if I could just open directly the PR that was related to the last change on a given file

andrea.crotti09:05:50

which in theory might not even be there if someone pushes to the default branch, but well in my case it will always be available pretty much

lassemaatta09:05:16

perhaps with a bit of elisp 🪄 it might be possible. You can manually • magit-blame • navigate to the interesting line • magit-blame-copy-hash to copy the commit hash of the line • browse to hash>&type=commits : opens a list of PR's which include the commit

👀 1
nice 1
aisamu13:05:29

For the last bit, <org>/<repo>/pulls?q=<SHA>, does the trick

aisamu13:05:39

And, if you're not a magit fan (why tho), replace steps 1-3 with https://jayconrod.com/posts/67/emacs--run-git-blame-on-the-current-line

pesterhazy13:05:35

What I'd do is • find the merge commit (perhaps using git log --first-parent • parse the commit message, which contains the PR number

jumar10:05:08

(spacemacs) I feel like you get this with vc-annotate and then git-link on a particular line you are interested in. The GitHub UI itself shows you the PR related to the commit.

jumar10:05:56

Or you simply invoke git-link and get to the PR with two clicks

cp4n11:05:05

I am installing Spacemacs as a starting point (standard key commands, no evil mode). Don't know if that will be a problem yet since it was designed really with vim style commands in mind. I also want to install Clojure LSP alongside Cider. I am reading that they overlap on some of the things that they do and it can cause problems possibly? Is there some kind of guide out there that would help me with this?

practicalli-johnny12:05:28

Overlap is mainly in automated format & indenting. Avoid using aggressive indent package with LSP format enabled, A quick guide for Setting up Spacemacs with cider and LSP https://practical.li/spacemacs/install-spacemacs/clojure-lsp/configure-lsp-and-cider/ My Spacemacs config has a fairly minimal set of LSP tools https://github.com/practicalli/spacemacs-config/blob/cd73591f34b2aa287bed7d5a11b344e8df50879b/init.el#L121 You may also wish to enable or disable features. There is a guide to features https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/

practicalli-johnny12:05:22

Note: the equivalent Spacemacs Emacs key binding for the SPC key is M - m and for the mode specific , it's M - RTN

👍 1
vemv12:05:17

btw nowadays Doom seems far better-maintained, while having a similar focus

☝️ 1
Akiz13:05:05

You’ll have to decide what xref will do. And then also signature / hover annotations on the functions offered by both lsp and cider.