Merge remote-tracking branch 'origin/master' into phoenix

Conflicts:
	.config/awesome/rc.lua
This commit is contained in:
Tom Willemsen 2012-10-07 15:23:23 +02:00
commit 52abe4f881
18 changed files with 575 additions and 115 deletions

View file

@ -13,7 +13,7 @@ urxvt.visualBell: true
urxvt.perl-lib: /usr/lib/urxvt/perl/ urxvt.perl-lib: /usr/lib/urxvt/perl/
urxvt.perl-ext-common: default,matcher,searchable-scrollback urxvt.perl-ext-common: default,matcher,searchable-scrollback
urxvt.urlLauncher: firefox urxvt.urlLauncher: conkeror
urxvt.matcher.button: 1 urxvt.matcher.button: 1
urxvt.font: xft:Monaco:weight=medium:pixelsize=18 urxvt.font: xft:Monaco:weight=medium:pixelsize=18

67
.config/awesome/ext.lua Normal file
View file

@ -0,0 +1,67 @@
local client=client
local awful=awful
local pairs=pairs
local table=table
module("ext")
-- Returns true if all pairs in table1 are present in table2
function match(table1, table2)
for k, v in pairs(table1) do
if table[k] ~= v and not table2[k]:find(v) then
return false
end
end
return true
end
--- Spawns cmd if no client can be found matching properties
-- If such a client can be found, pop to first tag where it is
-- visible, and give it focus
function run_or_raise(cmd, properties)
local clients = client.get()
local focused = awful.client.next(0)
local findex = 0
local matched_clients = { }
local n = 0
for i, c in pairs(clients) do
-- make an array of matched clients
if match(properties, c) then
n = n + 1
matched_clients[n] = c
if n == focused then
findex = n
end
end
end
if n > 0 then
local c = matched_clients[1]
-- if the focused window matched switch focus to next in list
if 0 < findex and findex < n then
c = matched_clients[findex + 1]
end
local ctags = c:tags()
if table.getn(ctags) == 0 then
-- ctags is empty, show client on current tag
local curtag = awful.tag.selected()
awful.client.movetotag(curtag, c)
else
-- Otherwise, pop to first tag client is visible on
awful.tag.viewonly(ctags[1])
end
-- And then focus the client
client.focus = c
c:raise()
awful.screen.focus(c.screen)
return
end
awful.util.spawn(cmd)
end

73
.config/awesome/oni.lua Normal file
View file

@ -0,0 +1,73 @@
local awful = awful
local beautiful = beautiful
local client = client
local ext = require("ext")
local lfs = require("lfs")
local pairs = pairs
local string = string
local table = table
local widget = widget
module("oni")
local maildirfmt = "/home/slash/documents/mail/%s/inbox/new/"
function mailcount(account)
local i = 0
local dir = string.format(maildirfmt, account)
for file in lfs.dir(dir) do
if file ~= "." and file ~= ".." then
i = i + 1
end
end
return i
end
local function showmail(name)
awful.util.spawn("emacsclient -e '(oni:view-mail \"" .. name .. "\")'")
end
function mailcount_widgets(label, account, name)
widgets = {}
widgets.label = widget({ type = "textbox" })
widgets.label.text = string.format(" %s: ", label)
widgets.count = widget({ type = "textbox" })
widgets.count.text = string.format(" %d ", mailcount(account))
widgets.count.bg = beautiful.bg_focus
widgets.count:buttons(
awful.util.table.join(
awful.button({ }, 1, function (c) showmail(name) end)))
return widgets
end
function focus_raise(direction)
awful.client.focus.bydirection(direction)
if client.focus then client.focus:raise() end
end
function ror_browser()
ext.run_or_raise("conkeror", { class = "Conkeror" })
end
function ror_editor()
ext.run_or_raise("emacsclient -c -a emacs", { class = "Emacs" })
end
function ror_term()
ext.run_or_raise("urxvt", { class = "URxvt" })
end
function run_browser()
awful.util.spawn("conkeror")
end
function run_editor()
awful.util.spawn("emacsclient -c -a emacs")
end
function run_term()
awful.util.spawn("urxvt")
end

