commit 5dad74bbe57ae192790f7e57a3befe85c8ca1109 Author: not manx Date: Thu Apr 30 15:07:06 2020 +0000 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d23a099 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +elpa +url +auto-save-list +autosaves +.cache +*~ +\#*# +tramp +network-security.data +ido.last +recentf +email.el \ No newline at end of file diff --git a/Komacs.png b/Komacs.png new file mode 100644 index 0000000..791129a Binary files /dev/null and b/Komacs.png differ diff --git a/bookmarks b/bookmarks new file mode 100644 index 0000000..31fc31f --- /dev/null +++ b/bookmarks @@ -0,0 +1,10 @@ +;;;; Emacs Bookmark Format Version 1 ;;;; +;;; This format is meant to be slightly human-readable; +;;; nevertheless, you probably don't want to edit it. +;;; -*- End Of Bookmark File Format Version Stamp -*- +(("org-refile-last-stored" + (filename . "~/todo.org") + (front-context-string) + (rear-context-string . " :prog:\n") + (position . 78)) +) \ No newline at end of file diff --git a/config.el b/config.el new file mode 100644 index 0000000..f35280a --- /dev/null +++ b/config.el @@ -0,0 +1,342 @@ +(defmacro definteractive (name &rest body) + `(defun ,name ,(car body) + (interactive) + ,@(cdr body))) + +(defmacro lambdainteractive (&rest body) + `(lambda ,(car body) (interactive) ,@(cdr body))) + +(defmacro local-keybind (key value) + `(lambda () (local-set-key (kbd ,key) (quote ,value)))) + +(definteractive manx/config-reload () + (when (get-buffer "config.org") + (with-current-buffer "config.org" (save-buffer))) + (org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) + +(global-set-key (kbd "C-c x r") 'manx/config-reload) +(global-set-key (kbd "C-c x e") (lambdainteractive ()(find-file "~/.emacs.d/config.org"))) + +(setq org-src-window-setup 'current-window) + +;; I read somewhere that Company breaks things? +(add-hook 'org-mode-hook 'company-mode) + +(setq org-structure-template-alist + (append + '(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") + ("js" "#+BEGIN_SRC javascript\n?\n#+END_SRC")) + org-structure-template-alist)) + +(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)) + +(definteractive manx/delete-org-link () + (if (org-in-regexp org-bracket-link-regexp 1) + (apply 'delete-region (list (match-beginning 0) (match-end 0))))) + +(add-hook 'org-mode-hook (local-keybind "C-c o l" manx/delete-org-link)) + +(setq org-image-actual-width 150) + +(definteractive manx/org-insert-link () + (org-insert-link) + (org-redisplay-inline-images)) + +(add-hook 'org-mode-hook (local-keybind "C-c C-l" manx/org-insert-link)) + +(tool-bar-mode -1) +(menu-bar-mode -1) +(scroll-bar-mode -1) +(line-number-mode 1) +(column-number-mode 1) +(display-battery-mode 1) + +(global-unset-key (kbd "C-z")) + +(definteractive manx/kill-whole-word () + (backward-word) + (kill-word 1)) + +(global-set-key (kbd "C-c k w") 'manx/kill-whole-word) + +(definteractive manx/kill-whole-line() + (move-beginning-of-line nil) + (kill-whole-line)) + +(global-set-key (kbd "C-c k l") 'manx/kill-whole-line) + +(global-set-key (kbd "C-c r b") 'revert-buffer) + +(definteractive manx/format-whole-buffer() + (save-excursion + (indent-region (point-min) (point-max) nil))) + +(global-set-key (kbd "s-i") 'manx/format-whole-buffer) + +(defun what-face (pos) + (interactive "d") + (let ((face (or (get-char-property (pos) 'read-face-name) + (get-char-property (pos) 'face)))) + (if face (message "Face: %s" face) (message "No face at %d" pos)))) + +(global-set-key (kbd "C-x k") (lambdainteractive () (kill-buffer (current-buffer)))) +(global-set-key (kbd "C-M-s-k") (lambdainteractive () (mapc 'kill-buffer (buffer-list)))) + +;; This is only used here for now but we should still more it some +;; time +(add-to-list 'load-path "~/.emacs.d/scripts/") + +(require 'transpose-frame) +(global-set-key (kbd "C-c f t") 'transpose-frame) +(global-set-key (kbd "C-c f i") 'flip-frame) +(global-set-key (kbd "C-c f o") 'flop-frame) + +(defmacro manx/split-and-follow (direction) + `(progn + ,direction + (balance-windows) + (other-window 1))) + +(global-set-key (kbd "C-x 3") (lambdainteractive () (manx/split-and-follow (split-window-below)))) +(global-set-key (kbd "C-x 2") (lambdainteractive () (manx/split-and-follow (split-window-horizontally)))) + +(setq use-package-always-ensure t + use-package-verbose t) + +(use-package keychain-environment + :bind ("C-c r e" . 'keychain-refresh-environment)) + +(use-package exwm + :bind ("s-k" . 'exwm-workspace-delete) + :config + (require 'exwm-config) + (require 'exwm-systemtray) + (exwm-systemtray-enable)) + +(use-package nginx-mode + :custom + (nginx-indent-tabs-mode t) + (nginx-indent-level 2) + :config (add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/" . nginx-mode))) + +(use-package diminish) + +(use-package company + :diminish 'company-mode + :bind (:map company-mode-map + ("C-c /" . 'yas-expand)) + :custom + (company-idle-delay 0) + (company-minimum-prefix-length 3) + :init (add-hook 'after-init-hook 'global-company-mode)) + +;; (use-package csharp-mode +;; :defer t) + +;; (use-package omnisharp +;; :defer t +;; :init (add-hook 'csharp-mode-hook 'omnisharp-mode)) + +;; (eval-after-load 'company +;; '(add-to-list 'company-backends 'company-omnisharp)) + +;; (add-hook 'csharp-mode #'company-mode) + +(use-package spaceline + :init + (require 'spaceline-config) + (setq powerline-default-seperator (quote arrow)) + (spaceline-spacemacs-theme) + :config (spaceline-toggle-buffer-size-off)) + +(use-package dashboard + :diminish (dashboard-mode page-break-lines-mode) + :custom + (dashboard-center-content t) + (dashboard-banner-logo-title "Komacs") + (dashboard-set-init-info t) + (dashboard-startup-banner "~/.emacs.d/Komacs.png") + (dashboard-show-shortcuts nil) + (dashboard-items '((recents . 5))) + :config (dashboard-setup-startup-hook)) + +(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) + +(use-package slime + :defer t + :custom + (slime-lisp-implementations + '((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core") + :env ("SBCL_HOME=/usr/lib64/sbcl/")))) + :diminish 'slime-mode + :init + (use-package slime-company) + (add-hook 'lisp-mode-hook 'slime-mode) + (slime-setup '(slime-fancy slime-company))) + +(use-package switch-window + :custom + (switch-window-input-style 'minibuffer) + (switch-window-increase 4) + (switch-window-threshold 2) + :bind ([remap other-window] . switch-window)) + +(use-package elixir-mode + :defer t + :config (use-package alchemist)) + +(use-package hungry-delete + :diminish 'hungry-delete-mode + :config (global-hungry-delete-mode 1))2 + +(use-package which-key + :diminish 'which-key-mode + :config (which-key-mode)) + +(use-package avy + :bind ("M-s" . avy-goto-char)) + +(use-package beacon + :diminish 'beacon-mode + :config (beacon-mode 1)) + +(use-package popup-kill-ring + :bind ("M-y" . popup-kill-ring)) + +(use-package yasnippet + :diminish 'yas-minor-mode +:bind + :init + (use-package yasnippet-snippets) + (yas-reload-all)) + +(add-hook 'html-mode-hook 'yas-minor-mode) +(add-hook 'LaTeX-mode-hook 'yas-minor-mode) +(add-hook 'emacs-lisp-mode 'yas-minor-mode) + +(setq ido-enable-flex-matching t + ido-create-new-buffer 'always + ido-everywhere 1) + +(use-package ido-vertical-mode + :bind ("C-l" . 'ido-reread-directory) + :custom + (ido-vertical-define-keys 'C-n-and-C-p-only) + :config + (ido-vertical-mode 1) + (ido-mode 1)) + +(defun unix-line-ends () + (let ((coding-str (symbol-name buffer-file-coding-system))) + (when (string-match "-\\(?:dos\\|mac\\)$" coding-str) + (set-buffer-file-coding-system 'unix)))) + +(add-hook 'find-file-hooks 'unix-line-ends) + +(setq locale-coding-system 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-selection-coding-system 'utf-8) +(prefer-coding-system 'utf-8) +(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) + +(defvar my-term-shell "/bin/bash") +(defadvice ansi-term (before force-bash) + (interactive (list my-term-shell))) +(ad-activate 'ansi-term) + +(global-set-key (kbd "") 'ansi-term) + +(show-paren-mode 1) +(electric-pair-mode t) +(global-hl-line-mode t) +(global-prettify-symbols-mode t) + +(defalias 'yes-or-no-p 'y-or-n-p) + +(setq scroll-conservatively 100 + x-select-enable-clipboard t + vc-follow-symlinks t) + +(setq backup-directory-alist + `(("." . ,(concat user-emacs-directory "autosaves")))) + +(add-hook 'doc-view-mode-hook 'auto-revert-mode) + +(setq tab-width 2 + indent-tabs-mode t) + +(defvaralias 'js-indent-level 'tab-width) +(defvaralias 'css-indent-offset 'tab-width) + +(defvar auto-minor-mode-alist () + "Alist of filename patterns vs correpsonding minor mode functions, see `auto-mode-alist' +All elements of this alist are checked, meaning you can enable multiple minor modes for the same regexp.") + +(defun enable-minor-mode-based-on-extension () + "Check file name against `auto-minor-mode-alist' to enable minor modes +the checking happens for all pairs in auto-minor-mode-alist" + (when buffer-file-name + (let ((name (file-name-sans-versions buffer-file-name)) + (remote-id (file-remote-p buffer-file-name)) + (case-fold-search auto-mode-case-fold) + (alist auto-minor-mode-alist)) + ;; Remove remote file name identification. + (when (and (stringp remote-id) + (string-match-p (regexp-quote remote-id) name)) + (setq name (substring name (match-end 0)))) + (while (and alist (caar alist) (cdar alist)) + (if (string-match-p (caar alist) name) + (funcall (cdar alist) 1)) + (setq alist (cdr alist)))))) + +(add-hook 'find-file-hook #'enable-minor-mode-based-on-extension) + +(define-minor-mode sensitive-minor-mode + "For sensitive files like password lists. +It disables backup creation and auto saving. + +With no argument, this command toggles the mode. +Non-null prefix argument turns on the mode. +Null prefix argument turns off the mode." + ;; The initial value. + nil + ;; The indicator for the mode line. + " Sensitive" + ;; The minor mode bindings. + nil + (if (symbol-value sensitive-minor-mode) + (progn + ;; disable backups + (set (make-local-variable 'backup-inhibited) t) + ;; disable auto-save + (if auto-save-default + (auto-save-mode -1))) + ;resort to default value of backup-inhibited + (kill-local-variable 'backup-inhibited) + ;resort to default auto save setting + (if auto-save-default + (auto-save-mode 1)))) + +;; Regexps of sensitive files. +(setq auto-minor-mode-alist + (append + '(("stream/manifest/.*\\.json$" . sensitive-minor-mode) + (".emacs.d/snippets/\\*$" . sensitive-minor-mode) + ("nginx/sites-(enabled|available)/*" . sensitive-minor-mode)) + auto-minor-mode-alist)) + +(add-hook 'emacs-lisp-mode-hook + (lambda () + (push + '("lambdainteractive" . ?Λ) prettify-symbols-alist))) + +(load "~/.emacs.d/email.el") diff --git a/config.html b/config.html new file mode 100644 index 0000000..cf12d6d --- /dev/null +++ b/config.html @@ -0,0 +1,1229 @@ + + + +config + + + + + + + +
+

