diff options
author | Case Duckworth | 2023-05-05 09:58:21 -0500 |
---|---|---|
committer | Case Duckworth | 2023-05-05 09:58:21 -0500 |
commit | 989171268461a0069ecd53a49e6098ce08638102 (patch) | |
tree | b88889d371152458f674c0a608222bf1192f3980 /lisp/acdw-org.el | |
parent | remove bad fiels (diff) | |
download | emacs-989171268461a0069ecd53a49e6098ce08638102.tar.gz emacs-989171268461a0069ecd53a49e6098ce08638102.zip |
changes use-package
Diffstat (limited to 'lisp/acdw-org.el')
-rw-r--r-- | lisp/acdw-org.el | 111 |
1 files changed, 83 insertions, 28 deletions
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index f961dda..2ec3339 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el | |||
@@ -137,19 +137,33 @@ itself. Other values of ARG will call `newline' with that ARG." | |||
137 | 137 | ||
138 | 138 | ||
139 | ;;; Copy rich text to the keyboard | 139 | ;;; Copy rich text to the keyboard |
140 | |||
140 | ;; Thanks to Oleh Krehel: | 141 | ;; Thanks to Oleh Krehel: |
141 | ;; https://emacs.stackexchange.com/questions/54292/copy-results-of-org-export-directly-to-clipboard | 142 | ;; https://emacs.stackexchange.com/questions/54292/copy-results-of-org-export-directly-to-clipboard |
142 | ;; So. Emacs can't do this itself because it doesn't support sending clipboard | 143 | ;; So. Emacs can't do this itself because it doesn't support sending clipboard |
143 | ;; or selection contents as text/html. We have to use xclip instead. | 144 | ;; or selection contents as text/html. We have to use xclip instead. |
145 | ;; (defun org-to-html-to-clipboard (&rest org-export-args) | ||
146 | ;; "Export current org buffer to HTML, then copy it to the clipboard. | ||
147 | ;; ORG-EXPORT-ARGS are passed to `org-export-to-file'." | ||
148 | ;; (let ((f (make-temp-file "org-html-export"))) | ||
149 | ;; (apply #'org-export-to-file 'html f org-export-args) | ||
150 | ;; (start-process "xclip" " *xclip*" | ||
151 | ;; "xclip" "-verbose" "-i" f | ||
152 | ;; "-t" "text/html" "-selection" "clipboard") | ||
153 | ;; (message "HTML pasted to clipboard."))) | ||
154 | |||
155 | ;; Wayland version.. TODO: make it work for both | ||
144 | (defun org-to-html-to-clipboard (&rest org-export-args) | 156 | (defun org-to-html-to-clipboard (&rest org-export-args) |
145 | "Export current org buffer to HTML, then copy it to the clipboard. | 157 | "Export current org buffer to HTML, then copy it to the clipboard. |
146 | ORG-EXPORT-ARGS are passed to `org-export-to-file'." | 158 | ORG-EXPORT-ARGS are passed to `org-export-to-file'." |
147 | (let ((f (make-temp-file "org-html-export"))) | 159 | (let ((buf (generate-new-buffer "*org-html-clipboard*" t))) |
148 | (apply #'org-export-to-file 'html f org-export-args) | 160 | (apply #'org-export-to-buffer 'html buf org-export-args) |
149 | (start-process "xclip" " *xclip*" | 161 | (with-current-buffer buf |
150 | "xclip" "-verbose" "-i" f | 162 | (call-process-region (point-min) (point-max) |
151 | "-t" "text/html" "-selection" "clipboard") | 163 | "wl-copy" nil nil nil |
152 | (message "HTML pasted to clipboard."))) | 164 | "-t" "text/html") |
165 | (kill-buffer-and-window)) | ||
166 | (message "HTML copied to clipboard."))) | ||
153 | 167 | ||
154 | (defun org-subtree-to-html-to-clipboard () | 168 | (defun org-subtree-to-html-to-clipboard () |
155 | "Export current subtree to HTML." | 169 | "Export current subtree to HTML." |
@@ -203,6 +217,33 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
203 | (when (org-at-heading-p) (org-align-tags)))))) | 217 | (when (org-at-heading-p) (org-align-tags)))))) |
204 | 218 | ||
205 | 219 | ||
220 | ;;; Navigating headings | ||
221 | |||
222 | (defun org-next-visible-heading-unfolding (arg) | ||
223 | (interactive "p") | ||
224 | (when (let ((pt (org-next-visible-heading arg))) | ||
225 | (and (buffer-narrowed-p) | ||
226 | (or (= (point) (point-min)) | ||
227 | (and pt | ||
228 | (= pt (point-max)))))) | ||
229 | (widen) | ||
230 | (org-next-visible-heading arg) | ||
231 | (org-narrow-to-subtree))) | ||
232 | |||
233 | (defun org-previous-visible-heading-unfolding (arg) | ||
234 | (interactive "p") | ||
235 | (org-next-visible-heading-unfolding (- arg))) | ||
236 | |||
237 | (defun org-up-heading-unfolding (arg) | ||
238 | (interactive "p") | ||
239 | (when (let ((pt (outline-up-heading arg))) | ||
240 | (and (buffer-narrowed-p) | ||
241 | (= (point) (point-min)))) | ||
242 | (widen) | ||
243 | (org-up-heading-unfolding arg) | ||
244 | (org-narrow-to-subtree))) | ||
245 | |||
246 | |||
206 | ;;; Misc. | 247 | ;;; Misc. |
207 | 248 | ||
208 | (defun org-clock-in-or-out (prefix) | 249 | (defun org-clock-in-or-out (prefix) |
@@ -261,19 +302,20 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
261 | org-archive-mark-done t | 302 | org-archive-mark-done t |
262 | org-fold-catch-invisible-edits 'show-and-error | 303 | org-fold-catch-invisible-edits 'show-and-error |
263 | org-clock-clocked-in-display 'mode-line | 304 | org-clock-clocked-in-display 'mode-line |
264 | org-clock-string-limit 7 ; just the clock bit | 305 | org-clock-string-limit 0 |
265 | org-clock-persist nil | 306 | org-clock-persist nil |
266 | org-confirm-babel-evaluate nil | 307 | org-confirm-babel-evaluate nil |
267 | org-cycle-separator-lines 0 | 308 | org-cycle-separator-lines 0 |
268 | org-deadline-warning-days 0 | 309 | org-deadline-warning-days 0 |
269 | org-directory (sync/ "org/" t) | 310 | org-directory (sync/ "org/" t) |
270 | org-ellipsis (or (bound-and-true-p truncate-string-ellipsis) "…") | 311 | org-ellipsis (or (bound-and-true-p truncate-string-ellipsis) "…") |
271 | org-emphasis-alist '(("*" org-bold) | 312 | org-emphasis-alist |
272 | ("/" org-italic) | 313 | '(("*" org-bold) |
273 | ("_" org-underline) | 314 | ("/" org-italic) |
274 | ("=" org-verbatim) | 315 | ("_" org-underline) |
275 | ("~" org-code) | 316 | ("=" org-verbatim) |
276 | ("+" org-strikethrough)) | 317 | ("~" org-code) |
318 | ("+" org-strikethrough)) | ||
277 | org-fontify-done-headline t | 319 | org-fontify-done-headline t |
278 | org-fontify-quote-and-verse-blocks t | 320 | org-fontify-quote-and-verse-blocks t |
279 | org-fontify-whole-heading-line t | 321 | org-fontify-whole-heading-line t |
@@ -320,6 +362,9 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
320 | (keymap-set org-mode-map "S-<return>" #'+org-table-copy-down|+org-return-dwim) | 362 | (keymap-set org-mode-map "S-<return>" #'+org-table-copy-down|+org-return-dwim) |
321 | (keymap-unset org-mode-map "C-'" t) | 363 | (keymap-unset org-mode-map "C-'" t) |
322 | (keymap-unset org-mode-map "C-," t) | 364 | (keymap-unset org-mode-map "C-," t) |
365 | (keymap-set org-mode-map "C-c C-n" #'org-next-visible-heading-unfolding) | ||
366 | (keymap-set org-mode-map "C-c C-p" #'org-previous-visible-heading-unfolding) | ||
367 | (keymap-set org-mode-map "C-c C-u" #'org-up-heading-unfolding) | ||
323 | ;; Hooks | 368 | ;; Hooks |
324 | (add-hook 'org-mode-hook | 369 | (add-hook 'org-mode-hook |
325 | (defun org-mode@setup () | 370 | (defun org-mode@setup () |
@@ -333,7 +378,8 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
333 | (add-hook 'before-save-hook | 378 | (add-hook 'before-save-hook |
334 | (defun before-save@org-mode@before-save () | 379 | (defun before-save@org-mode@before-save () |
335 | (org-align-tags 'all) | 380 | (org-align-tags 'all) |
336 | (+org-hide-drawers-except-point)) | 381 | (+org-hide-drawers-except-point) |
382 | ) | ||
337 | nil :local))) | 383 | nil :local))) |
338 | ;; Extra font-lock keywords | 384 | ;; Extra font-lock keywords |
339 | (font-lock-add-keywords | 385 | (font-lock-add-keywords |
@@ -353,13 +399,15 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
353 | ("<f8>" . org-clock-in-or-out)) | 399 | ("<f8>" . org-clock-in-or-out)) |
354 | :config | 400 | :config |
355 | (setopt org-clock-clocked-in-display 'mode-line | 401 | (setopt org-clock-clocked-in-display 'mode-line |
356 | global-mode-string | 402 | ;; global-mode-string |
357 | '((t jabber-activity-mode-string) | 403 | ;; '((t jabber-activity-mode-string) |
358 | (:eval (when (org-clocking-p) org-mode-line-string)) | 404 | ;; (:eval (when (org-clocking-p) org-mode-line-string)) |
359 | (display-time-mode display-time-string))) | 405 | ;; (display-time-mode display-time-string)) |
360 | (add-hook 'org-clock-in-hook (defun org-clock@remove-from-global-mode-string () | 406 | ) |
361 | (setq global-mode-string | 407 | ;; (add-hook 'org-clock-in-hook (defun org-clock@remove-from-global-mode-string () |
362 | (delq 'org-mode-line-string global-mode-string))))) | 408 | ;; (setq global-mode-string |
409 | ;; (delq 'org-mode-line-string global-mode-string)))) | ||
410 | ) | ||
363 | 411 | ||
364 | (use-package org-agenda | 412 | (use-package org-agenda |
365 | :bind (("C-c a" . org-agenda)) | 413 | :bind (("C-c a" . org-agenda)) |
@@ -372,7 +420,7 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
372 | (800 1000 1200 1400 1600 1800 2000) | 420 | (800 1000 1200 1400 1600 1800 2000) |
373 | " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") | 421 | " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") |
374 | org-agenda-current-time-string "← now ───────────────" | 422 | org-agenda-current-time-string "← now ───────────────" |
375 | org-agenda-include-diary t ; I use the org-diary features | 423 | org-agenda-include-diary nil ; I use the org-diary features |
376 | org-agenda-todo-ignore-deadlines 'near | 424 | org-agenda-todo-ignore-deadlines 'near |
377 | org-agenda-todo-ignore-scheduled 'future | 425 | org-agenda-todo-ignore-scheduled 'future |
378 | org-agenda-include-deadlines t | 426 | org-agenda-include-deadlines t |
@@ -397,7 +445,8 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
397 | '("WAIT" "MCKENZIE" "RACHEL"))))) | 445 | '("WAIT" "MCKENZIE" "RACHEL"))))) |
398 | (stuck "" ((org-agenda-overriding-header "Waiting")))) | 446 | (stuck "" ((org-agenda-overriding-header "Waiting")))) |
399 | ((org-agenda-files ',(list (progn (require 'chd) | 447 | ((org-agenda-files ',(list (progn (require 'chd) |
400 | (chd/ "inbox-chd.org")))))))) | 448 | (chd/ "inbox-chd.org")) |
449 | (sync/ "org/diary.org"))))))) | ||
401 | ;; Speedup agenda generation | 450 | ;; Speedup agenda generation |
402 | ;; https://orgmode.org/manual/Speeding-Up-Your-Agendas.html | 451 | ;; https://orgmode.org/manual/Speeding-Up-Your-Agendas.html |
403 | ;; https://orgmode.org/worg/agenda-optimization.html | 452 | ;; https://orgmode.org/worg/agenda-optimization.html |
@@ -409,7 +458,7 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
409 | (add-hook 'org-agenda-mode-hook #'truncate-lines-local-mode) | 458 | (add-hook 'org-agenda-mode-hook #'truncate-lines-local-mode) |
410 | (add-hook 'org-agenda-mode-hook #'hl-line-mode) | 459 | (add-hook 'org-agenda-mode-hook #'hl-line-mode) |
411 | (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree) | 460 | (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree) |
412 | (add-hook 'org-agenda-after-show-hook #'+org-hide-drawers-except-point) | 461 | ;; (add-hook 'org-agenda-after-show-hook #'+org-hide-drawers-except-point) |
413 | (define-advice org-agenda-files (:filter-return (files) skip-regexp) | 462 | (define-advice org-agenda-files (:filter-return (files) skip-regexp) |
414 | "Filter some files from `org-agenda'." | 463 | "Filter some files from `org-agenda'." |
415 | (when org-agenda-skip-file-regexp | 464 | (when org-agenda-skip-file-regexp |
@@ -420,11 +469,17 @@ If LIST is non-nil, return the result as a list instead of a string." | |||
420 | files))) | 469 | files))) |
421 | files) | 470 | files) |
422 | (define-advice org-agenda (:around (orig &rest r) inhibit-hooks) | 471 | (define-advice org-agenda (:around (orig &rest r) inhibit-hooks) |
423 | (let ((org-mode-hook nil)) | 472 | (dlet ((org-mode-hook nil)) |
473 | (apply orig r))) | ||
474 | (define-advice org-agenda-skip (:around (orig &rest r) fix-looking-at) | ||
475 | (dlet ((comment-start-skip "^\\s-*#\\(?: \\|$\\)")) | ||
424 | (apply orig r))) | 476 | (apply orig r))) |
477 | ;; (advice-remove 'org-agenda 'org-agenda@inhibit-hooks) | ||
425 | (define-advice org-agenda-switch-to (:after (&rest _) do-hooks) | 478 | (define-advice org-agenda-switch-to (:after (&rest _) do-hooks) |
426 | (run-hooks 'org-mode-hook)) | 479 | (run-hooks 'org-mode-hook)) |
427 | (progress@around org-agenda-list "Building agenda")) | 480 | (progress@around org-agenda-list "Building agenda") |
481 | (with-eval-after-load 'org-agenda | ||
482 | (add-to-list 'org-agenda-files (sync/ "org/diary.org")))) | ||
428 | 483 | ||
429 | (use-package org-capture | 484 | (use-package org-capture |
430 | :bind (("C-c c" . org-capture))) | 485 | :bind (("C-c c" . org-capture))) |
@@ -465,7 +520,7 @@ effect for exporting link types)." | |||
465 | org-export-with-toc nil)) | 520 | org-export-with-toc nil)) |
466 | 521 | ||
467 | (use-package org-word-count | 522 | (use-package org-word-count |
468 | :load-path "~/src/emacs/org-word-count/" | 523 | :load-path "~/src/org-word-count.el/" |
469 | :hook org-mode-hook) | 524 | :hook org-mode-hook) |
470 | 525 | ||
471 | (use-package org-modern | 526 | (use-package org-modern |
@@ -487,7 +542,7 @@ effect for exporting link types)." | |||
487 | 542 | ||
488 | (use-package org-taskwise | 543 | (use-package org-taskwise |
489 | :after org | 544 | :after org |
490 | :load-path "~/src/emacs/org-taskwise/") | 545 | :load-path "~/src/org-taskwise.el/") |
491 | 546 | ||
492 | (provide 'acdw-org) | 547 | (provide 'acdw-org) |
493 | ;;; acdw-org.el ends here | 548 | ;;; acdw-org.el ends here |