From 2dd3aed6971fe74915c1fc09b4de20a6c64e817b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 22 Apr 2024 12:23:13 -0500 Subject: New Custom Functions, Org Updates, Agenda Updates, &c. === Functions === - add function cj/dired-convert-image-to-jpeg - add function cj/dired-copy-path-as-kill - add function cj/export-org-to-md-on-save function - add function cj/org-link-to-current-file === Agenda === - rework the f8 main agenda into custom agenda using Aaron Bieber's ideas - agenda lists now use standard agenda functions - updated packages to remove org-super-agenda and ts (a dependency) - file commentary text updated to reflect the change === Org === - add grocery and shopping list capture items - add missing tests for org-skip-subtree-if-habit - add support for org-habits, including checkboxes - fix issue with org-auto-export-to-md - modularize org-agenda - move todo settings to org-config - reformat org-roam-config === &c. === - add day to sortable date - add disablefastrenderer to hugo server flags - add fill column indicator when emacs lisping - add gpt buffers to the bury-alive-list - add keybinding for fixup-whitespace - add magit cloning settings - finish automatically on "Link" capture - fix company complaints about shutting up function - fix em, e, ff, and f eshell aliases - make fallback theme modus-vivendi - prune the compilation cache when applicable --- modules/prog-general.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'modules/prog-general.el') diff --git a/modules/prog-general.el b/modules/prog-general.el index b6b58494..2338564f 100644 --- a/modules/prog-general.el +++ b/modules/prog-general.el @@ -141,6 +141,28 @@ If none exists, it opens magit-status." :bind ("C-c s i" . ivy-yasnippet)) +;; ----------------------- Export Org To Markdown On Save ---------------------- +;; if the file has the proper header, saving an org file will also export to +;; markdown with a timestamp. The header is this: +;; # -*- org-auto-export-to-md: t; -*- +;; #+DATE: +;; and is available as the org-export-md snippet + +(defvar org-auto-export-to-md nil) + +(defun cj/export-org-to-md-on-save () + "Export the current org file to Markdown format on save." + (when (and (eq major-mode 'org-mode) + org-auto-export-to-md) + (save-excursion + (goto-char (point-min)) + (search-forward "#+DATE:") + (kill-line) + (insert (format-time-string " %Y-%m-%d %H:%M")) + (org-md-export-to-markdown)))) + +(add-hook 'after-save-hook 'cj/export-org-to-md-on-save) + ;; --------------------- Display Color On Color Declaration -------------------- ;; display the actual color as highlight to color hex code -- cgit v1.2.3