1 Commits

Author SHA1 Message Date
Gergely Polonkai
9d100afe03 Start implementing Gerrit package 2016-10-25 18:25:08 +02:00
14 changed files with 8227 additions and 3373 deletions

File diff suppressed because one or more lines are too long

2
.gitignore vendored
View File

@@ -15,8 +15,6 @@
/url/
/hgs-cache
/smex-items
/var/
/anaconda-mode/
# All hail use-package!
/elpa/

View File

@@ -3,23 +3,17 @@
(setq mc/cmds-to-run-for-all
'(
avy-goto-char
c-electric-brace
c-electric-semi&comma
c-indent-line-or-region
electric-newline-and-maybe-indent
gpolonkai/move-to-beginning-of-line
gpolonkai/move-to-end-of-line
hungry-delete-backward
hungry-delete-forward
indent-for-tab-command
kill-region
org-cycle
org-end-of-line
org-kill-line
org-return
org-self-insert-command
org-space-key
sp-backward-delete-char
sp-backward-kill-word
sp-delete-char
@@ -27,11 +21,6 @@
(setq mc/cmds-to-run-once
'(
ace-jump-move
ace-mc-add-char
ace-mc-add-multiple-cursors
ace-mc-add-single-cursor
ace-mc-do-keyboard-reset
drag-stuff-right
end-of-buffer
helm-M-x

View File

@@ -1,155 +0,0 @@
(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.
'(background-color "#7f7f7f")
'(background-mode dark)
'(blink-cursor-mode t)
'(column-number-mode t)
'(cursor-color "#5c5cff")
'(cursor-type (quote bar))
'(custom-enabled-themes (quote (tango-dark)))
'(custom-file (concat user-emacs-directory "customizations.el"))
'(custom-safe-themes
(quote
("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" default)))
'(echo-keystrokes 0.1)
'(fill-column 76)
'(foreground-color "#5c5cff")
'(indent-tabs-mode nil)
'(indicate-empty-lines t)
'(inhibit-startup-echo-area-message (user-login-name))
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
'(package-selected-packages
(quote
(ace-mc
ace-popup-menu
ace-window
achievements
ag
alert
anaconda-mode
anzu
auto-highlight-symbol
auto-package-update
auto-virtualenv
avy
beacon
bind-key
cheatsheet
coffee-mode
command-log-mode
company
company-anaconda
company-c-headers
company-emoji
company-restclient
company-shell
diminish
dired-k
drag-stuff
electric-case
electric-spacing
emamux
eshell-fringe-status
eshell-prompt-extras
expand-region
fill-column-indicator
flycheck
flycheck-pkg-config
flymake-python-pyflakes
focus
form-feed
ggtags
git-gutter-fringe
git-messenger
git-timemachine
gitconfig-mode
gitignore-mode
gitlab
gnugo
gobgen
google
goto-last-change
helm
helm-ag
helm-c-yasnippet
helm-chrome
helm-company
helm-descbinds
helm-describe-modes
helm-flycheck
helm-flyspell
helm-github-stars
helm-google
helm-gtags
helm-hunks
helm-projectile
helm-pydoc
helm-smex
helm-swoop
helm-unicode
highlight-indent-guides
hl-todo
hungarian-holidays
hungry-delete
hyde
id-manager
identica-mode
jinja2-mode
js2-mode
json-mode
kanban
magit
magit-gerrit
magithub
markdown-mode
mc-extras
multiple-cursors
ng2-mode
nyan-mode
nyan-prompt
org
org-bullets
org-jekyll
org-projectile
org-random-todo
org-rtm
origami
plantuml-mode
projectile
rainbow-delimiters
rainbow-mode
restclient
restclient-helm
sass-mode
smart-mode-line
smart-mode-line-powerline-theme
smartparens
spinner
sx
typescript-mode
use-package
vala-mode
vala-snippets
wakatime-mode
xlicense
yaml-mode
yasnippet
zone-nyan
zygospore)))
'(sgml-basic-offset 4)
'(show-trailing-whitespace t)
'(tab-width 4))
(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 (:family "Hack" :foundry "simp" :slant normal :weight normal :height 98 :width normal))))
'(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0))))
'(hl-line ((t (:inherit nil :background "gray25"))))
'(trailing-whitespace ((t (:inherit nil :background "red1"))))
'(whitespace-line ((t (:inherit nil :background "orange4")))))

