|
|
Log in / Subscribe / Register

Magit 4.0 released

Version 4.0 of the Magit text-based Git user interface for Emacs has been released. Changes since the 3.3.0 release include the addition of context menus, a makeover for the menu-bar menu, new menu commands, and many other new features and bug fixes. See the release notes for full details.



to post comments

Please donate!

Posted Aug 13, 2024 9:19 UTC (Tue) by mattias.jc.bengtsson (guest, #145207) [Link]

As (I believe) my first LWN post I just wanted to encourage people to donate to Jonas for the amazing work on Magit!

Standalone Magit

Posted Aug 14, 2024 11:48 UTC (Wed) by bjackman (subscriber, #109548) [Link] (7 responses)

I stopped using Emacs a couple of years ago, I am happier for living an elisp-free life, but I desperately miss Magit.

I have been considering trying to build an Emacs config that turns Magit into a standalone Git TUI. Has anyone ever done this successfully? Obviously you'd lose a lot of Magit's power like this, but I think it would still be the best Git interface out there.

Standalone Magit

Posted Aug 14, 2024 17:05 UTC (Wed) by madscientist (subscriber, #16861) [Link]

I wrote this for some coworkers but since I always use Emacs I can't say how effective it is. Note I never use MacOS so I have no idea, really, what the last few lines do but I'm informed they are useful.

#!/bin/sh
#
# Open an Emacs magit window for the current Git workspace.
# If there is already an Emacs running daemon mode reuse it, else
# start one and connect to it.

die () { echo "$*"; exit 1; }

root=$(git rev-parse --show-toplevel) || die "Not in a Git clone"
cd "$root" || die "Cannot change to directory '$root'"

# See if there's a daemonized Emacs running; if not start one.
emacsclient -a false --eval nil -q -u \
    || { echo "Starting Emacs in daemon mode..."; emacs --daemon; } \
    || die "Could not start Emacs"

# See if Emacs is running in graphical mode
disp=$(emacsclient -a false --eval '(display-graphic-p)') \
    || die "Could not detect windows mode"

case $disp in
    (t) args=-n ;;
    (nil) args= ;;
    (*) echo "Unknown display results: $disp"; args= ;;
esac

# x-focus-frame should bring the frame to the front
emacsclient -a false $args -q -u -c \
            -e "(progn (magit-status \"$root\") (delete-other-windows) (x-focus-frame nil))" \
    || die "Could not start magit"

# Apparently this is useful on MacOS?
osascript=$(command -v osascript)
test -z "$osascript" || "$osascript" -e 'tell application "Emacs" to activate'

Standalone Magit

Posted Aug 14, 2024 18:11 UTC (Wed) by xtifr (guest, #143) [Link] (3 responses)

When you say you're happier for an elisp-free life, do you mean you don't want to mess with elisp code, or you don't want it installed on your system? If it's the former, then I'm happy to point out that you can do an amazing amount with Emacs without elisp! I've been using Emacs for decades, and since I switched to installing packages like magit via apt, and configuring everything I can via M-x configure, the amount of elisp in my init.el file has dropped from hundreds of lines down to about a dozen or so, with no real loss of functionality.

Standalone Magit

Posted Aug 14, 2024 18:29 UTC (Wed) by madscientist (subscriber, #16861) [Link] (1 responses)

You don't need apt to handle Emacs packages. It has its own package manager which will download from ELPA and install the latest content. Combined with use-package it's pretty powerful. I can even delete my entire ~/.emacs.d directory, keeping only ~/.emacs.d/init.el, then restart Emacs and it downloads all my packages (latest versions).

E.g., I have this in init.el for Magit:
(use-package magit
  :ensure t
  :bind (("C-c g" . magit-status)
         ("C-c f" . magit-file-dispatch)
         ))
(keybindings are up to your personal taste of course).

Or, run M-x package-list-packages RET to choose packages directly (or, if you prefer, the Options / Manage Emacs Packages menu option).

Standalone Magit

Posted Aug 17, 2024 19:12 UTC (Sat) by xtifr (guest, #143) [Link]

You have it backwards: you don't need use-package to handle Emacs packages. You can simply use apt, and life becomes much simpler and easier! No need to write a bunch of fragile lisp code for each package you want. (Your mere five line stanza for magit seems unusually small compared to what most packages needed back when I used use-package. But even so, it's about five lines more than I currently need, which, multiplied by the many, many Emacs packages I have installed, adds up!)

If I were using an OS that didn't treat Emacs as a first class citizen, then yes, I might well use use-package. But since my OS does treat Emacs as a first-class citizen, I'm happy to take advantage of that fact. :)

There are, of course, some trade-offs, and you may have your own reasons for preferring use-package, but for me, apt is by far the superior choice!

Standalone Magit

Posted Aug 16, 2024 14:27 UTC (Fri) by bjackman (subscriber, #109548) [Link]

Yeah I suspect you may be right. On a major version upgrade my .emacs broke and I decided it was time for config bankruptcy. If I had started from a clean config perhaps I could have built back up quickly to something functional and easy to maintain like you describe.

But also, I was curious to try VS Code. I have now been a serious multi-year user of Vim, Sublime, Emacs and VS Code!

Standalone Magit

Posted Aug 14, 2024 18:53 UTC (Wed) by mbunkus (subscriber, #87248) [Link]

An easy way to launch a new TUI Emacs process with Magit for $PWD is a simple emacs -nw --eval '(progn (magit) (delete-other-windows))'

Standalone Magit

Posted Aug 15, 2024 17:58 UTC (Thu) by dannyobrien (subscriber, #25583) [Link]

It's GUI, not TUI, but git-cola is an underestimated piece of software.

Forge

Posted Aug 15, 2024 8:47 UTC (Thu) by lobachevsky (subscriber, #121871) [Link]

Magit's just an amazing piece of software. If the Forge addon could do pull request reviews, then I wouldn't have to leave Emacs.


Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds