diff options
author | Thanos Apollo <[email protected]> | 2025-03-15 15:43:08 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2025-03-15 15:43:08 +0200 |
commit | 86c0946e67fe923915cc12be34a46daa8cdec03a (patch) | |
tree | 975501fd53d83fe25fb671731eb2d48d68c3ed26 | |
parent | c59163a03feebbd8166cc5fc739d2972d468cded (diff) |
emacs: Update gnosis packages
-rw-r--r-- | .config/emacs/init.el | 114 |
1 files changed, 87 insertions, 27 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 7a6f502..0b48b91 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -620,6 +620,20 @@ (cl-loop for remote in remote-names do (async-shell-command (format "git push -u %s" remote) (format "Push for: %s" remote))))) + ;; forgejo agit workflow + (defun thanos/forgejo-pr-submit (title topic &optional branch) + (interactive (list (read-string "PR Title: ") + (read-string "Topic: "))) + (let* ((branch (or branch "main")) + (desc (read-string-from-buffer "PR Description" "")) + (git (executable-find "git"))) + (unless git + (error "Git path not found")) + (async-shell-command + (format + "%s push origin HEAD:refs/for/%s -o topic=\"%s\" -o title=\"%s\" -o description=\"%s\"" + git branch topic title desc) + "*forgejo PR*"))) :bind (:map vc-prefix-map ("b d" . 'vc-git-delete-branch) @@ -801,8 +815,10 @@ (setf erc-modules '(netsplit fill button match track completion readonly networks ring autojoin noncommands irccontrols move-to-prompt stamp - menu list log notifications) + menu list log) erc-log-channels-directory (expand-file-name "erc" user-emacs-directory)) + + (erc-notify-mode -1) (defun thanos/erc-login () "Login to libera.chat" @@ -912,7 +928,7 @@ '((:deck "Bulgarian" (:amnesia 0.55 :proto (0 1 3))) (:deck "Unking" (:amnesia 0.45)) (:tag "vocabulary" (:amnesia 0.65 :proto (0 1 3))))) - :bind (("C-c SPC" . 'thanos/gnosis-map) + :bind (("C-c ;" . 'thanos/gnosis-map) :map thanos/gnosis-map ("a" . 'gnosis-add-note) ("d" . 'gnosis-dashboard))) @@ -920,28 +936,72 @@ ;; Sync gnosis on startup (gnosis-vc-pull) + (use-package ucs-normalize + :after org-gnosis + :config + (defun thanos/strip-diacritics (s) + "Remove diacritics from string S." + (let ((decomposed (ucs-normalize-NFD-string s))) + (replace-regexp-in-string "\\p{Mn}+" "" decomposed)))) + (use-package org-gnosis :load-path "~/Dev/emacs-lisp/org-gnosis" :vc t :init (define-prefix-command 'thanos/notes-map) (define-prefix-command 'thanos/journal-map) - :config + :config + (setf org-gnosis-db (emacsql-sqlite-open + (expand-file-name "data.db" org-gnosis-dir))) + (setf org-gnosis-dir "~/Notes" + org-gnosis-node-templates + '(("Default" (lambda () "" "#+startup: content\n"))) org-gnosis-journal-templates - '(("Default" (lambda () - (format "\n* Body stats\nweight:\n\n* Daily Notes\n\n* Goals\n%s" - (org-gnosis-todos)))) - ("Empty" (lambda () ""))) + '(("2050 Plan" journal/plan-2050) + ("Empty" (lambda () "" "#+startup: content\n"))) org-gnosis-show-tags t ;; Create files as gpg - org-gnosis-create-as-gpg t) + org-gnosis-create-as-gpg t + ;; change database location + org-gnosis-completing-read-func #'thanos/completing-read) + + (defun thanos/completing-read (prompt collection) + "Prompt user with completing-read that ignores diacritics on completion. +Useful if you write in langs like Greek :)." + (let* ((stripped-alist (mapcar (lambda (item) + (cons (thanos/strip-diacritics item) item)) + collection)) + (map (let ((m (make-sparse-keymap))) + (set-keymap-parent m minibuffer-local-completion-map) + (define-key m " " #'self-insert-command) + m)) + (completion-table + (lambda (string pred action) + (if (eq action 'metadata) + '(metadata (category . diacritic-completion)) + (complete-with-action + action stripped-alist + (thanos/strip-diacritics string) pred)))) + (result (minibuffer-with-setup-hook + (lambda () (use-local-map map)) + (completing-read prompt completion-table)))) + (or (cdr (assoc result stripped-alist)) result))) (defun thanos/org-open-at-point () "Open Org link at point in the same window, if possible." (interactive) (let ((org-link-frame-setup '((file . find-file)))) - (org-open-at-point))) + (org-gnosis-goto-id))) + + (defun journal/plan-2050 () + "My journaling template for 2050-01-01." + (let ((days-remaining (- (time-to-days (encode-time 0 0 0 1 1 2050)) + (time-to-days (current-time))))) + (format + "\nἩμέραι ἓως ἔτους 2050: *%s* \n\n* Καταγραφή\n* Ὑπομνήματα Ἡμέρας\n* Στόχοι\n** Πίστη\n+ [ ] Πρωινὴ Προσευχή\n+ [ ] Ἑσπερινή Προσευχή\n** Agenda\n%s" + days-remaining (org-gnosis-todos)))) + :bind (("C-c n" . thanos/notes-map) ("C-c j" . thanos/journal-map) :map thanos/notes-map @@ -952,28 +1012,28 @@ ("j" . org-gnosis-journal) ("f" . org-gnosis-journal-find) ("i" . org-gnosis-journal-insert) - :map org-mode-map + :map org-gnosis-mode-map ("C-c C-." . org-gnosis-insert-tags) ("C-c i" . org-id-get-create) ("C-c C-o" . thanos/org-open-at-point))) - ;; (use-package org-gnosis-ui - ;; :load-path "~/Dev/emacs-lisp/org-gnosis-ui/" - ;; :after org-gnosis - ;; :config - ;; (setf org-gnosis-ui-custom-theme - ;; '((bg . "#1b1d1e") - ;; (bg-alt . "#282a36") - ;; (fg . "#ffffff") - ;; (fg-alt . "#c6daff") - ;; (red . "#ff5f5f") - ;; (orange . "#f1fa8c") - ;; (yellow . "#efef00") - ;; (green . "#44df44") - ;; (cyan . "#00eff0") - ;; (blue . "#338fff") - ;; (violet . "#9099d9") ;; indigo - ;; (magenta . "#ff66ff")))) + (use-package org-gnosis-ui + :load-path "~/Dev/emacs-lisp/org-gnosis-ui/" + :after org-gnosis + :config + (setf org-gnosis-ui-custom-theme + '((bg . "#1b1d1e") + (bg-alt . "#282a36") + (fg . "#ffffff") + (fg-alt . "#c6daff") + (red . "#ff5f5f") + (orange . "#f1fa8c") + (yellow . "#efef00") + (green . "#44df44") + (cyan . "#00eff0") + (blue . "#338fff") + (violet . "#9099d9") ;; indigo + (magenta . "#ff66ff")))) (use-package pcmpl-tailscale :vc t |