recompile elpa

sometimes there are some issue with compiled lisp stuff, i get the error invalid funcion org-preserve-local-variables a lot. Normally you can solve it with this.

run in shell

find . -name '*.elc' -type f | xargs rm -f

elisp websockets

  ;; // the brainded way to spin up websocket.el

  (defun cls/status-start ()
    (interactive)
    (websocket-open
     "ws://localhost:8080/ws"
     :on-message (lambda (_websocket frame)
                   (message "Message call happened")
                   (message (format "%S" (websocket-frame-text frame))))
     :on-open (lambda (_websocket)
                (message "Websocket opened")
                (websocket-send-text _websocket "Hello, world")))
  ;; 14:54 kenzo:    that 'nil is where you put the call to your start-up callback defun
    nil)

systemd service for emacs

[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
Type=simple
ExecStart=/usr/bin/emacs26 --fg-daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure

[Install]
WantedBy=default.target

cool dired mode for spacemacs

inspiration

edit dotspacemacs-additional-packages to include diredfl and dired-git-info

   dotspacemacs-additional-packages '(
                                      ;...
                                      diredfl
                                      dired-git-info
                                      )

save the file and restart spacemacs to download the packages

SPC f e R

add the following to your .spacemacs

  ;; dired config
  (add-hook 'dired-mode-hook
            (lambda () (dired-hide-details-mode)))

  (with-eval-after-load 'dired
    (define-key dired-mode-map ")" 'dired-git-info-mode))

toggle diredfl-global-mode

M-x customize-variable diredfl-global-mode

org-todo-keywords

org-todo-keywords offers useful todo tracking as well as time tracking abilities. org-todo-keywords can be configured to timestamp the changes of a org heading's todo state, as well as include custom elements for more fine grained time tracking ability. to use my configurations place this in your .emacs or .spacemacs.

  (setq org-todo-keywords '((sequence "❎ TODO(t!)" "☑ DONE(d!)")
                            (sequence "👷 IN PROGRESS(i!)" "|")
                            (sequence "🐛 BUG(b!)" "|")
                            (sequence "✨ FEATURE(f!)" "|" )
                            (sequence "⚒ CHORE(c!)" "|" )
                            (sequence "🔎 REVIEW(r!)" "|" )
                            (sequence "🎅 QA(q!)" "|" )))
Note: normally in my actual config, I omit the text labels, because i find that it keeps my config more concise. I however, will be using the given config for the contiuation of this article.

Some things you may have noticed in the config is the usage of ! next to the keymappings. This is what tells org-todo to track state changes of that keyword. The state changes are represented as follows

☑ DONE get groceries

  • State "☑ DONE" from "👷 IN PROGRESS" [2019-10-26 Sat 21:05]
  • State "👷 IN PROGRESS" from "❎ TODO" [2019-10-26 Sat 21:01]
  • State "❎ TODO" from [2019-10-26 Sat 21:00]
Note: this is represented here as html because my static site renderer is weird about org source code blocks

Now that data is being generated about our todo habits, we can begin to measure it. Suppose I want to know the average time I have spent working on all of my tasks. We have a list of timestamps, and information about the state of a task at that point of time. We can track the time spent working on a task by tracking the time difference between state transitions. Some state transitions should not be taken into account to track the time spent working on a task, because they don't imply time spent working. for example:

  - State "👷 IN PROGRESS" from "❎ TODO"    [2019-10-26 Sat 21:01]
  - State "❎ TODO"    from              [2019-10-26 Sat 21:00]

Although there was a 1 mintue time difference in time between state transitions, there was no work being done in this time. From our configuration that was defined earlier

  (setq org-todo-keywords '((sequence "❎ TODO(t!)" "☑ DONE(d!)")
                            (sequence "👷 IN PROGRESS(i!)" "|")
                            (sequence "🐛 BUG(b!)" "|")
                            (sequence "✨ FEATURE(f!)" "|" )
                            (sequence "⚒ CHORE(c!)" "|" )
                            (sequence "🔎 REVIEW(r!)" "|" )
                            (sequence "🎅 QA(q!)" "|" )))

we can define transitions from 👷 IN PROGRESS to any other state, to be a meaningful data point to represent our time spent working metric. The time spent working metric can also be represented as a time series graph as well, since the timestamp contains information on the Year-Month-Day of the state transition, which can be used to see if the average time spent working on a task is increasing, or decreasing over time. Combining this feature with org-tags gives a very powerful ability to get an even finer precision into the average time spent working metric, by combining it into categories e.g.:

  • programming
  • python
  • lisp
  • writing
  • etc.

although tempting to write this in lisp, orgparse can load org mode documents into a python object, and python's ecosystem is more suited for exploring data analytics.

org-schedule-effort

worth exploring this functionality more src

(defun org-schedule-effort ()
(interactive)
  (save-excursion
    (org-back-to-heading t)
    (let* (
        (element (org-element-at-point))
        (effort (org-element-property :EFFORT element))
        (scheduled (org-element-property :scheduled element))
        (ts-year-start (org-element-property :year-start scheduled))
        (ts-month-start (org-element-property :month-start scheduled))
        (ts-day-start (org-element-property :day-start scheduled))
        (ts-hour-start (org-element-property :hour-start scheduled))
        (ts-minute-start (org-element-property :minute-start scheduled)) )
      (org-schedule nil (concat
        (format "%s" ts-year-start)
        "-"
        (if (< ts-month-start 10)
          (concat "0" (format "%s" ts-month-start))
          (format "%s" ts-month-start))
        "-"
        (if (< ts-day-start 10)
          (concat "0" (format "%s" ts-day-start))
          (format "%s" ts-day-start))
        " "
        (if (< ts-hour-start 10)
          (concat "0" (format "%s" ts-hour-start))
          (format "%s" ts-hour-start))
        ":"
        (if (< ts-minute-start 10)
          (concat "0" (format "%s" ts-minute-start))
          (format "%s" ts-minute-start))
        "+"
        effort)) )))

reminder bell/system notifications

org schedule effort offers begin and end org schedule windows, instead of using effort

por que no los dos?

even general automation would be nice