From 3ba9390d3c5d15d17a6448a20a9f799c130c400a Mon Sep 17 00:00:00 2001 From: horhik Date: Mon, 17 Apr 2023 22:21:11 +0300 Subject: [PATCH] add org publish --- home/emacs/.emacs.d/config.org | 269 ++++++++++++++++++++++++++++----- 1 file changed, 227 insertions(+), 42 deletions(-) diff --git a/home/emacs/.emacs.d/config.org b/home/emacs/.emacs.d/config.org index 710b4da..17724bb 100644 --- a/home/emacs/.emacs.d/config.org +++ b/home/emacs/.emacs.d/config.org @@ -192,57 +192,68 @@ ** Fonts #+begin_src emacs-lisp +(add-to-list 'default-frame-alist + '(font . "Liberation Serif")) ;; Default fonts -(add-to-list 'default-frame-alist '(font . "Mononoki Nerd Font" )) -(set-face-attribute 'default t :font "Mononoki Nerd Font" ) -(set-frame-font "Mononoki Nerd Font 12" nil t) +;(add-to-list 'default-frame-alist '(font . "mononoki" )) +;(set-face-attribute 'default t :font "mononoki" ) +;(set-frame-font "mononoki" nil t) + ;;(set-fontset-font "fontset-startup" 'unicode -;; (font-spec :name "Mononoki Nerd Font" :size 14)) -(when (member "Twitter Color Emoji" (font-family-list)) - (set-fontset-font t 'unicode "Twitter Color Emoji" nil 'prepend)) - -(when (member "Twemoji" (font-family-list)) - (set-fontset-font t 'unicode "Twemoji" nil 'prepend)) +;; (font-spec :name "mononoki" :size 14)) +;(when (member "Twemoji" (font-family-list)) +; (set-fontset-font t 'unicode "Twemoji" nil 'prepend)) ;; โ˜บ๏ธ โ˜ป ๐Ÿ˜ƒ ๐Ÿ˜„ ๐Ÿ˜… ๐Ÿ˜† ๐Ÿ˜Š ๐Ÿ˜Ž ๐Ÿ˜‡ ๐Ÿ˜ˆ ๐Ÿ˜ ๐Ÿคฃ ๐Ÿคฉ ๐Ÿคช ๐Ÿฅณ ๐Ÿ˜ ๐Ÿ˜€ ๐Ÿ˜‚ ๐Ÿค  ๐Ÿคก ๐Ÿค‘ ๐Ÿค“ ๐Ÿค– ๐Ÿ˜— ๐Ÿ˜š ๐Ÿ˜˜ ๐Ÿ˜™ ๐Ÿ˜‰ ๐Ÿค— ๐Ÿ˜ ๐Ÿฅฐ ๐Ÿคค ๐Ÿ˜‹ ๐Ÿค” ๐Ÿคจ ๐Ÿง ๐Ÿคญ ๐Ÿคซ ๐Ÿ˜ฏ ๐Ÿค ๐Ÿ˜Œ ๐Ÿ˜– ๐Ÿ˜• ๐Ÿ˜ณ ๐Ÿ˜” ๐Ÿคฅ ๐Ÿฅด ๐Ÿ˜ฎ ๐Ÿ˜ฒ ๐Ÿคฏ ๐Ÿ˜ฉ ๐Ÿ˜ซ ๐Ÿฅฑ ๐Ÿ˜ช ๐Ÿ˜ด ๐Ÿ˜ต โ˜น๏ธ ๐Ÿ˜ฆ ๐Ÿ˜ž ๐Ÿ˜ฅ ๐Ÿ˜Ÿ ๐Ÿ˜ข ๐Ÿ˜ญ ๐Ÿคข ๐Ÿคฎ ๐Ÿ˜ท ๐Ÿค’ ๐Ÿค• ๐Ÿฅต ๐Ÿฅถ ๐Ÿฅบ ๐Ÿ˜ฌ ๐Ÿ˜“ ๐Ÿ˜ฐ ๐Ÿ˜จ ๐Ÿ˜ฑ ๐Ÿ˜’ ๐Ÿ˜  ๐Ÿ˜ก ๐Ÿ˜ค ๐Ÿ˜ฃ ๐Ÿ˜ง ๐Ÿคฌ ๐Ÿ˜ธ ๐Ÿ˜น ๐Ÿ˜บ ๐Ÿ˜ป ๐Ÿ˜ผ ๐Ÿ˜ฝ ๐Ÿ˜พ ๐Ÿ˜ฟ ๐Ÿ™€ ๐Ÿ™ˆ ๐Ÿ™‰ ๐Ÿ™Š ๐Ÿคฆ ๐Ÿคท ๐Ÿ™… ๐Ÿ™† ๐Ÿ™‹ ๐Ÿ™Œ ๐Ÿ™ ๐Ÿ™Ž ๐Ÿ™‡ ๐Ÿ™ ๐Ÿ‘ฏ ๐Ÿ’ƒ ๐Ÿ•บ ๐Ÿคณ ๐Ÿ’‡ ๐Ÿ’ˆ ๐Ÿ’† ๐Ÿง– ๐Ÿง˜ ๐Ÿง ๐ŸงŽ ๐Ÿ‘ฐ ๐Ÿคฐ ๐Ÿคฑ ๐Ÿ‘ถ ๐Ÿง’ ๐Ÿ‘ฆ ๐Ÿ‘ง ๐Ÿ‘ฉ ๐Ÿ‘จ ๐Ÿง‘ ๐Ÿง” ๐Ÿง“ ๐Ÿ‘ด ๐Ÿ‘ต ๐Ÿ‘ค ๐Ÿ‘ฅ ๐Ÿ‘ช ๐Ÿ‘ซ ๐Ÿ‘ฌ ๐Ÿ‘ญ ๐Ÿ‘ฑ ๐Ÿ‘ณ ๐Ÿ‘ฒ ๐Ÿง• ๐Ÿ‘ธ ๐Ÿคด ๐ŸŽ… ๐Ÿคถ ๐Ÿง ๐Ÿฆป ๐Ÿฆฎ ๐Ÿฆฏ ๐Ÿฆบ ๐Ÿฆผ ๐Ÿฆฝ ๐Ÿฆพ ๐Ÿฆฟ ๐Ÿคต ๐Ÿ‘ฎ ๐Ÿ‘ท ๐Ÿ’ ๐Ÿ’‚ ๐Ÿ•ด ๐Ÿ•ต๏ธ ๐Ÿฆธ ๐Ÿฆน ๐Ÿง™ ๐Ÿงš ๐Ÿงœ ๐Ÿง ๐Ÿงž ๐Ÿง› ๐ŸงŸ ๐Ÿ‘ผ ๐Ÿ‘ฟ ๐Ÿ‘ป ๐Ÿ‘น ๐Ÿ‘บ ๐Ÿ‘ฝ ๐Ÿ‘พ ๐Ÿ›ธ ๐Ÿ’€ โ˜ ๏ธ ๐Ÿ•ฑ ๐Ÿง  ๐Ÿฆด ๐Ÿ‘ ๐Ÿ‘€ ๐Ÿ‘‚ ๐Ÿ‘ƒ ๐Ÿ‘„ ๐Ÿ—ข ๐Ÿ‘… ๐Ÿฆท ๐Ÿฆต ๐Ÿฆถ ๐Ÿ’ญ ๐Ÿ—ฌ ๐Ÿ—ญ ๐Ÿ’ฌ ๐Ÿ—จ ๐Ÿ—ฉ ๐Ÿ’ฆ ๐Ÿ’ง ๐Ÿ’ข ๐Ÿ’ซ ๐Ÿ’ค ๐Ÿ’จ ๐Ÿ’ฅ ๐Ÿ’ช ๐Ÿ—ฒ ๐Ÿ”ฅ ๐Ÿ’ก ๐Ÿ’ฉ ๐Ÿ’ฏ ;; Fallback for emojies +;(set-frame-font "-UKWN-mononoki-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1") +;(add-to-list 'default-frame-alist '(font . "Liberation Sans" )) #+end_src emacs-lisp *** Font for text-mode #+begin_src emacs-lisp - (use-package mixed-pitch - :straight t - :hook - (text-mode . mixed-pitch-mode) - :config - (set-face-attribute 'default nil :font "Mononoki Nerd Font" :height 130) - (set-face-attribute 'fixed-pitch nil :font "Mononoki Nerd Font") - (set-face-attribute 'variable-pitch nil :font "FiraSans")) + ;; (use-package mixed-pitch + ;; :straight t + ;; :hook + ;; (text-mode . mixed-pitch-mode) + ;; :config + ;; (set-face-attribute 'default nil :font "mononoki" :height 130) + ;; (set-face-attribute 'fixed-pitch nil :font "mononoki") + ;; (set-face-attribute 'variable-pitch nil :font "mononoki")) + #+end_src * Keybindigs ** Defining smth #+begin_src emacs-lisp - (defun opt () - "open tasks" + (defun opt () + "open tasks" + (interactive) + (find-file "~/GTD/tasks.org")) + (defun opi () + "open inbox" + (interactive) + (find-file "~/GTD/inbox.org")) + (defun opd () + "open daily" (interactive) - (find-file "~/GTD/tasks.org")) - (defun opi () - "open inbox" - (interactive) - (find-file "~/GTD/inbox.org")) - (defun opd () - "open daily" + (find-file "~/GTD/daily.org")) + (defun opr () + "open readlist" (interactive) - (find-file "~/GTD/daily.org")) - (defun opr () - "open readlist" - (interactive) - (find-file "~/GTD/readlist.org")) -(defun opc () - "open readlist" - (interactive) - (find-file "~/.emacs.d/config.org")) + (find-file "~/GTD/readlist.org")) + (defun opc () + "open readlist" + (interactive) + (find-file "~/.emacs.d/config.org")) +(defun open-shoplist () + "open shoplist" + (interactive) + (find-file "~/GTD/shoplist.org")) +(defun open-projects () + "open projects" + (interactive) + (find-file "~/GTD/projects.org")) #+end_src ** Basic @@ -271,6 +282,8 @@ "t i" '(opi :which-key "๐Ÿ“ฅInbox") "t d" '(opd :which-key "๐ŸŒ„Daily") "t r" '(opr :which-key "๐Ÿ“šReadlist") + "t s" '(open-shoplist :which-key "๐Ÿ›’Shoplist") + "t p" '(open-projects :which-key "๐Ÿ“Projects") "SPC" 'counsel-M-x @@ -293,7 +306,7 @@ #+begin_src emacs-lisp (defun my/setup-org-margins() (setq visual-fill-column-center-text t) - (visual-fill-column-mode t) + ;(visual-fill-column-mode t) (visual-line-mode t) ) #+end_src @@ -334,7 +347,7 @@ (add-hook 'org-agenda-finalize-hook #'hl-line-mode) - (set-face-attribute 'org-document-title nil :font "mononoki" :weight 'bold :height 1.3) + (set-face-attribute 'org-document-title nil :font "Mononoki Nerd Font" :weight 'bold :height 1.3) ;; (dolist (face '((org-level-1 . 1.0) ;; (org-level-2 . 1.0) @@ -373,7 +386,7 @@ ;; Get rid of the background on column views (set-face-attribute 'org-column nil :background nil) (set-face-attribute 'org-column-title nil :background nil) - (setq org-src-fontify-natively t) + ;(setq org-src-fontify-natively t) (setq org-agenda-start-with-log-mode t) (setq org-log-done 'time) (setq org-log-into-drawer t) @@ -609,7 +622,7 @@ ("s-y" . org-download-yank))) :config - (setq-default org-download-image-dir "~/Notes/assets") + (setq-default org-download-image-dir ".") ) (general-define-key @@ -1182,7 +1195,179 @@ https://github.com/emacs-eaf/emacs-application-framework #+end_src * HOWM #+begin_src emacs-lisp -(use-package howm - :straight t - ) + (use-package howm + :straight t + ) +(global-set-key (kbd "C-x *") 'zoom) +#+end_src +* Orb Publish +** Setting up variables +#+begin_src emacs-lisp + (setq blog-path "~/Space/Code/Blog/") + (setq blog-static-path "~/Space/Code/Blog/html/") + (setq blog-content-path "~/Space/Code/Blog/html/") + (setq blog-templates "~/Space/Code/Blog/assets/templates/") +#+end_src +** Custom sections +#+begin_src emacs-lisp + (defun blog/html-postamble (plist) + "PLIST." + (concat (format + (with-temp-buffer + (insert-file-contents (concat blog-templates "postamble.html")) (buffer-string)) + (format-time-string this-date-format (plist-get plist :time)) (plist-get plist :creator)))) + + (defun blog/html-preamble (plist) + "PLIST: An entry." + (if (org-export-get-date plist this-date-format) + (plist-put plist + :subtitle (format "Published on %s by %s." + (org-export-get-date plist this-date-format) + (car (plist-get plist :author))))) + ;; Preamble + (with-temp-buffer + (insert-file-contents (concat blog-templates "preamble.html")) (buffer-string))) + + (defun blog/html-index-preamble (plist) + "PLIST: An entry." + (if (org-export-get-date plist this-date-format) + (plist-put plist + :subtitle (format "Published on %s by %s." + (org-export-get-date plist this-date-format) + (car (plist-get plist :author))))) + ;; Preamble + (with-temp-buffer + (insert-file-contents (concat blog-templates "index-preamble.html")) (buffer-string))) + +#+end_src +** Preambles and postambles +#+begin_center emacs-lisp +(setq index-preamble "
+

