Restucture chronometrist config; add chronometrist-details config
This commit is contained in:
parent
3e7522f6d6
commit
346a9b3802
151
init.org
151
init.org
|
@ -329,10 +329,8 @@ I'm pretty much using this to emulate `god-mode', which was great, but is no lon
|
|||
** Applications
|
||||
*** time tracking - chronometrist
|
||||
choice.el is required by =chronometrist-key-values=
|
||||
**** chronometrist
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package choice
|
||||
:load-path "~/.emacs.d/contrapunctus/choice/")
|
||||
|
||||
(use-package chronometrist
|
||||
;; :disabled t
|
||||
:load-path "~/.emacs.d/contrapunctus/chronometrist/elisp/"
|
||||
|
@ -342,9 +340,14 @@ choice.el is required by =chronometrist-key-values=
|
|||
(chronometrist-sexp-mode . visual-line-mode)
|
||||
(kill-emacs-query-functions . chronometrist-query-stop)
|
||||
:bind (("<f9>" . chronometrist)
|
||||
("<kp-insert>" . chronometrist))
|
||||
("<kp-insert>" . chronometrist)
|
||||
(:map chronometrist-mode-map
|
||||
("c" . previous-line)
|
||||
("r" . next-line))
|
||||
(:map chronometrist-report-mode-map
|
||||
("h" . chronometrist-report-previous-week)
|
||||
("s" . chronometrist-report-next-week)))
|
||||
:config
|
||||
(require 'chronometrist-key-values)
|
||||
(setq chronometrist-before-in-functions '()
|
||||
chronometrist-after-in-functions '(;; chronometrist-tags-add
|
||||
;; chronometrist-kv-add
|
||||
|
@ -352,34 +355,19 @@ choice.el is required by =chronometrist-key-values=
|
|||
chronometrist-before-out-functions '(contrapunctus-before-project-stop
|
||||
;; chronometrist-tags-add
|
||||
;; chronometrist-tag-choice
|
||||
chronometrist-key-values-unified-choice
|
||||
chronometrist-key-values-unified-prompt
|
||||
;; chronometrist-kv-add
|
||||
;; chronometrist-skip-query-reset
|
||||
)
|
||||
chronometrist-after-out-functions '(contrapunctus-after-project-stop)
|
||||
chronometrist-activity-indicator 'contrapunctus-chronometrist-activity-indicator))
|
||||
|
||||
(use-package chronometrist-goal
|
||||
:load-path "~/.emacs.d/contrapunctus/chronometrist-goal/"
|
||||
:hook (chronometrist-mode . chronometrist-goal-minor-mode)
|
||||
:config
|
||||
(setq chronometrist-goal-list
|
||||
'((30 "Arrangement/new edition")
|
||||
(15 "Aural exercises")
|
||||
(15 "Transcription" "Theory")
|
||||
;; was 30 before, but that was too little for composing
|
||||
(60 "Composing" "Writing" "Recording")
|
||||
(15 "Data organization" "Physical organization" "Khilona archiving")
|
||||
(60 "Exercise")
|
||||
(120 "Guitar")
|
||||
(90 "Reading")
|
||||
(60 "Singing")
|
||||
(20 "Subtitles")
|
||||
(15 "Acting")
|
||||
(30 "Keyboard")
|
||||
(15 "Wikisource"))
|
||||
alert-default-style 'libnotify))
|
||||
|
||||
chronometrist-activity-indicator 'contrapunctus-chronometrist-activity-indicator
|
||||
chronometrist-details-display-key-values #'contrapunctus-display-chronometrist-key-values
|
||||
;; add key-value column to schema
|
||||
;; add key-value cells to rows
|
||||
))
|
||||
#+END_SRC
|
||||
***** activity-indicator
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun contrapunctus-chronometrist-activity-indicator ()
|
||||
(thread-last (plist-put (chronometrist-last)
|
||||
:stop (chronometrist-format-time-iso8601))
|
||||
|
@ -387,21 +375,25 @@ choice.el is required by =chronometrist-key-values=
|
|||
chronometrist-events-to-durations
|
||||
(-reduce #'+)
|
||||
truncate
|
||||
chronometrist-format-time))
|
||||
|
||||
chronometrist-format-duration))
|
||||
#+END_SRC
|
||||
***** find-two-files
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun contrapunctus-find-two-files (file-1 file-2)
|
||||
"Open FILE-1 and FILE-2 in new windows.
|
||||
FILE-1 will appear above FILE-2."
|
||||
(find-file-other-window file-2)
|
||||
(split-window-below)
|
||||
(find-file file-1))
|
||||
|
||||
#+END_SRC
|
||||
***** outline-open-heading
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun cp-outline-open-heading (n)
|
||||
(goto-char (point-min))
|
||||
(outline-next-visible-heading n)
|
||||
(outline-show-subtree))
|
||||
#+END_SRC
|
||||
|
||||
***** start-project
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun contrapunctus-start-project (project)
|
||||
(delete-other-windows)
|
||||
|
@ -425,7 +417,8 @@ FILE-1 will appear above FILE-2."
|
|||
(find-file-other-window
|
||||
;; "/media/data/anon/1-music-scores/2-my-compositions/2017/2017-02 The Rainbow Flower/1 Chhutti Ka Din/music/"
|
||||
"/media/data/anon/1-music-scores/2-my-compositions/2019/2019-03 Kahe Natak Karte Ho Ji?/2 Adi Kal Se/")
|
||||
(launch-file "/media/data/anon/1-music-scores/2-my-compositions/2019/2019-03 Kahe Natak Karte Ho Ji?/2 Adi Kal Se/output/2 Adi Kal Se-pacON.pdf"))
|
||||
(launch-file "/media/data/anon/1-music-scores/2-my-compositions/2019/2019-03 Kahe Natak Karte Ho Ji?/2 Adi Kal Se/output/2 Adi Kal Se-pacON.pdf")
|
||||
(start-process "qtractor" nil "qtractor" "/media/data/anon/8-music-production/1-my-creations/2019/natyashastra/2-adi-kal-se/adi-kal-se.qtr"))
|
||||
("Data organization"
|
||||
(find-dired "/media/data/anon/" "-name \\'dl\\' -size +0c"))
|
||||
("Digitization"
|
||||
|
@ -433,7 +426,7 @@ FILE-1 will appear above FILE-2."
|
|||
"/media/data/anon/Documents/Text Files/latex/Don't, Mr. Disraeli!/dont-mr-disraeli.tex")
|
||||
(launch-file
|
||||
"/media/data/anon/Documents/Text Files/latex/Don't, Mr. Disraeli!/dont-mr-disraeli.pdf"))
|
||||
("Exercise" (chronometrist-key-values-unified-choice "Exercise")
|
||||
("Exercise" (chronometrist-key-values-unified-prompt "Exercise")
|
||||
(chronometrist-open-log))
|
||||
("Guitar"
|
||||
(let* ((path-1 "/media/data/anon/Sync/Scores/guitar-solo/repertoire.org")
|
||||
|
@ -456,18 +449,20 @@ FILE-1 will appear above FILE-2."
|
|||
("OSM"
|
||||
;; (async-shell-command "java -jar ~/josm-tested.jar" " *JOSM*" " *JOSM errors*")
|
||||
;; (delete-window (get-buffer-window " *JOSM*"))
|
||||
(contrapunctus-find-two-files "/media/data/anon/phone/Nokia 6.1/Android/data/net.osmand.plus/files/"
|
||||
;; "/media/data/anon/phone/Nokia 6.1/external/DCIM/OpenCamera/osm/"
|
||||
"/media/data/anon/phone/Nokia 6.1/Documents/Markor/OSM/TODO.md"))
|
||||
(contrapunctus-find-two-files "/media/data/phone/anon/Nokia 6.1/Android/data/net.osmand.plus/files/"
|
||||
;; "/media/data/phone/anon/Nokia 6.1/external/DCIM/OpenCamera/osm/"
|
||||
"/media/data/phone/anon/Nokia 6.1/Documents/Markor/OSM/TODO.md"))
|
||||
("Programming"
|
||||
(launch-file "/media/data/anon/git/cl/McCLIM/Documentation/Manual/Texinfo/mcclim.pdf")
|
||||
(eww-open-file "/media/data/anon/git/cl/McCLIM/Documentation/Manual/Texinfo/mcclim.html")
|
||||
(find-file-other-window
|
||||
"/media/data/anon/phone/Nokia 6.1/Documents/Markor/Computers/todo.md"))
|
||||
"/media/data/phone/anon/Nokia 6.1/Documents/Markor/Computers/todo.md"))
|
||||
("Recording"
|
||||
(find-file-other-window "/media/data/anon/8-music-production/1-my-creations/BWV 1006a/1 Prelude/"))
|
||||
("Singing"
|
||||
(find-file-other-window "/media/data/anon/Sync/Scores/voice/repertoire.org"))
|
||||
("Subtitles"
|
||||
;; (find-file-other-window "/media/data/anon/Music/0-classical/vocal/musical/Company/")
|
||||
(start-process "subtitleeditor" nil "subtitleeditor" "/home/khilona/Videos/Peer Gynt/peer-gynt.srt"))
|
||||
(start-process "subtitleeditor" nil "subtitleeditor" "/media/data/khilona/Videos/Peer Gynt/peer-gynt.srt"))
|
||||
("Teaching"
|
||||
(find-file-other-window "/media/data/anon/Documents/Text Files/students/")
|
||||
;; (launch-file "/media/data/anon/Sync/Scores/voice/jingle-bell-rock.pdf")
|
||||
|
@ -478,7 +473,7 @@ FILE-1 will appear above FILE-2."
|
|||
"/media/data/anon/1-music-scores/2-my-compositions/2019/2019-03 Kahe Natak Karte Ho Ji/Kahe Natak Karte Ho Ji.org"))
|
||||
("Transcription"
|
||||
;; (find-file-other-window
|
||||
;; "/media/data/anon/phone/Nokia 6.1/Documents/Markor/Music/transcriptions.md")
|
||||
;; "/media/data/phone/anon/Nokia 6.1/Documents/Markor/Music/transcriptions.md")
|
||||
(emms-play-file "/media/data/anon/Music/Hallelujah Rufus Wainwright-xR0DKOGco_o.opus")
|
||||
(launch-file "/media/data/anon/1-music-scores/4-my-arrangements/2021/2021-03-11 Hallelujah/output/2021-03-11 Hallelujah-pacON.pdf")
|
||||
(find-file "/media/data/anon/1-music-scores/4-my-arrangements/2021/"))
|
||||
|
@ -486,16 +481,17 @@ FILE-1 will appear above FILE-2."
|
|||
(start-process "flatpak" (generate-new-buffer-name "kdenlive")
|
||||
"flatpak" "run" "org.kde.kdenlive"
|
||||
"/home/khilona/Videos/ghar ghar theatre 3/ggt3.kdenlive")
|
||||
(find-alternate-file-other-window "/home/khilona/Videos/ghar ghar theatre 3/"
|
||||
;; "/home/khilona/Videos/podcast/"
|
||||
))
|
||||
(find-file-other-window ;; "/home/khilona/Videos/ghar ghar theatre 3/"
|
||||
"/media/data/khilona/Videos/podcast/"))
|
||||
("Wiktionary"
|
||||
(find-file-other-window
|
||||
"/media/data/anon/phone/Nokia 6.1/Documents/Markor/Languages/hindi.md"))
|
||||
"/media/data/phone/anon/Nokia 6.1/Documents/Markor/Languages/hindi.md"))
|
||||
("Writing"
|
||||
(find-file-other-window
|
||||
"/media/data/anon/phone/Nokia 6.1/Documents/Markor/Songs or Poems/"))))
|
||||
|
||||
"/media/data/phone/anon/Nokia 6.1/Documents/Markor/Songs or Poems/"))))
|
||||
#+END_SRC
|
||||
***** commit-prompt
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(autoload 'magit-anything-modified-p "magit")
|
||||
|
||||
(defun contrapunctus-commit-prompt ()
|
||||
|
@ -509,14 +505,20 @@ Return nil (and run `magit-status') if the user answers no."
|
|||
(format "You have uncommitted changes in %S. Really clock out? "
|
||||
default-directory)) t)
|
||||
(t (magit-status) nil)))
|
||||
#+END_SRC
|
||||
|
||||
***** before-project-stop
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun contrapunctus-before-project-stop (project)
|
||||
(if (member project '("Composing" "Khilona archiving" "Programming"))
|
||||
(contrapunctus-commit-prompt)
|
||||
;; all functions in `chronometrist-before-project-stop-functions'
|
||||
;; must return t for successful clock-out
|
||||
t))
|
||||
#+END_SRC
|
||||
|
||||
***** after-project-stop
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(require 'request)
|
||||
(require 'esxml-query)
|
||||
(defun contrapunctus-after-project-stop (project)
|
||||
|
@ -552,7 +554,47 @@ Return nil (and run `magit-status') if the user answers no."
|
|||
`(:osm-url ,(concat "https://www.openstreetmap.org/changeset/" id)
|
||||
:osm-comment ,comment)))))))
|
||||
(_ (delete-other-windows))))
|
||||
#+END_SRC
|
||||
|
||||
***** display-key-values
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun contrapunctus-display-chronometrist-key-values (plist)
|
||||
"Function used to print key-values in `chronometrist-details' buffers.
|
||||
It is meant to be used as a value for `chronometrist-details-display-key-values'."
|
||||
;; (pcase (plist-get plist :name)
|
||||
;; ("Com"))
|
||||
)
|
||||
#+END_SRC
|
||||
**** key-values
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package chronometrist-key-values
|
||||
:load-path "~/.emacs.d/contrapunctus/chronometrist/elisp/")
|
||||
#+END_SRC
|
||||
**** goal
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package chronometrist-goal
|
||||
:load-path "~/.emacs.d/contrapunctus/chronometrist-goal/"
|
||||
:hook (chronometrist-mode . chronometrist-goal-minor-mode)
|
||||
:config
|
||||
(setq chronometrist-goal-list
|
||||
'((30 "Arrangement/new edition")
|
||||
(15 "Aural exercises")
|
||||
(15 "Transcription" "Theory")
|
||||
;; was 30 before, but that was too little for composing
|
||||
(60 "Composing" "Writing" "Recording")
|
||||
(15 "Data organization" "Physical organization" "Khilona archiving")
|
||||
(60 "Exercise")
|
||||
(120 "Guitar")
|
||||
(90 "Reading")
|
||||
(60 "Singing")
|
||||
(20 "Subtitles")
|
||||
(15 "Acting")
|
||||
(30 "Keyboard")
|
||||
(15 "Wikisource"))
|
||||
alert-default-style 'libnotify))
|
||||
#+END_SRC
|
||||
**** count-expressions
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun contrapunctus-count-expressions ()
|
||||
(interactive)
|
||||
(chronometrist-sexp-in-file chronometrist-file
|
||||
|
@ -561,13 +603,10 @@ Return nil (and run `magit-status') if the user answers no."
|
|||
while (ignore-errors (read (current-buffer)))
|
||||
do (cl-incf count)
|
||||
finally do (message "%s" count))))
|
||||
|
||||
;; Wrote these two as potential alternatives to `org-babel-tangle',
|
||||
;; which was far slower than I'd like (took around 20s for
|
||||
;; chronometrist.org when I checked during the migration process, and
|
||||
;; 43s after the migration was complete.) These, on the other hand,
|
||||
;; are almost instant, but I don't use them anywhere because I run a
|
||||
;; sed script as a file local variable.
|
||||
#+END_SRC
|
||||
**** tangling
|
||||
Wrote these two as potential alternatives to `org-babel-tangle', which was far slower than I'd like (took around 20s for chronometrist.org when I checked during the migration process, and 43s after the migration was complete.) These, on the other hand, are almost instant, but I don't use them anywhere because I run a sed script as a file local variable.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun chronometrist-tangle ()
|
||||
(goto-char (point-min))
|
||||
(cl-loop with source
|
||||
|
@ -601,7 +640,7 @@ Return nil (and run `magit-status') if the user answers no."
|
|||
(format "sed -n '/#+BEGIN_SRC emacs-lisp$/,/#+END_SRC$/{//!p;}' ~s.org > ~s.el" base base)))))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
**** querying data
|
||||
An example of querying the Chronometrist file data - finding out how much time I've spent on tasks matching a certain criteria.
|
||||
#+BEGIN_SRC emacs-lisp :tangle no :load no
|
||||
(chronometrist-loop-file for plist in chronometrist-file
|
||||
|
|
Loading…
Reference in New Issue