My journey into creating a nice environment to create while having fun continues.
The custom focus mode I wrote about last time has received an update. To help with being focussed all the windows except the active one now disappear when you enter the mode. Of course, when you exit the mode all the windows are restored. All powered by my discovery of the save and store window configuration functions.
Calculations have now move to being done in pixels. Why you might ask? Well, emacs lets you adjust your text scaling on the fly and to get this right we need pixel level calculation. Of course I put a hook in to be told about text scaling to make it more complete. There's probably other unknown bugs just waiting to be found but for now, as a personal tool, I doubt I will put much more time into it. Given how stable emacs is, it's possible I will get to use for at least another decade without having to update the code much.
tab-bar-mode mode is my latest discovery, yes it is a built in package shipped with emacs.. You will not be susprised to to be told it lets you use tabs in Emacs. It seems to work really well. Each new tab is a Frame which can have multiple windows in it. I really like this way of working. In emacs do C-x t and wait for which key to bring up the menu describing what functions you have.
Not all things are done in emacs and I recently come across this fascinating script for triggering tasks.
function install() {
echo "install task not implemented"
}
function build() {
echo "building"
cc main.c sqlite3.c -std=c23 -o cosy-pen_exe
}
function test(){
echo "test task not implemented"
}
function start() {
echo "start task not implemented"
}
function default() {
build
}
function help() {
echo "$0 <task> <args>"
echo "Tasks:"
compgen -A function | cat -n
}
TIMEFORMAT="Task completed in %3lR"
time ${@:-default}
The idea is you create a selection of functions and then the
$(@:-default) dispatches to the correct function:
./tasks.sh # Run the default command which in this example calls build
./tasks.sh build # directly runs the build command
The help() function is pretty cool as it uses compgen to
scan the function names and display the tasks available. I have to admit
compgen is new to me. It is usually used to generate auto complete
lists, using it in a shell script like above is novel
It you have a directory/project where you want to run various tasks
this is a really simple way to do it. Not as feature complete as a tool
like Just but hits the sweet spot on simple and being no
hassle. Alas I lost track of where I got the code from so cannot link to
them.
As you may have guessed I am starting to play with sqllite and C. It looks like there are only 8 methods you really need to understand to get you a long way. That's for a different post though.