From: Stefan Bund Date: Thu, 17 Sep 2015 07:35:24 +0000 (+0200) Subject: org mode, more window stuff X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=a377b8462f3a4476de74877ffdfb08103e24bb4d;p=emacs-init.git org mode, more window stuff --- diff --git a/.gitmodules b/.gitmodules index 5536bd8..081bfb3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,3 +15,9 @@ url = git://g0dil.de/emacsstuff.git [submodule "git-wip"] path = git-wip url = https://github.com/bartman/git-wip.git +[submodule "emacs-window-toggle"] + path = emacs-window-toggle + url = https://gist.github.com/3383607.git +[submodule "org-mode"] + path = org-mode + url = git://orgmode.org/org-mode.git diff --git a/emacs-custom.el b/emacs-custom.el index ea0eebe..52ba306 100644 --- a/emacs-custom.el +++ b/emacs-custom.el @@ -60,6 +60,7 @@ '(nxml-child-indent 4) '(nxml-where-global-mode nil) '(nxml-where-header nil) + '(org-startup-indented t) '(pop-up-windows nil) '(rng-validate-chunk-size 2000) '(rng-validate-delay 3) diff --git a/emacs-window-toggle b/emacs-window-toggle new file mode 160000 index 0000000..1c87f56 --- /dev/null +++ b/emacs-window-toggle @@ -0,0 +1 @@ +Subproject commit 1c87f56e5d457655a6d8acd4da693f6f96be7d6f diff --git a/org-mode b/org-mode new file mode 160000 index 0000000..0461101 --- /dev/null +++ b/org-mode @@ -0,0 +1 @@ +Subproject commit 0461101fbbb75c4e7942306ce66032122cf3ab0b diff --git a/python/init_python.el b/python/init_python.el index da250d8..ca60d06 100644 --- a/python/init_python.el +++ b/python/init_python.el @@ -319,6 +319,15 @@ "Couldn't enable flymake; permission denied on %s" flymake-filename))))) (add-hook 'find-file-hook 'safer-flymake-find-file-hook) +(defun py-skip-few-lines (&optional count) + (if (null count) (setq count 3)) + (let ((blanks 0)) + (while + (and (or (when (eolp) (setq count 0) (incf blanks) t) + (when (> count 0) (decf count) t)) + (< (forward-line 1) 1))) + (> blanks 0))) + (defun py-imports-region () (save-excursion (goto-char (point-min)) @@ -326,6 +335,9 @@ (looking-at "__future__"))) (beginning-of-line) (setq beg (point)) + (while (and (py-skip-few-lines) + (looking-at "import\\s-+\\|from\\s-+")) + (setq beg (point))) (if (not (looking-at "\\(import\\s-+\\|from\\s-+\\)")) (cons beg beg) (while (looking-at "\\(import\\s-+\\|from\\s-+\\)") diff --git a/setup/emacs-window-toggle.el b/setup/emacs-window-toggle.el new file mode 100644 index 0000000..45c752e --- /dev/null +++ b/setup/emacs-window-toggle.el @@ -0,0 +1,9 @@ +(let ((dir (concat (file-name-directory + (directory-file-name + (file-name-directory + (or load-file-name + (when (boundp 'bytecomp-filename) bytecomp-filename) + buffer-file-name)))) + "emacs-window-toggle/"))) + (load (concat dir "emacs-window-toggle.el")) + (global-set-key "\C-c\C-\\" 'toggle-windows-split)) diff --git a/setup/init-org.el b/setup/init-org.el new file mode 100644 index 0000000..3b97e75 --- /dev/null +++ b/setup/init-org.el @@ -0,0 +1,17 @@ +(let ((base (file-name-directory + (directory-file-name + (file-name-directory + (or load-file-name + (when (boundp 'bytecomp-filename) bytecomp-filename) buffer-file-name)))))) + + (add-to-list 'load-path (concat base "org-mode/lisp")) + (add-to-list 'load-path (concat base "org-mode/contrib")) + + (require 'flyspell) + (if (not (boundp 'flyspell-delayed-commands)) + (setq flyspell-delayed-commands '())) + + (require 'org) + (require 'org-version) + + (setq org-odt-data-dir (concat base "org-mode/etc"))) \ No newline at end of file diff --git a/setup/magit.el b/setup/magit.el index de8011d..db2f66e 100644 --- a/setup/magit.el +++ b/setup/magit.el @@ -120,16 +120,31 @@ (grep (format "git ls-files -z | xargs -r0 grep -nwHF %s | cat -" symbol))))) (global-set-key "\C-cGF" 'git-files-find-symbol) + (defun dired-git-files () (interactive) - (let ((default-directory (magit-get-top-dir default-directory)) + (let ((default-directory (magit-get-top-dir default-directory))\ (ls-lisp-use-insert-directory-program t) files) - (setq files (shell-command-to-string "git ls-files")) - (dired (cons default-directory (split-string files "\n"))))) + (setq files (delete-if '(lambda (file) (string= file "")) + (split-string (shell-command-to-string "git ls-files") "\n"))) + (dired (cons default-directory files)))) (global-set-key "\C-cGD" 'dired-git-files) +(defun dired-grep-git-files (regexp &optional words-only) + (interactive "sRegexp: \nP") + (let ((default-directory (magit-get-top-dir default-directory)) + (cmd (format "git ls-files -z | xargs -r0 grep -l -E%s -- %s | cat -" + (if words-only " -w" "") (shell-quote-argument regexp)))) + (if (not default-directory) + (error "not in Git repository")) + (setq files (delete-if '(lambda (file) (string= file "")) + (split-string (shell-command-to-string cmd) "\n"))) + (dired (cons default-directory files)))) + +(global-set-key "\C-cGH" 'dired-grep-git-files) + (defun magit-svn-fetch () (interactive) (magit-run-git-async "svn" "fetch")) diff --git a/setup/mywin.el b/setup/mywin.el index 05d3b4c..1887b52 100644 --- a/setup/mywin.el +++ b/setup/mywin.el @@ -207,3 +207,4 @@ the buffer stack in the current window." (shrink-window-horizontally (- (- width (window-width) (* window-min-width (1- count))))))) (global-set-key "\C-x=" 'safe-max-window-horizontally) +(global-set-key "\C-x-" 'maximize-window-15) \ No newline at end of file