summaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs68
1 files changed, 58 insertions, 10 deletions
diff --git a/emacs b/emacs
index 7056587..58bb2ab 100644
--- a/emacs
+++ b/emacs
@@ -1,10 +1,11 @@
-;; -*- self-compile-mode: t -*-
+;; -*- self-compile-mode: t; foldingo-close: t -*-
(setq custom-file "~/.emacs.d/emacs-custom.el")
(load custom-file)
(setq warning-suppress-types nil)
-;; load-path anpassen
+;;{{{ load-path anpassen
+
(let* ((my-lisp-dir "~/.emacs.d/lisp")
(default-directory my-lisp-dir)
(orig-load-path load-path))
@@ -12,20 +13,27 @@
(normal-top-level-add-subdirs-to-load-path)
(nconc load-path orig-load-path))
-;; fix scroll bug with emacs 24.1
+;;}}}
+
+;;{{{ fix scroll bug with emacs 24.1
+
(when (boundp 'bidi-paragraph-direction)
(setq-default bidi-paragraph-direction 'left-to-right))
-;; load own color theme
+;;}}}
+
+;;{{{ load own color theme
(when (require 'color-theme nil 'noerror)
(color-theme-initialize)
(if (not window-system)
(color-theme-alex-console)
(color-theme-alex)))
+;;}}}
-;; user settings
+;;{{{ user settings
(setq user-full-name "Alexander Sulfrian"
user-mail-address "alexander@sulfrian.net")
+;;}}}
;; define F1 to display man page of the current word
(global-set-key [(f1)] (lambda () (interactive) (manual-entry (current-word))))
@@ -45,7 +53,7 @@
(global-set-key [mouse-3] 'imenu)
-;; fix keys for urxvt
+;;{{{ fix keys for urxvt
(if (not window-system)
(mapc (lambda (map)
(define-key function-key-map
@@ -73,6 +81,7 @@
("<M-S-right>" "ESC M-[ c")
("<M-S-left>" "ESC M-[ d")
)))
+;;}}}
(setq auto-mode-alist (cons '("README" . text-mode) auto-mode-alist))
(setq compilation-scroll-output t)
@@ -363,7 +372,8 @@ If this is set during find-file, flyspell mode gets enabled automaticaly.")
(add-hook 'js-mode-hook
(lambda () (flymake-mode t))))
-;; org-mode
+;;{{{ org-mode
+
(when (require 'org nil 'noerror)
(progn
(setq org-todo-keywords
@@ -376,6 +386,8 @@ If this is set during find-file, flyspell mode gets enabled automaticaly.")
(setq org-startup-folded 'content)
(setq org-startup-indented t)))
+;;}}}
+
;; promela-mode
(when (require 'promela-mode nil 'noerror)
(setq auto-mode-alist
@@ -408,19 +420,20 @@ If this is set during find-file, flyspell mode gets enabled automaticaly.")
;; arduino-mode
(require 'arduino-mode nil 'noerror)
-;; deft
+;;{{{ deft
(when (require 'deft nil 'noerror)
(setq deft-extension "org"
deft-directory "~/.org/deft/"
deft-text-mode 'org-mode)
(global-set-key (kbd "<f9>") 'deft))
+;;}}}
;; edit with emacs
(when (require 'edit-server nil 'noerror)
(setq edit-server-new-frame nil)
(edit-server-start))
-;; fix raise-frame
+;;{{{ fix raise-frame
(defadvice raise-frame (after make-it-work (&optional frame) activate)
"Work around some bug? in raise-frame/Emacs/GTK/Metacity/something.
Katsumi Yamaoka <yamaoka@jpl.org> posted this in
@@ -428,8 +441,10 @@ If this is set during find-file, flyspell mode gets enabled automaticaly.")
(call-process
"wmctrl" nil nil nil "-i" "-R"
(frame-parameter (or frame (selected-frame)) 'outer-window-id)))
+;;}}}
+
+;;{{{ quick open shell
-;; quick open shell
(defun dirname (file)
(replace-regexp-in-string "[^/]*$" "" file))
@@ -443,3 +458,36 @@ If this is set during find-file, flyspell mode gets enabled automaticaly.")
(message "Buffer does not contain a file.")))
(global-set-key (kbd "<f12>") 'open-buffer-shell)
+
+;;}}}
+
+;;{{{ foldingo-mode
+(when (require 'foldingo nil 'noerror)
+ (add-hook 'find-file-hooks
+ 'install-fold-mode-if-needed)
+
+ ;; we want never implicit foldings
+ (defun alex-fold-mode-hook ()
+ (setq-default fold-implicit-fold-threshold 1000000))
+ (add-hook 'fold-mode-hook
+ 'alex-fold-mode-hook)
+
+ ;; close all folds when requested with file local variable folding-close
+ (defadvice install-fold-mode-if-needed (after alex-foldingo-fold-all compile activate)
+ (if (and fold-mode foldingo-close)
+ (fold-close-all-folds)))
+
+ ;; shortcut for toggling a fold
+ (defun alex-fold-toggle-current-fold ()
+ (interactive)
+ (fold-toggle (fold-current-fold)))
+ (define-key fold-keymap (kbd "C-c C-f") 'alex-fold-toggle-current-fold)
+
+ ;; refresh the folds after save, but do not change the current status
+ (defun alex-fold-refresh-after-save ()
+ (when fold-mode
+ (if foldingo-close
+ (fold-enter-fold-mode-close-all-folds)
+ (fold-enter-mode))))
+ (add-hook 'after-save-hook 'alex-fold-refresh-after-save))
+;;}}}