summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/org-config.el191
-rw-r--r--modules/prog-go.el5
2 files changed, 98 insertions, 98 deletions
diff --git a/modules/org-config.el b/modules/org-config.el
index 753b1092..555a966b 100644
--- a/modules/org-config.el
+++ b/modules/org-config.el
@@ -6,102 +6,6 @@
;;; Code:
-
-;; ---------------------------------- Org Mode ---------------------------------
-
-(use-package org
- :defer t
- :ensure nil ;; use the built-in package
- :pin manual ;; never upgrade from the version built-into Emacs
- :init
- (defvar-keymap cj/org-table-map
- :doc "org table operations.")
- (keymap-set cj/custom-keymap "T" cj/org-table-map)
- :bind
- ("C-c c" . org-capture)
- ("C-c a" . org-agenda)
- (:map org-mode-map
- ("C-c I" . org-table-field-info) ;; was C-c ?
- ("C-\\" . org-match-sparse-tree)
- ("C-c t" . org-set-tags-command)
- ("C-c l" . org-store-link)
- ("C-c C-l" . org-insert-link)
- ("s-<up>" . org-priority-up)
- ("s-<down>" . org-priority-down)
- ("C-c N" . org-narrow-to-subtree)
- ("C-c >" . cj/org-narrow-forward)
- ("C-c <" . cj/org-narrow-backwards)
- ("<f5>" . org-reveal)
- ("C-c <ESC>" . widen))
- (:map cj/org-table-map
- ("r i" . org-table-insert-row)
- ("r d" . org-table-kill-row)
- ("c i" . org-table-insert-column)
- ("c d" . org-table-delete-column))
-
- ;; backward and forward day are ',' and '.'
- ;; shift & meta moves by week or year
- ;; C-. jumps to today
- ;; original keybindings blocked by windmove keys
- ;; these are consistent with plain-old calendar mode
- (:map org-read-date-minibuffer-local-map
- ("," . (lambda () (interactive)
- (org-eval-in-calendar '(calendar-backward-day 1))))
- ("." . (lambda () (interactive)
- (org-eval-in-calendar '(calendar-forward-day 1))))
- ("<" . (lambda () (interactive)
- (org-eval-in-calendar '(calendar-backward-month 1))))
- (">" . (lambda () (interactive)
- (org-eval-in-calendar '(calendar-forward-month 1))))
- ("M-," . (lambda () (interactive)
- (org-eval-in-calendar '(calendar-backward-year 1))))
- ("M-." . (lambda () (interactive)
- (org-eval-in-calendar '(calendar-forward-year 1)))))
-
- :init
- ;; windmove's keybindings conflict with org-agenda-todo-nextset/previousset keybindings
- ;; solution: map the super key so that
- ;; - super up/down increases and decreases the priority
- ;; - super left/right changes the todo state
- (setq org-replace-disputed-keys t)
- (setq org-disputed-keys
- '(([(shift left)] . [(super left)])
- ([(shift right)] . [(super right)])
- ([(shift up)] . [(super up)])
- ([(shift down)] . [(super down)])
- ([(control shift right)] . [(meta shift +)])
- ([(control shift left)] . [(meta shift -)])))
-
- (defun cj/org-narrow-forward ()
- "Narrow to the next subtree at the same level."
- (interactive)
- (widen)
- (org-forward-heading-same-level 1)
- (org-narrow-to-subtree))
-
- (defun cj/org-narrow-backwards ()
- "Narrow to the previous subtree at the same level."
- (interactive)
- (widen)
- (org-backward-heading-same-level 1)
- (org-narrow-to-subtree))
-
- :hook
- (org-mode . turn-on-visual-line-mode)
- (org-mode . (lambda () (setq-local tab-width 8)))
-
- :config
- ;; Load org-protocol for org-protocol:// URL handling
- (require 'org-protocol nil t)
-
- ;; Set archive location (must be done after org loads)
- (setq org-archive-location
- (concat org-dir "/archives/archive.org::datetree/"))
-
- (cj/org-general-settings)
- (cj/org-appearance-settings)
- (cj/org-todo-settings))
-
;; ---------------------------- Org General Settings ---------------------------
(defun cj/org-general-settings ()
@@ -213,6 +117,101 @@
;; inherit parents properties (sadly not schedules or deadlines)
(setq org-use-property-inheritance t))
+;; ---------------------------------- Org Mode ---------------------------------
+
+(use-package org
+ :defer t
+ :ensure nil ;; use the built-in package
+ :pin manual ;; never upgrade from the version built-into Emacs
+ :init
+ (defvar-keymap cj/org-table-map
+ :doc "org table operations.")
+ (keymap-set cj/custom-keymap "T" cj/org-table-map)
+ :bind
+ ("C-c c" . org-capture)
+ ("C-c a" . org-agenda)
+ (:map org-mode-map
+ ("C-c I" . org-table-field-info) ;; was C-c ?
+ ("C-\\" . org-match-sparse-tree)
+ ("C-c t" . org-set-tags-command)
+ ("C-c l" . org-store-link)
+ ("C-c C-l" . org-insert-link)
+ ("s-<up>" . org-priority-up)
+ ("s-<down>" . org-priority-down)
+ ("C-c N" . org-narrow-to-subtree)
+ ("C-c >" . cj/org-narrow-forward)
+ ("C-c <" . cj/org-narrow-backwards)
+ ("<f5>" . org-reveal)
+ ("C-c <ESC>" . widen))
+ (:map cj/org-table-map
+ ("r i" . org-table-insert-row)
+ ("r d" . org-table-kill-row)
+ ("c i" . org-table-insert-column)
+ ("c d" . org-table-delete-column))
+
+ ;; backward and forward day are ',' and '.'
+ ;; shift & meta moves by week or year
+ ;; C-. jumps to today
+ ;; original keybindings blocked by windmove keys
+ ;; these are consistent with plain-old calendar mode
+ (:map org-read-date-minibuffer-local-map
+ ("," . (lambda () (interactive)
+ (org-eval-in-calendar '(calendar-backward-day 1))))
+ ("." . (lambda () (interactive)
+ (org-eval-in-calendar '(calendar-forward-day 1))))
+ ("<" . (lambda () (interactive)
+ (org-eval-in-calendar '(calendar-backward-month 1))))
+ (">" . (lambda () (interactive)
+ (org-eval-in-calendar '(calendar-forward-month 1))))
+ ("M-," . (lambda () (interactive)
+ (org-eval-in-calendar '(calendar-backward-year 1))))
+ ("M-." . (lambda () (interactive)
+ (org-eval-in-calendar '(calendar-forward-year 1)))))
+
+ :init
+ ;; windmove's keybindings conflict with org-agenda-todo-nextset/previousset keybindings
+ ;; solution: map the super key so that
+ ;; - super up/down increases and decreases the priority
+ ;; - super left/right changes the todo state
+ (setq org-replace-disputed-keys t)
+ (setq org-disputed-keys
+ '(([(shift left)] . [(super left)])
+ ([(shift right)] . [(super right)])
+ ([(shift up)] . [(super up)])
+ ([(shift down)] . [(super down)])
+ ([(control shift right)] . [(meta shift +)])
+ ([(control shift left)] . [(meta shift -)])))
+
+ (defun cj/org-narrow-forward ()
+ "Narrow to the next subtree at the same level."
+ (interactive)
+ (widen)
+ (org-forward-heading-same-level 1)
+ (org-narrow-to-subtree))
+
+ (defun cj/org-narrow-backwards ()
+ "Narrow to the previous subtree at the same level."
+ (interactive)
+ (widen)
+ (org-backward-heading-same-level 1)
+ (org-narrow-to-subtree))
+
+ :hook
+ (org-mode . turn-on-visual-line-mode)
+ (org-mode . (lambda () (setq-local tab-width 8)))
+
+ :config
+ ;; Load org-protocol for org-protocol:// URL handling
+ (require 'org-protocol nil t)
+
+ ;; Set archive location (must be done after org loads)
+ (setq org-archive-location
+ (concat org-dir "/archives/archive.org::datetree/"))
+
+ (cj/org-general-settings)
+ (cj/org-appearance-settings)
+ (cj/org-todo-settings))
+
;; ------------------------------- Org Superstar -------------------------------
(use-package org-superstar
diff --git a/modules/prog-go.el b/modules/prog-go.el
index 465cbf14..32f4edd8 100644
--- a/modules/prog-go.el
+++ b/modules/prog-go.el
@@ -88,6 +88,9 @@ Install with: go install github.com/go-delve/delve/cmd/dlv@latest")
(defun cj/go-mode-keybindings ()
"Set up keybindings for Go programming.
Overrides default prog-mode keybindings with Go-specific commands."
+ ;; C-; f: Format with gofmt/goimports
+ (local-set-key (kbd "C-; f") #'gofmt)
+
;; S-f5: Run staticcheck (static analysis)
(local-set-key (kbd "S-<f5>") #'cj/go-staticcheck)
@@ -100,8 +103,6 @@ Overrides default prog-mode keybindings with Go-specific commands."
(use-package go-mode
:hook ((go-ts-mode . cj/go-setup)
(go-ts-mode . cj/go-mode-keybindings))
- :bind (:map go-ts-mode-map
- ("C-; f" . gofmt)) ;; Override global formatter with gofmt/goimports
:mode (("\\.go\\'" . go-ts-mode) ;; .go files use go-ts-mode
("go\\.mod\\'" . go-mod-ts-mode)) ;; go.mod uses go-mod-ts-mode
:config