Fork me on GitHub
#emacs
<
2023-03-19
>
Drew Verlee01:03:45

also, what magit ediff command do you like to run to handle merge conflicts? smerge-ediff?

pavlosmelissinos06:03:19

From a magit-status buffer and with point on a file that has a conflict, magit-ediff-dwim (`e` by default) It splits the screen in four quadrants,

A        B
Merged   Ancestor (C)
and opens a second, tiny frame that controls the original. You navigate with p/n (previous/next conflict chunk) and select the version you want with a/b/c. If you want more control, e.g. combine A and B, you can modify the merged buffer directly. When you're done you quit (q) It's quite handy for resolving conflicts and because it's semi-automatic it helps you avoid messing up >>>s or <<<s

pavlosmelissinos06:03:57

Haven't really used smerge. Back when I was figuring out which approach to use ediff seemed better to me but I don't remember why.

pavlosmelissinos06:03:24

It might have been because smerge uses git's terminology (mine/other) which confuses me and the key chords are a bit awkward. :thinking_face: Edit: Magit's guide doesn't hold your hand but it did help me decide https://magit.vc/manual/magit/Resolving-Conflicts.html

👍 2
Ed23:05:47

I really like a smerge-mode. I tend to use smerge-keep-current a lot. I disliked the separate frame that ediff opens and have disabled that (see https://emacs.stackexchange.com/questions/17064/never-create-frame-in-ediff). In the end, I use both. Smerge is really convenient for quick and easy merges, but when things get more complex ediff is better at highlighting the differences ...

👍 2
hifumi12301:03:03

5 seconds seems pretty abnormal. Is your project very large? IME the speed of buffer updates when switching branches ultimately depends on the amount of changes between two branches. e.g. if I switch away from a branch that changed dozens of files, then that takes longer than switching away from a branch where I changed just a few files

Drew Verlee02:03:57

this happens on a project with nearly nothing in it.

hkjels12:03:33

My guess, is that you are running on Windows?

hkjels12:03:56

Magit just doesn't work on Windows in my humble opinion

Drew Verlee14:03:06

i'm running on linux.

hkjels16:03:19

Ok. Then it should be instant. You’ll have to profile I guess

Drew Verlee17:03:46

How would you profile this?

hkjels18:03:50

M-x profiler-start cpu+mem , M-x magit-status, M-x profiler-stop

👀 2
👍 4
Drew Verlee19:03:42

Ty @U0B1SDL67 I'll give that a try.

hifumi12301:03:17

as for merge conflicts, I just open the file directly and solve them by hand 😄 magit will place some thing like

<<< UPSTREAM
code here...
>>> BRANCH
code here...
and then I see how to tie the two together, if possible

Drew Verlee02:03:36

by hand is fine, just seeing if there are more options.

camdez06:03:14

I typically use the basic smerge commands (not the ediff stuff). On my machine (and, I believe, by default) they’re on C-c ^. You can navigate between conflict markers, choose any of the three versions (or a combination), refine the conflict down to the exact changes, etc. IMHO, it’s definitely worth the (learning) investment.

pesterhazy14:03:29

I recently decided that I want to use en-dash – like this – for more typographically correct parenthetical insertions

pesterhazy14:03:50

Using this to get standard macOS keybindings for en-dash and em-dash

;; Use MacOS key-bindings (Option-hyhpen, Option-Shift-hyphen) for en-dash and em-dash
;; (define-key undo-tree-map (kbd "M-_") nil) ;; remove override
(global-set-key (kbd "M-_") (lambda () (interactive) (insert "—")))
(global-set-key (kbd "M--") (lambda () (interactive) (insert "–")))
(global-set-key (kbd "M-8") (lambda () (interactive) (insert "•")))
(global-set-key (kbd "M-*") (lambda () (interactive) (insert "°")))

👀 2
pesterhazy14:03:30

hyphen-hypen July–August American style—with a long em-dash without spaces

pesterhazy14:03:58

Just wanted to share, curious what emacs typography nerds are using otherwise

pesterhazy14:03:27

(To be clear the difference between hyphen and en-dash isn't visible in my Emacs fixed-width font, but it does show when I copy and paste into a document)

daveliepmann14:03:42

I like typopunct-mode. Keybindings are simple enough that I can't forget: with the mode on, -- becomes en-dash, --- becomes em-dash.

💡 2
ag19:03:23

For those who use Evil, there's also a way to enter special characters with digraphs. In insert mode - C-k -M for em dash, and C-k -N - for en dash. Quite easy to remember.

💡 2