config

+
+

Table of Contents

+
+ +
+
+
+

1 org

+
+
+

1.1 edit/reload config.org

+
+
+

1.1.1 edit

+
+
+ +
(defun manx/config-open ()
+	(interactive)
+	(find-file "~/.emacs.d/config.org"))
+(global-set-key (kbd "C-c x e") 'manx/config-open)
+
+
+
+
+
+

1.1.2 reload

+
+
+ +
(defun manx/config-reload ()
+	(interactive)
+	;; save buffer if it's been edited
+	(if (get-buffer "config.org")
+			(with-current-buffer "config.org" (save-buffer)))
+	(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
+(global-set-key (kbd "C-c x r") 'manx/config-reload)
+
+
+
+
+
+
+

1.2 src edit in current window

+
+
+ +
(setq org-src-window-setup 'current-window)
+
+
+
+
+
+

1.3 disable company-mode

+
+
+ +
(add-hook 'org-mode-hook 'company-mode)
+
+
+
+
+
+

1.4 Snippets

+
+
+ +
(setq org-structure-template-alist
+				(append
+				 '(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")
+					 ("js" "#+BEGIN_SRC javascript\n?\n#+END_SRC"))
+				 org-structure-template-alist))
+
+
+
+
+
+

1.5 html export

+
+
+

1.5.1 html5

+
+
+ +
(setq org-html-doctype "html5")
+
+
+
+
+
+

1.5.2 Save file as HTML

+
+
+ +
(defun manx/save-org-to-html()
+	(interactive)
+	(when (equal major-mode 'org-mode)
+		(save-buffer)
+		(org-html-export-to-html)))
+
+(add-hook 'org-mode-hook
+					(lambda () (local-set-key (kbd "C-c s h") 'manx/save-org-to-html)))
+
+
+
+
+
+
+

1.6 Links

+
+
+ +
(defun manx/delete-org-link ()
+	(interactive)
+	(if (org-in-regexp org-bracket-link-regexp 1)
+			(apply 'delete-region (list (match-beginning 0) (match-end 0)))))
+
+(add-hook 'org-mode-hook
+					(lambda () (local-set-key (kbd "C-c o l") 'manx/delete-org-link)))
+
+
+
+
+

1.6.1 Inline Images

+
+
+ +
(defun manx/org-insert-link()
+	(interactive)
+	(org-insert-link)
+	(org-redisplay-inline-images))
+
+
+(add-hook 'org-mode-hook
+					(lambda () (local-set-key (kbd "C-c C-l") 'manx/org-insert-link)))
+(setq org-image-actual-width 150)
+
+
+
+
+
+
+
+

2 emacs gui

+
+
+ +
(tool-bar-mode -1)
+(menu-bar-mode -1)
+(scroll-bar-mode -1)
+(line-number-mode 1)
+(column-number-mode 1)
+(display-battery-mode 1)
+
+(global-unset-key (kbd "C-z"))
+
+
+
+
+
+

3 functions

+
+
+

3.1 text

+
+
+

3.1.1 copy whole line

+
+
+ +
(defun copy-whole-line ()
+	(interactive)
+	(save-excursion
+		(kill-new
+					(buffer-substring
+					 (point-at-bol)
+					 (point-at-eol)))))
+(global-set-key (kbd "C-c k l") 'copy-whole-line)
+
+
+
+
+
+

3.1.2 kill whole word

+
+
+ +
(defun kill-whole-word ()
+	(interactive)
+	(backward-word)
+	(kill-word 1))
+(global-set-key (kbd "C-c k w") 'kill-whole-word)
+
+
+
+
+
+

3.1.3 kill whole line

+
+
+ +
(defun manx/kill-whole-line()
+	(interactive)
+	(move-beginning-of-line nil)
+	(kill-whole-line))
+(global-set-key (kbd "C-c k l") 'manx/kill-whole-line)
+
+
+
+
+
+

3.1.4 comment region

+
+
+ +
(defun manx/revert-buffer ()
+	(interactive)
+	(revert-buffer))
+
+(global-set-key (kbd "C-c r b") 'manx/revert-buffer)
+
+
+
+
+
+

3.1.5 yas-expand for when company decides to be shit

+
+
+ +
(global-set-key (kbd "C-c /") 'yas-expand)
+
+
+
+
+
+

3.1.6 Format whole file

+
+
+ +
(defun manx/format-whole-buffer()
+	(interactive)
+	(save-excursion
+		(indent-region (point-min) (point-max) nil)))
+(global-set-key (kbd "s-i") 'manx/format-whole-buffer)
+
+
+
+
+
+
+

3.2 buffers

+
+
+

3.2.1 kill current buffer

+
+
+ +
(defun kill-current-buffer()
+	(interactive)
+	(kill-buffer (current-buffer)))
+(global-set-key (kbd "C-x k") 'kill-current-buffer)
+
+
+
+
+
+

3.2.2 kill all buffers

+
+
+ +
(defun kill-all-buffers()
+	(interactive)
+	(mapc 'kill-buffer (buffer-list)))
+(global-set-key (kbd "C-M-s-k") 'kill-all-buffers)
+
+
+
+
+
+
+

3.3 frames

+
+
+

3.3.1 transpose frame

+
+
+ +
(global-set-key (kbd "C-c f t") 'transpose-frame)
+
+
+
+
+
+

3.3.2 flip frame

+
+
+ +
;; _f_rame fl_i_p
+(global-set-key (kbd "C-c f i") 'flip-frame)
+
+
+
+
+
+

3.3.3 flop frame

+
+
+ +
;; _f_rame fl_o_p
+(global-set-key (kbd "C-c f o") 'flop-frame)
+
+
+
+
+
+

3.3.4 split and follow vertically

+
+
+ +
(defun split-and-follow-vertical ()
+	(interactive)
+	(split-window-right)
+	(balance-windows)
+	(other-window 1))
+(global-set-key (kbd "C-x 3") 'split-and-follow-vertical)
+
+
+
+
+
+

3.3.5 split and follow hoizontally

+
+
+ +
(defun split-and-follow-horizontal ()
+	(interactive)
+	(split-window-below)
+	(balance-windows)
+	(other-window 1))
+(global-set-key (kbd "C-x 2") 'split-and-follow-horizontal)
+
+
+
+
+
+
+

3.4 EXWM workspace

+
+
+ +
(global-set-key (kbd "s-k") 'exwm-workspace-delete)
+
+
+
+
+
+
+

4 use-package

+
+
+

4.1 org-babel-http

+
+
+ +
(use-package ob-http
+	:ensure t)
+
+
+
+
+
+

4.2 exwm

+
+
+

4.2.1 install

+
+
+ +
(use-package exwm
+	:ensure t
+	:config
+	(require 'exwm-config)
+	(exwm-config-default))
+
+
+
+
+
+

4.2.2 system tray

+
+
+ +
(require 'exwm-systemtray)
+(exwm-systemtray-enable)
+
+
+
+
+
+
+

4.3 diminish

+
+

+Packages are diminished individually by use-package key, making +everything a bit more modular +

+
+ +
(use-package diminish
+	:ensure t)
+
+
+
+
+
+

4.4 company

+
+
+

4.4.1 company

+
+
+ +
(use-package company
+	:ensure t
+	:diminish 'company-mode
+	:config
+	(setq company-idle-delay 0)
+	(setq company-minimum-prefix-length 3)
+	:init (add-hook 'after-init-hook 'global-company-mode))
+
+
+
+
+
+

4.4.2 slime

+
+
+ +
(use-package slime-company
+	:ensure t
+	:diminish 'slime-mode)
+(slime-setup '(slime-fancy slime-company))
+
+
+
+
+
+

4.4.3 auctex

+
+
+ +
(use-package company-auctex
+	:ensure t)
+(company-auctex-init)
+
+
+
+
+
+
+

4.5 omnisharp

+
+
+ +
(use-package csharp-mode
+	:ensure t)
+
+(use-package omnisharp
+	:ensure t
+	:init (add-hook 'csharp-mode-hook 'omnisharp-mode))
+
+(eval-after-load 'company
+	'(add-to-list 'company-backends 'company-omnisharp))
+
+(add-hook 'csharp-mode #'company-mode)
+
+
+
+
+
+

4.6 auctex

+
+
+

4.6.1 auctex

+
+
+ +
(use-package tex
+	:ensure auctex)
+
+
+
+
+
+

4.6.2 indent

+
+
+ +
(setq LaTeX-item-indent 0)
+
+
+
+
+
+
+

4.7 spaceline

+
+
+ +
(use-package spaceline
+	:ensure t
+	:config
+	(require 'spaceline-config)
+	(setq powerline-default-seperator (quote arrow))
+	(spaceline-spacemacs-theme))
+
+(spaceline-toggle-buffer-size-off)
+
+
+
+
+
+

4.8 dashboard

+
+
+ +
(use-package dashboard
+	:ensure t
+	:config
+	(dashboard-setup-startup-hook)
+	(setq dashboard-center-content t
+				dashboard-items '((recents . 5))
+				dashboard-banner-logo-title "Okaeri ~"))
+
+
+
+
+
+

4.9 avy

+
+
+ +
(use-package avy
+	:ensure t
+	:bind ("M-s" . avy-goto-char))
+
+
+
+
+
+

4.10 which key

+
+
+ +
(use-package which-key
+	:ensure t
+	:diminish 'which-key-mode
+	:init (which-key-mode))
+
+
+
+
+
+

4.11 slime

+
+
+ +
(use-package slime
+	:ensure t
+	:init
+	(setq inferior-lisp-program "/usr/bin/sbcl")
+	(add-hook 'lisp-mode-hook 'slime-mode))
+
+
+
+
+
+

4.12 switch window

+
+
+ +
(use-package switch-window
+	:ensure t
+	:config
+	(setq switch-window-input-style 'minibuffer)
+	(setq switch-window-increase 4)
+	(setq switch-window-threshold 2)
+	:bind ([remap other-window] . switch-window))
+
+
+
+
+
+

4.13 popup kill ring

+
+
+ +
(use-package popup-kill-ring
+	:ensure t
+	:bind ("M-y" . popup-kill-ring))
+
+
+
+
+
+

4.14 minor modes

+
+
+

4.14.1 hungry delete

+
+
+ +
(use-package hungry-delete
+	:ensure t
+	:diminish 'hungry-delete-mode
+	:config (global-hungry-delete-mode 1))
+
+
+
+
+
+

4.14.2 symon

+
+
+ +
(use-package symon
+	:ensure t
+	:bind ("s-h" . symon-mode))
+
+
+
+
+
+

4.14.3 beacon

+
+
+ +
(use-package beacon
+	:ensure t
+	:diminish 'beacon-mode
+	:init (beacon-mode 1))
+
+
+
+
+
+

4.14.4 yasnippet

+
+
  1. package
    +
    + +
    (use-package yasnippet
    +	:ensure t
    +	:diminish 'yas-minor-mode
    +	:config (use-package yasnippet-snippets
    +						:ensure t)
    +	(yas-reload-all))
    +
    +
    +
    +
  2. +
  3. enable for major modes
    +
    + +
    (add-hook 'html-mode-hook 'yas-minor-mode)
    +(add-hook 'LaTeX-mode-hook 'yas-minor-mode)
    +(add-hook 'emacs-lisp-mode 'yas-minor-mode)
    +
    +
    +
    +
+
+
+
+

4.15 Javascript

+
+
+ +
(use-package js2-mode
+	:ensure t)
+
+
+
+
+
+
+

5 ido

+
+
+

5.1 Enable IDO

+
+
+ +
(setq ido-enable-flex-matching t)
+(setq ido-create-new-buffer 'always)
+(setq ido-everywhere 1)
+(ido-mode 1)
+(global-set-key (kbd "C-l") 'ido-reread-directory)
+
+
+
+
+
+

5.2 IDO vertical

+
+
+ +
(use-package ido-vertical-mode
+	:ensure t
+	:init (ido-vertical-mode 1))
+(setq ido-vertical-define-keys 'C-n-and-C-p-only)
+
+
+
+
+
+
+

6 misc

+
+
+

6.1 UTF8

+
+
+ +
(setq locale-coding-system 'utf-8)
+(set-terminal-coding-system 'utf-8)
+(set-keyboard-coding-system 'utf-8)
+(set-selection-coding-system 'utf-8)
+(prefer-coding-system 'utf-8)
+
+
+
+
+
+

6.2 terminal

+
+
+

6.2.1 Make bash implicit terminal

+
+
+ +
(defvar my-term-shell "/bin/bash")
+(defadvice ansi-term (before force-bash)
+	(interactive (list my-term-shell)))
+(ad-activate 'ansi-term)
+
+
+
+
+
+

6.2.2 open term with s-return

+
+
+ +
(global-set-key (kbd "<s-return>") 'ansi-term)
+
+
+
+
+
+
+

6.3 parenthesis matching

+
+
+ +
(show-paren-mode 1)
+
+
+
+
+
+

6.4 copy/paste

+
+
+ +
(setq x-select-enable-clipboard t)
+
+
+
+
+
+

6.5 y/n instead of yes/no

+
+
+ +
(defalias 'yes-or-no-p 'y-or-n-p)
+
+
+
+
+
+

6.6 electric pair mode

+
+
+ +
(electric-pair-mode t)
+
+
+
+
+
+

6.7 scroll line by line

+
+
+ +
(setq scroll-conservatively 100)
+
+
+
+
+
+

6.8 highlight line

+
+
+ +
(global-hl-line-mode t)
+
+
+
+
+
+

6.9 prettify symbols

+
+
+ +
(global-prettify-symbols-mode t)
+
+
+
+
+
+

6.10 docView auto reload

+
+
+ +
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
+
+
+
+
+
+

6.11 Indentation

+
+
+ +
(setq-default tab-width 2)
+(setq-default indent-tabs-mode t)
+(defvaralias 'js-indent-level 'tab-width)
+(defvaralias js2-basic-offset 'tab-width)
+(defvaralias 'css-indent-offset 'tab-width)
+
+
+
+
+
+
+

7 auto-minor-mode

+
+

+auto-mode-alist but for minor modes. +

+ +

+For example, used with sensitive-mode to not create backups +(path/to/file~) when creating yasnippets +

+
+ +
(defvar auto-minor-mode-alist ()
+	"Alist of filename patterns vs correpsonding minor mode functions, see `auto-mode-alist'
+All elements of this alist are checked, meaning you can enable multiple minor modes for the same regexp.")
+
+(defun enable-minor-mode-based-on-extension ()
+	"Check file name against `auto-minor-mode-alist' to enable minor modes
+the checking happens for all pairs in auto-minor-mode-alist"
+	(when buffer-file-name
+		(let ((name (file-name-sans-versions buffer-file-name))
+					(remote-id (file-remote-p buffer-file-name))
+					(case-fold-search auto-mode-case-fold)
+					(alist auto-minor-mode-alist))
+			;; Remove remote file name identification.
+			(when (and (stringp remote-id)
+								 (string-match-p (regexp-quote remote-id) name))
+				(setq name (substring name (match-end 0))))
+			(while (and alist (caar alist) (cdar alist))
+				(if (string-match-p (caar alist) name)
+						(funcall (cdar alist) 1))
+				(setq alist (cdr alist))))))
+
+(add-hook 'find-file-hook #'enable-minor-mode-based-on-extension)
+
+
+
+
+
+

8 sensitive-minor-mode

+
+
+ +
(define-minor-mode sensitive-minor-mode
+	"For sensitive files like password lists.
+It disables backup creation and auto saving.
+
+With no argument, this command toggles the mode.
+Non-null prefix argument turns on the mode.
+Null prefix argument turns off the mode."
+	;; The initial value.
+	nil
+	;; The indicator for the mode line.
+	" Sensitive"
+	;; The minor mode bindings.
+	nil
+	(if (symbol-value sensitive-minor-mode)
+			(progn
+				;; disable backups
+				(set (make-local-variable 'backup-inhibited) t) 
+				;; disable auto-save
+				(if auto-save-default
+						(auto-save-mode -1)))
+		;resort to default value of backup-inhibited
+		(kill-local-variable 'backup-inhibited)
+		;resort to default auto save setting
+		(if auto-save-default
+				(auto-save-mode 1))))
+
+;; Regexps of sensitive files.
+(setq auto-minor-mode-alist
+			(append
+			 '(("stream/manifest/.*\\.json$" . sensitive-minor-mode)
+				 (".emacs.d/snippets/\*$" . sensitive-minor-mode))
+			 auto-minor-mode-alist))
+
+
+
+
+
+

9 unix line endings

+
+
+ +
(defun unix-line-ends ()
+	(let ((coding-str (symbol-name buffer-file-coding-system)))
+		(when (string-match "-\\(?:dos\\|mac\\)$" coding-str)
+			(set-buffer-file-coding-system 'unix))))
+
+(add-hook 'find-file-hooks 'unix-line-ends)
+
+
+ + +
+ +
new Date().getSeconds();
+
+
+
+
+
+
+

Created: 2020-04-03 Fri 18:59

+

Emacs 24.5.1 (Org mode 8.2.10)

+

Validate

+
+ + diff --git a/config.org b/config.org new file mode 100644 index 0000000..f22c009 --- /dev/null +++ b/config.org @@ -0,0 +1,455 @@ +* macros +** definteractive +Wrappers around functions and lambdas so I don't have to type +(interactive) all the damn time +#+BEGIN_SRC emacs-lisp + (defmacro definteractive (name &rest body) + `(defun ,name ,(car body) + (interactive) + ,@(cdr body))) + + (defmacro lambdainteractive (&rest body) + `(lambda ,(car body) (interactive) ,@(cdr body))) +#+END_SRC +** local-keybind +Hide unecessary lambda when calling (local-set-key) for org-mode +functions +#+BEGIN_SRC emacs-lisp + (defmacro local-keybind (key value) + `(lambda () (local-set-key (kbd ,key) (quote ,value)))) +#+END_SRC +* org +** edit/reload config.org +Saves config.org if it's open then reloads the file. +#+BEGIN_SRC emacs-lisp + (definteractive manx/config-reload () + (when (get-buffer "config.org") + (with-current-buffer "config.org" (save-buffer))) + (org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) + + (global-set-key (kbd "C-c x r") 'manx/config-reload) + (global-set-key (kbd "C-c x e") (lambdainteractive ()(find-file "~/.emacs.d/config.org"))) +#+END_SRC +** misc +#+BEGIN_SRC emacs-lisp + (setq org-src-window-setup 'current-window) + + ;; I read somewhere that Company breaks things? + (add-hook 'org-mode-hook 'company-mode) +#+END_SRC +** Snippets +#+BEGIN_SRC emacs-lisp + (setq org-structure-template-alist + (append + '(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") + ("js" "#+BEGIN_SRC javascript\n?\n#+END_SRC")) + org-structure-template-alist)) +#+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 () + (if (org-in-regexp org-bracket-link-regexp 1) + (apply 'delete-region (list (match-beginning 0) (match-end 0))))) + + (add-hook 'org-mode-hook (local-keybind "C-c o l" manx/delete-org-link)) +#+END_SRC +*** Inline Images +#+BEGIN_SRC emacs-lisp + (setq org-image-actual-width 150) + + (definteractive manx/org-insert-link () + (org-insert-link) + (org-redisplay-inline-images)) + + (add-hook 'org-mode-hook (local-keybind "C-c C-l" manx/org-insert-link)) +#+END_SRC +* emacs gui +#+BEGIN_SRC emacs-lisp + (tool-bar-mode -1) + (menu-bar-mode -1) + (scroll-bar-mode -1) + (line-number-mode 1) + (column-number-mode 1) + (display-battery-mode 1) + + (global-unset-key (kbd "C-z")) +#+END_SRC +* functions +** text +*** kill whole word +#+BEGIN_SRC emacs-lisp + (definteractive manx/kill-whole-word () + (backward-word) + (kill-word 1)) + + (global-set-key (kbd "C-c k w") 'manx/kill-whole-word) +#+END_SRC +*** kill whole line +#+BEGIN_SRC emacs-lisp + (definteractive manx/kill-whole-line() + (move-beginning-of-line nil) + (kill-whole-line)) + + (global-set-key (kbd "C-c k l") 'manx/kill-whole-line) +#+END_SRC +*** revert buffer +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-c r b") 'revert-buffer) +#+END_SRC +*** Format whole file +#+BEGIN_SRC emacs-lisp + (definteractive manx/format-whole-buffer() + (save-excursion + (indent-region (point-min) (point-max) nil))) + + (global-set-key (kbd "s-i") 'manx/format-whole-buffer) +#+END_SRC +*** colour under cursor +#+BEGIN_SRC emacs-lisp + (defun what-face (pos) + (interactive "d") + (let ((face (or (get-char-property (pos) 'read-face-name) + (get-char-property (pos) 'face)))) + (if face (message "Face: %s" face) (message "No face at %d" pos)))) +#+END_SRC +** buffers +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-x k") (lambdainteractive () (kill-buffer (current-buffer)))) + (global-set-key (kbd "C-M-s-k") (lambdainteractive () (mapc 'kill-buffer (buffer-list)))) +#+END_SRC +** frames +*** transpose-frame +#+BEGIN_SRC emacs-lisp + ;; This is only used here for now but we should still more it some + ;; time + (add-to-list 'load-path "~/.emacs.d/scripts/") + + (require 'transpose-frame) + (global-set-key (kbd "C-c f t") 'transpose-frame) + (global-set-key (kbd "C-c f i") 'flip-frame) + (global-set-key (kbd "C-c f o") 'flop-frame) +#+END_SRC +*** split and follow +#+BEGIN_SRC emacs-lisp + (defmacro manx/split-and-follow (direction) + `(progn + ,direction + (balance-windows) + (other-window 1))) + + (global-set-key (kbd "C-x 3") (lambdainteractive () (manx/split-and-follow (split-window-below)))) + (global-set-key (kbd "C-x 2") (lambdainteractive () (manx/split-and-follow (split-window-horizontally)))) +#+END_SRC +* use-package +#+BEGIN_SRC emacs-lisp + (setq use-package-always-ensure t + use-package-verbose t) +#+END_SRC +** keychain-environment +#+BEGIN_SRC emacs-lisp + (use-package keychain-environment + :bind ("C-c r e" . 'keychain-refresh-environment)) +#+END_SRC +** exwm +#+BEGIN_SRC emacs-lisp + (use-package exwm + :bind ("s-k" . 'exwm-workspace-delete) + :config + (require 'exwm-config) + (require 'exwm-systemtray) + (exwm-systemtray-enable)) +#+END_SRC +** nginx +#+BEGIN_SRC emacs-lisp + (use-package nginx-mode + :custom + (nginx-indent-tabs-mode t) + (nginx-indent-level 2) + :config (add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/" . nginx-mode))) +#+END_SRC +** diminish +#+BEGIN_SRC emacs-lisp + (use-package diminish) +#+END_SRC +** company +#+BEGIN_SRC emacs-lisp + (use-package company + :diminish 'company-mode + :bind (:map company-mode-map + ("C-c /" . 'yas-expand)) + :custom + (company-idle-delay 0) + (company-minimum-prefix-length 3) + :init (add-hook 'after-init-hook 'global-company-mode)) +#+END_SRC +** omnisharp +#+BEGIN_SRC emacs-lisp + ;; (use-package csharp-mode + ;; :defer t) + + ;; (use-package omnisharp + ;; :defer t + ;; :init (add-hook 'csharp-mode-hook 'omnisharp-mode)) + + ;; (eval-after-load 'company + ;; '(add-to-list 'company-backends 'company-omnisharp)) + + ;; (add-hook 'csharp-mode #'company-mode) +#+END_SRC +** spaceline +#+BEGIN_SRC emacs-lisp + (use-package spaceline + :init + (require 'spaceline-config) + (setq powerline-default-seperator (quote arrow)) + (spaceline-spacemacs-theme) + :config (spaceline-toggle-buffer-size-off)) + +#+END_SRC +** dashboard +#+BEGIN_SRC emacs-lisp + (use-package dashboard + :diminish (dashboard-mode page-break-lines-mode) + :custom + (dashboard-center-content t) + (dashboard-banner-logo-title "Komacs") + (dashboard-set-init-info t) + (dashboard-startup-banner "~/.emacs.d/Komacs.png") + (dashboard-show-shortcuts nil) + (dashboard-items '((recents . 5))) + :config (dashboard-setup-startup-hook)) + + (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) +#+END_SRC +** slime +#+BEGIN_SRC emacs-lisp + (use-package slime + :defer t + :custom + (slime-lisp-implementations + '((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core") + :env ("SBCL_HOME=/usr/lib64/sbcl/")))) + :diminish 'slime-mode + :init + (use-package slime-company) + (add-hook 'lisp-mode-hook 'slime-mode) + (slime-setup '(slime-fancy slime-company))) +#+END_SRC +** switch window +#+BEGIN_SRC emacs-lisp + (use-package switch-window + :custom + (switch-window-input-style 'minibuffer) + (switch-window-increase 4) + (switch-window-threshold 2) + :bind ([remap other-window] . switch-window)) +#+END_SRC +** elixir +#+BEGIN_SRC emacs-lisp + (use-package elixir-mode + :defer t + :config (use-package alchemist)) +#+END_SRC +** minor modes +*** hungry delete +#+BEGIN_SRC emacs-lisp + (use-package hungry-delete + :diminish 'hungry-delete-mode + :config (global-hungry-delete-mode 1))2 +#+END_SRC +*** which key +#+BEGIN_SRC emacs-lisp + (use-package which-key + :diminish 'which-key-mode + :config (which-key-mode)) +#+END_SRC +*** avy +#+BEGIN_SRC emacs-lisp + (use-package avy + :bind ("M-s" . avy-goto-char)) +#+END_SRC +*** beacon +#+BEGIN_SRC emacs-lisp + (use-package beacon + :diminish 'beacon-mode + :config (beacon-mode 1)) +#+END_SRC +*** popup kill ring +#+BEGIN_SRC emacs-lisp + (use-package popup-kill-ring + :bind ("M-y" . popup-kill-ring)) +#+END_SRC +*** yasnippet +#+BEGIN_SRC emacs-lisp + (use-package yasnippet + :diminish 'yas-minor-mode +:bind + :init + (use-package yasnippet-snippets) + (yas-reload-all)) +#+END_SRC +**** enable for major modes +#+BEGIN_SRC emacs-lisp + (add-hook 'html-mode-hook 'yas-minor-mode) + (add-hook 'LaTeX-mode-hook 'yas-minor-mode) + (add-hook 'emacs-lisp-mode 'yas-minor-mode) +#+END_SRC +* ido +#+BEGIN_SRC emacs-lisp + (setq ido-enable-flex-matching t + ido-create-new-buffer 'always + ido-everywhere 1) + + (use-package ido-vertical-mode + :bind ("C-l" . 'ido-reread-directory) + :custom + (ido-vertical-define-keys 'C-n-and-C-p-only) + :config + (ido-vertical-mode 1) + (ido-mode 1)) +#+END_SRC +* misc +** unix line endings +#+BEGIN_SRC emacs-lisp + (defun unix-line-ends () + (let ((coding-str (symbol-name buffer-file-coding-system))) + (when (string-match "-\\(?:dos\\|mac\\)$" coding-str) + (set-buffer-file-coding-system 'unix)))) + + (add-hook 'find-file-hooks 'unix-line-ends) +#+END_SRC +** UTF8 +#+BEGIN_SRC emacs-lisp + (setq locale-coding-system 'utf-8) + (set-terminal-coding-system 'utf-8) + (set-keyboard-coding-system 'utf-8) + (set-selection-coding-system 'utf-8) + (prefer-coding-system 'utf-8) + (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) +#+END_SRC +** terminal +*** Make bash implicit terminal +#+BEGIN_SRC emacs-lisp + (defvar my-term-shell "/bin/bash") + (defadvice ansi-term (before force-bash) + (interactive (list my-term-shell))) + (ad-activate 'ansi-term) + + (global-set-key (kbd "") 'ansi-term) +#+END_SRC +** minor things +#+BEGIN_SRC emacs-lisp + (show-paren-mode 1) + (electric-pair-mode t) + (global-hl-line-mode t) + (global-prettify-symbols-mode t) + + (defalias 'yes-or-no-p 'y-or-n-p) + + (setq scroll-conservatively 100 + x-select-enable-clipboard t + vc-follow-symlinks t) + + (setq backup-directory-alist + `(("." . ,(concat user-emacs-directory "autosaves")))) +#+END_SRC +** docView auto reload +#+BEGIN_SRC emacs-lisp + (add-hook 'doc-view-mode-hook 'auto-revert-mode) +#+END_SRC +** Indentation +#+BEGIN_SRC emacs-lisp + (setq tab-width 2 + indent-tabs-mode t) + + (defvaralias 'js-indent-level 'tab-width) + (defvaralias 'css-indent-offset 'tab-width) +#+END_SRC +* auto-minor-mode +auto-mode-alist but for minor modes. + +For example, used with sensitive-mode to not create backups +(path/to/file~) when creating yasnippets +#+BEGIN_SRC emacs-lisp + (defvar auto-minor-mode-alist () + "Alist of filename patterns vs correpsonding minor mode functions, see `auto-mode-alist' + All elements of this alist are checked, meaning you can enable multiple minor modes for the same regexp.") + + (defun enable-minor-mode-based-on-extension () + "Check file name against `auto-minor-mode-alist' to enable minor modes + the checking happens for all pairs in auto-minor-mode-alist" + (when buffer-file-name + (let ((name (file-name-sans-versions buffer-file-name)) + (remote-id (file-remote-p buffer-file-name)) + (case-fold-search auto-mode-case-fold) + (alist auto-minor-mode-alist)) + ;; Remove remote file name identification. + (when (and (stringp remote-id) + (string-match-p (regexp-quote remote-id) name)) + (setq name (substring name (match-end 0)))) + (while (and alist (caar alist) (cdar alist)) + (if (string-match-p (caar alist) name) + (funcall (cdar alist) 1)) + (setq alist (cdr alist)))))) + + (add-hook 'find-file-hook #'enable-minor-mode-based-on-extension) +#+END_SRC +* sensitive-minor-mode +#+BEGIN_SRC emacs-lisp + (define-minor-mode sensitive-minor-mode + "For sensitive files like password lists. + It disables backup creation and auto saving. + + With no argument, this command toggles the mode. + Non-null prefix argument turns on the mode. + Null prefix argument turns off the mode." + ;; The initial value. + nil + ;; The indicator for the mode line. + " Sensitive" + ;; The minor mode bindings. + nil + (if (symbol-value sensitive-minor-mode) + (progn + ;; disable backups + (set (make-local-variable 'backup-inhibited) t) + ;; disable auto-save + (if auto-save-default + (auto-save-mode -1))) + ;resort to default value of backup-inhibited + (kill-local-variable 'backup-inhibited) + ;resort to default auto save setting + (if auto-save-default + (auto-save-mode 1)))) + + ;; Regexps of sensitive files. + (setq auto-minor-mode-alist + (append + '(("stream/manifest/.*\\.json$" . sensitive-minor-mode) + (".emacs.d/snippets/\\*$" . sensitive-minor-mode) + ("nginx/sites-(enabled|available)/*" . sensitive-minor-mode)) + auto-minor-mode-alist)) +#+END_SRC +* Prettify symbols +#+BEGIN_SRC emacs-lisp + (add-hook 'emacs-lisp-mode-hook + (lambda () + (push + '("lambdainteractive" . ?Λ) prettify-symbols-alist))) +#+END_SRC +* Email +#+BEGIN_SRC emacs-lisp + (load "~/.emacs.d/email.el") +#+END_SRC diff --git a/games/tetris-scores b/games/tetris-scores new file mode 100644 index 0000000..529181a --- /dev/null +++ b/games/tetris-scores @@ -0,0 +1,10 @@ +1476 manx Tue Mar 26 12:17:27 2019 +737 manx Mon Mar 25 16:40:54 2019 +529 manx Wed Mar 27 11:19:28 2019 +512 manx Wed Mar 13 15:31:53 2019 +507 manx Wed Mar 13 15:34:55 2019 +459 manx Wed Mar 20 12:35:48 2019 +431 manx Wed Mar 13 15:38:47 2019 +272 manx Thu Mar 21 13:45:44 2019 +269 manx Tue Mar 19 10:51:54 2019 +160 manx Wed Mar 20 12:33:02 2019 diff --git a/init.el b/init.el new file mode 100644 index 0000000..f4ddc7d --- /dev/null +++ b/init.el @@ -0,0 +1,63 @@ +;; required package fluff +(require 'package) +(setq package-enable-at-startup nil) +(add-to-list 'package-archives + '("melpa" . "http://melpa.milkbox.net/packages/") t) + +(package-initialize) + +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +(unless (package-installed-p 'spacemacs-theme) + (package-refresh-contents) + (package-install 'spacemacs-theme)) + + + +;; org-babel won't compile these sometimes? +(if (file-newer-than-file-p "~/.emacs.d/config.org" "~/.emacs.d/config.el") + (org-babel-load-file "~/.emacs.d/config.org") + (load "~/.emacs.d/config.el")) + +;; Stuff generated by emacs +(custom-set-variables + ;; custom-set-variables 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. + '(TeX-engine (quote xetex)) + '(company-idle-delay 0) + '(company-minimum-prefix-length 3) + '(custom-enabled-themes (quote (spacemacs-dark))) + '(custom-safe-themes + (quote + ("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 + (alchemist elixir-mode nginx-mode ac-js2 pdf-tools yasnippet-snippets which-key use-package symon switch-window spacemacs-theme spaceline slime-company popup-kill-ring omnisharp keychain-environment js2-mode ido-vertical-mode hungry-delete exwm diminish dashboard company-auctex beacon avy))) + '(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) t) + '(switch-window-threshold 2 t)) +(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/scripts/lass.el b/scripts/lass.el new file mode 100644 index 0000000..b480667 --- /dev/null +++ b/scripts/lass.el @@ -0,0 +1,21 @@ +;; This file is a part of LASS +;; (c) 2014 TymoonNET/NexT http://tymoon.eu (shinmera@tymoon.eu) +;; Author: Nicolas Hafner + +(defun lass-compile-current () + (interactive) + (or + (when (and (slime-connected-p) + (or (slime-eval '(cl:not (cl:null (cl:find-package :lass)))) + (and (slime-eval '(cl:not (cl:null (cl:find-package :ql)))) + (slime-eval '(ql:quickload :lass))))) + (message "LASS compiled to %s" (slime-eval `(uiop:native-namestring (lass:generate (uiop:parse-native-namestring ,(buffer-file-name))))))) + (message "LASS compiled. %s" (shell-command-to-string (format "lass %s" (shell-quote-argument (buffer-file-name))))))) + +(define-derived-mode lass-mode common-lisp-mode + "LASS" "Mode with auto-compiling for LASS files." + (add-hook 'after-save-hook 'lass-compile-current nil t)) + +(add-to-list 'auto-mode-alist '("\\.lass\\'" . lass-mode)) + +(provide 'lass) diff --git a/scripts/transpose-frame.el b/scripts/transpose-frame.el new file mode 100644 index 0000000..0ba51be --- /dev/null +++ b/scripts/transpose-frame.el @@ -0,0 +1,268 @@ + +;;; transpose-frame.el --- Transpose windows arrangement in a frame + +;; Copyright (c) 2011 S. Irie + +;; Author: S. Irie +;; Maintainer: S. Irie +;; Keywords: window + +(defconst transpose-frame-version "0.1.0") + +;; This program is free software. + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: + +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. + +;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: + +;; This program provides some interactive functions which allows users +;; to transpose windows arrangement in currently selected frame: +;; +;; `transpose-frame' ... Swap x-direction and y-direction +;; +;; +------------+------------+ +----------------+--------+ +;; | | B | | A | | +;; | A +------------+ | | | +;; | | C | => +--------+-------+ D | +;; +------------+------------+ | B | C | | +;; | D | | | | | +;; +-------------------------+ +--------+-------+--------+ +;; +;; `flip-frame' ... Flip vertically +;; +;; +------------+------------+ +------------+------------+ +;; | | B | | D | +;; | A +------------+ +------------+------------+ +;; | | C | => | | C | +;; +------------+------------+ | A +------------+ +;; | D | | | B | +;; +-------------------------+ +------------+------------+ +;; +;; `flop-frame' ... Flop horizontally +;; +;; +------------+------------+ +------------+------------+ +;; | | B | | B | | +;; | A +------------+ +------------+ A | +;; | | C | => | C | | +;; +------------+------------+ +------------+------------+ +;; | D | | D | +;; +-------------------------+ +-------------------------+ +;; +;; `rotate-frame' ... Rotate 180 degrees +;; +;; +------------+------------+ +-------------------------+ +;; | | B | | D | +;; | A +------------+ +------------+------------+ +;; | | C | => | C | | +;; +------------+------------+ +------------+ A | +;; | D | | B | | +;; +-------------------------+ +------------+------------+ +;; +;; `rotate-frame-clockwise' ... Rotate 90 degrees clockwise +;; +;; +------------+------------+ +-------+-----------------+ +;; | | B | | | A | +;; | A +------------+ | | | +;; | | C | => | D +--------+--------+ +;; +------------+------------+ | | B | C | +;; | D | | | | | +;; +-------------------------+ +-------+--------+--------+ +;; +;; `rotate-frame-anticlockwise' ... Rotate 90 degrees anti-clockwise +;; +;; +------------+------------+ +--------+--------+-------+ +;; | | B | | B | C | | +;; | A +------------+ | | | | +;; | | C | => +--------+--------+ D | +;; +------------+------------+ | A | | +;; | D | | | | +;; +-------------------------+ +-----------------+-------+ +;; +;; This program is tested on GNU Emacs 22, 23. + +;; +;; Installation: +;; +;; First, save this file as transpose-frame.el and byte-compile in a directory +;; that is listed in load-path. +;; +;; Put the following in your .emacs file: +;; +;; (require 'transpose-frame) +;; +;; To swap x-direction and y-direction of windows arrangement, for example, +;; just type as: +;; +;; M-x transpose-frame +;; +;; Have fun! +;; + +;;; ChangeLog: + +;; 2011-03-01 S. Irie +;; * Version 0.1.0 +;; * Save more information such as hscroll, margins, fringes, etc. +;; * Bug fix +;; 2011-02-28 S. Irie +;; * Version 0.0.1 +;; * Initial version + +;;; ToDo: + +;;; Code: + +;; Internal functions + +(defun transpose-frame-get-arrangement (&optional frame subtree) + (let ((tree (or subtree + (car (window-tree frame))))) + (if (windowp tree) + (list (window-buffer tree) + (window-start tree) + (window-point tree) + (window-hscroll tree) + (window-margins tree) + (window-fringes tree) + (window-dedicated-p tree) + (window-redisplay-end-trigger tree) + tree + (eq tree (frame-selected-window frame))) + (let* ((vertical (car tree)) + (edges (cadr tree)) + (length (float (if vertical + (- (nth 3 edges) (cadr edges)) + (- (nth 2 edges) (car edges)))))) + (cons vertical + (mapcar (lambda (subtree) + (cons (transpose-frame-get-arrangement frame subtree) + (/ (let ((edges (if (windowp subtree) + (window-edges subtree) + (cadr subtree)))) + (if vertical + (- (nth 3 edges) (cadr edges)) + (- (nth 2 edges) (car edges)))) + length))) + (cddr tree))))))) + +(defun transpose-frame-set-arrangement (config &optional window-or-frame &rest how) + (let ((window (if (windowp window-or-frame) + window-or-frame + (frame-selected-window window-or-frame)))) + (unless (windowp window-or-frame) + (delete-other-windows window)) + (if (bufferp (car config)) + (let ((buffer (pop config))) + (set-window-buffer window buffer) + (set-window-start window (pop config)) + (set-window-point window (pop config)) + (set-window-hscroll window (pop config)) + (set-window-margins window (caar config) (cdr (pop config))) + (apply 'set-window-fringes window (pop config)) + (set-window-dedicated-p window (pop config)) + (set-window-redisplay-end-trigger window (pop config)) + (let ((orig-window (pop config)) + (ol-func (lambda (ol) + (if (eq (overlay-get ol 'window) orig-window) + (overlay-put ol 'window window)))) + (ol-lists (with-current-buffer buffer + (overlay-lists)))) + (mapc ol-func (car ol-lists)) + (mapc ol-func (cdr ol-lists))) + (if (car config) (select-window window))) + (let* ((horizontal (if (memq 'transpose how) + (pop config) + (not (pop config)))) + (edges (window-edges window)) + (length (if horizontal + (- (nth 2 edges) (car edges)) + (- (nth 3 edges) (cadr edges))))) + (if (memq (if horizontal 'flop 'flip) how) + (setq config (reverse config))) + (while (cdr config) + (setq window (prog1 + (split-window window (round (* length (cdar config))) + horizontal) + (apply 'transpose-frame-set-arrangement + (caar config) window how)) + config (cdr config))) + (apply 'transpose-frame-set-arrangement + (caar config) window how))))) + +;; User commands + +;;;###autoload +(defun transpose-frame (&optional frame) + "Transpose windows arrangement at FRAME. +Omitting FRAME means currently selected frame." + (interactive) + (transpose-frame-set-arrangement (transpose-frame-get-arrangement frame) frame + 'transpose) + (if (interactive-p) (recenter))) + +;;;###autoload +(defun flip-frame (&optional frame) + "Flip windows arrangement vertically at FRAME. +Omitting FRAME means currently selected frame." + (interactive) + (transpose-frame-set-arrangement (transpose-frame-get-arrangement frame) frame + 'flip)) + +;;;###autoload +(defun flop-frame (&optional frame) + "Flop windows arrangement horizontally at FRAME. +Omitting FRAME means currently selected frame." + (interactive) + (transpose-frame-set-arrangement (transpose-frame-get-arrangement frame) frame + 'flop)) + +;;;###autoload +(defun rotate-frame (&optional frame) + "Rotate windows arrangement 180 degrees at FRAME. +Omitting FRAME means currently selected frame." + (interactive) + (transpose-frame-set-arrangement (transpose-frame-get-arrangement frame) frame + 'flip 'flop)) + +;;;###autoload +(defun rotate-frame-clockwise (&optional frame) + "Rotate windows arrangement 90 degrees clockwise at FRAME. +Omitting FRAME means currently selected frame." + (interactive) + (transpose-frame-set-arrangement (transpose-frame-get-arrangement frame) frame + 'transpose 'flop) + (if (interactive-p) (recenter))) + +;;;###autoload +(defun rotate-frame-anticlockwise (&optional frame) + "Rotate windows arrangement 90 degrees anti-clockwise at FRAME. +Omitting FRAME means currently selected frame." + (interactive) + (transpose-frame-set-arrangement (transpose-frame-get-arrangement frame) frame + 'transpose 'flip) + (if (interactive-p) (recenter))) + +(provide 'transpose-frame) + +;;; +;;; transpose-frame.el ends here diff --git a/scripts/transpose-frame.elc b/scripts/transpose-frame.elc new file mode 100644 index 0000000..6ccb965 Binary files /dev/null and b/scripts/transpose-frame.elc differ diff --git a/snippets/csharp-mode/get-set b/snippets/csharp-mode/get-set new file mode 100644 index 0000000..04789d2 --- /dev/null +++ b/snippets/csharp-mode/get-set @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: getset +# key: gs +# -- +{ get; set; }$0 diff --git a/snippets/html-mode/css b/snippets/html-mode/css new file mode 100644 index 0000000..1fa91b8 --- /dev/null +++ b/snippets/html-mode/css @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: css +# key: css +# -- +$0 \ No newline at end of file diff --git a/snippets/html-mode/html5 b/snippets/html-mode/html5 new file mode 100644 index 0000000..c7b4984 --- /dev/null +++ b/snippets/html-mode/html5 @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: DOCTYPE html +# key: 5 +# -- + \ No newline at end of file diff --git a/snippets/latex-mode/figure b/snippets/latex-mode/figure new file mode 100644 index 0000000..447593c --- /dev/null +++ b/snippets/latex-mode/figure @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: figure +# key: fig +# -- +\begin{figure}[H] + \centering + \includegraphics[width=${1:1}\textwidth]{${2:path}} + \caption{\label{fig:${3:label}}$0} +\end{figure} diff --git a/snippets/latex-mode/hline b/snippets/latex-mode/hline new file mode 100644 index 0000000..d175dde --- /dev/null +++ b/snippets/latex-mode/hline @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: hline +# key: hl +# -- +\hline $0 \ No newline at end of file diff --git a/snippets/latex-mode/italic b/snippets/latex-mode/italic new file mode 100644 index 0000000..cf59093 --- /dev/null +++ b/snippets/latex-mode/italic @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: italic +# key: i +# -- +\textit{$1}$0 diff --git a/snippets/latex-mode/item b/snippets/latex-mode/item new file mode 100644 index 0000000..1354eb9 --- /dev/null +++ b/snippets/latex-mode/item @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: item +# key: - +# -- +\item {$0} \ No newline at end of file diff --git a/snippets/latex-mode/itemize b/snippets/latex-mode/itemize new file mode 100644 index 0000000..4c618cf --- /dev/null +++ b/snippets/latex-mode/itemize @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: itemize +# key: it +# -- +\begin{itemize} + \item $0 +\end{itemize} \ No newline at end of file diff --git a/snippets/latex-mode/subfigure b/snippets/latex-mode/subfigure new file mode 100644 index 0000000..02851e9 --- /dev/null +++ b/snippets/latex-mode/subfigure @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: subfigure +# key: sfig2 +# -- +\begin{figure}[H] + \centering + \begin{subfigure}{${1:0.45}\textwidth} + \includegraphics[width=${2:1}\textwidth]{${3:path}} + \end{subfigure} + \begin{subfigure}{$1\textwidth} + \includegraphics[width=$2\textwidth]{${4:path}} + \end{subfigure} +\end{figure} +$0 \ No newline at end of file diff --git a/snippets/latex-mode/tabularx b/snippets/latex-mode/tabularx new file mode 100644 index 0000000..db6190f --- /dev/null +++ b/snippets/latex-mode/tabularx @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: tabularx +# key: tabx +# -- +\begin{tabularx}{\textwidth}{${1:|c|}} + \hline + $0 + \hline +\end{tabularx} \ No newline at end of file diff --git a/snippets/lisp-mode/defignore b/snippets/lisp-mode/defignore new file mode 100644 index 0000000..c39b5d6 --- /dev/null +++ b/snippets/lisp-mode/defignore @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: defignore +# key: defignore +# -- +(defignore ${1} (${2}) + ${3}) +$0 \ No newline at end of file diff --git a/snippets/lisp-mode/wah b/snippets/lisp-mode/wah new file mode 100644 index 0000000..437f156 --- /dev/null +++ b/snippets/lisp-mode/wah @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: wah +# key: w +# -- +(wah $0) \ No newline at end of file diff --git a/snippets/omnisharp-mode/get-set b/snippets/omnisharp-mode/get-set new file mode 100644 index 0000000..622786a --- /dev/null +++ b/snippets/omnisharp-mode/get-set @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: get-set +# key: gs +# -- +{ get; set; }$0