From 10c101dd62a0f7b32af3155d30b609f576e604e1 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Fri, 16 Sep 2022 17:45:59 -0800 Subject: [PATCH] Fix org-appear and get rid of pointless org-contrib --- lisp/mitch-orgstuff.el | 74 ++++++++++++++++++++++++++++++++++++++++++ lisp/mitch-packages.el | 21 +++++------- 2 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 lisp/mitch-orgstuff.el diff --git a/lisp/mitch-orgstuff.el b/lisp/mitch-orgstuff.el new file mode 100644 index 0000000..f5e303e --- /dev/null +++ b/lisp/mitch-orgstuff.el @@ -0,0 +1,74 @@ +;;; mitch-orgstuff.el --- Hacking on top of Org mode. + +;;; Commentary: + +;; Some of the things I want to do with org aren't built-in or intended. This +;; file is the cum total of my intent to implement these things. + +;;; Code: + +(defvar org-directory (expand-file-name "org/" "~")) +(defvar org-vw-dir org-directory) ;; whoops +(defvar org-wiki-regex + (rx (literal org-vw-dir) "/" (regexp ".+") ".org" eol)) + +(defun org-vw-get-filename (word) + "Given WORD, generate the absolute filename for that org-vw entry." + (expand-file-name (format "%s.org" (downcase word)) org-vw-dir)) +;; (org-vw-get-filename "wordWERD") + +(defun org-vw-make-newlink () + "Make the word at point the link to an org file, like in VimWiki." + (interactive) + (let* ((oldpoint (point)) + (current-word (thing-at-point 'word 'no-properties)) + (cw-file-name (org-vw-get-filename current-word))) + (backward-word) + (kill-word 1) + (org-insert-link nil cw-file-name current-word) + (goto-char oldpoint))) +;; (org-insert-link nil "~/" "a file or sth") + +(defun org-vw-show-markup () ;;broken, just use org-appear or sth + "When on a line containing hidden characters, show them." + (interactive) + (let ((point (point)) + (bol (point-at-bol)) + (eol (point-at-eol))) + (remove-text-properties bol eol + '(invisible nil)) + t)) +(defun org-vw-back () + "Go back to the previous org file and bury this buffer." + (interactive) + (if (buffer-modified-p) + (if (y-or-n-p "Do you want to save this file?") + (save-buffer))) + (bury-buffer) + (other-window 1)) + +(define-minor-mode org-vw-mode + "Org VimWiki mode." + :lighter " VW" + :keymap (make-sparse-keymap) + ;; This is a hack, because hyperbole is scary. Ideal implementation would add + ;; a proper case rather than this weird fallback. + (make-local-variable action-key-default-function) + (setq-local action-key-default-function #'org-vw-make-newlink) + ;; General: + (general-define-key + :keymaps 'local + :states 'normal + "DEL" 'org-vw-back)) +;; (add-to-list 'auto-mode-alist `(,org-wiki-regex . org-vw-mode)) +(add-hook 'org-mode-hook #'org-vw-mode) + +;; ------------------ ABANDON ALL SANITY, YE WHO ENTER HERE -------------------- + +;; Below, I attempt to generalize tangling a whole directory of org files into +;; whichever export format, and then apply that. + +(require 'ox-hugo) + +(provide 'mitch-orgstuff) +;;; mitch-orgstuff.el ends here diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index 44cac16..09194d3 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -482,6 +482,7 @@ targets." :custom (org-hide-leading-stars t) (org-startup-indented t) + (org-hide-emphasis-markers t) :config (add-hook 'after-save-hook #'(lambda () (if (equal major-mode 'org-mode) @@ -501,19 +502,15 @@ targets." :config (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-delimiter-face fixed-pitch)) :hook (org-mode . org-variable-pitch-minor-mode)) -(use-package org-contrib +(use-package org-appear + :hook (org-mode . org-appear-mode) :after org - :config - (org-babel-do-load-languages - 'org-babel-load-languages - '((powershell . t) - (shell . t) - ))) -;; (use-package org-appear -;; :hook (org-mode . org-appear-mode) -;; :after org -;; :custom -;; (org-appear-autolinks t)) + :custom + (org-appear-autolinks t) + (org-appear-autoemphasis t) + (org-appear-autoentities t) + (org-appear-autokeywords t) + (org-appear-autosubmarkers t)) (use-package ob-powershell :after org :custom