org mode, more window stuff
Stefan Bund [Thu, 17 Sep 2015 07:35:24 +0000 (09:35 +0200)]
.gitmodules
emacs-custom.el
emacs-window-toggle [new submodule]
org-mode [new submodule]
python/init_python.el
setup/emacs-window-toggle.el [new file with mode: 0644]
setup/init-org.el [new file with mode: 0644]
setup/magit.el
setup/mywin.el

index 5536bd8..081bfb3 100644 (file)
@@ -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
index ea0eebe..52ba306 100644 (file)
@@ -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 (submodule)
index 0000000..1c87f56
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 1c87f56e5d457655a6d8acd4da693f6f96be7d6f
diff --git a/org-mode b/org-mode
new file mode 160000 (submodule)
index 0000000..0461101
--- /dev/null
+++ b/org-mode
@@ -0,0 +1 @@
+Subproject commit 0461101fbbb75c4e7942306ce66032122cf3ab0b
index da250d8..ca60d06 100644 (file)
         "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))
                 (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 (file)
index 0000000..45c752e
--- /dev/null
@@ -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 (file)
index 0000000..3b97e75
--- /dev/null
@@ -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
index de8011d..db2f66e 100644 (file)
       (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"))
index 05d3b4c..1887b52 100644 (file)
@@ -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