diff --git a/.gitignore b/.gitignore index d23a099..7f6df08 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ tramp network-security.data ido.last recentf -email.el \ No newline at end of file +email.el +org-export.el +projectile-bookmarks.eld \ No newline at end of file diff --git a/config.el b/config.el index efb98f5..83925a2 100644 --- a/config.el +++ b/config.el @@ -16,9 +16,22 @@ :bind ("C-c r e" . '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 :diminish 'company-mode @@ -54,7 +67,7 @@ (slime-lisp-implementations '((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core") :env ("SBCL_HOME=/usr/lib64/sbcl/")))) - :diminish 'slime-mode + :diminish (slime-mode slime-autodoc-mode) :init (use-package slime-company) (add-hook 'lisp-mode-hook 'slime-mode) @@ -84,8 +97,6 @@ (dashboard-items '((recents . 5))) :config (dashboard-setup-startup-hook)) -(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) - (use-package transpose-frame :ensure t :bind (("C-c f t" . transpose-frame) @@ -154,7 +165,12 @@ ;; Don't indent whole file with org-mode (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 org-edit-src-content-indentation 0 @@ -163,13 +179,63 @@ (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)) +(defun manx/eval-these (lang body) + (not (string-equal "\"\\n\"" body))) + +(setq org-confirm-babel-evaluate 'manx/eval-these) + +(defun manx-publish/local-dir (dir) + (concat "~/Documents/org/" dir)) + +(defun manx-publish/remote-dir (dir) + (concat "/ssh:plum@plum.moe|sudo:78:" dir)) + +(defvar manx-publish/html-head "") + +(defun sitemap (title list) + (concat "#+title:" title "\n" + "#+setupfile:~/Documents/org/includes/setup.org\n\n" + (format "@@html:

%s

@@" title) + "@@html:@@" + (string-join (mapcar #'car (cdr list))) + "@@html:@@")) + +(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 () (when (org-in-regexp org-bracket-link-regexp 1) @@ -193,6 +259,7 @@ (save-excursion (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 "s-i") 'manx/format-whole-buffer) (global-set-key (kbd "C-c r b") 'revert-buffer) @@ -202,6 +269,10 @@ (switch-to-buffer (get-buffer-create "*scratch*")) (lisp-interaction-mode)) +(definteractive manx/lisp-buffer () + (switch-to-buffer (get-buffer-create "*lisp playground*")) + (lisp-mode)) + (definteractive manx/kill-all () (mapc 'kill-buffer (buffer-list)) (manx/scratch-buffer)) @@ -212,9 +283,9 @@ (defmacro manx/split-and-follow (direction) `(progn - ,direction - (balance-windows) - (other-window 1))) + ,direction + (balance-windows) + (other-window 1))) (global-set-key (kbd "C-x 3") (lambdainteractive () (manx/split-and-follow (split-window-below)))) diff --git a/config.org b/config.org index 38c2311..d882e7f 100644 --- a/config.org +++ b/config.org @@ -34,13 +34,30 @@ Always ensure packages are installed. Log to ~*Messages*~. :bind ("C-c r e" . 'keychain-refresh-environment) :init (keychain-refresh-environment)) #+END_SRC -** auto-minor-mode +** slimhtml #+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 ** diminish #+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 ** company #+BEGIN_SRC emacs-lisp @@ -88,7 +105,7 @@ sbcl is in a werid place on Gentoo. (slime-lisp-implementations '((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core") :env ("SBCL_HOME=/usr/lib64/sbcl/")))) - :diminish 'slime-mode + :diminish (slime-mode slime-autodoc-mode) :init (use-package slime-company) (add-hook 'lisp-mode-hook 'slime-mode) @@ -123,8 +140,6 @@ sbcl is in a werid place on Gentoo. (dashboard-show-shortcuts nil) (dashboard-items '((recents . 5))) :config (dashboard-setup-startup-hook)) - -(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) #+END_SRC ** windows and frames *** transpose-frame @@ -213,6 +228,7 @@ Also saves config if open. manx/emacs-org is defined in [[./init.el][init.el]] ** misc #+BEGIN_SRC emacs-lisp (setq org-src-window-setup 'current-window) +(setq org-html-doctype "html5") ;; I read somewhere that Company breaks things? (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 (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 org-edit-src-content-indentation 0 org-src-preserve-indentation nil org-agenda-files '("~/todo.org")) #+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 #+BEGIN_SRC emacs-lisp (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 (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 "s-i") 'manx/format-whole-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*")) (lisp-interaction-mode)) +(definteractive manx/lisp-buffer () + (switch-to-buffer (get-buffer-create "*lisp playground*")) + (lisp-mode)) + (definteractive manx/kill-all () (mapc 'kill-buffer (buffer-list)) (manx/scratch-buffer)) @@ -417,7 +431,6 @@ Null prefix argument turns off the mode." (setq-local make-backup-files t) (auto-save-mode 1))) - ;; Regexps of sensitive files. (setq auto-minor-mode-alist (append @@ -426,3 +439,4 @@ Null prefix argument turns off the mode." ("/etc/nginx/*" . sensitive-minor-mode)) auto-minor-mode-alist)) #+END_SRC + diff --git a/custom.el b/custom.el index cdc3642..5d3bb59 100644 --- a/custom.el +++ b/custom.el @@ -4,12 +4,35 @@ ;; 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. + '(company-idle-delay 0) + '(company-minimum-prefix-length 3) '(custom-safe-themes (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 was added by Custom. ;; 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. - '(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"))))) + ) diff --git a/init.el b/init.el index 4813963..8c17952 100644 --- a/init.el +++ b/init.el @@ -1,4 +1,3 @@ -;; required package fluff (require 'package) (setq package-enable-at-startup nil) (add-to-list 'package-archives @@ -25,12 +24,14 @@ (defconst manx/emacs-el (in-emacs-home "config.el")) (defconst manx/emacs-org (in-emacs-home "config.org")) (defconst manx/emacs-email (in-emacs-home "email.el")) +(defconst manx/org-export (in-emacs-home "export.el")) -;; If everything exists then execute files -(unless (member nil '(custom-file manx/emacs-el manx/emacs-org manx/emacs-email)) +(when (and manx/emacs-el manx/emacs-org) (if (file-newer-than-file-p manx/emacs-org manx/emacs-el) (org-babel-load-file manx/emacs-org) - (load manx/emacs-el 'noerror)) - (load custom-file 'noerrror) - (load manx/emacs-email 'noerror)) ;; and this are needed when using emacsclient + (load manx/emacs-el 'noerror))) +(mapc (lambda (file) + (when file + (load file 'noerror))) + '(manx/emacs-email manx/org-export custom-file)) diff --git a/snippets/lisp-mode/defsystem b/snippets/lisp-mode/defsystem index 623988a..89d991c 100644 --- a/snippets/lisp-mode/defsystem +++ b/snippets/lisp-mode/defsystem @@ -4,11 +4,11 @@ # contributor: Manx # -- (asdf:defsystem #:${1:system-name} - :description "${2:none}" - :author "Manx (boku@plum.moe)" - :license ${3:"X11/MIT"} - :version "0.0.1" - :serial t - :depends-on ${4:} - :Components ${5:}) + :description "${2:none}" + :author "Manx (boku@plum.moe)" + :license ${3:"X11/MIT"} + :version "0.0.1" + :serial t + :depends-on ${4:} + :Components ${5:}) $0 \ No newline at end of file diff --git a/snippets/org-mode/src b/snippets/org-mode/src new file mode 100644 index 0000000..972a92e --- /dev/null +++ b/snippets/org-mode/src @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: begin src +# key: src +# -- +#+begin_src ${1:} +$0 +#+end_src