From 37883b69199715feff7b7826ad5bfba904aea3fb Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 31 Mar 2024 17:23:50 +0800 Subject: add git-rl{,h} & archive remaining Magit config to git history I find that having two different kinds of display of browseable git logs and diffs in Emacs can break my flow. --- .config/git/config | 1 + .emacs.d/init.el | 18 ------------------ bin/git-rl | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 18 deletions(-) create mode 100755 bin/git-rl diff --git a/.config/git/config b/.config/git/config index ee7d3e1a..94e8f965 100644 --- a/.config/git/config +++ b/.config/git/config @@ -9,6 +9,7 @@ --simplify-by-decoration d = diff cl = clean -xdff + rlh = rl HEAD [annex] # Manually upgrade to new repository layouts once I've confirmed that diff --git a/.emacs.d/init.el b/.emacs.d/init.el index b01a9802..1070b8b1 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -305,9 +305,6 @@ windows side-by-side in the frame." '(log-edit-insert-message-template log-edit-insert-cvs-template log-edit-insert-changelog spw/log-edit-show-diff) nil nil "Drop log-edit-show-files to avoid its window becoming most recently used for C-x o.") - '(magit-define-global-key-bindings nil) - '(magit-diff-refine-hunk 'all) - '(magit-save-repository-buffers nil) '(mail-envelope-from 'header nil nil "Bypass MTA rewriting user@localhost.") '(mail-specify-envelope-from t nil nil "Bypass MTA rewriting user@localhost.") '(mail-user-agent 'gnus-user-agent) @@ -1013,9 +1010,6 @@ To be used only when it seems to be necessary." (setq auto-revert-use-notify nil) (global-auto-revert-mode 1) -;; Work around lack of . -(setq magit-auto-revert-mode nil) - ;; C-x x g should not ask for confirmation. (global-set-key "\C-xxg" (lambda () (interactive) @@ -4005,16 +3999,6 @@ unread." ;;;; VC -;;; Want Magit installed for `git-commit-mode', `git-rebase-mode' and these -;;; reflog commands. Otherwise, I prefer how VC is more buffer-oriented, such -;;; as in eschewing the (singular) Git staging area for `diff-mode' buffers. - -(require 'git-commit nil t) - -(global-set-key "\C-cvr" #'magit-reflog-current) -(global-set-key "\C-cvH" #'magit-reflog-head) -(global-set-key "\C-cvO" #'magit-reflog-other) - (spw/when-library-available mailscripts (global-set-key "\C-cvm" #'spw/mailscripts-prepare-patch) ;; Want a dedicated binding for this because often need it with Debian BTS. @@ -4025,8 +4009,6 @@ unread." "vt" notmuch-extract-thread-patches-to-project "vw" mailscripts-extract-message-patches-to-project)) -(spw/reclaim-keys-from magit magit-mode-map "\M-w") - ;; Emacs 30: move into `custom-set-variables'. (when (>= emacs-major-version 30) (setopt vc-git-log-switches '("--format=fuller" "--stat"))) diff --git a/bin/git-rl b/bin/git-rl new file mode 100755 index 00000000..060ba744 --- /dev/null +++ b/bin/git-rl @@ -0,0 +1,18 @@ +#!/bin/sh + +# Copyright © 2024 Sean Whitton +# SPDX-License-Identifier: MIT + +if [ $# -gt 1 ]; then + echo >&2 "usage: git rl []" + exit 255 +fi + +git reflog show -10 --color=always \ + --format="* %C(black white)%h%Creset..:%x09\ +%C(red bold)%gd%Creset%x09\ +%C(black white)%>(15)%cr %Creset%x09\ +%C(cyan bold)%gs%Creset" \ + "${1:-$(git symbolic-ref --short HEAD)}" \ + | sed -e 's# ago \[m\t# \[m\t#' -e 's#: #\[m\t#' \ + | column -t -s\ -o\ -l5 -T5 -- cgit v1.2.3