From 0252d5a1cb0a6bfabbd7adfded5b7e71b8b0f4e6 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Wed, 15 Dec 2021 14:14:10 +0100 Subject: [PATCH] Combine org settings in bundle--org --- bundle/bundle--hooks.el | 1 - bundle/bundle--keys.el | 4 -- bundle/bundle--mk.el | 42 ----------- bundle/bundle--org.el | 142 ++++++++++++++++++++++++++++++++++++++ bundle/bundle--package.el | 95 +------------------------ 5 files changed, 143 insertions(+), 141 deletions(-) create mode 100644 bundle/bundle--org.el diff --git a/bundle/bundle--hooks.el b/bundle/bundle--hooks.el index 1c96544b..ca01594a 100644 --- a/bundle/bundle--hooks.el +++ b/bundle/bundle--hooks.el @@ -3,7 +3,6 @@ (add-hook 'write-file-hooks 'delete-trailing-whitespace) (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files) (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files) -(add-hook 'org-mode-hook 'turn-on-auto-fill) (add-hook 'newsticker-mode-hook 'imenu-add-menubar-index) (if (display-graphic-p) (add-hook 'after-init-hook (lambda () diff --git a/bundle/bundle--keys.el b/bundle/bundle--keys.el index 2a037a58..a151d1d4 100644 --- a/bundle/bundle--keys.el +++ b/bundle/bundle--keys.el @@ -1,8 +1,4 @@ ;; GLOBAL KEYS -(global-set-key (kbd "C-c l") 'org-store-link) -(global-set-key (kbd "C-c a") 'org-agenda) -(global-set-key (kbd "C-c c") 'org-capture) -(global-set-key (kbd "C-c b") 'org-switchb) ;; (global-set-key (kbd "C-c C-x m") 'org-pomodoro) (global-set-key (kbd "C-x g") 'magit-status) (global-set-key (kbd "C-x M-g") 'magit-dispatch) diff --git a/bundle/bundle--mk.el b/bundle/bundle--mk.el index 5d5989c5..3bc5a13c 100644 --- a/bundle/bundle--mk.el +++ b/bundle/bundle--mk.el @@ -57,23 +57,6 @@ (interactive "nTransparency Value 0 - 100 opaque: ") (set-frame-parameter (selected-frame) 'alpha value)) -(defun me/org-copy-subtree-contents () - "Get the content text of the subtree at point and add it to the `kill-ring'. -Excludes the heading and any child subtrees." - (interactive) - (if (org-before-first-heading-p) - (message "Not in or on an org heading") - (save-excursion - ;; If inside heading contents, move the point back to the heading - ;; otherwise `org-agenda-get-some-entry-text' won't work. - (unless (org-on-heading-p) (org-previous-visible-heading 1)) - (let ((contents (substring-no-properties - (org-agenda-get-some-entry-text - (point-marker) - most-positive-fixnum)))) - (message "Copied: %s" contents) - (kill-new contents))))) - (defun jnf/magit-browse-pull-request () "In `magit-log-mode', open the associated pull request at point." (interactive) @@ -91,28 +74,3 @@ Excludes the heading and any child subtrees." (s-replace ".git" "" remote-url) "/pull/" (match-string 1 region))))))) - -;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks. -(defun org-agenda-log-mode-colorize-block () - "Set different line spacing based on clock time duration." - (save-excursion - (let* ((colors (cl-case (alist-get 'background-mode (frame-parameters)) - ('light (list "#d8dee9" "#e5e9f0" "#eceff4")) - ('dark (list "#bf616a" "#d08770" "#ebcb8b" "#a3be8c" "#b48ead")))) - pos - duration) - (nconc colors colors) - (goto-char (point-min)) - (while (setq pos (next-single-property-change (point) 'duration)) - (goto-char pos) - (when (and (not (equal pos (point-at-eol))) - (setq duration (org-get-at-bol 'duration))) - ;; larger duration bar height - (let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30)))) - (ov (make-overlay (point-at-bol) (1+ (point-at-eol))))) - (overlay-put ov 'face `(:background ,(car colors) :foreground "black")) - (setq colors (cdr colors)) - (overlay-put ov 'line-height line-height) - (overlay-put ov 'line-spacing (1- line-height)))))))) - -(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block) diff --git a/bundle/bundle--org.el b/bundle/bundle--org.el new file mode 100644 index 00000000..3760cfa9 --- /dev/null +++ b/bundle/bundle--org.el @@ -0,0 +1,142 @@ +(use-package ob-go) +(use-package ob-http) +(use-package ob-rust) +(use-package ob-typescript) +(use-package org + :init + (org-babel-lob-ingest "~/.emacs.d/library-of-babel.org") + :custom + (org-hide-emphasis-markers t) + (org-default-notes-file "notes.org") + (org-insert-mode-line-in-empty-file t) + (org-adapt-indentation nil) + (org-agenda-prefix-format + '((agenda . " %i %-12:c%?-12t%-6e% s") + (todo . " %i %-12:c %-6e") + (tags . " %i %-12:c") + (search . " %i %-12:c"))) + (org-agenda-dim-blocked-tasks nil) + (org-agenda-inhibit-startup nil) + (org-agenda-span 7) + (org-agenda-start-on-weekday 1) + (org-agenda-include-diary t) + (org-capture-templates + '(("n" "Note" entry + (file+headline "notes.org" "Notes") "* %k\n%U\n- %l\n- %K\n%i\n%?") + + ("t" "Task" entry + (file+headline "planning.org" "Tasks") "* TODO %?\n%u\n%a") + + ("a" "Appointment" entry + (file+headline "planning.org" "Appointments") "* %?\n%T\n") + + ("m" "Meeting" entry + (file+headline "planning.org" "Meetings") "* %? :MEETING:\n%T" :clock-in t) + + ("j" "Journal" entry + (file+olp+datetree "journal.org" "Journal") "* %^{Activity}\nEntered on %U\n%i\n%?" :tree-type week) + + ("l" "Log" entry + (file+olp+datetree "journal.org" "Logbook") "* %U - %^{Activity} :LOG:"))) + (org-clock-out-remove-zero-time-clocks t) + (org-clock-persist t) + (org-clock-rounding-minutes 30) + (org-confirm-babel-evaluate nil) + (org-duration-format (quote h:mm)) + (org-export-with-sub-superscripts nil) + (org-export-dispatch-use-expert-ui nil) + (org-export-backends + '(ascii beamer html icalendar latex md odt)) + (org-global-properties + '(("EFFORT_ALL" . "0:30 1:00 2:00 3:00 5:00 8:00"))) + (org-html-doctype "html5") + (org-html-html5-fancy t) + (org-html-htmlize-output-type nil) + (org-latex-pdf-process + '("latexmk -xelatex -shell-escape -quiet -f %f")) + (org-latex-compiler "xelatex") + (org-latex-listings t) + (org-log-done (quote time)) + (org-refile-targets '((nil :maxlevel . 3))) + (org-startup-folded t) + (org-startup-truncated nil) + (org-src-fontify-natively t) + (org-src-tab-acts-natively t) + (org-src-window-setup 'other-window) + (org-src-lang-modes + '(("bash" . sh) + ("elisp" . emacs-lisp) + ("beamer" . latex) + ("calc" . fundamental) + ("dot" . fundamental) + ("screen" . shell-script) + ("shell" . sh) + ("C" . c) + ("sqlite" . sql) + ("scheme" . racket) + ("plantuml" . plantuml))) + (org-time-stamp-rounding-minutes '(30 30)) + (org-todo-keywords + '((sequence "TODO" "DOING(!)" "DONE(!)"))) + (org-use-property-inheritance nil) + :config + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (js . t) + (lisp . t) + (python . t) + (sqlite . t) + (shell . t) + (plantuml . t) + (typescript . t) + (http . t)))) + +;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks. +(defun org-agenda-log-mode-colorize-block () + "Set different line spacing based on clock time duration." + (save-excursion + (let* ((colors (cl-case (alist-get 'background-mode (frame-parameters)) + ('light (list "#d8dee9" "#e5e9f0" "#eceff4")) + ('dark (list "#bf616a" "#d08770" "#ebcb8b" "#a3be8c" "#b48ead")))) + pos + duration) + (nconc colors colors) + (goto-char (point-min)) + (while (setq pos (next-single-property-change (point) 'duration)) + (goto-char pos) + (when (and (not (equal pos (point-at-eol))) + (setq duration (org-get-at-bol 'duration))) + ;; larger duration bar height + (let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30)))) + (ov (make-overlay (point-at-bol) (1+ (point-at-eol))))) + (overlay-put ov 'face `(:background ,(car colors) :foreground "black")) + (setq colors (cdr colors)) + (overlay-put ov 'line-height line-height) + (overlay-put ov 'line-spacing (1- line-height)))))))) + +(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block) + +(defun me/org-copy-subtree-contents () + "Get the content text of the subtree at point and add it to the `kill-ring'. +Excludes the heading and any child subtrees." + (interactive) + (if (org-before-first-heading-p) + (message "Not in or on an org heading") + (save-excursion + ;; If inside heading contents, move the point back to the heading + ;; otherwise `org-agenda-get-some-entry-text' won't work. + (unless (org-on-heading-p) (org-previous-visible-heading 1)) + (let ((contents (substring-no-properties + (org-agenda-get-some-entry-text + (point-marker) + most-positive-fixnum)))) + (message "Copied: %s" contents) + (kill-new contents))))) + +(add-hook 'org-mode-hook 'turn-on-auto-fill) + +(global-set-key (kbd "C-c l") 'org-store-link) +(global-set-key (kbd "C-c a") 'org-agenda) +(global-set-key (kbd "C-c c") 'org-capture) +(global-set-key (kbd "C-c b") 'org-switchb) diff --git a/bundle/bundle--package.el b/bundle/bundle--package.el index 039d31a6..707855ce 100644 --- a/bundle/bundle--package.el +++ b/bundle/bundle--package.el @@ -118,11 +118,6 @@ (add-hook 'js-mode-hook 'eglot-ensure) -(use-package ob-go) -(use-package ob-http) -(use-package ob-rust) -(use-package ob-typescript) - (use-package web-mode ;; :hook html-mode :mode "\\.html?\\'" @@ -147,95 +142,6 @@ slime-editing-commands slime-sbcl-exts))) -(use-package org - :init - (org-babel-lob-ingest "~/.emacs.d/library-of-babel.org") - :custom - (org-hide-emphasis-markers t) - (org-default-notes-file "notes.org") - (org-insert-mode-line-in-empty-file t) - (org-adapt-indentation nil) - (org-agenda-prefix-format - '((agenda . " %i %-12:c%?-12t%-6e% s") - (todo . " %i %-12:c %-6e") - (tags . " %i %-12:c") - (search . " %i %-12:c"))) - (org-agenda-dim-blocked-tasks nil) - (org-agenda-inhibit-startup nil) - (org-agenda-span 7) - (org-agenda-start-on-weekday 1) - (org-agenda-include-diary t) - (org-capture-templates - '(("n" "Note" entry - (file+headline "notes.org" "Notes") "* %k\n%U\n- %l\n- %K\n%i\n%?") - - ("t" "Task" entry - (file+headline "planning.org" "Tasks") "* TODO %?\n%u\n%a") - - ("a" "Appointment" entry - (file+headline "planning.org" "Appointments") "* %?\n%T\n") - - ("m" "Meeting" entry - (file+headline "planning.org" "Meetings") "* %? :MEETING:\n%T" :clock-in t) - - ("j" "Journal" entry - (file+olp+datetree "journal.org" "Journal") "* %^{Activity}\nEntered on %U\n%i\n%?" :tree-type week) - - ("l" "Log" entry - (file+olp+datetree "journal.org" "Logbook") "* %U - %^{Activity} :LOG:"))) - (org-clock-out-remove-zero-time-clocks t) - (org-clock-persist t) - (org-clock-rounding-minutes 30) - (org-confirm-babel-evaluate nil) - (org-duration-format (quote h:mm)) - (org-export-with-sub-superscripts nil) - (org-export-dispatch-use-expert-ui nil) - (org-export-backends - '(ascii beamer html icalendar latex md odt)) - (org-global-properties - '(("EFFORT_ALL" . "0:30 1:00 2:00 3:00 5:00 8:00"))) - (org-html-doctype "html5") - (org-html-html5-fancy t) - (org-html-htmlize-output-type nil) - (org-latex-pdf-process - '("latexmk -xelatex -shell-escape -quiet -f %f")) - (org-latex-compiler "xelatex") - (org-latex-listings t) - (org-log-done (quote time)) - (org-refile-targets '((nil :maxlevel . 3))) - (org-startup-folded t) - (org-startup-truncated nil) - (org-src-fontify-natively t) - (org-src-tab-acts-natively t) - (org-src-window-setup 'other-window) - (org-src-lang-modes - '(("bash" . sh) - ("elisp" . emacs-lisp) - ("beamer" . latex) - ("calc" . fundamental) - ("dot" . fundamental) - ("screen" . shell-script) - ("shell" . sh) - ("C" . c) - ("sqlite" . sql) - ("scheme" . racket) - ("plantuml" . plantuml))) - (org-time-stamp-rounding-minutes '(30 30)) - (org-todo-keywords - '((sequence "TODO" "DOING(!)" "DONE(!)"))) - (org-use-property-inheritance nil) - :config - (org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . t) - (js . t) - (lisp . t) - (python . t) - (sqlite . t) - (shell . t) - (plantuml . t) - (typescript . t) - (http . t)))) (use-package helpful :commands (helpful-callable helpful-variable helpful-command helpful-key) @@ -419,4 +325,5 @@ (use-package elpher) +(load "bundle--org") (load "bundle--irc")