Posts

Showing posts from March, 2023

Meta git (mgit)

Image
  Meta git (mgit) is a wrapper around magit , which is a wrapper around git . If the output looks familiar, it's because it's the output from command git status -v. For the discerning eye, it uses the font-lock defaults from diff mode (notice the highlight on ;;). diff-mode uses repeated diff commands to highlight the refinements. Use diff-mode or diff-refine-hunk if you must have the eye-candy. Motivation Magit is a handy tool for working with git repository in GNU Emacs. However, if you work with a large enough repository, you'll hit a performance road-block. Here's an attempt to deconstruct the problem and find a solution. Magit provides an information rich dashboard for git status. However, this comes with multiple calls to git command. If you run M-x magit-toggle-verbose-refresh and then run magit-status, you'll see the following output: Refreshing buffer ‘magit: src<anand>’...   magit-insert-error-header                          2.031e-06   magit-inser

Git graph in GNU Emacs

Image
  Get a decent view of git tree in GNU Emacs (M-x magit-pg-repo ). By default, it draws the graph with last 100 commits. If you want a different behaviour, edit the following constant. (defconst magit-pg-command   (concat "git --no-pager log --branches --decorate=full "           "--pretty=format:\"%H%x00%P%x00%an%x00%ar%x00%s%x00%d\" "           " -n 100 ")   "The command used to fill the raw output buffer.")     If you want to use the script in terminal ( temacs -batch -l $PWD/magit-pretty-graph.el -f magit-pg-repo ), add the following path (adjust for versions) to the top of the script and uncomment line 238. (setq path '("~/.emacs.d/elpa/magit-20220603.1738/"          "~/.emacs.d/elpa/compat-28.1.1.1/"          "~/.emacs.d/elpa/dash-20220602.2113/"          "~/.emacs.d/elpa/magit-section-20220513.1429/"          "~/.emacs.d/elpa/with-editor-20220506.420/"          "~/.emac

GNU Emacs as a LISP interpreter

Image
  After applying the following patch, you can run GNU Emacs as a standalone LISP interpreter for batch usage. It basically disables the command loop and non-essential symbols in batch mode.   temacs is Emacs sans any bootstrap elisp code. It is the first artifact generated during the Emacs build process. So you might not find it in your package installation. You can use the emacs binary too for the same effect - just understand that underneath they are not the same.   modified   src/keyboard.c @@ -1067,6 +1067,7 @@ command_loop (void)      while (1)        {      internal_catch (Qtop_level, top_level_1, Qnil); +    if (!noninteractive)      internal_catch (Qtop_level, command_loop_2, Qnil);      executing_kbd_macro = Qnil;   @@ -2631,9 +2632,9 @@ read_char (int commandflag, Lisp_Object map,    if (minibuf_level == 0        && !end_time        && !current_kboard->immediate_echo +      && ! noninteractive        && (this_command_key_count > 0