From 66b38e616d7b63faef957b5ca790f9d2d588da3d Mon Sep 17 00:00:00 2001 From: Magdalena Szweda Date: Fri, 2 Oct 2026 21:26:20 +0200 Subject: add vc-jj config for better workflow --- doom/.config/doom/config.el | 39 ++++++++++++++++++++------ doom/.config/doom/config.org | 66 ++++++++++++++++++++++++++------------------ 2 files changed, 70 insertions(+), 35 deletions(-) (limited to 'doom') diff --git a/doom/.config/doom/config.el b/doom/.config/doom/config.el index cad7dd4..d80b253 100644 --- a/doom/.config/doom/config.el +++ b/doom/.config/doom/config.el @@ -301,16 +301,39 @@ emms-cache-file (concat doom-cache-dir "emms-cache")) ;; ADD w BINDINGS :desc "revision other window" "~" #'vc-revision-other-window) -(map! - :leader - :prefix "g m" - :desc "Status" "m" #'majutsu ; default majutsu buffer - :desc "Describe" "d" #'majutsu-describe ; equivalent of 'jj describe' - :desc "New" "n" #'majutsu-new ; new jj rev - :desc "Push" "p" #'majutsu-git-push) ; push to git - (use-package! vc-jj) +(after! vc-jj + (defvar my/vc-jj-advance-to nil) + + (defun my/vc-jj-bookmark-advance (&optional names) + "Advance the closest bookmarks (or just NAMES) forward." + (interactive + (when current-prefix-arg + (list (completing-read-multiple + "Advance bookmarks: " + (vc-jj--process-lines + nil "bookmark" "list" + "-T" "if(!self.remote(), self.name() ++ '\n')"))))) + (with-temp-buffer + (let ((status (apply #'vc-jj--call nil t "bookmark" "advance" + (append (when my/vc-jj-advance-to + (list "--to" my/vc-jj-advance-to)) + names)))) + (message "vc-jj: %s" (string-trim (buffer-string))) + status))) + + (defun my/vc-jj--advance-before-push (&rest _) + (my/vc-jj-bookmark-advance)) + (advice-add 'vc-jj-push :before #'my/vc-jj--advance-before-push) + + (defun my/vc-jj-checkin (files comment &optional _rev) + "Describe @, then push. FILES is ignored: jj has no partial checkin." + (let ((default-directory (vc-jj-root (car files)))) + (vc-jj-modify-change-comment nil "@" comment) + (vc-jj-push nil))) + (advice-add 'vc-jj-checkin :override #'my/vc-jj-checkin)) + (setq org-directory "~/org/") (after! org diff --git a/doom/.config/doom/config.org b/doom/.config/doom/config.org index 9fe5e64..96ef07d 100644 --- a/doom/.config/doom/config.org +++ b/doom/.config/doom/config.org @@ -1,12 +1,5 @@ -#+TITLE: Doom Emacs configuration -#+PROPERTY: header-args:emacs-lisp :tangle config.el -* Foreword - -"Hello! This is my literate configuration for Doom Emacs." -Why literate? because org is cool! -I use Doom Emacs because it's easy, simple & easy to configure. -This config will be ported into normal Emacs in the future, but im not planning that for now. -yea +#+TITLE: Literate DOOM Emacs configuration + * Splash screen This is my custom splash screen for Emacs. #+begin_src emacs-lisp @@ -536,7 +529,7 @@ This currently doesnt work. :n "RET" #'emms-browser-add-tracks-and-play)) #+end_src -* Git +* vc ~LEAVE Emacs? You gotta be kidding.~ ** TODO vc :: maps Mappings for vc. @@ -579,22 +572,6 @@ I tried my best to match these to the default bindings under ~C-x v~ ;; ADD w BINDINGS :desc "revision other window" "~" #'vc-revision-other-window) #+end_src -** Majutsu -I use the JuJutsu version control system. -I am an old user of ~magit~. Why not use magit for JJ? - -Define mappings for the already-installed ~majutsu~ -Open the main majutsu buffer. -#+begin_src emacs-lisp - (map! - :leader - :prefix "g m" - :desc "Status" "m" #'majutsu ; default majutsu buffer - :desc "Describe" "d" #'majutsu-describe ; equivalent of 'jj describe' - :desc "New" "n" #'majutsu-new ; new jj rev - :desc "Push" "p" #'majutsu-git-push) ; push to git -#+end_src - ** vc-jj ~vc-jj~ adds jujutsu integration to Emacs's ~vc~! #+begin_src emacs-lisp :tangle no @@ -606,7 +583,42 @@ Then, we actually enable it. #+begin_src emacs-lisp (use-package! vc-jj) #+end_src -~vc-jj~ configures itself into vc by itself, no further configuration is needed +vc-jj has a bit of a... weird flow, it runs ~jj commit~ instead of ~jj describe~, and doesnt advance bookmarks the way i usually do in my flow. + +Here we fix it! +#+begin_src emacs-lisp +(after! vc-jj + (defvar my/vc-jj-advance-to nil) + + (defun my/vc-jj-bookmark-advance (&optional names) + "Advance the closest bookmarks (or just NAMES) forward." + (interactive + (when current-prefix-arg + (list (completing-read-multiple + "Advance bookmarks: " + (vc-jj--process-lines + nil "bookmark" "list" + "-T" "if(!self.remote(), self.name() ++ '\n')"))))) + (with-temp-buffer + (let ((status (apply #'vc-jj--call nil t "bookmark" "advance" + (append (when my/vc-jj-advance-to + (list "--to" my/vc-jj-advance-to)) + names)))) + (message "vc-jj: %s" (string-trim (buffer-string))) + status))) + + (defun my/vc-jj--advance-before-push (&rest _) + (my/vc-jj-bookmark-advance)) + (advice-add 'vc-jj-push :before #'my/vc-jj--advance-before-push) + + (defun my/vc-jj-checkin (files comment &optional _rev) + "Describe @, then push. FILES is ignored: jj has no partial checkin." + (let ((default-directory (vc-jj-root (car files)))) + (vc-jj-modify-change-comment nil "@" comment) + (vc-jj-push nil))) + (advice-add 'vc-jj-checkin :override #'my/vc-jj-checkin)) +#+end_src + * Org ~Protesting for Org README support.~ -- cgit v1.2.3