View file

@ -4,10 +4,9 @@ require("awful.rules")
require("beautiful") require("beautiful")
require("bowl") require("bowl")
require("keychain") require("keychain")
require("lfs")
require("naughty") require("naughty")
require("ext")
oni = { } -- Container for custom functions. require("oni")
--- Error handling --- Error handling
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to
@ -33,72 +32,6 @@ do
end) end)
end end
--- Functions
function oni.focus_raise(direction)
awful.client.focus.bydirection(direction)
if client.focus then client.focus:raise() end
end
-- Returns true if all pairs in table1 are present in table2
function oni.match(table1, table2)
for k, v in pairs(table1) do
if table[k] ~= v and not table2[k]:find(v) then
return false
end
end
return true
end
--- Spawns cmd if no client can be found matching properties
-- If such a client can be found, pop to first tag where it is
-- visible, and give it focus
function oni.run_or_raise(cmd, properties)
local clients = client.get()
local focused = awful.client.next(0)
local findex = 0
local matched_clients = { }
local n = 0
for i, c in pairs(clients) do
-- make an array of matched clients
if oni.match(properties, c) then
n = n + 1
matched_clients[n] = c
if n == focused then
findex = n
end
end
end
if n > 0 then
local c = matched_clients[1]
-- if the focused window matched switch focus to next in list
if 0 < findex and findex < n then
c = matched_clients[findex + 1]
end
local ctags = c:tags()
if table.getn(ctags) == 0 then
-- ctags is empty, show client on current tag
local curtag = awful.tag.selected()
awful.client.movetotag(curtag, c)
else
-- Otherwise, pop to first tag client is visible on
awful.tag.viewonly(ctags[1])
end
-- And then focus the client
client.focus = c
c:raise()
awful.screen.focus(c.screen)
return
end
awful.util.spawn(cmd)
end
-- {{{ Variable definitions -- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers -- Themes define colours, icons, and wallpapers
beautiful.init("/home/slash/.config/awesome/themes/custom/theme.lua") beautiful.init("/home/slash/.config/awesome/themes/custom/theme.lua")
@ -282,28 +215,19 @@ globalkeys = awful.util.table.join(
sub({ }, "b", function () oni.focus_raise("left") end), sub({ }, "b", function () oni.focus_raise("left") end),
sub({ }, "n", function () oni.focus_raise("down") end), sub({ }, "n", function () oni.focus_raise("down") end),
sub({ }, "p", function () oni.focus_raise("up") end), sub({ }, "p", function () oni.focus_raise("up") end),
sub({ }, "e", sub({ }, "c", oni.ror_term),
function () oni.run_or_raise("emacsclient -c -a emacs", sub({ "Shift", }, "c", oni.run_term),
{ class = "Emacs" }) end), sub({ }, "e", oni.ror_editor),
sub({ "Shift", }, "e", sub({ "Shift", }, "e", oni.run_editor),
function () awful.util.spawn("emacsclient -c -a emacs") end), sub({ }, "w", oni.ror_browser),
sub({ }, "c", sub({ "Shift", }, "w", oni.run_browser) }),
function () oni.run_or_raise("urxvt",
{ class = "URxvt" }) end),
sub({ "Shift", }, "c",
function () awful.util.spawn("urxvt") end),
sub({ }, "w",
function () oni.run_or_raise("conkeror",
{ class = "Conkeror" }) end),
sub({ "Shift", }, "w",
function () awful.util.spawn("conkeror") end) }),
awful.key({ "Control", "Mod1" }, "l", awful.key({ "Control", "Mod1" }, "l",
function () awful.util.spawn("i3lock -c 000000") end), function () awful.util.spawn("i3lock -c 000000") end),
awful.key({ modkey, }, "Left", awful.tag.viewprev ), awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ), awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore), awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), -- awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end),
-- Layout manipulation -- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),

