Added org-export details

ご主人様
not manx 4 years ago
parent c2b3a17c27
commit 5b29e6f18f
Signed by: C-xC-c
GPG Key ID: F52ED472284EF2F4

2
.gitignore vendored

@ -10,3 +10,5 @@ network-security.data
ido.last ido.last
recentf recentf
email.el email.el
org-export.el
projectile-bookmarks.eld

@ -16,9 +16,22 @@
:bind ("C-c r e" . 'keychain-refresh-environment) :bind ("C-c r e" . 'keychain-refresh-environment)
:init (keychain-refresh-environment)) :init (keychain-refresh-environment))
(use-package auto-minor-mode) (use-package ox-slimhtml)
(org-export-define-derived-backend 'custom-html-exporter
'slimhtml
:translate-alist
'((code . org-html-code)
(timestamp . org-html-timestamp)))
(use-package projectile
:config (projectile-mode 1))
(use-package diminish) (use-package diminish
:init
(diminish 'eldoc-mode)
(diminish 'org-src-mode))
(use-package auto-minor-mode)
(use-package company (use-package company
:diminish 'company-mode :diminish 'company-mode
@ -54,7 +67,7 @@
(slime-lisp-implementations (slime-lisp-implementations
'((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core") '((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core")
:env ("SBCL_HOME=/usr/lib64/sbcl/")))) :env ("SBCL_HOME=/usr/lib64/sbcl/"))))
:diminish 'slime-mode :diminish (slime-mode slime-autodoc-mode)
:init :init
(use-package slime-company) (use-package slime-company)
(add-hook 'lisp-mode-hook 'slime-mode) (add-hook 'lisp-mode-hook 'slime-mode)
@ -84,8 +97,6 @@
(dashboard-items '((recents . 5))) (dashboard-items '((recents . 5)))
:config (dashboard-setup-startup-hook)) :config (dashboard-setup-startup-hook))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
(use-package transpose-frame (use-package transpose-frame
:ensure t :ensure t
:bind (("C-c f t" . transpose-frame) :bind (("C-c f t" . transpose-frame)
@ -154,7 +165,12 @@
;; Don't indent whole file with org-mode ;; Don't indent whole file with org-mode
(eval-after-load "org-mode" (local-set-key (kbd "s-i") nil)) (eval-after-load "org-mode" (local-set-key (kbd "s-i") nil))
(add-to-list 'org-structure-template-alist '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")) (setq org-structure-template-alist
(append
'(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")
("lisp" "#+BEGIN_SRC lisp\n?\n#+END_SRC")
("sh" "#+BEGIN_SRC shell\n?\n#+END_SRC"))
org-structure-template-alist))
(setq org-src-tab-acts-natively t (setq org-src-tab-acts-natively t
org-edit-src-content-indentation 0 org-edit-src-content-indentation 0
@ -163,13 +179,63 @@
(setq org-html-doctype "html5") (setq org-html-doctype "html5")
(definteractive manx/save-org-to-html() (defun manx/eval-these (lang body)
(when (equal major-mode 'org-mode) (not (string-equal "\"\\n\"" body)))
(save-buffer)
(org-html-export-to-html))) (setq org-confirm-babel-evaluate 'manx/eval-these)
(add-hook 'org-mode-hook (defun manx-publish/local-dir (dir)
(local-keybind "C-c s h" manx/save-org-to-html)) (concat "~/Documents/org/" dir))
(defun manx-publish/remote-dir (dir)
(concat "/ssh:plum@plum.moe|sudo:78:" dir))
(defvar manx-publish/html-head "<link rel=\"stylesheet\" href=\"/static/css/style.css\" />")
(defun sitemap (title list)
(concat "#+title:" title "\n"
"#+setupfile:~/Documents/org/includes/setup.org\n\n"
(format "@@html:<h1>%s</h1>@@" title)
"@@html:<archive>@@"
(string-join (mapcar #'car (cdr list)))
"@@html:</archive>@@"))
(setq org-publish-project-alist
`(("plum"
:base-directory ,(manx-publish/local-dir "plum")
:publishing-directory ,(manx-publish/remote-dir "/var/www/plum.moe")
:publishing-function ox-slimhtml-publish-to-html
:html-head ,manx-publish/html-head
:recursive t)
("words"
:base-directory ,(manx-publish/local-dir "words")
:publishing-directory ,(manx-publish/remote-dir "/var/www/words.plum.moe")
:publishing-function ox-slimhtml-publish-to-html
:auto-sitemap t
:sitemap-filename "index.html"
:sitemap-title "Words by Manx"
:sitemap-sort-files anti-chronologically
:sitemap-file-entry-format "%d - %t"
:sitemap-function sitemap
:author-info t
:creator-info t
:html-head ,manx-publish/html-head)
("flags"
:base-directory ,(manx-publish/local-dir "flags")
:publishing-directory ,(manx-publish/remote-dir "/var/www/flags")
:publishing-function ox-slimhtml-publish-to-html
:html-head ,manx-publish/html-head)
("static"
:base-directory ,(manx-publish/local-dir "static")
:base-extension "css\\|js\\|svg"
:publishing-function org-publish-attachment
:recursive t
:publishing-directory ,(manx-publish/remote-dir "/var/www/plum.moe/static"))))
(definteractive manx/blog ()
(load-theme 'spacemacs-light)
(org-publish-project "words")
(load-theme 'spacemacs-dark))
(definteractive manx/delete-org-link () (definteractive manx/delete-org-link ()
(when (org-in-regexp org-bracket-link-regexp 1) (when (org-in-regexp org-bracket-link-regexp 1)
@ -193,6 +259,7 @@
(save-excursion (save-excursion
(indent-region (point-min) (point-max) nil))) (indent-region (point-min) (point-max) nil)))
(global-set-key (kbd "C-c M-w") (lambdainteractive () (kill-ring-save (point-min) (point-max))))
(global-set-key (kbd "C-c k l") 'manx/kill-line) (global-set-key (kbd "C-c k l") 'manx/kill-line)
(global-set-key (kbd "s-i") 'manx/format-whole-buffer) (global-set-key (kbd "s-i") 'manx/format-whole-buffer)
(global-set-key (kbd "C-c r b") 'revert-buffer) (global-set-key (kbd "C-c r b") 'revert-buffer)
@ -202,6 +269,10 @@
(switch-to-buffer (get-buffer-create "*scratch*")) (switch-to-buffer (get-buffer-create "*scratch*"))
(lisp-interaction-mode)) (lisp-interaction-mode))
(definteractive manx/lisp-buffer ()
(switch-to-buffer (get-buffer-create "*lisp playground*"))
(lisp-mode))
(definteractive manx/kill-all () (definteractive manx/kill-all ()
(mapc 'kill-buffer (buffer-list)) (mapc 'kill-buffer (buffer-list))
(manx/scratch-buffer)) (manx/scratch-buffer))

@ -34,13 +34,30 @@ Always ensure packages are installed. Log to ~*Messages*~.
:bind ("C-c r e" . 'keychain-refresh-environment) :bind ("C-c r e" . 'keychain-refresh-environment)
:init (keychain-refresh-environment)) :init (keychain-refresh-environment))
#+END_SRC #+END_SRC
** auto-minor-mode ** slimhtml
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package auto-minor-mode) (use-package ox-slimhtml)
(org-export-define-derived-backend 'custom-html-exporter
'slimhtml
:translate-alist
'((code . org-html-code)
(timestamp . org-html-timestamp)))
#+END_SRC
** projectile
#+BEGIN_SRC emacs-lisp
(use-package projectile
:config (projectile-mode 1))
#+END_SRC #+END_SRC
** diminish ** diminish
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package diminish) (use-package diminish
:init
(diminish 'eldoc-mode)
(diminish 'org-src-mode))
#+END_SRC
** auto-minor-mode
#+BEGIN_SRC emacs-lisp
(use-package auto-minor-mode)
#+END_SRC #+END_SRC
** company ** company
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -88,7 +105,7 @@ sbcl is in a werid place on Gentoo.
(slime-lisp-implementations (slime-lisp-implementations
'((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core") '((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core")
:env ("SBCL_HOME=/usr/lib64/sbcl/")))) :env ("SBCL_HOME=/usr/lib64/sbcl/"))))
:diminish 'slime-mode :diminish (slime-mode slime-autodoc-mode)
:init :init
(use-package slime-company) (use-package slime-company)
(add-hook 'lisp-mode-hook 'slime-mode) (add-hook 'lisp-mode-hook 'slime-mode)
@ -123,8 +140,6 @@ sbcl is in a werid place on Gentoo.
(dashboard-show-shortcuts nil) (dashboard-show-shortcuts nil)
(dashboard-items '((recents . 5))) (dashboard-items '((recents . 5)))
:config (dashboard-setup-startup-hook)) :config (dashboard-setup-startup-hook))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
#+END_SRC #+END_SRC
** windows and frames ** windows and frames
*** transpose-frame *** transpose-frame
@ -213,6 +228,7 @@ Also saves config if open. manx/emacs-org is defined in [[./init.el][init.el]]
** misc ** misc
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq org-src-window-setup 'current-window) (setq org-src-window-setup 'current-window)
(setq org-html-doctype "html5")
;; I read somewhere that Company breaks things? ;; I read somewhere that Company breaks things?
(add-hook 'org-mode-hook 'company-mode) (add-hook 'org-mode-hook 'company-mode)
@ -220,25 +236,18 @@ Also saves config if open. manx/emacs-org is defined in [[./init.el][init.el]]
;; Don't indent whole file with org-mode ;; Don't indent whole file with org-mode
(eval-after-load "org-mode" (local-set-key (kbd "s-i") nil)) (eval-after-load "org-mode" (local-set-key (kbd "s-i") nil))
(add-to-list 'org-structure-template-alist '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")) (setq org-structure-template-alist
(append
'(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")
("lisp" "#+BEGIN_SRC lisp\n?\n#+END_SRC")
("sh" "#+BEGIN_SRC shell\n?\n#+END_SRC"))
org-structure-template-alist))
(setq org-src-tab-acts-natively t (setq org-src-tab-acts-natively t
org-edit-src-content-indentation 0 org-edit-src-content-indentation 0
org-src-preserve-indentation nil org-src-preserve-indentation nil
org-agenda-files '("~/todo.org")) org-agenda-files '("~/todo.org"))
#+END_SRC #+END_SRC
** html export
#+BEGIN_SRC emacs-lisp
(setq org-html-doctype "html5")
(definteractive manx/save-org-to-html()
(when (equal major-mode 'org-mode)
(save-buffer)
(org-html-export-to-html)))
(add-hook 'org-mode-hook
(local-keybind "C-c s h" manx/save-org-to-html))
#+END_SRC
** Links ** Links
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(definteractive manx/delete-org-link () (definteractive manx/delete-org-link ()
@ -268,6 +277,7 @@ Also saves config if open. manx/emacs-org is defined in [[./init.el][init.el]]
(save-excursion (save-excursion
(indent-region (point-min) (point-max) nil))) (indent-region (point-min) (point-max) nil)))
(global-set-key (kbd "C-c M-w") (lambdainteractive () (kill-ring-save (point-min) (point-max))))
(global-set-key (kbd "C-c k l") 'manx/kill-line) (global-set-key (kbd "C-c k l") 'manx/kill-line)
(global-set-key (kbd "s-i") 'manx/format-whole-buffer) (global-set-key (kbd "s-i") 'manx/format-whole-buffer)
(global-set-key (kbd "C-c r b") 'revert-buffer) (global-set-key (kbd "C-c r b") 'revert-buffer)
@ -279,6 +289,10 @@ Also saves config if open. manx/emacs-org is defined in [[./init.el][init.el]]
(switch-to-buffer (get-buffer-create "*scratch*")) (switch-to-buffer (get-buffer-create "*scratch*"))
(lisp-interaction-mode)) (lisp-interaction-mode))
(definteractive manx/lisp-buffer ()
(switch-to-buffer (get-buffer-create "*lisp playground*"))
(lisp-mode))
(definteractive manx/kill-all () (definteractive manx/kill-all ()
(mapc 'kill-buffer (buffer-list)) (mapc 'kill-buffer (buffer-list))
(manx/scratch-buffer)) (manx/scratch-buffer))
@ -417,7 +431,6 @@ Null prefix argument turns off the mode."
(setq-local make-backup-files t) (setq-local make-backup-files t)
(auto-save-mode 1))) (auto-save-mode 1)))
;; Regexps of sensitive files. ;; Regexps of sensitive files.
(setq auto-minor-mode-alist (setq auto-minor-mode-alist
(append (append
@ -426,3 +439,4 @@ Null prefix argument turns off the mode."
("/etc/nginx/*" . sensitive-minor-mode)) ("/etc/nginx/*" . sensitive-minor-mode))
auto-minor-mode-alist)) auto-minor-mode-alist))
#+END_SRC #+END_SRC

@ -4,12 +4,35 @@
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(company-idle-delay 0)
'(company-minimum-prefix-length 3)
'(custom-safe-themes '(custom-safe-themes
(quote (quote
("bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" default)))) ("fa2b58bb98b62c3b8cf3b6f02f058ef7827a8e497125de0254f56e373abee088" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" default)))
'(dashboard-banner-logo-title "Komacs")
'(dashboard-center-content t)
'(dashboard-items (quote ((recents . 5))))
'(dashboard-set-init-info t)
'(dashboard-show-shortcuts nil)
'(dashboard-startup-banner "~/.emacs.d/Komacs.png")
'(ido-vertical-define-keys (quote C-n-and-C-p-only))
'(nginx-indent-level 2)
'(nginx-indent-tabs-mode t)
'(package-selected-packages
(quote
(rust-mode cargo flycheck-rust yasnippet-snippets which-key use-package transpose-frame switch-window spacemacs-theme spaceline slime-company projectile popup-kill-ring ox-slimhtml omnisharp nginx-mode keychain-environment ido-vertical-mode hungry-delete htmlize diminish dashboard company-auctex beacon avy auto-minor-mode alchemist)))
'(slime-lisp-implementations
(quote
((sbcl
("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core")
:env
("SBCL_HOME=/usr/lib64/sbcl/")))) t)
'(switch-window-increase 4 t)
'(switch-window-input-style (quote minibuffer))
'(switch-window-threshold 2))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "#292b2e" :foreground "#b2b2b2" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 110 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))) )

@ -1,4 +1,3 @@
;; required package fluff
(require 'package) (require 'package)
(setq package-enable-at-startup nil) (setq package-enable-at-startup nil)
(add-to-list 'package-archives (add-to-list 'package-archives
@ -25,12 +24,14 @@
(defconst manx/emacs-el (in-emacs-home "config.el")) (defconst manx/emacs-el (in-emacs-home "config.el"))
(defconst manx/emacs-org (in-emacs-home "config.org")) (defconst manx/emacs-org (in-emacs-home "config.org"))
(defconst manx/emacs-email (in-emacs-home "email.el")) (defconst manx/emacs-email (in-emacs-home "email.el"))
(defconst manx/org-export (in-emacs-home "export.el"))
;; If everything exists then execute files (when (and manx/emacs-el manx/emacs-org)
(unless (member nil '(custom-file manx/emacs-el manx/emacs-org manx/emacs-email))
(if (file-newer-than-file-p manx/emacs-org manx/emacs-el) (if (file-newer-than-file-p manx/emacs-org manx/emacs-el)
(org-babel-load-file manx/emacs-org) (org-babel-load-file manx/emacs-org)
(load manx/emacs-el 'noerror)) (load manx/emacs-el 'noerror)))
(load custom-file 'noerrror)
(load manx/emacs-email 'noerror)) ;; and this are needed when using emacsclient
(mapc (lambda (file)
(when file
(load file 'noerror)))
'(manx/emacs-email manx/org-export custom-file))

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: begin src
# key: src
# --
#+begin_src ${1:}
$0
#+end_src
Loading…
Cancel
Save