Segmentation Fail. Horhik's blog

+
+
") +(setq inner-preamble "
+

Horhik's blog

+
+
") + +(setq site-postamble "") +(setq org-html-preamble-format `(("en", inner-preamble))) +(setq org-html-postamble-format `(("en", site-postamble))) +#+end_center +** list +#+begin_src emacs-lisp + (require 'ox-publish) + + + (setq org-publish-project-alist + '( + ("blogposts" + :base-directory ,(concat blog-content-path "posts") + :base-extension "org" + :publishing-directory ,(concat blog-static-path "posts") + :publishing-function org-html-publish-to-html + :recursive t + :headline-levels 8 + :html-preamble blog/html-preamble + :html-postamble blog/html-postamble + :sitemap-filename "posts.org" + :sitemap-title "Blog Index" + :with-tags t + :with-toc t + :section-numbers: nil + :table-of-contents t + :html-head-include-default-style nil + ) + ("portfolio" + :base-directory "/home/horhik/Code/Blog/pages/portfolio/" + :base-extension "org" + :publishing-directory "/home/horhik/Code/Blog/html/" + :publishing-function org-html-publish-to-html + :headline-levels 8 + :html-preamble blog/html-preamble + :html-postamble blog/html-postamble + :sitemap-filename: "portfolio.org" + :sitemap-title: "Portfolio" + :validation-link nil + :table-of-contents nil + :html-head-include-default-style nil + ) + ("about" + :base-directory "/home/horhik/Code/Blog/pages/about/" + :base-extension "org" + :publishing-directory "/home/horhik/Code/Blog/html/about/" + :publishing-function org-html-publish-to-html + :recursive t + :headline-levels 8 + :html-preamble blog/html-preamble + :html-postamble blog/html-postamble + :validation-link nil + :table-of-contents nil + :html-head-include-default-style nil + ) + ("donate" + :base-directory "/home/horhik/Code/Blog/pages/donate" + :base-extension "org" + :publishing-directory "/home/horhik/Code/Blog/html/" + :publishing-function org-html-publish-to-html + :recursive t + :headline-levels 8 + :html-preamble blog/html-preamble + :html-postamble blog/html-postamble + :validation-link nil + :table-of-contents nil + :html-head-include-default-style nil + ) + ("projects" + :base-directory "/home/horhik/Code/Blog/pages/projects/" + :base-extension "org" + :publishing-directory "/home/horhik/Code/Blog/html/" + :publishing-function org-html-publish-to-html + :recursive t + :headline-levels 8 + :html-preamble blog/html-preamble + :html-postamble blog/html-postamble + :validation-link nil + :sitemap-filename "projects.org" + :sitemap-title "Projects" + :table-of-contents nil + :html-head-include-default-style nil + ) + ("blogstatic" + :base-directory "~Blog/pages/" + :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf" + :publishing-directory "/home/horhik/Code/Blog/html/" + :recursive t + :publishing-function org-publish-attachment + ) + ("index" + :base-directory "/home/horhik/Code/Blog/" + :base-extension "org" + :publishing-directory "/home/horhik/Code/Blog/html/" + :publishing-function org-html-publish-to-html + :auto-sitemap: t + :sitemap-filename "sitemap.org" + :sitemap-title "Sitemap" + :headline-levels 8 + :html-preamble blog/html-index-preamble + :html-postamble blog/html-postamble + ) + ("Blog" :components ("blogposts" "blogstatic" "projects" "portfolio" "about" "donate" "index")) + ) + ) #+end_src