My Emacs configuration contains a
custom.el file, which should contain custom
code, that is only relevant on a specific machine. That’s why this file is not
tracked via git. More and more bits of useful snippets show up in my
file and I’d like to jot down some examples which I might expand on in the
This snippet is inspired by a blog post which I’ve found on
/r/emacs. The elisp function calls the PowerShell function
which is part of the PSScriptAnalyzer PowerShell module:
(defun fw/pspretty-buffer ()
(shell-command-on-region (point-min) (point-max) "powershell.exe -Command \"$script = $input | Out-String; Invoke-Formatter $script\" " t t))
After seeing this post, I’ve decided to dive into creating my own
agenda. I’m using a custom agenda view to keep track of things I have to do
while I am at work. The custom view show my scheduled tasks for the next three
days, as well as all unscheduled tasks, sorted by their TODO statement (e.g.
“TODO”, “WAIT” or “DONE”):
'(("." "Overview (Custom)"
(org-agenda-scheduled-leaders '("" ""))
(org-agenda-overriding-header "* Calendar\n")))
((org-agenda-overriding-header "\n* Open\n")
(set-face-attribute 'org-agenda-structure nil :inherit 'default :height 1.25)
The custom headers make the agenda look like a regular org-mode file. Enabling
(orgstruct-mode) on the agenda buffer allows me to hide and show sections.
I haven’t come around to like
org-capture, so for now I’ve created this:
(defun fw/home ()
(org-agenda nil ".")
(find-file (concat "~/org/" (format-time-string "%Y-%m-%d") ".org"))
(global-set-key (kbd "<f12>") 'fw/home)
F12 opens up my “home” view, which consists of my projects-overview
file, my custom agenda, as well as a date stamped file which I use to keep track
of unexpected issues, thoughts and ideas.