From c22a39f751c7344385f7aa680c5f3512eb1ae81e Mon Sep 17 00:00:00 2001 From: Akko Date: Wed, 9 Aug 2023 14:50:07 +0200 Subject: [PATCH] Idunnolol --- config.el | 47 +++++++++++++++++++------ custom.el | 3 ++ init.el | 5 +-- lisp/ob-ledger/ob-ledger.el | 68 +++++++++++++++++++++++++++++++++++++ packages.el | 5 +++ 5 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 lisp/ob-ledger/ob-ledger.el diff --git a/config.el b/config.el index c4949ca..97fd4cf 100644 --- a/config.el +++ b/config.el @@ -27,12 +27,12 @@ (setq avy-all-windows nil) (setq avy-timeout-seconds 0.2) (setq avy-keys '(?a ?s ?d ?f ?k ?l ?; ?g ?h - ?q ?w ?e ?r ?t ?y ?i ?p - ?A ?S ?D ?F ?J ?K ?L)) + ?q ?w ?e ?r ?t ?y ?i ?p + ?A ?S ?D ?F ?J ?K ?L)) (define-key evil-normal-state-map (kbd "C-.") #'avy-goto-char-timer) (setq aw-keys '(?a ?s ?d ?f ?k ?l ?; ?g ?h - ?q ?w ?e ?r ?t ?y ?i ?p - ?A ?S ?D ?F ?J ?K ?L)) + ?q ?w ?e ?r ?t ?y ?i ?p + ?A ?S ?D ?F ?J ?K ?L)) (define-key evil-normal-state-map (kbd ";") 'evil-ex) (define-key evil-normal-state-map (kbd "g a") 'paste-above) @@ -187,7 +187,7 @@ entry (org-publish-find-title entry project))) ((eq style 'tree) - (capitalize (file-name-nondirectory (directory-file-name entry)))) + (capitalize (file-name-nondirectory (directory-file-name entry)))) (t entry))) :headline-levels 4 @@ -213,14 +213,14 @@ ("static" :base-directory "~/Blog/static" - :base-extension "css\\|txt\\|jpg\\|gif\\|png\\|ttf" + :base-extension "css\\|txt\\|jpg\\|gif\\|png\\|ttf\\|js" :recursive t :publishing-directory "~/Blog/html/static" :publishing-function org-publish-attachment) ("blog" :components ("pages" "static"))))) - (setq org-publish-project-alist (akko/blog-spec)) +(setq org-publish-project-alist (akko/blog-spec)) (defun akko/publish-blog () (interactive) @@ -246,10 +246,10 @@ :trigger "__blog") (defun akko/org-current-time-string () - (with-temp-buffer - (org-mode) - (org-time-stamp '(16)) - (buffer-substring (point-min) (point-max)))) + (with-temp-buffer + (org-mode) + (org-time-stamp '(16)) + (buffer-substring (point-min) (point-max)))) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode)) @@ -260,3 +260,28 @@ (setq python-shell-interpreter "ipython" python-shell-interpreter-args "-i --simple-prompt") (setq python-shell-completion-native-disabled-interpreters '("ipython")) + +(setq org-roam-directory (file-truename "/mnt/tenma/srv/boymind")) +(org-roam-db-autosync-mode) + +(org-babel-do-load-languages + 'org-babel-load-languages + '((ledger . t) + )) + +(require 'elcord) +(elcord-mode) + +(use-package! org-roam + :config + (setq org-roam-database-connector 'sqlite3)) + +(add-to-list 'org-agenda-files "/mnt/tenma/srv/boymind/20230727221433-agenda_akko.org") + +(setq org-roam-capture-templates '(("d" "default" plain "%?" + :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("i" "inbox" plain "* TODO %?" + :target (node "inbox") + :unnarrowed t))) diff --git a/custom.el b/custom.el index 7d3c84f..1a338b7 100644 --- a/custom.el +++ b/custom.el @@ -3,6 +3,9 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. + '(elcord-editor-icon "emacs_icon") + '(elcord-idle-message "Conquering the Pyu city-states...") + '(elcord-mode t nil (elcord)) '(org-agenda-files '("~/org/tasks.org" "~/todo.org")) '(package-selected-packages '(polymode fish-mode solidity-mode yaml-mode bison-mode graphql-mode arduino-mode gdscript-mode speed-type ivy-posframe lsp-haskell treemacs key-chord)) diff --git a/init.el b/init.el index 7dd65ee..b085321 100644 --- a/init.el +++ b/init.el @@ -112,7 +112,7 @@ ;;assembly ; assembly for fun or debugging cc ; C/C++/Obj-C madness ;;clojure ; java with a lisp - ;;common-lisp ; if you've seen one lisp, you've seen them all + common-lisp ; if you've seen one lisp, you've seen them all ;;coq ; proofs-as-programs ;;crystal ; ruby at the speed of c ;;csharp ; unity, .NET, and mono shenanigans @@ -134,7 +134,7 @@ ;;kotlin ; a better, slicker Java(Script) ;;latex ; writing papers in Emacs has never been so fun ;;lean - ;;ledger ; an accounting system in Emacs + ledger ; an accounting system in Emacs lua ; one-based indices? one-based indices markdown ; writing docs for people to ignore ;;nim ; python + lisp at the speed of c @@ -155,6 +155,7 @@ ;;plantuml ; diagrams for confusing people more ;;purescript ; javascript, but functional (python ; beautiful is better than ugly + +conda +lsp) qt ; the 'cutest' gui framework ever racket ; a DSL for DSLs diff --git a/lisp/ob-ledger/ob-ledger.el b/lisp/ob-ledger/ob-ledger.el new file mode 100644 index 0000000..2be1a39 --- /dev/null +++ b/lisp/ob-ledger/ob-ledger.el @@ -0,0 +1,68 @@ +;;; ob-ledger.el --- Babel Functions for Ledger -*- lexical-binding: t; -*- + +;; Copyright (C) 2010-2020 Free Software Foundation, Inc. + +;; Author: Eric S Fraga +;; Keywords: literate programming, reproducible research, accounting +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating ledger entries. +;; +;; This differs from most standard languages in that +;; +;; 1) there is no such thing as a "session" in ledger +;; +;; 2) we are generally only going to return output from the ledger program +;; +;; 3) we are adding the "cmdline" header argument +;; +;; 4) there are no variables + +;;; Code: +(require 'ob) + +(defvar org-babel-default-header-args:ledger + '((:results . "output") (:cmdline . "bal")) + "Default arguments to use when evaluating a ledger source block.") + +(defun org-babel-execute:ledger (body params) + "Execute a block of Ledger entries with org-babel. This function is +called by `org-babel-execute-src-block'." + (message "executing Ledger source code block") + (let ((cmdline (cdr (assq :cmdline params))) + (in-file (org-babel-temp-file "ledger-")) + (out-file (org-babel-temp-file "ledger-output-"))) + (with-temp-file in-file (insert body)) + (message "%s" (concat "ledger" + " -f " (org-babel-process-file-name in-file) + " " cmdline)) + (with-output-to-string + (shell-command (concat "ledger" + " -f " (org-babel-process-file-name in-file) + " " cmdline + " > " (org-babel-process-file-name out-file)))) + (with-temp-buffer (insert-file-contents out-file) (buffer-string)))) + +(defun org-babel-prep-session:ledger (_session _params) + (error "Ledger does not support sessions")) + +(provide 'ob-ledger) + +;;; ob-ledger.el ends here diff --git a/packages.el b/packages.el index 5fe6d79..a87c451 100644 --- a/packages.el +++ b/packages.el @@ -10,3 +10,8 @@ (package! which-key) (package! org-mode :recipe (:repo "https://code.orgmode.org/bzg/org-mode.git")) (add-to-list 'load-path "./elfiles") + +(package! ledger-mode) +(package! ob-ledger :recipe (:local-repo "lisp/ob-ledger")) +(package! elcord) +(package! emacsql-sqlite3)