about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-18 18:16:01 -0600
committerCase Duckworth2022-01-18 18:16:01 -0600
commit6852a7307a6f3a70d32b44d4971f98a343a64c59 (patch)
treec2044852a492ca622d6489881ff3482ab0476c73
parentAdd unworking sketch for fluid-width tabs (diff)
downloademacs-6852a7307a6f3a70d32b44d4971f98a343a64c59.tar.gz
emacs-6852a7307a6f3a70d32b44d4971f98a343a64c59.zip
Ahh
-rw-r--r--init.el22
-rw-r--r--lisp/+org.el47
-rw-r--r--lisp/acdw.el2
3 files changed, 58 insertions, 13 deletions
diff --git a/init.el b/init.el index e03e28f..0011380 100644 --- a/init.el +++ b/init.el
@@ -490,14 +490,14 @@
490 "|" "DONE(d!)") 490 "|" "DONE(d!)")
491 (sequence "|" "CANCELED(k!)") 491 (sequence "|" "CANCELED(k!)")
492 (sequence "MEETING(m)"))) 492 (sequence "MEETING(m)")))
493 (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal)
494 #'+org-open-html)
495 (:bind "RET" #'+org-return-dwim 493 (:bind "RET" #'+org-return-dwim
496 "<S-return>" #'+org-table-copy-down 494 "<S-return>" #'+org-table-copy-down
497 "C-c C-l" #'+org-insert-link-dwim 495 "C-c C-l" #'+org-insert-link-dwim
498 "C-c C-n" #'+org-next-heading-widen 496 "C-c C-n" #'+org-next-heading-widen
499 "C-c C-p" #'+org-previous-heading-widen 497 "C-c C-p" #'+org-previous-heading-widen
500 "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)
501 (:local-hook user-save-hook #'+org-before-save@prettify-buffer) 501 (:local-hook user-save-hook #'+org-before-save@prettify-buffer)
502 (advice-add #'org-delete-backward-char :override #'+org-delete-backward-char) 502 (advice-add #'org-delete-backward-char :override #'+org-delete-backward-char)
503 ;; (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 +506,9 @@
506 ;; (apply fn r))) 506 ;; (apply fn r)))
507 (with-eval-after-load 'org 507 (with-eval-after-load 'org
508 (org-clock-persistence-insinuate) 508 (org-clock-persistence-insinuate)
509 (org-link-set-parameters "tel" :follow #'+org-tel-open)) 509 (org-link-set-parameters "tel" :follow #'+org-tel-open)
510 (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal)
511 #'+org-open-html))
510 ;; Extra keywords 512 ;; Extra keywords
511 (font-lock-add-keywords 513 (font-lock-add-keywords
512 'org-mode 514 'org-mode
@@ -514,12 +516,12 @@
514 ("^ *\\([-]\\) " 516 ("^ *\\([-]\\) "
515 (0 (compose-region (match-beginning 1) (match-end 1) "•"))) 517 (0 (compose-region (match-beginning 1) (match-end 1) "•")))
516 ("^ *\\([+]\\) " 518 ("^ *\\([+]\\) "
517 (0 (compose-region (match-beginning 1) (match-end 1) "◦")))) 519 (0 (compose-region (match-beginning 1) (match-end 1) "◦")))))
518 (with-eval-after-load 'form-feed 520 (with-eval-after-load 'form-feed
519 ;; Horizontal lines 521 ;; Horizontal lines
520 (font-lock-add-keywords 522 (font-lock-add-keywords
521 'org-mode 523 'org-mode
522 '(("^-----+" 0 'form-feed--font-lock-face t)))))) 524 '(("^-----+" . form-feed--font-lock-face)))))
523 525
524(setup org-agenda 526(setup org-agenda
525 (:option org-agenda-skip-deadline-if-done t 527 (:option org-agenda-skip-deadline-if-done t
diff --git a/lisp/+org.el b/lisp/+org.el index 5869622..0f2c625 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -447,10 +447,53 @@ the deletion might narrow the column."
447(defun +org-open-html (file-path link-string) 447(defun +org-open-html (file-path link-string)
448 "Open FILE-PATH with `browse-url'. 448 "Open FILE-PATH with `browse-url'.
449This function is intended to use with `org-file-apps'. See the 449This function is intended to use with `org-file-apps'. See the
450documentation of that function for a description of the two 450 documentation of that function for a description of the two
451arguments here, FILE-PATH and LINK-STRING." 451 arguments here, FILE-PATH and LINK-STRING."
452 (message "Opening %s (%s)..." file-path link-string) 452 (message "Opening %s (%s)..." file-path link-string)
453 (browse-url file-path)) 453 (browse-url file-path))
454 454
455(defun +org-insert-horizontal-rule (prefix)
456 "Insert a horizontal rule (-----) after the current line.
457With PREFIX, insert before the current line."
458 (interactive "P")
459 (if prefix
460 (move-beginning-of-line nil)
461 (move-end-of-line nil)
462 (forward-line 1))
463 (insert "-----\n"))
464
465;;; Make code snippets in org-mode easier to type
466;; http://mbork.pl/2022-01-17_Making_code_snippets_in_Org-mode_easier_to_type
467
468(defun +org-insert-backtick ()
469 "Insert a backtick using `org-self-insert-command'."
470 (interactive)
471 (setq last-command-event ?`)
472 (call-interactively #'org-self-insert-command))
473
474(defvar-local +org-insert-tilde-language nil
475 "Default language name in the current Org file.
476If nil, `org-insert-tilde' after 2 tildes inserts an \"example\"
477block. If a string, it inserts a \"src\" block with the given
478language name.")
479
480(defun +org-insert-tilde ()
481 "Insert a tilde using `org-self-insert-command'."
482 (interactive)
483 (if (string= (buffer-substring-no-properties (- (point) 3) (point))
484 "\n~~")
485 (progn (delete-char -2)
486 (if +org-insert-tilde-language
487 (insert (format "#+begin_src %s\n#+end_src"
488 +org-insert-tilde-language))
489 (insert "#+begin_example\n#+end_example"))
490 (forward-line -1)
491 (if (string= +org-insert-tilde-language "")
492 (move-end-of-line nil)
493 ;;(org-edit-special) ; Useful really only with splits.
494 ))
495 (setq last-command-event ?~)
496 (call-interactively #'org-self-insert-command)))
497
455(provide '+org) 498(provide '+org)
456;;; +org.el ends here 499;;; +org.el ends here
diff --git a/lisp/acdw.el b/lisp/acdw.el index 17741ab..28ea108 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)