Dotfiles/site-modules/core/files/emacs/mbwatch/mbwatch.el
Ade Attwood b095833f8e refactor(emacs): move emacs config to be really minimal
Yea thats it, we are bringing back the use of emacs. This is very much the "why
choose" way and using the correct tool for the job.

I have now gone back to emacs for all the productivity / notes related stuff.
Code will still continue to be in neovim. The developer experience nvim brings
is really nice, the community around plugins is amazing, you can really get
your work done fast. What it does not have is org-mode, this is the feature of
emacs and I would like to go back to using it.

Emacs has now replaced todoist, obsidian and gmail web client. Singularly, I
think these tools are on par if not better sometimes that the emacs
replacement. However, together with org-link, this is where the power is. Being
able to quickly capture tasks that link back to emails is supper powerful.

The org-mode stuff is generally the same. It uses evil mode, so my fingers
don't get lost, Doom to make it look good. All the key bindings are the same,
it's just ripped out all the code and language support. The only code related
package is company so I can get completion on the roam links just like you do
in obsidian.

Email is powered by notmuch. I said this replaces the gmail web client,
however, it's really a couple of other too. The main benefit over have this is
you can have one inbox for multiple accounts. Having a single list for your
inbox is a grate way to keep track of everything. This will org capture and org
links works perfectly with the inbox zero flow, having the ability to file
things away not lose track of them is really nice.
2024-09-24 20:27:20 +01:00

61 lines
1.8 KiB
EmacsLisp

;; mbwatch-mode.el --- Run mbwatch and handle its output -*- lexical-binding: t; -*-
(defvar mbwatch-process nil
"The process object for the mbwatch command.")
(defvar mbwatch-output-hook nil
"Hook run when new output is received from the mbwatch process. Each function
in this hook is called with a single argument, the new output.")
(defun mbwatch-start ()
"Start the mbwatch process."
(let ((process-buffer (get-buffer-create "*mbwatch*")))
(with-current-buffer process-buffer
(read-only-mode -1)
(erase-buffer)
(read-only-mode 1))
(setq mbwatch-process
(start-process-shell-command
"mbwatch" process-buffer "mbwatch"))
(set-process-filter
mbwatch-process
'mbwatch-process-filter)
(message "mbwatch process started.")))
(defun mbwatch-stop ()
"Stop the mbwatch process."
(interactive)
(when (and mbwatch-process (process-live-p mbwatch-process))
(kill-process mbwatch-process)
(setq mbwatch-process nil)))
(defun mbwatch-process-filter (proc output)
"Filter function for mbwatch process output.
PROC is the process. OUTPUT is the new output."
(with-current-buffer (process-buffer proc)
(let ((inhibit-read-only t))
(goto-char (point-max))
(insert output))
(mbwatch-handle-output output)))
(defun mbwatch-handle-output (output)
"Handle new OUTPUT from the mbwatch process."
(when (string-match "Synced changes for \\(.*?\\) in mailbox \\(.*?\\)$" output)
(let ((account (match-string 1 output))
(mailbox (match-string 2 output)))
(run-hook-with-args 'mbwatch-output-hook account mailbox))))
(define-minor-mode mbwatch-mode
"Minor mode to run mbwatch command and handle its output."
:lighter " mbwatch"
:global t
(if mbwatch-mode
(mbwatch-start)
(mbwatch-stop)))
(provide 'mbwatch)
;;; mbwatch-mode.el ends here