View file

@ -74,7 +74,7 @@ theme.titlebar_maximized_button_normal_active = "/home/slash/.config/awesome/the
theme.titlebar_maximized_button_focus_active = "/home/slash/.config/awesome/themes/custom/titlebar/maximized_focus_active.png" theme.titlebar_maximized_button_focus_active = "/home/slash/.config/awesome/themes/custom/titlebar/maximized_focus_active.png"
-- You can use your own command to set your wallpaper -- You can use your own command to set your wallpaper
theme.wallpaper_cmd = { "awsetbg -u hsetroot /home/slash/pictures/wallpapers/3600x1080/wallpaper-1085607.jpg" } theme.wallpaper_cmd = { "awsetbg -u feh -c /usr/share/archlinux/wallpaper/archlinux-simplyblack.png" }
-- You can use your own layout icons like this: -- You can use your own layout icons like this:
theme.layout_fairh = "/home/slash/.config/awesome/themes/custom/layouts/fairhw.png" theme.layout_fairh = "/home/slash/.config/awesome/themes/custom/layouts/fairhw.png"

View file

@ -131,6 +131,9 @@ define_webjump("google",
define_webjump("github", define_webjump("github",
"https://github.com/search?q=%s&type=Everything&repo=&langOverride=&start_value=1", "https://github.com/search?q=%s&type=Everything&repo=&langOverride=&start_value=1",
$alternative="https://github.com"); $alternative="https://github.com");
define_webjump("mdn",
"https://developer.mozilla.org/en-US/search?q=%s",
$alternative="https://developer.mozilla.org/");
// Archlinux // Archlinux
define_webjump("arch/wiki", define_webjump("arch/wiki",
"https://wiki.archlinux.org/index.php?search=%s", "https://wiki.archlinux.org/index.php?search=%s",
@ -164,3 +167,91 @@ remove_hook("download_added_hook", open_download_buffer_automatically);
hints_minibuffer_annotation_mode(true); hints_minibuffer_annotation_mode(true);
theme_load("naquadah"); theme_load("naquadah");
var gh_url = "http://github.com/";
function read_url_github_ad_command_handler(input)
{
var m = /^gh\s+@(\S+)(?:\s+((?:un)?follow))?/.exec(input);
if (m) {
if (m[2])
return gh_url + "users/follow?target=";
return gh_url + m[1];
}
return null;
}
function read_url_github_my_command_handler(input)
{
var m = /^gh\s+my\s+(dashboard|issues|notifications|profile|pulls|stars)/.exec(input);
if (m) {
switch (m[1]) {
case "dashboard":
case "notifications":
case "stars":
return gh_url + m[1];
case "issues":
case "pulls":
return gh_url + "dashboard/" + m[1];
case "profile":
return gh_url + "settings/" + m[1];
}
}
return null;
}
function read_url_github_repo_command_handler(input)
{
var m = /^gh\s+(\S+\/\S+)(?:\s+(\#\d+|\@\S+|issues|pulls|wiki|graphs|network|admin)(?:\s+(\#\d+|new))?)?$/.exec(input);
if (m) {
repo_url = gh_url + m[1] + "/";
switch (m[2]) {
case "issues":
issues_url = repo_url + m[2] + "/";
if (m[3]) {
if (m[3][0] == '#')
return issues_url + m[3].substring(1);
else if (m[3] == "new")
return issues_url + m[3];
else
break;
}
return issues_url;
case "pulls":
case "wiki":
case "graphs":
case "network":
case "admin":
return repo_url + m[2];
default:
// Still need watch and unwatch
if (m[2]) {
if (m[2][0] == '#')
return repo_url + "issues/" + m[2].substring(1);
else if (m[2][0] == '@')
return repo_url + "tree/" + m[2].substring(1);
else
break;
}
return repo_url;
}
}
return null;
}
function read_url_github_command_handler(input)
{
return read_url_github_ad_command_handler(input)
|| read_url_github_my_command_handler(input)
|| read_url_github_repo_command_handler(input);
}
read_url_handler_list = [read_url_github_command_handler];

15
.emacs.d/.gitignore vendored Normal file
View file

@ -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

View file

@ -1,4 +1,3 @@
;; -*- eval: (git-auto-commit-mode 1) -*-
(setq gnus-select-method '(nntp "news.eternal-september.org")) (setq gnus-select-method '(nntp "news.eternal-september.org"))
(setq gnus-secondary-select-methods (setq gnus-secondary-select-methods
'((nnmaildir "gmail" '((nnmaildir "gmail"
@ -64,7 +63,7 @@
(add-hook 'gnus-group-mode-hook '(lambda () (linum-mode -1))) (add-hook 'gnus-group-mode-hook '(lambda () (linum-mode -1)))
;-----[ BBDB ]-------------------------------------------------------- ;-----[ BBDB ]--------------------------------------------------------
(require 'bbdb) ;; (require 'bbdb)
(bbdb-initialize 'gnus 'message) ;; (bbdb-initialize 'gnus 'message)
(bbdb-insinuate-gnus) ;; (bbdb-insinuate-gnus)
(setq bbdb-north-american-phone-numbers-p nil) ;; (setq bbdb-north-american-phone-numbers-p nil)

View file

@ -245,6 +245,7 @@ DOT are intentionally being skipped."
(defun oni:html-mode-func () (defun oni:html-mode-func ()
"Function for `html-mode-hook'." "Function for `html-mode-hook'."
(yas-minor-mode)
(fci-mode)) (fci-mode))
(defun oni:indent-shift-left (start end &optional count) (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)))
(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) (defun oni:myepisodes-formatter (plist)
"Format RSS items from MyEpisodes as org tasks. "Format RSS items from MyEpisodes as org tasks.
PLIST contains all the pertinent information." 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 () (defun oni:org-mode-func ()
"Function for `org-mode-hook'." "Function for `org-mode-hook'."
(flyspell-mode) (flyspell-mode)
(auto-fill-mode)) (auto-fill-mode)
(yas-minor-mode))
(defun oni:php-mode-func () (defun oni:php-mode-func ()
"Function for `php-mode-hook'." "Function for `php-mode-hook'."
@ -809,6 +815,9 @@ for easy selection."
(setq eshell-prompt-regexp "^[#$]> ") (setq eshell-prompt-regexp "^[#$]> ")
(setq fci-rule-color "darkred") (setq fci-rule-color "darkred")
(setq flymake-gui-warnings-enabled nil) (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-file-name (expand-file-name "~/.emacs.d/flymake.log"))
(setq flymake-log-level 0) (setq flymake-log-level 0)
(setq flymake-warn-line-regexp (setq flymake-warn-line-regexp
@ -816,7 +825,9 @@ for easy selection."
(regexp-opt '("warning" (regexp-opt '("warning"
"Warning" "Warning"
"Missing docstring" "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 frame-title-format '(:eval (concat "emacs: " (buffer-name))))
(setq geiser-repl-history-filename "~/.emacs.d/geiser-history") (setq geiser-repl-history-filename "~/.emacs.d/geiser-history")
(setq gtags-auto-update t) (setq gtags-auto-update t)
@ -845,6 +856,7 @@ for easy selection."
(setq mail-header-separator "") (setq mail-header-separator "")
(setq message-log-max 1000) (setq message-log-max 1000)
(setq message-send-mail-function 'message-send-mail-with-sendmail) (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-date-format "%d-%m %H:%M")
(setq mu4e-headers-fields '((:date . 11) (setq mu4e-headers-fields '((:date . 11)
(:flags . 6) (:flags . 6)
@ -899,7 +911,7 @@ for easy selection."
(setq org-feed-alist (setq org-feed-alist
'(("MyEpisodes" '(("MyEpisodes"
"http://www.myepisodes.com/rss.php?feed=mylist&uid=Slash&pwdmd5=04028968e1f0b7ee678b748a4320ac17" "http://www.myepisodes.com/rss.php?feed=mylist&uid=Slash&pwdmd5=04028968e1f0b7ee678b748a4320ac17"
"~/documents/org/org" "MyEpisodes" "~/documents/org/tasks" "MyEpisodes"
:formatter oni:myepisodes-formatter))) :formatter oni:myepisodes-formatter)))
(setq org-hide-emphasis-markers t) (setq org-hide-emphasis-markers t)
(setq org-outline-path-complete-in-steps t) (setq org-outline-path-complete-in-steps t)
@ -928,6 +940,7 @@ for easy selection."
("marmalade" . "http://marmalade-repo.org/packages/"))) ("marmalade" . "http://marmalade-repo.org/packages/")))
(setq package-load-list '((htmlize "1.39") (setq package-load-list '((htmlize "1.39")
(lua-mode "20111107") (lua-mode "20111107")
(python "0.24.2")
all)) all))
(setq php-function-call-face 'font-lock-function-name-face) (setq php-function-call-face 'font-lock-function-name-face)
(setq php-mode-force-pear t) (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 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func)
(add-hook 'markdown-mode-hook 'oni:markdown-mode-func) (add-hook 'markdown-mode-hook 'oni:markdown-mode-func)
(add-hook 'message-mode-hook 'oni:message-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 'org-mode-hook 'oni:org-mode-func)
(add-hook 'php-mode-hook 'oni:php-mode-func) (add-hook 'php-mode-hook 'oni:php-mode-func)
(add-hook 'prog-mode-hook 'oni:prog-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 '("\\.jl$" . sawfish-mode))
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-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 '("\\.php[345]?$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode)) (add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode))
(add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode)) (add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))
@ -1051,6 +1065,9 @@ for easy selection."
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("^\\*.*\\*$" . ((bw-display-in-bottom-window . nil)))) '("^\\*.*\\*$" . ((bw-display-in-bottom-window . nil))))
(delete " " mode-line-format)
(delete " " mode-line-format)
(unless (oni:required-packages-installed-p) (unless (oni:required-packages-installed-p)
(message "%s" "Refreshing package database...") (message "%s" "Refreshing package database...")
(package-refresh-contents) (package-refresh-contents)
@ -1065,9 +1082,10 @@ for easy selection."
(scroll-bar-mode -1) (scroll-bar-mode -1)
(tool-bar-mode -1) (tool-bar-mode -1)
(tooltip-mode -1) (tooltip-mode -1)
(line-number-mode -1)
(column-number-mode -1)
(auto-insert-mode) (auto-insert-mode)
(column-number-mode)
(electric-indent-mode) (electric-indent-mode)
(electric-pair-mode) (electric-pair-mode)
(ido-mode) (ido-mode)

View file

@ -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

View file

@ -26,32 +26,49 @@
(defvar quick-edit-map (defvar quick-edit-map
(let ((map (make-sparse-keymap))) (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 "b" 'backward-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 "v" 'scroll-up-command)
(define-key map "/" 'undo) (define-key map "/" 'undo)
(define-key map "w" 'oni:kill-region-or-backward-char) (define-key map "0" 'delete-window)
(define-key map "d" 'oni:kill-region-or-forward-char) (define-key map "1" 'delete-other-windows)
(define-key map "k" 'oni:kill-region-or-line) (define-key map "2" 'split-window-below)
(define-key map "3" 'split-window-right)
(define-key map "K" 'kill-whole-line) (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 "f" 'forward-char)
(define-key map "j" 'newline-and-indent) (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 "w" 'oni:kill-region-or-backward-char)
(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) (define-key map (kbd "RET") 'quick-edit-mode)
map) map)
"Keymap for quick-edit-mode.") "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 ;;;###autoload
(define-minor-mode quick-edit-mode (define-minor-mode quick-edit-mode
"Quickly edit stuff." "Quickly edit stuff."
:lighter " qe" :lighter " qe"
:global t :global t
(if quick-edit-mode (if quick-edit-mode
(setq overriding-local-map quick-edit-map) (progn
(setq overriding-local-map nil))) (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) (provide 'quick-edit-mode)
;;; quick-edit-mode.el ends here ;;; quick-edit-mode.el ends here

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: for
# key: for
# condition: pony-tpl-minor-mode
# --
{% for $1 in $2 %}
$0
{% endfor %}

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Template Block
# key: %
# condition: pony-tpl-minor-mode
# --
{% $1 %}
$0
{% end$1 %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: codeblock
# key: code
# --
#+begin_src $1
$0
#+end_src

View file

@ -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

View file

@ -30,10 +30,16 @@
(custom-theme-set-faces (custom-theme-set-faces
'new 'new
'(default ((t (:background "#111113" :foreground "#eeeeec")))) '(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-delimiter-face ((t (:foreground "#a9a9a9" :slant italic :weight bold))))
'(font-lock-comment-face ((t (:foreground "#a9a9a9" :slant italic)))) '(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-keyword-face ((t (:foreground "#cfce29"))))
'(font-lock-string-face ((t (:foreground "#ffbd5c"))))
'(font-lock-type-face ((t (:foreground "#78a2c1")))) '(font-lock-type-face ((t (:foreground "#78a2c1"))))
'(highlight ((t (:background "#171719"))))
'(ido-subdir ((t (:foreground "#ff5d55")))) '(ido-subdir ((t (:foreground "#ff5d55"))))
'(jabber-chat-prompt-foreign ((t (:foreground "#ff5d55")))) '(jabber-chat-prompt-foreign ((t (:foreground "#ff5d55"))))
'(jabber-chat-prompt-local ((t (:foreground "#78a2c1")))) '(jabber-chat-prompt-local ((t (:foreground "#78a2c1"))))
@ -43,7 +49,6 @@
'(mode-line ((t (:background "#222224" :foreground "#eeeeec" :box nil)))) '(mode-line ((t (:background "#222224" :foreground "#eeeeec" :box nil))))
'(mode-line-inactive ((t (:background "#171719" :foreground "#999999" :box nil)))) '(mode-line-inactive ((t (:background "#171719" :foreground "#999999" :box nil))))
'(region ((t (:background "#2729b6")))) '(region ((t (:background "#2729b6"))))
'(highlight ((t (:background "#171719"))))
) )
(provide-theme 'new) (provide-theme 'new)

View file

@ -127,9 +127,15 @@
(format-expand *window-formatters* *window-format* (format-expand *window-formatters* *window-format*
(current-window))))) (current-window)))))
(set-prefix-key (kbd "C-z")) (set-prefix-key (kbd "C-i"))
(define-key *top-map* (kbd "C-M-l") "run-i3lock") (define-key *top-map* (kbd "C-M-l") "run-i3lock")
(define-key *top-map* (kbd "KP_Begin") "vsplit")
(define-key *top-map* (kbd "KP_Divide") "remove")
(define-key *top-map* (kbd "KP_Left") "only")
(define-key *top-map* (kbd "KP_Multiply") "fnext")
(define-key *top-map* (kbd "KP_Right") "hsplit")
(define-key *top-map* (kbd "KP_End") "pull-hidden-next")
(define-key *root-map* (kbd "c") "raise-urxvt") (define-key *root-map* (kbd "c") "raise-urxvt")
(define-key *root-map* (kbd "C") "run-urxvt") (define-key *root-map* (kbd "C") "run-urxvt")

15
.xinitrc Normal file
View file

@ -0,0 +1,15 @@
xmodmap ~/.Xmodmap
{ emacs --daemon & } && sleep 1
pidof mpdscribble >& /dev/null
if [ $? -ne 0 ]
then
mpdscribble &
fi
# rox -b Default
test -n "$1" && wm=$1 || wm="awesome" # wm="emacsclient -ce \"(oni:wm-init)\""
exec ck-launch-session $wm