From 2c1ca97ab33cb7dd5cedf7b32b82492b39d12385 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 21 Jun 2025 12:13:24 +0200 Subject: [PATCH 1/6] jj: Adopt new default revset aliases This commit changes the way I display my jj logs a little. We distinguish between 3 styles now - the 'stack()': short and to the point, only ancestor commits from the last non-mutable one onwards - the 'recent()': the previously default view over ancestor commits or any other head nodes (i.e. any branches) that are from me, with a few commits leading up to them visible. - the 'all()': the traditional 'show everything' summation for finding very specific commits or getting a macro-scale overview of the history Basically, only the 'stack()' view was added - but it is now the new default for the default command and the previous 'default' has been renamed to 'recent()'. This is mirrored in the shell aliases: all the `jl`, `jlo`, `jloo` aliases use the 'recents()' view. The capital versions (`JL` and the like) are not affected as as they keep showing the 'all()' view. Importantly, the `j` base command uses the 'stack()' view, however. Lastly, we extract the aliases to find `WIP:` commits and `PRIVATE:` commits into actual jj revset aliases and call them from our shell aliases. The functionality does not change, though we now have an additional alias for finding specifically the latter commits with `jlfp` ('jj log find private'). --- vcs/jj/config/jj/config.toml | 10 ++++++++-- vcs/jj/config/sh/alias.d/jj.sh | 9 +++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/vcs/jj/config/jj/config.toml b/vcs/jj/config/jj/config.toml index 05f0890..a9c6eb8 100644 --- a/vcs/jj/config/jj/config.toml +++ b/vcs/jj/config/jj/config.toml @@ -11,7 +11,7 @@ sign-on-push = true private-commits = "description(glob-i:'WIP:*') | description(glob-i:'PRIVATE:*')" # refuse to push WIP commits [ui] -default-command = "log" +default-command = ["log", "-T", "builtin_log_oneline", "-r", "stack()"] diff-editor = ["nvim", "-c", "DiffEditor $left $right $output"] # use delta as formatter but _only_ for diff and show @@ -73,7 +73,7 @@ if(root, ''' [revsets] -log = "ancestors(@, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()" +log = "recent()" [revset-aliases] "bases" = "dev" @@ -81,3 +81,9 @@ log = "ancestors(@, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | tru "branches" = "downstream(trunk(), bookmarks()) & mine()" "curbranch" = "latest(branches::@- & branches)" "githead" = "::git_head()" +"wip()" = "description(regex:\"^WIP:\")" +"private()" = "description(regex:\"^PRIVATE:\")" +"blacklist()" = "wip() | private()" +"recent()" = "ancestors(@, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()" +"recent(x)" = "ancestors(x, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()" +"stack()" = "ancestors(reachable(@, mutable()), 2)" diff --git a/vcs/jj/config/sh/alias.d/jj.sh b/vcs/jj/config/sh/alias.d/jj.sh index 070edce..a8033fe 100644 --- a/vcs/jj/config/sh/alias.d/jj.sh +++ b/vcs/jj/config/sh/alias.d/jj.sh @@ -49,11 +49,11 @@ alias jab="jj abandon" # revset info alias J="jj log -r 'all()'" # mirror default command being log -alias jl="jj log -T builtin_log_oneline" +alias jl="jj log -T builtin_log_oneline -r 'recent()'" alias JL="jj log -T builtin_log_oneline -r 'all()'" -alias jlo="jj log --summary -T builtin_log_compact_full_description" +alias jlo="jj log --summary -T builtin_log_compact_full_description -r 'recent()'" alias JLO="jj log --summary -T builtin_log_compact_full_description -r 'all()'" -alias jloo="jj log --patch" +alias jloo="jj log --patch -r 'recent()'" alias JLOO="jj log --patch -r 'all()'" alias jol="jj op log" jlf() { @@ -65,7 +65,8 @@ jlof() { jloof() { jj log --patch -r "description(substring-i:\"$*\")" } -alias jlfw='jj log -r "description(regex:\"^WIP:\")"' +alias jlfw='jj log -r "wip()"' +alias jlfp='jj log -r "private()"' # show branches (i.e. head commits) w a couple previous commits alias jh="jj log -r 'ancestors(heads(all()), 3)'" From ededd904b4f91026cfa0068ae9bd2a9af2252016 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 22 Jun 2025 18:24:42 +0200 Subject: [PATCH 2/6] jj: Switch to email for signing key identification --- vcs/jj/config/jj/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcs/jj/config/jj/config.toml b/vcs/jj/config/jj/config.toml index a9c6eb8..773e3e0 100644 --- a/vcs/jj/config/jj/config.toml +++ b/vcs/jj/config/jj/config.toml @@ -4,7 +4,7 @@ name = "Marty Oehme" [signing] backend = "gpg" -key = "73BA40D5AFAF49C9" +key = "contact@martyoeh.me" [git] sign-on-push = true From 21844e3a30d267d76cbdda7db4123db4945a7d89 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 22 Jun 2025 18:31:00 +0200 Subject: [PATCH 3/6] task: Ensure compdef options only get set in zsh --- office/.config/sh/alias.d/taskwarrior.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/office/.config/sh/alias.d/taskwarrior.sh b/office/.config/sh/alias.d/taskwarrior.sh index c69b7ac..dc70002 100644 --- a/office/.config/sh/alias.d/taskwarrior.sh +++ b/office/.config/sh/alias.d/taskwarrior.sh @@ -14,7 +14,9 @@ t() { # copy the `task` zsh completions over to my little alias 😉 # FIXME: this is not very pretty and not super portable (needs ps) but # works for now. from here: https://unix.stackexchange.com/a/72564/414758 -if exist task && [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi +if echo "$SHELL" | grep -q zsh; then + if exist task && [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi +fi alias ta="task add" alias tal="task log" @@ -29,8 +31,8 @@ if exist timew; then else alias tra="task active" fi -alias tdd="task end.after:today all" # done doday -alias tdy="task end.after:yesterday all" # done yesterday-today +alias tdd="task end.after:today all" # done doday +alias tdy="task end.after:yesterday all" # done yesterday-today alias tdw="task end.after:today-1wk completed" # done this week alias tad="task +ACTIVE done" From d42593edfe6531fc7167a138a39474556f7f6a8e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 22 Jun 2025 18:42:14 +0200 Subject: [PATCH 4/6] task: Remove configuration files for taskopen Since I am exclusively using `topen` (https://git.martyoeh.me/Marty/topen) for my task notes currently, this commit gets rid of any left-over config files setting up `taskopen`. Starts to simplify the taskwarrior setup a tiny bit. --- office/.config/sh/env.d/taskopen-xdg.sh | 3 --- office/.config/task/taskopenrc | 20 -------------------- 2 files changed, 23 deletions(-) delete mode 100644 office/.config/sh/env.d/taskopen-xdg.sh delete mode 100644 office/.config/task/taskopenrc diff --git a/office/.config/sh/env.d/taskopen-xdg.sh b/office/.config/sh/env.d/taskopen-xdg.sh deleted file mode 100644 index 5aac3a7..0000000 --- a/office/.config/sh/env.d/taskopen-xdg.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -export TASKOPENRC="${XDG_CONFIG_HOME:-"$HOME/.config"}/task/taskopenrc" diff --git a/office/.config/task/taskopenrc b/office/.config/task/taskopenrc deleted file mode 100644 index a446a24..0000000 --- a/office/.config/task/taskopenrc +++ /dev/null @@ -1,20 +0,0 @@ -[General] -EDITOR = nvim -taskbin = task -path_ext = /usr/share/taskopen/scripts - -[Actions] -note_custom_ext.regex = "^Note\\.?(.*)?" -note_custom_ext.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.$LAST_MATCH" - -notes.regex = "^Note$" -notes.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.md" - -links.regex = "^https?://" -links.command = "open $FILE" - -mail.regex = "^<.*@.*>$" -mail.command = "notmuch show mid:${FILE:1:-1}" - -[CLI] - From a4bbb0ed3a8175f5d291e2a2fc2f165ea86d91d6 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 22 Jun 2025 18:41:56 +0200 Subject: [PATCH 5/6] task: Add new repository for idea collection Following this blogpost: https://eshapard.github.io/code/a-separate-taskwarrior-configuration-for-ideas.html I think it is a really good idea to try this out. At first I was collecting ideas in my regular taskwarrior repository -- this was no good as every task list was flooded by somedays and maybes which would never leave. But I still wanted to have a nice repository to collect all my ideas in. So, the second strategy was to have one big (markdown) file which would simply collect all my ideas. But now I was doubling and tripling them up because the list was so long, and it was more of a chore to find where to put everything than just a quick 'idea add'. This may be the best of both worlds: making use of the nice interface to a task database using the full strength of taskwarrior querying, without cluttering up my main task repository. The workflow is exactly as with regular taskwarrior, only the executable is not called `task` (or `t` in my case) but `idea`. So you e.g. add an idea with `idea add`, or query all diy ideas with `idea +diy`. Just like regular taskwarrior. --- office/.config/sh/alias.d/taskwarrior.sh | 6 ++++++ office/.config/sh/env.d/taskwarrior-xdg.sh | 7 ++++++- office/.config/task/taskrc | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/office/.config/sh/alias.d/taskwarrior.sh b/office/.config/sh/alias.d/taskwarrior.sh index dc70002..8b3a820 100644 --- a/office/.config/sh/alias.d/taskwarrior.sh +++ b/office/.config/sh/alias.d/taskwarrior.sh @@ -39,3 +39,9 @@ alias tad="task +ACTIVE done" alias tas="task +ACTIVE stop" alias to="task note" + +#--- + +idea() { + task rc.data.location="$TASK_DATA_IDEA" "$@" +} diff --git a/office/.config/sh/env.d/taskwarrior-xdg.sh b/office/.config/sh/env.d/taskwarrior-xdg.sh index 1d75474..ef26b7a 100644 --- a/office/.config/sh/env.d/taskwarrior-xdg.sh +++ b/office/.config/sh/env.d/taskwarrior-xdg.sh @@ -1,3 +1,8 @@ #!/usr/bin/env sh -[ -d "$XDG_DATA_HOME/task/notes" ] || mkdir -p "$XDG_DATA_HOME/task/notes" + +export TASK_DATA_HOME="$XDG_DATA_HOME/task" +export TASK_DATA_IDEA="$XDG_DATA_HOME/ideas" + +[ -d "$TASK_DATA_HOME/notes" ] || mkdir -p "$TASK_DATA_HOME/notes" +[ -d "$TASK_DATA_IDEA/notes" ] || mkdir -p "$TASK_DATA_IDEA/notes" diff --git a/office/.config/task/taskrc b/office/.config/task/taskrc index 8539bd5..d6d8104 100644 --- a/office/.config/task/taskrc +++ b/office/.config/task/taskrc @@ -10,7 +10,7 @@ # Use the command 'task show' to see all defaults and overrides # Files -data.location=$XDG_DATA_HOME/task +data.location=$TASK_DATA_HOME # disable case sensitivity search.case.sensitive=no From 20741b3ca067a3c151d33f42b155046a9753f0f7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 22 Jun 2025 19:27:28 +0200 Subject: [PATCH 6/6] Add idea aliases for running topen in the repository Notes can be opened/written by either executing `idea note ` or `idean `. --- office/.config/sh/alias.d/taskwarrior.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/office/.config/sh/alias.d/taskwarrior.sh b/office/.config/sh/alias.d/taskwarrior.sh index 8b3a820..9546974 100644 --- a/office/.config/sh/alias.d/taskwarrior.sh +++ b/office/.config/sh/alias.d/taskwarrior.sh @@ -41,7 +41,15 @@ alias tas="task +ACTIVE stop" alias to="task note" #--- +# Additional idea repository idea() { + if [ "$1" = "note" ]; then + shift + idean "$@" + fi task rc.data.location="$TASK_DATA_IDEA" "$@" } +idean() { + topen --task-data "$TASK_DATA_IDEA" --notes-dir "$TASK_DATA_IDEA/notes" "$@" +}