Compare commits

...

2 Commits

Author SHA1 Message Date
9b4f15f69a
Do not unconditionally enable subword-mode in prog-mode
In most of the languages I use this is futile.  Just enable it in individual
modes instead.
2022-09-10 09:14:20 +02:00
2e895a23fa
Allow nil dates in workload report to ignore those constraints
Emacs Lisp is fun :)
2022-09-10 09:12:02 +02:00
2 changed files with 28 additions and 15 deletions

11
init.el
View File

@ -151,7 +151,6 @@
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
(add-hook 'prog-mode-hook 'page-break-lines-mode) (add-hook 'prog-mode-hook 'page-break-lines-mode)
(add-hook 'text-mode-hook 'page-break-lines-mode) (add-hook 'text-mode-hook 'page-break-lines-mode)
(add-hook 'prog-mode-hook 'subword-mode)
(add-hook 'prog-mode-hook 'hl-line-mode) (add-hook 'prog-mode-hook 'hl-line-mode)
(add-hook 'lisp-mode-hook 'turn-on-lispy-when-available) (add-hook 'lisp-mode-hook 'turn-on-lispy-when-available)
@ -2996,6 +2995,7 @@ With given ARG, display files in `db/important-document-path."
(append '((company-capf company-dabbrev-code)) (append '((company-capf company-dabbrev-code))
company-backends)))) company-backends))))
(add-hook 'haskell-mode-hook 'flycheck-mode) (add-hook 'haskell-mode-hook 'flycheck-mode)
(add-hook 'haskle--mode-hook 'subword-mode)
(with-demoted-errors "Non-Fatal Error: %s" (with-demoted-errors "Non-Fatal Error: %s"
(require 'haskell-indentation) (require 'haskell-indentation)
@ -3020,11 +3020,7 @@ With given ARG, display files in `db/important-document-path."
:init (setq plantuml-output-type "svg" :init (setq plantuml-output-type "svg"
plantuml-default-exec-mode 'jar plantuml-default-exec-mode 'jar
plantuml-jar-path "/usr/share/plantuml/plantuml.jar" plantuml-jar-path "/usr/share/plantuml/plantuml.jar"
plantuml-indent-level 2) plantuml-indent-level 2))
:config (progn
(add-hook 'plantuml-mode-hook
#'(lambda ()
(subword-mode -1)))))
(use-package python (use-package python
:config (progn :config (progn
@ -3033,7 +3029,8 @@ With given ARG, display files in `db/important-document-path."
(add-hook 'python-mode-hook #'highlight-indentation-mode) (add-hook 'python-mode-hook #'highlight-indentation-mode)
(add-hook 'python-mode-hook #'company-mode) (add-hook 'python-mode-hook #'company-mode)
(add-hook 'python-mode-hook #'lsp-deferred))) (add-hook 'python-mode-hook #'lsp-deferred)
(add-hook 'python-mode-hook #'subword-mode)))
;; https://ddavis.io/posts/emacs-python-lsp/ ;; https://ddavis.io/posts/emacs-python-lsp/
(use-package pyvenv (use-package pyvenv

View File

@ -9,6 +9,7 @@
;;; Code: ;;; Code:
(require 'subr-x) (require 'subr-x)
(require 'dash)
(require 'cl-lib) (require 'cl-lib)
(require 'org) (require 'org)
(require 'org-agenda) (require 'org-agenda)
@ -394,11 +395,26 @@ entries.
When ORG-QL-MATCH, an org-ql sexp, is given, filter the list of When ORG-QL-MATCH, an org-ql sexp, is given, filter the list of
tasks in range by this expression. When ORG-QL-MATCH is not tasks in range by this expression. When ORG-QL-MATCH is not
given, default to `(todo)'." given, default to `(todo)'.
(let* (;; Allow Org syntax for dates; the result should be understandable by
;; `parse-time-string' and thus `org-ql-query' should be fine with that. START-DATE and END-DATE must be strings formatted such that
(start-date (org-read-date nil nil start-date)) `org-read-date' can parse a date from them. In particular,
(end-date (org-read-date nil nil end-date)) everything understood by `parse-time-string' should be fine.
When START-DATE or END-DATE (or both) are nil, no constraints are
imposed on the respective time range."
(unless (or (null start-date)
(stringp start-date))
(user-error "START-DATE must be nil or a string, but it's %s" start-date))
(unless (or (null end-date)
(stringp end-date))
(user-error "END-DATE must be nil or a string, but it's %s" end-date))
(let* ((start-date-expr (--when-let (and start-date (org-read-date nil nil start-date))
(list :from it)))
(end-date-expr (--when-let (and end-date (org-read-date nil nil end-date))
(list :to it)))
(tasks (org-ql-query (tasks (org-ql-query
:from (org-agenda-files) :from (org-agenda-files)
:select '(cons :select '(cons
@ -406,9 +422,9 @@ given, default to `(todo)'."
(org-entry-get (point) "Effort")) (org-entry-get (point) "Effort"))
:where `(and ,(or org-ql-match '(todo)) :where `(and ,(or org-ql-match '(todo))
;; Is this redundant? Could we just stick with `ts-active'? ;; Is this redundant? Could we just stick with `ts-active'?
(or (scheduled :from ,start-date :to ,end-date) (or (scheduled ,@start-date-expr ,@end-date-expr)
(deadline :from ,start-date :to ,end-date) (deadline ,@start-date-expr ,@end-date-expr)
(ts-active :from ,start-date :to ,end-date))))) (ts-active ,@start-date-expr ,@end-date-expr)))))
(total-time (->> tasks (total-time (->> tasks
(-map #'(lambda (task) (-map #'(lambda (task)
(let ((effort (cdr task))) (let ((effort (cdr task)))