reddit / emacs

Magit's Killer Feature #1: Commit Text Completion Based on the Diff

divinedominion · 2022-05-23 07:43
divinedominion · 2022-05-23 07:45
I know, I know -- this is just a _happy coincidence_ of a completion package + Magit displaying the buffer contents to make this work. But I'm not trying to convince anyone using `vc-mode` to switch. I'm trying to spread the gospel to the native GUI app non-believers. Combing from macOS Git GUI apps, which generally are superb, Magit is still an improvement for me!
b3n · 2022-05-23 09:47
No need for magit or company, `M-/` (`dabbrev-expand`) will do this out of the box. :-)
_viz_ · 2022-05-23 10:28
+1. C-c C-w in *vc-log* buffers is useful too.
_viz_ · 2022-05-23 10:28
+1. C-c C-w in *vc-log* buffers is useful too.
torsteinkrause · 2022-05-23 10:29
Or hippie-expand. Company *does* put it into a nice drop down, though.
micah · 2022-05-23 12:02
How do you enable company in commit mode?
azswcowboy · 2022-05-23 12:09
M-/ is my favorite emacs move…ever. No telling how many keystrokes it’s saved over the decades. Pro tip — if the first expansion is wrong, do it again.
divinedominion · 2022-05-23 12:35
I have `(add-hook 'after-init-hook global-company-mode)` Also, I believe this ties into VeryLongCamelCaseTypeNames: (setq company-dabbrev-ignore-case 'keep-case company-dabbrev-downcase nil) ;; Keep dabbrev suggestions as-is, no downcasing
[deleted] · 2022-05-23 15:37
[deleted]
sunnyata · 2022-05-23 15:52
Incidentally, what is with the description of magit as a "porcelain" for git? I've never heard this term before it was used in magit, been involved in software for a long time.
thoomfish · 2022-05-23 16:08
It's git terminology. Much like a toilet, there are two parts to git, the [porcelain and the plumbing](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain). The plumbing commands implement lower level primitives and are intended to have stable/machine readable output that you can rely on when writing scripts. Most of the CLI git commands you would normally use are also considered porcelain, though some also have a `--porcelain` flag you can pass which says "I'm making my own porcelain, please give me machine readable, plumbing-style output that I can parse."
sunnyata · 2022-05-23 16:09
TIL! Thanks.
elimik31 · 2022-05-23 16:47
Last week I switched from company to *vertico* which relies completely on the `completion-at-point-functions`. What made the transition seamless was [cape](https://github.com/minad/cape), which adds many completion functions that I know from company and also allows to convert company backends to completion-at-point functions. I get `dabbrev` completions in a nice dropdown similar to how company does it with vertico and by adding `cape-dabbrev` to my completion-at-point functions and I just checked and it works well in magit.
timmymayes · 2022-05-23 22:18
Emacs newb. What exactly does this do?
funkiestj · 2022-05-23 23:07
I loved magit when I used it. I went to a new job, tried to get magit working and ended up in dependency hell. I gave up. I wish I could pay an emacs consultant to get stuff I'd like to use working (magit, gopls + lsp-mode). I no longer have the will to joust with it when a feature is not super easy to set up.
dsemy · 2022-05-23 23:12
https://www.gnu.org/software/emacs/manual/html_node/emacs/Dynamic-Abbrevs.html
nnreddit-user · 2022-05-23 23:29
> I wish I could pay an emacs consultant Be careful what you wish for. shmelpa.commandlinesystems.com
oantolin · 2022-05-24 02:32
That's `log-edit-generate-changelog-from-diff` in case anyone is curious.
martianh · 2022-05-24 14:23
it would be helpful if your post mentioned what company setup you have to get this going. it doesn't work by default for me, as i have company plain text features disabled but default. maybe they're worth enabling in some magit buffers though?
divinedominion · 2022-05-25 07:08
Sure; just `global-company-mode`, really, though. Full config here https://gist.github.com/DivineDominion/e15c152f2fad785f4e1167b9a4df548b
divinedominion · 2022-05-25 07:08
We need a bot for this :)
divinedominion · 2022-05-25 07:09
I've been eager to try cape as well since I'm a big vertico fan. Great to know it works!
divinedominion · 2022-05-25 07:10
It's said this is git terminology, but virtually nobody knows this stuff :)