diff options
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/.gitignore | 15 | ||||
-rw-r--r-- | .emacs.d/gnus.el | 9 | ||||
-rw-r--r-- | .emacs.d/init.el | 28 | ||||
-rw-r--r-- | .emacs.d/site-lisp/eltuki.el | 198 | ||||
-rw-r--r-- | .emacs.d/site-lisp/quick-edit-mode.el | 41 | ||||
-rw-r--r-- | .emacs.d/snippets/html-mode/for | 8 | ||||
-rw-r--r-- | .emacs.d/snippets/html-mode/generic-block | 8 | ||||
-rw-r--r-- | .emacs.d/snippets/org-mode/codeblock | 7 | ||||
-rw-r--r-- | .emacs.d/snippets/org-mode/heading | 9 | ||||
-rw-r--r-- | .emacs.d/themes/new-theme.el | 7 |
10 files changed, 307 insertions, 23 deletions
diff --git a/.emacs.d/.gitignore b/.emacs.d/.gitignore new file mode 100644 index 0000000..2fa1670 --- /dev/null +++ b/.emacs.d/.gitignore @@ -0,0 +1,15 @@ +tramp +elpa +bookmarks +abbrev_defs +custom.el +*.elc +ac-comphist.dat +auto-save-list/ +url/ +packages/ +newsticker/ +templates/ +rinit.* +!rinit.org +history diff --git a/.emacs.d/gnus.el b/.emacs.d/gnus.el index 1bf988a..503aa1d 100644 --- a/.emacs.d/gnus.el +++ b/.emacs.d/gnus.el @@ -1,4 +1,3 @@ -;; -*- eval: (git-auto-commit-mode 1) -*- (setq gnus-select-method '(nntp "news.eternal-september.org")) (setq gnus-secondary-select-methods '((nnmaildir "gmail" @@ -64,7 +63,7 @@ (add-hook 'gnus-group-mode-hook '(lambda () (linum-mode -1))) ;-----[ BBDB ]-------------------------------------------------------- -(require 'bbdb) -(bbdb-initialize 'gnus 'message) -(bbdb-insinuate-gnus) -(setq bbdb-north-american-phone-numbers-p nil) +;; (require 'bbdb) +;; (bbdb-initialize 'gnus 'message) +;; (bbdb-insinuate-gnus) +;; (setq bbdb-north-american-phone-numbers-p nil) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 75c52e7..faf5ff5 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -245,6 +245,7 @@ DOT are intentionally being skipped." (defun oni:html-mode-func () "Function for `html-mode-hook'." + (yas-minor-mode) (fci-mode)) (defun oni:indent-shift-left (start end &optional count) @@ -420,6 +421,10 @@ code. Found at http://xahlee.org/emacs/elisp_parse_time.html" (end-of-line))) (end-of-line)))) +;; (defun oni:mu4e-view-mode-func () +;; "Function for `mu4e-view-mode-hook'." +;; (longlines-mode)) + (defun oni:myepisodes-formatter (plist) "Format RSS items from MyEpisodes as org tasks. PLIST contains all the pertinent information." @@ -449,7 +454,8 @@ When dealing with braces, add another line and indent that too." (defun oni:org-mode-func () "Function for `org-mode-hook'." (flyspell-mode) - (auto-fill-mode)) + (auto-fill-mode) + (yas-minor-mode)) (defun oni:php-mode-func () "Function for `php-mode-hook'." @@ -809,6 +815,9 @@ for easy selection." (setq eshell-prompt-regexp "^[#$]> ") (setq fci-rule-color "darkred") (setq flymake-gui-warnings-enabled nil) +(setq flymake-info-line-regexp + (eval-when-compile + (regexp-opt '("Invalid name")))) (setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log")) (setq flymake-log-level 0) (setq flymake-warn-line-regexp @@ -816,7 +825,9 @@ for easy selection." (regexp-opt '("warning" "Warning" "Missing docstring" - "String statement has no effect")))) + "String statement has no effect" + "No value passed for parameter" + "imported but unused")))) (setq frame-title-format '(:eval (concat "emacs: " (buffer-name)))) (setq geiser-repl-history-filename "~/.emacs.d/geiser-history") (setq gtags-auto-update t) @@ -845,6 +856,7 @@ for easy selection." (setq mail-header-separator "") (setq message-log-max 1000) (setq message-send-mail-function 'message-send-mail-with-sendmail) +(setq mode-line-position nil) (setq mu4e-headers-date-format "%d-%m %H:%M") (setq mu4e-headers-fields '((:date . 11) (:flags . 6) @@ -899,7 +911,7 @@ for easy selection." (setq org-feed-alist '(("MyEpisodes" "http://www.myepisodes.com/rss.php?feed=mylist&uid=Slash&pwdmd5=04028968e1f0b7ee678b748a4320ac17" - "~/documents/org/org" "MyEpisodes" + "~/documents/org/tasks" "MyEpisodes" :formatter oni:myepisodes-formatter))) (setq org-hide-emphasis-markers t) (setq org-outline-path-complete-in-steps t) @@ -928,6 +940,7 @@ for easy selection." ("marmalade" . "http://marmalade-repo.org/packages/"))) (setq package-load-list '((htmlize "1.39") (lua-mode "20111107") + (python "0.24.2") all)) (setq php-function-call-face 'font-lock-function-name-face) (setq php-mode-force-pear t) @@ -982,6 +995,7 @@ for easy selection." (add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func) (add-hook 'markdown-mode-hook 'oni:markdown-mode-func) (add-hook 'message-mode-hook 'oni:message-mode-func) +;; (add-hook 'mu4e-view-mode-hook 'oni:mu4e-view-mode-func) (add-hook 'org-mode-hook 'oni:org-mode-func) (add-hook 'php-mode-hook 'oni:php-mode-func) (add-hook 'prog-mode-hook 'oni:prog-mode-func) @@ -1034,7 +1048,7 @@ for easy selection." (add-to-list 'auto-mode-alist '("\\.jl$" . sawfish-mode)) (add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode)) -(add-to-list 'auto-mode-alist '("\\.m\\(ark\\)?do?wn$" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.m\\(ark\\)?d\\(?:o?wn\\)?$" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode)) (add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode)) (add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode)) @@ -1051,6 +1065,9 @@ for easy selection." (add-to-list 'display-buffer-alist '("^\\*.*\\*$" . ((bw-display-in-bottom-window . nil)))) +(delete " " mode-line-format) +(delete " " mode-line-format) + (unless (oni:required-packages-installed-p) (message "%s" "Refreshing package database...") (package-refresh-contents) @@ -1065,9 +1082,10 @@ for easy selection." (scroll-bar-mode -1) (tool-bar-mode -1) (tooltip-mode -1) +(line-number-mode -1) +(column-number-mode -1) (auto-insert-mode) -(column-number-mode) (electric-indent-mode) (electric-pair-mode) (ido-mode) diff --git a/.emacs.d/site-lisp/eltuki.el b/.emacs.d/site-lisp/eltuki.el new file mode 100644 index 0000000..4815108 --- /dev/null +++ b/.emacs.d/site-lisp/eltuki.el @@ -0,0 +1,198 @@ +;;; eltuki.el --- Tekuti functions + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen <slash@drd> +;; Keywords: convenience + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Tekuti functions. + +;;; Code: + +(require 'org) + +(defgroup eltuki + nil + "tekuti functions in Emacs." + :group 'external) + +(defcustom eltuki-blog-dir "~/blog" + "Plain blog post directory, not the git repository." + :group 'eltuki + :type 'string) + +(defcustom eltuki-default-status "publish" + "Default status to use when status is unknown." + :group 'eltuki + :type 'string) + +(defcustom eltuki-default-comment-status "open" + "Default status for comments." + :group 'eltuki + :type 'string) + +(defun eltuki-new-post () + (interactive) + (switch-to-buffer (get-buffer-create "*eltuki*")) + (org-mode)) + +(defun eltuki-get-title () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TITLE: \\(.*\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1)) + (error "Post has no title.")))) + +(defun eltuki-set-title (title) + (interactive "MTitle: ") + (setq title (concat " " title)) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TITLE:\\(.*\\)$" nil t) + (replace-match title t t nil 1) + (insert "#+TITLE:" title "\n") + (unless (= (char-after) ?\n) + (insert-char ?\n))))) + +(defun eltuki-get-timestamp () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TIMESTAMP: \\([[:digit:]]+\\)$" nil t) + (match-string 1) + (format-time-string "%s")))) + +(defun eltuki-set-timestamp () + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((newtime (format-time-string " %s"))) + (if (re-search-forward "^#\\+TIMESTAMP:\\(.*\\)$" nil t) + (replace-match newtime nil t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+TIMESTAMP:" newtime "\n"))))) + +(defun eltuki-get-tags () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^#\\+TAGS: \\(.*\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1))))) + +(defun eltuki-set-tags (tags) + (interactive "MTags: ") + (setq tags (concat " " tags)) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TAGS:\\(.*\\)$" nil t) + (replace-match tags t t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+TAGS:" tags "\n")))) + +(defun eltuki-get-status () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+STATUS: \\(draft\\|publish\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1)) + eltuki-default-status))) + +(defun eltuki-toggle-status () + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((newstatus (if (string= (eltuki-get-status) "draft") + " publish" + " draft"))) + (if (re-search-forward "^#\\+STATUS:\\(.*\\)$" nil t) + (replace-match newstatus t t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+STATUS:" newstatus "\n"))))) + +(defun eltuki-get-comment-status () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward + "^#\\+COMMENTSTATUS: \\(open\\|closed\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1)) + eltuki-default-comment-status))) + +(defun eltuki-toggle-comment-status () + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((newstatus (if (string= (eltuki-get-comment-status) "closed") + " open" + " closed"))) + (if (re-search-forward "^#\\+COMMENTSTATUS:\\(.*\\)$" nil t) + (replace-match newstatus t t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+COMMENTSTATUS:" newstatus "\n"))))) + +(defun eltuki-slugify-string (str) + (while (string-match "[^a-zA-Z0-9 ]+" str) + (setq str (replace-match "" nil t str))) + (while (string-match " +" str) + (setq str (replace-match "-" nil t str))) + (downcase str)) + +(defun eltuki-get-directory () + (concat + eltuki-blog-dir "/" + (format-time-string "%Y%%2f%m%%2f%d%%2f") + (eltuki-slugify-string (eltuki-get-title)))) + +(defun eltuki-write-content (dir) + (with-current-buffer (org-export-region-as-html + (point-min) (point-max) t "*eltuki-html*") + (write-region (point-min) (point-max) (concat dir "/content")))) + +(defun eltuki-write-metadata (dir) + (let ((timestamp (eltuki-get-timestamp)) + (tags (eltuki-get-tags)) + (status (eltuki-get-status)) + (title (eltuki-get-title)) + (name (eltuki-slugify-string (eltuki-get-title))) + (commentstatus (eltuki-get-comment-status))) + (with-temp-buffer + (insert "timestamp: " timestamp "\n" + "tags: " tags "\n" + "status: " status "\n" + "title: " title "\n" + "name: " name "\n" + "comment_status: " commentstatus) + (write-region (point-min) (point-max) (concat dir "/metadata"))))) + +(defun eltuki-finish () + (interactive) + (let ((buffer (get-buffer "*eltuki*")) + (dest (eltuki-get-directory))) + (unless (file-exists-p dest) + (mkdir dest)) + + (eltuki-write-content dest) + (eltuki-write-metadata dest) + (kill-buffer buffer))) + +(provide 'eltuki) +;;; eltuki.el ends here diff --git a/.emacs.d/site-lisp/quick-edit-mode.el b/.emacs.d/site-lisp/quick-edit-mode.el index effd30f..821c738 100644 --- a/.emacs.d/site-lisp/quick-edit-mode.el +++ b/.emacs.d/site-lisp/quick-edit-mode.el @@ -26,32 +26,49 @@ (defvar quick-edit-map (let ((map (make-sparse-keymap))) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) - (define-key map "f" 'forward-char) + (define-key map "/" 'undo) + (define-key map "0" 'delete-window) + (define-key map "1" 'delete-other-windows) + (define-key map "2" 'split-window-below) + (define-key map "3" 'split-window-right) + (define-key map "K" 'kill-whole-line) + (define-key map "V" 'scroll-down-command) + (define-key map "a" 'oni:move-beginning-of-dwim) (define-key map "b" 'backward-char) + (define-key map "d" 'oni:kill-region-or-forward-char) (define-key map "e" 'oni:move-end-of-dwim) - (define-key map "a" 'oni:move-beginning-of-dwim) - (define-key map "V" 'scroll-down-command) + (define-key map "f" 'forward-char) + (define-key map "j" 'newline-and-indent) + (define-key map "k" 'oni:kill-region-or-line) + (define-key map "n" 'next-line) + (define-key map "o" 'other-window) + (define-key map "p" 'previous-line) (define-key map "v" 'scroll-up-command) - (define-key map "/" 'undo) (define-key map "w" 'oni:kill-region-or-backward-char) - (define-key map "d" 'oni:kill-region-or-forward-char) - (define-key map "k" 'oni:kill-region-or-line) - (define-key map "K" 'kill-whole-line) - (define-key map "j" 'newline-and-indent) + (define-key map (kbd "C-b") 'electric-buffer-list) + (define-key map (kbd "C-g") 'quick-edit-mode) (define-key map (kbd "RET") 'quick-edit-mode) map) "Keymap for quick-edit-mode.") +(defun qe-locally-disable () + "Disable quick-edit mode in the minibuffer" + (when (eq overriding-local-map quick-edit-map) + (setq-local overriding-local-map nil))) + ;;;###autoload (define-minor-mode quick-edit-mode "Quickly edit stuff." :lighter " qe" :global t (if quick-edit-mode - (setq overriding-local-map quick-edit-map) - (setq overriding-local-map nil))) + (progn + (setq overriding-local-map quick-edit-map) + (add-hook 'minibuffer-setup-hook 'qe-locally-disable) + (add-hook 'special-mode-hook 'qe-locally-disable)) + (setq overriding-local-map nil) + (remove-hook 'minibuffer-setup-hook 'qe-locally-disable) + (remove-hook 'special-mode-hook 'qe-locally-disable))) (provide 'quick-edit-mode) ;;; quick-edit-mode.el ends here diff --git a/.emacs.d/snippets/html-mode/for b/.emacs.d/snippets/html-mode/for new file mode 100644 index 0000000..01d9c44 --- /dev/null +++ b/.emacs.d/snippets/html-mode/for @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for +# key: for +# condition: pony-tpl-minor-mode +# -- +{% for $1 in $2 %} + $0 +{% endfor %}
\ No newline at end of file diff --git a/.emacs.d/snippets/html-mode/generic-block b/.emacs.d/snippets/html-mode/generic-block new file mode 100644 index 0000000..82d40c7 --- /dev/null +++ b/.emacs.d/snippets/html-mode/generic-block @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: Template Block +# key: % +# condition: pony-tpl-minor-mode +# -- +{% $1 %} + $0 +{% end$1 %}
\ No newline at end of file diff --git a/.emacs.d/snippets/org-mode/codeblock b/.emacs.d/snippets/org-mode/codeblock new file mode 100644 index 0000000..a200b08 --- /dev/null +++ b/.emacs.d/snippets/org-mode/codeblock @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: codeblock +# key: code +# -- +#+begin_src $1 + $0 +#+end_src
\ No newline at end of file diff --git a/.emacs.d/snippets/org-mode/heading b/.emacs.d/snippets/org-mode/heading new file mode 100644 index 0000000..9d5451e --- /dev/null +++ b/.emacs.d/snippets/org-mode/heading @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Heading +# key: * +# -- +${1:*} ${2:TODO} $3 +${1:$(make-string (length text) ?\ )} :PROPERTIES: +${1:$(make-string (length text) ?\ )} :CATEGORY: $4 +${1:$(make-string (length text) ?\ )} :END: +${1:$(make-string (length text) ?\ )} $0
\ No newline at end of file diff --git a/.emacs.d/themes/new-theme.el b/.emacs.d/themes/new-theme.el index a2234ca..c4df5e6 100644 --- a/.emacs.d/themes/new-theme.el +++ b/.emacs.d/themes/new-theme.el @@ -30,10 +30,16 @@ (custom-theme-set-faces 'new '(default ((t (:background "#111113" :foreground "#eeeeec")))) + '(flymake-errline ((t (:background "#8b1a1a")))) + '(flymake-infoline ((t (:background "#00008b")))) + '(flymake-warnline ((t (:background "#9a3200")))) '(font-lock-comment-delimiter-face ((t (:foreground "#a9a9a9" :slant italic :weight bold)))) '(font-lock-comment-face ((t (:foreground "#a9a9a9" :slant italic)))) + '(font-lock-doc-face ((t (:foreground "#9ad870")))) '(font-lock-keyword-face ((t (:foreground "#cfce29")))) + '(font-lock-string-face ((t (:foreground "#ffbd5c")))) '(font-lock-type-face ((t (:foreground "#78a2c1")))) + '(highlight ((t (:background "#171719")))) '(ido-subdir ((t (:foreground "#ff5d55")))) '(jabber-chat-prompt-foreign ((t (:foreground "#ff5d55")))) '(jabber-chat-prompt-local ((t (:foreground "#78a2c1")))) @@ -43,7 +49,6 @@ '(mode-line ((t (:background "#222224" :foreground "#eeeeec" :box nil)))) '(mode-line-inactive ((t (:background "#171719" :foreground "#999999" :box nil)))) '(region ((t (:background "#2729b6")))) - '(highlight ((t (:background "#171719")))) ) (provide-theme 'new) |