diff options
-rw-r--r-- | init.el | 20 | ||||
-rw-r--r-- | lisp/+org.el | 47 | ||||
-rw-r--r-- | lisp/acdw.el | 2 |
3 files changed, 58 insertions, 11 deletions
diff --git a/init.el b/init.el index f7ce8db..f28da00 100644 --- a/init.el +++ b/init.el | |||
@@ -495,7 +495,9 @@ | |||
495 | "C-c C-l" #'+org-insert-link-dwim | 495 | "C-c C-l" #'+org-insert-link-dwim |
496 | "C-c C-n" #'+org-next-heading-widen | 496 | "C-c C-n" #'+org-next-heading-widen |
497 | "C-c C-p" #'+org-previous-heading-widen | 497 | "C-c C-p" #'+org-previous-heading-widen |
498 | "C-c C-o" #'+org-open-at-point-dwim) | 498 | "C-c C-o" #'+org-open-at-point-dwim |
499 | "`" #'+org-insert-tilde | ||
500 | "~" #'+org-insert-backtick) | ||
499 | (:local-hook user-save-hook #'+org-before-save@prettify-buffer) | 501 | (:local-hook user-save-hook #'+org-before-save@prettify-buffer) |
500 | (advice-add #'org-delete-backward-char :override #'+org-delete-backward-char) | 502 | (advice-add #'org-delete-backward-char :override #'+org-delete-backward-char) |
501 | ;; (define-advice org-open-at-point (:around (fn &rest r) open-external) | 503 | ;; (define-advice org-open-at-point (:around (fn &rest r) open-external) |
@@ -506,7 +508,9 @@ | |||
506 | (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) | 508 | (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) |
507 | #'+org-open-html) | 509 | #'+org-open-html) |
508 | (org-clock-persistence-insinuate) | 510 | (org-clock-persistence-insinuate) |
509 | (org-link-set-parameters "tel" :follow #'+org-tel-open)) | 511 | (org-link-set-parameters "tel" :follow #'+org-tel-open) |
512 | (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) | ||
513 | #'+org-open-html)) | ||
510 | ;; Extra keywords | 514 | ;; Extra keywords |
511 | (font-lock-add-keywords | 515 | (font-lock-add-keywords |
512 | 'org-mode | 516 | 'org-mode |
@@ -514,12 +518,12 @@ | |||
514 | ("^ *\\([-]\\) " | 518 | ("^ *\\([-]\\) " |
515 | (0 (compose-region (match-beginning 1) (match-end 1) "•"))) | 519 | (0 (compose-region (match-beginning 1) (match-end 1) "•"))) |
516 | ("^ *\\([+]\\) " | 520 | ("^ *\\([+]\\) " |
517 | (0 (compose-region (match-beginning 1) (match-end 1) "◦")))) | 521 | (0 (compose-region (match-beginning 1) (match-end 1) "◦"))))) |
518 | (with-eval-after-load 'form-feed | 522 | (with-eval-after-load 'form-feed |
519 | ;; Horizontal lines | 523 | ;; Horizontal lines |
520 | (font-lock-add-keywords | 524 | (font-lock-add-keywords |
521 | 'org-mode | 525 | 'org-mode |
522 | '(("^-----+" 0 'form-feed--font-lock-face t)))))) | 526 | '(("^-----+" . form-feed--font-lock-face))))) |
523 | 527 | ||
524 | (setup org-agenda | 528 | (setup org-agenda |
525 | (:option org-agenda-skip-deadline-if-done t | 529 | (:option org-agenda-skip-deadline-if-done t |
diff --git a/lisp/+org.el b/lisp/+org.el index 11a816f..57a4a16 100644 --- a/lisp/+org.el +++ b/lisp/+org.el | |||
@@ -451,10 +451,53 @@ the deletion might narrow the column." | |||
451 | (defun +org-open-html (file-path link-string) | 451 | (defun +org-open-html (file-path link-string) |
452 | "Open FILE-PATH with `browse-url'. | 452 | "Open FILE-PATH with `browse-url'. |
453 | This function is intended to use with `org-file-apps'. See the | 453 | This function is intended to use with `org-file-apps'. See the |
454 | documentation of that function for a description of the two | 454 | documentation of that function for a description of the two |
455 | arguments here, FILE-PATH and LINK-STRING." | 455 | arguments here, FILE-PATH and LINK-STRING." |
456 | (message "Opening %s (%s)..." file-path link-string) | 456 | (message "Opening %s (%s)..." file-path link-string) |
457 | (browse-url file-path)) | 457 | (browse-url file-path)) |
458 | 458 | ||
459 | (defun +org-insert-horizontal-rule (prefix) | ||
460 | "Insert a horizontal rule (-----) after the current line. | ||
461 | With PREFIX, insert before the current line." | ||
462 | (interactive "P") | ||
463 | (if prefix | ||
464 | (move-beginning-of-line nil) | ||
465 | (move-end-of-line nil) | ||
466 | (forward-line 1)) | ||
467 | (insert "-----\n")) | ||
468 | |||
469 | ;;; Make code snippets in org-mode easier to type | ||
470 | ;; http://mbork.pl/2022-01-17_Making_code_snippets_in_Org-mode_easier_to_type | ||
471 | |||
472 | (defun +org-insert-backtick () | ||
473 | "Insert a backtick using `org-self-insert-command'." | ||
474 | (interactive) | ||
475 | (setq last-command-event ?`) | ||
476 | (call-interactively #'org-self-insert-command)) | ||
477 | |||
478 | (defvar-local +org-insert-tilde-language nil | ||
479 | "Default language name in the current Org file. | ||
480 | If nil, `org-insert-tilde' after 2 tildes inserts an \"example\" | ||
481 | block. If a string, it inserts a \"src\" block with the given | ||
482 | language name.") | ||
483 | |||
484 | (defun +org-insert-tilde () | ||
485 | "Insert a tilde using `org-self-insert-command'." | ||
486 | (interactive) | ||
487 | (if (string= (buffer-substring-no-properties (- (point) 3) (point)) | ||
488 | "\n~~") | ||
489 | (progn (delete-char -2) | ||
490 | (if +org-insert-tilde-language | ||
491 | (insert (format "#+begin_src %s\n#+end_src" | ||
492 | +org-insert-tilde-language)) | ||
493 | (insert "#+begin_example\n#+end_example")) | ||
494 | (forward-line -1) | ||
495 | (if (string= +org-insert-tilde-language "") | ||
496 | (move-end-of-line nil) | ||
497 | ;;(org-edit-special) ; Useful really only with splits. | ||
498 | )) | ||
499 | (setq last-command-event ?~) | ||
500 | (call-interactively #'org-self-insert-command))) | ||
501 | |||
459 | (provide '+org) | 502 | (provide '+org) |
460 | ;;; +org.el ends here | 503 | ;;; +org.el ends here |
diff --git a/lisp/acdw.el b/lisp/acdw.el index a96e6a7..34d1bc4 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -128,7 +128,7 @@ I keep forgetting how they differ." | |||
128 | 128 | ||
129 | (defmacro +defvar (var value &rest _) | 129 | (defmacro +defvar (var value &rest _) |
130 | "Quick way to `setq' a variable from a `defvar' form." | 130 | "Quick way to `setq' a variable from a `defvar' form." |
131 | (declare (doc-string 3)) | 131 | (declare (doc-string 3) (indent 2)) |
132 | `(setq ,var ,value)) | 132 | `(setq ,var ,value)) |
133 | 133 | ||
134 | (defmacro +with-message (message &rest body) | 134 | (defmacro +with-message (message &rest body) |