File diff suppressed because it is too large Load Diff

30
gerrit/gerrit.el Normal file
View File

@@ -0,0 +1,30 @@
(eval-when-compile (require 'cl))
(require 'request)
(defun gerrit-json-read ()
"Gerrit puts five extra chars (\")]}'\n\")at the beginning of
each JSON response for security reasons. All this function does
is it strips those chars before calling `json-read'"
(goto-line 2)
(beginning-of-line)
(json-read))
(let ((username "epolger")
(password "EsthaiTh6Fu"))
(request
"https://gerrit.ericsson.se/a/changes/?q=status:open+owner:self"
:parser 'gerrit-json-read
:headers '(("Authorization"
(concat ("Basic "
(base64-encode-string (concat username
":"
password))))))
:success (function* (lambda (&key data &allow-other-keys)
(message "Success!")
(message "%s" data)))
:error (function* (lambda (&key error-thrown &allow-other-keys&rest _)
(message "Got error: %s" error-thrown)))
:complete (lambda (&rest _) (message "Finished!"))
:status-code '((401 . (lambda (&rest _) (message "Got 401"))))))

564
init.el
View File

@@ -1,17 +1,12 @@
(setq custom-file (concat user-emacs-directory "customizations.el"))
(load custom-file)
;; Initialize the package system and use-package
(setq load-prefer-newer t)
(require 'package)
(add-to-list 'package-archives
'("gnu" . "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
'("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package)
@@ -20,8 +15,6 @@
;; Set up my personal keymap early so I can use it in use-package
;; calls
(defvar gpolonkai/pers-map (make-sparse-keymap)
"My own, personal, keymap!")
(define-prefix-command 'gpolonkai/pers-map)
(define-key ctl-x-map "t" 'gpolonkai/pers-map)
@@ -30,23 +23,142 @@
user-emacs-directory
(convert-standard-filename "lisp/")))
;; Load my own functions
(load "gnu-c-header")
(load "round-number-to-decimals")
(load "zim")
(load "enclose-string")
(load "buf-manipulation")
(load "text-manip")
(load "frame-manip")
(load "file-manip")
(load "window-manip")
(load "gpolonkai-misc")
(advice-add 'define-key :before #'warn-key-rebind)
;; Define aliases
(defalias 'yes-or-no-p 'y-or-n-p)
;; Custom stuff
(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.
'(background-color "#7f7f7f")
'(background-mode dark)
'(blink-cursor-mode t)
'(column-number-mode t)
'(cursor-color "#5c5cff")
'(cursor-type (quote bar))
'(custom-enabled-themes (quote (tango-dark)))
'(custom-safe-themes
(quote
("84d2f9eeb3f82d619ca4bfffe5f157282f4779732f48a5ac1484d94d5ff5b279"
"c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223"
"3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa"
"a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e"
"1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365"
"fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6"
default)))
'(echo-keystrokes 0.1)
'(foreground-color "#5c5cff")
'(indent-tabs-mode nil)
'(indicate-empty-lines t)
'(inhibit-startup-echo-area-message (user-login-name))
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
'(package-selected-packages
(quote
(ace-window
ag
alert
avy
beacon
cheatsheet
coffee-mode
command-log-mode
company
company-c-headers
company-emoji
company-restclient
company-shell
diminish
drag-stuff
electric-case
electric-spacing
emamux
flycheck
flycheck-pkg-config
focus
ggtags
git-gutter
git-messenger
git-timemachine
gitconfig-mode
gitignore-mode
gnugo
gobgen
google
goto-last-change
helm
helm-ag
helm-chrome
helm-company
helm-descbinds
helm-describe-modes
helm-flycheck
helm-flyspell
helm-github-stars
helm-google
helm-gtags
helm-projectile
helm-smex
helm-swoop
helm-unicode
hungarian-holidays
hungry-delete
hyde
id-manager
identica-mode
jinja2-mode
js2-mode
json-mode
magit
magit-gerrit
magithub
markdown-mode
mc-extras
multiple-cursors
ng2-mode
nyan-mode
nyan-prompt
org
org-bullets
org-jekyll
org-projectile
org-random-todo
org-rtm
origami
plantuml-mode
projectile
rainbow-delimiters
rainbow-mode
restclient
restclient-helm
sass-mode
smart-mode-line
smart-mode-line-powerline-theme
smartparens
spinner
sx
typescript-mode
use-package
vala-mode
vala-snippets
wakatime-mode
xlicense
yaml-mode
yasnippet
zone-nyan)))
'(sgml-basic-offset 4)
'(show-trailing-whitespace t)
'(tab-width 4))
;; Custom face settings
(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.
'(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 3.0))))
'(hl-line ((t (:inherit nil :background "gray25"))))
'(trailing-whitespace ((t (:inherit nil :background "red1"))))
'(whitespace-line ((t (:inherit nil :background "orange")))))
(set-face-attribute 'default t :font "Hack-10")
(set-frame-font "Hack-10" nil t)
@@ -56,8 +168,6 @@
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
;; Maximize the frame
(set-frame-parameter nil 'fullscreen 'maximized)
;; Some personal stuff
(setq user-mail-address "gergely@polonkai.eu")
@@ -76,9 +186,8 @@
(helm-mode t)
:bind
(("M-x" . helm-M-x)
:map ctl-x-map
("C-f" . helm-find-files)
("b" . helm-mini)))
("C-x C-f" . helm-find-files)
("C-x b" . helm-mini)))
(use-package helm-swoop
:ensure t
@@ -172,28 +281,15 @@
(add-hook 'eshell-load-hook 'nyan-prompt-enable)))
;; Zone!
(when (display-graphic-p)
(use-package zone-nyan
:ensure t
:after
zone
:config
(setq-default zone-nyan-hide-progress t)
(setq zone-programs (vconcat zone-programs [zone-nyan]))))
(defun gpolonkai/zone-enable ()
(interactive)
(zone-when-idle 60)
(message "I will zone out after idling for 60 seconds."))
(use-package zone-nyan
:ensure t
:init
(setq zone-programs [zone-nyan])
(setq-default zone-nyan-hide-progress t))
(use-package zone
:demand
:config
(zone-when-idle 60)
:bind
(:map gpolonkai/pers-map
("zi" . gpolonkai/zone-enable)
("zq" . zone-leave-me-alone)))
(zone-when-idle 60))
;; Magit and friends
(use-package magit
@@ -202,8 +298,7 @@
(setq magit-auto-revert-mode nil)
(setq magit-last-seen-setup-instructions "1.4.0")
:bind
(:map ctl-x-map
("g" . magit-status)))
(("C-x g" . magit-status)))
(use-package magithub
:ensure t)
@@ -218,7 +313,7 @@
:demand
:config
(define-prefix-command 'origami-mode-map)
(define-key ctl-x-map (kbd "C-z") 'origami-mode-map)
(global-set-key (kbd "C-x C-z") 'origami-mode-map)
(global-origami-mode)
:bind
(:map origami-mode-map
@@ -238,8 +333,7 @@
(use-package helm-ag
:ensure t
:bind
(:map gpolonkai/pers-map
("s" . helm-do-ag)))
(("C-x M-a" . helm-do-ag)))
(use-package smartparens
:ensure t
@@ -255,22 +349,7 @@
(use-package smart-mode-line
:ensure t
:after
org
:config
(add-to-list 'sml/replacer-regexp-list
'("^~/Projects/" ":Proj:")
t)
(add-to-list 'sml/replacer-regexp-list
'("^~/Projektek/" ":Proj:")
t)
(add-to-list 'sml/replacer-regexp-list
(list (concat "^" (regexp-quote user-documents-directory))
":Doc:")
t)
(add-to-list 'sml/replacer-regexp-list
'("^:Proj:jekyll/gergelypolonkai.github.io/" ":Blog:")
t)
(sml/setup))
(use-package company
@@ -307,19 +386,10 @@
(drag-stuff-global-mode t))
;; Git gutter
;; If we are in text-only mode, there is no fringe.
(let ((gitgutter-package
(if (display-graphic-p)
"git-gutter-fringe"
"git-gutter")))
(eval `(use-package ,gitgutter-package
:ensure t
:demand
:config
(global-git-gutter-mode t)
:bind
(:map gpolonkai/pers-map
("gg" . git-gutter:update-all-windows)))))
(use-package git-gutter
:ensure t
:config
(global-git-gutter-mode t))
;; Org mode
(use-package org
@@ -353,28 +423,12 @@
'("p" "Blog post"
entry (file+datetree (concat org-directory "blog.org"))
"* %^{Title} :blog:\n :PROPERTIES:\n :on: %T\n :END:\n %i%?"))
(add-to-list 'org-capture-templates
'("g" "GT2 note"
entry (file+headline (concat org-directory "gt2-notes.org")
"Captures")
"** %^{Title}\n :PROPERTIES:\n :on: %T\n :END:\n %i%?"))
(setq org-time-stamp-formats '("<%Y-%m-%d>" . "<%Y-%m-%d %H:%M>"))
(setq org-todo-keywords
'((sequence "TODO(t)"
"DOING(w@/!)"
"BLOCKED(b@/!)"
"|"
"REVIEW(r@/!)"
"DONE(d@/!)")))
:bind
(:map gpolonkai/pers-map
("a" . org-agenda-list)
("c" . org-capture)
:map org-mode-map
("SPC" . org-space-key)
("C-c l" . org-toggle-link-display)
("C-a" . gpolonkai/move-to-beginning-of-line)
("C-e" . gpolonkai/move-to-end-of-line)))
("SPC" . org-space-key)))
(use-package org-bullets
:ensure t
@@ -387,27 +441,17 @@
(use-package wakatime-mode
:ensure t
:init
(setq-default wakatime-cli-path "/usr/bin/wakatime")
(setq-default wakatime-cli-path "/usr/local/bin/wakatime")
:config
(global-wakatime-mode t))
(use-package ace-window
:ensure t
:config
(setq aw-background nil
aw-dispatch-always t)
(add-to-list 'aw-dispatch-alist
'(?s gpolonkai/scroll-window-up " Scroll window up")
t)
(add-to-list 'aw-dispatch-alist
'(?S gpolonkai/scroll-window-down " Scroll window down")
t)
(add-to-list 'aw-dispatch-alist
'(?q gpolonkai/bury-window " Bury (quit) window")
t)
:init
(setq aw-keys '(?a ?o ?e ?u ?i ?d ?h ?t ?n)
aw-background nil)
:bind
(:map ctl-x-map
("o" . ace-window)))
(("M-P" . ace-window)))
(use-package avy
:ensure t
@@ -415,7 +459,7 @@
:config
(avy-setup-default)
:bind
(("M-g c" . avy-goto-char)
(("C-:" . avy-goto-char)
("C-'" . avy-goto-char-2)
("M-g f" . avy-goto-line)
("M-g w" . avy-goto-word-1)
@@ -445,12 +489,12 @@
(use-package electric-case
:ensure t
:config
(add-hook 'c-mode-hook 'electric-case-c-init))
(add-hook 'c-mode-hook ''electric-case-c-init))
(use-package electric-spacing
:ensure t
:config
(add-hook 'c-mode-common-hook 'electric-spacing-mode))
:bind
(([f7] . electric-spacing-mode)))
(use-package emamux
:ensure t)
@@ -462,10 +506,7 @@
:ensure t)
(use-package git-messenger
:ensure t
:bind
(:map gpolonkai/pers-map
("gm" . git-messenger:popup-message)))
:ensure t)
(use-package git-timemachine
:ensure t
@@ -529,10 +570,7 @@
:ensure t)
(use-package markdown-mode
:ensure t
:config
(push '("\\.markdown\\'" . markdown-mode) auto-mode-alist)
(push '("\\.md\\'" . markdown-mode) auto-mode-alist))
:ensure t)
(use-package mc-extras
:ensure t)
@@ -581,7 +619,7 @@
(use-package helm-smex
:ensure t
:bind
(("M-S-x" . helm-smex)))
(("M-X" . helm-smex)))
(use-package ediff
:ensure t
@@ -610,13 +648,9 @@
(use-package org-random-todo
:ensure t
:demand
:config
;; Dont bug me too often…
(setq org-random-todo-how-often 3600)
:bind
(:map gpolonkai/pers-map
("r" . org-random-todo)))
(setq org-random-todo-how-often 3600))
(use-package calendar
:init
@@ -740,7 +774,7 @@
(use-package cheatsheet
:ensure t)
(use-package nxml-mode
(use-package nxml
:config
(setq nxml-attribute-indent 4
nxml-child-indent 2
@@ -776,165 +810,26 @@
(add-hook 'after-make-frame-functions
'--set-emoji-font))
(use-package zygospore
:ensure t
:bind
(:map ctl-x-map
("1" . zygospore-toggle-delete-other-windows)))
;; Load my own functions
(load "gnu-c-header.el")
(load "toggle-window-split.el")
(load "round-number-to-decimals.el")
(load "transpose-windows.el")
(load "zim.el")
(load "clearcase.el")
(load "enclose-string.el")
(load "buf-manipulation.el")
(load "package-manip")
(load "text-manip")
(load "frame-manip")
(use-package webjump
:bind
(:map gpolonkai/pers-map
("j" . webjump)))
(use-package which-func
:config
(add-hook 'prog-mode-hook
(lambda ()
(which-func-mode)))
(setq which-func-unknown ""))
(use-package ace-popup-menu
:ensure t
:config
(ace-popup-menu-mode 1))
(use-package bind-key
:ensure t)
(use-package kanban
:ensure t)
(use-package achievements
:ensure t
:config
(achievements-mode 1))
(use-package auto-highlight-symbol
:ensure t
:config
(global-auto-highlight-symbol-mode t))
(use-package auto-package-update
:ensure t
:config
(setq auto-package-update-interval 7
auto-package-update-delete-old-versions t))
(use-package cookie1
:demand t
:config
(setq cookie-file (concat user-emacs-directory "fortune-cookies.txt"))
:bind
(:map gpolonkai/pers-map
("k" . cookie)))
(use-package ace-mc
:ensure t)
(use-package dired-k
:ensure t
:bind
(:map dired-mode-map
("K" . dired-k)))
(use-package fill-column-indicator
:ensure t
:config
(add-hook 'prog-mode-hook 'fci-mode))
(use-package form-feed
:ensure t
:config
(add-hook 'emacs-lisp-mode-hook 'form-feed-mode))
(use-package anzu
:ensure t
:config
(global-anzu-mode 1))
(use-package auto-virtualenv
:ensure t
:config
(add-hook 'python-mode-hook 'auto-virtualenv-set-virtualenv)
(add-hook 'projectile-after-switch-project-hook
'auto-virtualenv-set-virtualenv))
(use-package flymake-python-pyflakes
:ensure t)
(use-package gitlab
:ensure t)
(use-package files
:config
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t))))
(use-package helm-c-yasnippet
:ensure t
:demand t
:config
(setq helm-yas-space-match-any-greedy t)
:bind
(("C-c y" . helm-yas-complete)))
(use-package helm-hunks
:ensure t)
(use-package helm-pydoc
:ensure t)
(use-package hl-todo
:ensure t)
(use-package glasses
:ensure t
:config
(add-hook 'prog-mode-hook 'glasses-mode))
(when (display-graphic-p)
(use-package eshell-fringe-status
:ensure t
:config
(add-hook 'eshell-mode-hook 'eshell-fringe-status-mode)))
(use-package eshell-prompt-extras
:ensure t
:config
(with-eval-after-load "esh-opt"
(autoload 'epe-theme-lambda "eshell-prompt-extras")
(setq eshell-highlight-prompt nil
eshell-prompt-function 'epe-theme-lambda)))
(use-package highlight-indent-guides
:ensure t
:config
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
(setq highlight-indent-guides-method 'character))
(use-package expand-region
:ensure t
:bind
(:map ctl-x-map
("*" . er/expand-region)))
(use-package anaconda-mode
:ensure t
:config
(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'python-mode-hook 'anaconda-eldoc-mode))
(use-package company-anaconda
:ensure t
:after
company
:config
(add-to-list 'company-backends 'company-anaconda))
;; Define aliases
(defalias 'yes-or-no-p 'y-or-n-p)
;; `c-mode' settings
(add-hook 'c-mode-hook
(lambda ()
(which-func-mode)))
(add-hook 'c-mode-common-hook
(lambda ()
(local-set-key (kbd "C-c o") 'ff-find-other-file)
@@ -973,37 +868,17 @@
(setq c-offset-alist '((member-init-intro . ++)))
;; Custom key bindings
(bind-keys
:map global-map
("M-(" . æ-enclose-region)
("<C-return>" . open-line-below)
("<C-S-return>" . open-line-above)
("M-t" . nil) ;; Remove the old keybinding
("M-t c" . transpose-chars)
("M-t w" . transpose-words)
("M-t l" . transpose-lines)
("M-t e" . transpose-sexps)
("M-t s" . transpose-sentences)
("M-t p" . transpose-paragraphs)
("M-t W" . transpose-windows)
("C-a" . gpolonkai/move-to-beginning-of-line)
("C-e" . gpolonkai/move-to-end-of-line)
:map ctl-x-map
("C-y" . duplicate-line)
("_" . maximize-window)
("C-r" . rename-current-buffer-file)
("C-d" . delete-current-buffer-file)
("~" . toggle-char-case)
("|" . toggle-window-split)
:map isearch-mode-map
("<C-return>" . isearch-exit-other-end)
:map gpolonkai/pers-map
("m" . hidden-mode-line-mode)
("C-i e" . "gergely@polonkai.eu")
("C-i w" . "http://gergely.polonkai.eu/")
("C-p" . package-list-packages)
("o i" . gpolonkai/visit-init-file)
("o o" . gpolonkai/visit-org-index))
(global-set-key (kbd "C-x _") 'maximize-window)
(global-set-key (kbd "C-c C-y") 'duplicate-line)
(global-set-key (kbd "M-(") 'æ-enclose-region)
(global-set-key (kbd "C-x w") 'webjump)
(global-set-key (kbd "<C-return>") 'open-line-below)
(global-set-key (kbd "<C-S-return>") 'open-line-above)
(global-set-key (kbd "C-x C-r") 'rename-current-buffer-file)
(global-set-key (kbd "C-x C-d") 'delete-current-buffer-file)
(global-set-key (kbd "C-x ~") 'toggle-char-case)
(define-key isearch-mode-map (kbd "<C-return>") #'isearch-exit-other-end)
(define-key gpolonkai/pers-map (kbd "m") 'hidden-mode-line-mode)
;; Kudos goes to
;; http://endlessparentheses.com/leave-the-cursor-at-start-of-match-after-isearch.html
@@ -1020,7 +895,6 @@
;; Enable some functions
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'erase-buffer 'disabled nil)
;; text-mode settings
(add-hook 'text-mode-hook (lambda () (visual-line-mode t)))
@@ -1030,30 +904,26 @@
'(("lambda" . 955) ; λ
("->" . 8594) ; →
("=>" . 8658) ; ⇒
("map" . 8614)) ; ↦
("map" . 8614))) ; ↦
;; …and some pairs to complete
;; TODO: maybe add-to-list is a better way to do it
(setq insert-pair-alist
'(
(40 41) ; ()
(91 93) ; []
(123 125) ; {}
(60 62) ; <>
(34 34) ; ""
(39 39) ; ''
(96 39) ; `'
(8220 8221) ; “”
(8222 8221) ; „”
(8216 8217) ;
(8249 8250) ;
(8250 8249) ;
(171 187) ; «»
(187 171) ; »«
))
;; …and some pairs to complete
;; TODO: maybe add-to-list is a better way to do it
insert-pair-alist '(
(40 41) ; ()
(91 93) ; []
(123 125) ; {}
(60 62) ; <>
(34 34) ; ""
(39 39) ; ''
(96 39) ; `'
(8220 8221) ; “”
(8222 8221) ; „”
(8216 8217) ;
(8249 8250) ;
(8250 8249) ;
(171 187) ; «»
(187 171)) ; »«
;; Set the frame title to the current file name
frame-title-format '((:eval (concat system-name
": "
(if (buffer-file-name)
(abbreviate-file-name
(buffer-file-name))
"%b")))))
;; Check for package upgrades every Monday so I dont forget.
(check-for-package-upgrades-on-day 1)

View File

@@ -127,40 +127,3 @@ copied to the kill-ring."
(let ((beginning (progn (beginning-of-line) (point)))
(end (progn (end-of-line) (point))))
(copy-region-as-kill beginning end))))
(defun gpolonkai/move-to-beginning-of-line ()
"Move to different beginnings of the line; in order: beginning
of the visual line if `visual-line-mode' is active, the first
non-whitespace (indentation), the actual beginning of the line.
This function will jump between the first character and the
indentation if used multiple times.
Inspired by Bozhidar Batsov's solution:
http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/"
(interactive)
(let ((last-pos (point)))
(when visual-line-mode
(beginning-of-visual-line))
(when (= (point) last-pos)
(back-to-indentation))
(when (= (point) last-pos)
(beginning-of-line))
(when (and (eq major-mode 'org-mode)
(= (point) last-pos))
(org-beginning-of-line))
(when (= (point) last-pos)
(back-to-indentation))))
(defun gpolonkai/move-to-end-of-line ()
"Move to the end of the line. If `visual-line-mode' is active,
jump to the end of the visual line first. The jump to the
actual end of the line."
(interactive)
(let ((last-pos (point)))
(when visual-line-mode
(end-of-visual-line))
(when (= (point) last-pos)
(end-of-line))
(when (and (eq major-mode 'org-mode)
(= (point) last-pos))
(org-end-of-line))))

7968
lisp/clearcase.el Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
(defun open-this-file-as-other-user (user)
"Edit current file as USER, using `tramp' and `sudo'. If the current
buffer is not visiting a file, prompt for a file name."
(interactive "sEdit as user (default: root): ")
(when (string= "" user)
(setq user "root"))
(let* ((filename (or buffer-file-name
(read-file-name (format "Find file (as %s): "
user))))
(tramp-path (concat (format "/sudo:%s@localhost:" user) filename)))
(if buffer-file-name
(find-alternate-file tramp-path)
(find-file tramp-path))))
(defun gpolonkai/visit-init-file ()
"Open the init file."
(interactive)
(find-file-other-window user-init-file))
(defun gpolonkai/visit-org-index ()
"Visit the root of Org-mode notes."
(interactive)
(find-file-other-window (concat (file-name-as-directory org-directory)
"index.org")))

View File

@@ -1,27 +0,0 @@
(defun warn-key-rebind (keymap key new-def)
"Warn if a key is being rebound."
(let ((global-def (global-key-binding key))
(local-def (local-key-binding key))
(minor-defs (minor-mode-key-binding key))
(key-desc (key-description key)))
(when (and global-def
(not (numberp global-def))
(not (equal global-def new-def)))
(warn "'%s' from the global keymap is being rebound from '%s' to '%s'"
key-desc
global-def
new-def))
(when (and local-def
(not (numberp local-def))
(not (equal local-def new-def)))
(warn "'%s' from the local keymap is being rebound from '%s' to '%s'"
key-desc
local-def
new-def))
(when minor-defs
(dolist (binding minor-defs)
(warn "'%s' from '%s' keymap is being rebound from '%s' to '%s'"
key-desc
(car binding)
(cdr binding)
new-def)))))

View File

@@ -1,70 +0,0 @@
;;; minari.el --- Calculate Minari dates
;;; Commentary:
;;
;;; Code:
(defconst minari-special-day-names
'("Hëður" "Rideyy" "Morkh" "Morkh+" "Khmerd" "Chamog")
"Names of the special (monthless) days of the year.")
(defconst minari-weekday-names
'("Rounn" "Mïrdu" "Hëmi" "Drak" "Þodon" "Charm")
"Names of weekdays.")
(defconst minari-month-names
'("Mëbel" "Dirann" "Ma"
"Gerub" "Þrei" "Dimoc"
"Xentor" "Mëðïr" "Draþ"
"Quaden" "Ridïmel" "Rodom")
"Names of months.")
(defun minari-today-string ()
"Calculate today's date according to the Minari Calendar."
(let ((today (decode-time (current-time))))
;; FIXME: Im not sure about this one… If I increment by 11, I get a
;; wrong date according to my GNOME Shell extension. If I increment by
;; 10, the date is OK, but by calculating it in my head, its bad.
(incf (nth 3 today) 10)
(let* ((minari-leap (date-leap-year-p (nth 5 today)))
(doy (time-to-day-in-year (apply 'encode-time today)))
(minari-year (- (nth 5 today) 1873))
(minari-month 0)
(minari-doy 0)
(minari-day 0)
(minari-weekday 0)
(minari-special-day -1))
(cond
((eq doy 0) (setq minari-special-day 0))
((eq doy 91) (setq minari-special-day 1))
((eq doy 182) (setq minari-special-day 2))
((and (eq doy 183) minari-leap) (setq minari-special-day 3))
((and (eq doy 273) (not minari-leap)) (setq minari-special-day 4))
((and (eq doy 274) minari-leap) (setq minari-special-day 4))
((and (eq doy 364) (not minari-leap)) (setq minari-special-day 5))
((and (eq doy 365) minari-leap) (setq minari-special-day 5))
(t (let ((decr 0)
(minari-doy doy))
(when (> minari-doy 0) (incf decr))
(when (> minari-doy 91) (incf decr))
(when (> minari-doy 182) (incf decr))
(when (and (> minari-doy 183) minari-leap) (incf decr))
(when (and (> minari-doy 273) (not minari-leap)) (incf decr))
(when (and (> minari-doy 274) minari-leap) (incf decr))
(setq minari-doy (- minari-doy (- decr 1))
minari-month (round (fceiling (/ minari-doy 30.0)))
minari-day (% minari-doy 30))
(when (eq minari-day 0) (setq minari-day 30))
(setq minari-weekday (% minari-day 6)))))
(if (eq -1 minari-special-day)
(format "%d %s %s (%s)"
minari-year
(nth (- minari-month 1) minari-month-names)
minari-day
(nth minari-weekday minari-weekday-names))
(nth (- minari-special-day 1) minari-special-day-names)))))
(provide 'minari)
;;; minari.el ends here

View File

@@ -1,15 +1,3 @@
(defun transpose-windows (arg)
"Transpose the buffers shown in two windows."
(interactive "p")
(let ((selector (if (>= arg 0) 'next-window 'previous-window)))
(while (/= arg 0)
(let ((this-win (window-buffer))
(next-win (window-buffer (funcall selector))))
(set-window-buffer (selected-window) next-win)
(set-window-buffer (funcall selector) this-win)
(select-window (funcall selector)))
(setq arg (if (plusp arg) (1- arg) (1+ arg))))))
(defun toggle-window-split ()
(interactive)
(if (= (count-windows) 2)
@@ -36,21 +24,4 @@
(if this-win-2nd (other-window 1))))
(error "This works only for two windows!")))
(defun gpolonkai/scroll-window-up (window)
"Scroll WINDOW up as `scroll-up-command' would."
(interactive)
(save-selected-window
(select-window window)
(scroll-up)))
(defun gpolonkai/scroll-window-down (window)
"Scroll WINDOW down as `scroll-down-command' would."
(interactive)
(save-selected-window
(select-window window)
(scroll-down)))
(defun gpolonkai/bury-window (window)
"Quit WINDOW without killing it."
(interactive)
(quit-window nil window))
(global-set-key (kbd "C-x |") 'toggle-window-split)

11
lisp/transpose-windows.el Normal file
View File

@@ -0,0 +1,11 @@
(defun transpose-windows (arg)
"Transpose the buffers shown in two windows."
(interactive "p")
(let ((selector (if (>= arg 0) 'next-window 'previous-window)))
(while (/= arg 0)
(let ((this-win (window-buffer))
(next-win (window-buffer (funcall selector))))
(set-window-buffer (selected-window) next-win)
(set-window-buffer (funcall selector) this-win)
(select-window (funcall selector)))
(setq arg (if (plusp arg) (1- arg) (1+ arg))))))