Skip to content

Commit

Permalink
updated documentation + updated full-ide.window-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyglazyrindev committed Jan 17, 2018
1 parent 9ad678a commit 91f0956
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 55 deletions.
78 changes: 28 additions & 50 deletions layouts/FullIde.md
Expand Up @@ -12,20 +12,15 @@ First of all, please see the interface of this emacs window-configuration.

## Organize your emacs layout

First of all, install window-purpose emacs package through "package-install" or "el-get". Then please create directory YOUR_EMACSD_DIRECTORY/layouts and copy the file full-ide.window-layout there. Add to your init.el following elisp code.
First of all, install window-purpose emacs package through "package-install" or "el-get". Add to your init.el following elisp code.

```elisp
(defun load-purpose-mode ()
(interactive)
(purpose-x-code1–setup-ibuffer)
(neotree-toggle)
(imenu-list-minor-mode)
(frame-or-buffer-changed-p ’purpose-full-ide-buffers-changed)
(add-hook ’post-command-hook #’purpose-full-ide-buffers-changed)
(purpose-load-window-layout-file „YOUREMACSD_PATH/layouts/full-ide.window-layout“)
(todo-mode-get-buffer-create))
(purpose-mode)
(purpose-full-ide-setup))
(global-set-key (kbd „M-L“) ’load-purpose-mode)
(global-set-key (kbd „M-L“)OB ’load-purpose-mode)
(defun get-only-one-buffer-with-purpose (purpose)
„Get buffers wih purpose“
Expand All @@ -36,46 +31,36 @@ Then by clicking a key combination "M-L", you will get a full ide window layout.

## Browse your project and files

For this I propose to use neotree emacs plugin + projectile. Neotree initialization very easy, it’s already done in load-purpose-mode function I mentioned above. Projectile installation also very simple. Please check documentation of these libraries.
For this I propose to use neotree emacs plugin + projectile. Neotree initialization very easy, it’s already done in this package. Projectile installation also very simple. Please check documentation of these libraries.

How do you switch to list of the files in your project ?
If you add following to your init.el, then using combination "C-c C-l" you will be able to switch to the buffer with your directory structure.

```elisp
(define-key purpose-mode-map (kbd „C-c C-l“)
(lambda () (interactive) (purpose-switch-buffer (get-only-one-buffer-with-purpose ’dired))))
(lambda () (interactive) (purpose-switch-buffer (get-only-one-buffer-with-purpose ’Neotree))))
```

## Keep list of your opened files

How do you see the list of currently opened files in your project, in your environment ? For this purpose, we’ve added a buffer with purpose buffers and pointed to this buffer "ibuffers" emacs mode

How do you switch to this buffer ? You may add your own key combination, using an example of the code above, you need to replace only "dired" with "buffers" and use the key combination which fits your keyboard "habits".
How do you switch to this buffer ? You may add your own key combination, using an example of the code above, you need to replace only "Neotree" with "buffers" and use the key combination which fits your keyboard "habits".

## Edit your code

The emacs configuration for this need depends on technologies you are working with. I work mostly with python/js/bash, so for my needs it’s enough to add following changes to my init el
The emacs configuration for this need depends on technologies you are working with. I work mostly with python/js/bash, so for my needs I need no extra configuration for emacs-purpose buffer purposes. But you may decide to add your own purposes, please configure it as described below.

```elisp
(add-to-list ’purpose-user-mode-purposes
’(css-mode . edit))
(add-to-list ’purpose-user-mode-purposes
’(shell-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(eshell-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(term-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(yaml-mode . edit))
(add-to-list ’purpose-user-mode-purposes
’(conf-unix-mode . edit))
(purpose-conf „magit-single“
:regexp-purposes ’((„^\\*magit“ . edit)))
’(EMACS_MODE . PURPOSE))
;; don’t forget to recompile user-configuration after you updated list of supported emacs modes
(purpose-compile-user-configuration)
```

You may switch to the file opened in your emacs using key combination "C-c C-c". To enavle this key combination, please add the code below to your initel
You may switch to the file opened in your emacs using key combination "C-c C-c". To enable this key combination, please add the code below to your init.el

```elisp
(define-key purpose-mode-map (kbd „C-c C-c“)
Expand All @@ -91,39 +76,32 @@ It would be great to show a search results in the misc buffer and get huge benef
```elisp
(add-to-list ’purpose-user-mode-purposes
’(inferior-python-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(python-inferior-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(org-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(grep-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(gdb-inferior-io-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(fundamental-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(compilation-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(shell-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(eshell-mode . misc))
(add-to-list ’purpose-user-mode-purposes
’(term-mode . misc))
;; don’t forget to recompile user-configuration after you updated list of supported emacs modes
(purpose-compile-user-configuration)
```

As you can see I associated a lot of major modes with misc purpose, so all these major modes will open in the buffer with purpose misc.
It makes sense to add a simple key-combinations to increase the height of buffer to analyze a lot of findings by grep.. etc

The simple elisp solution will do that for you

```elisp
(global-set-key „\C-c+“ (lambda () (interactive) (enlarge-window +20)))
(global-set-key „\C-c_“ (lambda () (interactive) (enlarge-window -20)))
## Special todo buffer for a todos in your projects

As developers we put to the code @todo markers just to remember what should be fixed, etc. Especially for this purpose we added "special" todo functionality based on org-mode. To see it in action you need to add a bash alias to your environment "collecttodotags". It could be something similar to the text below

```bash
alias collecttodotags="find 'pwd' -type d \( -name .git -o -name node_modules \) -prune -o -type f \( -name todo.org \) -prune -o -type f -print -exec grep -n ’@todo’ ’{}’ \; | create_org_mode_todo_file.py > ./todo.org"
```

You may use the simple of version of todo.org file builder from our repository. Please check out the file "create_org_mode_todo_file.py".

How do you use it efficiently ? We sort @todo mentions by number of "o" letters in the end of this phrase "@todooo". So, if you add a comment

```python
# @todoooo, the socket here should be monkey-patched by socket from gevent
```

So, these key-combinations will help you to get full advantages of this buffer with so different purposes.
this "todo" entry will appear higher than simple "@todo Need a fix".

## List of your functions

Expand Down
18 changes: 13 additions & 5 deletions layouts/full-ide.window-layout
@@ -1,5 +1,13 @@
(nil (0 0 225 50) (nil (0 0 157 50) (t (0 0 28 50) (:purpose dired :purpose-dedicated t :width 0.2 :height 0.5098039215686274 :edges (0.0 0.0 0.2 0.5098039215686274)) (:purpose
buffers :purpose-dedicated t :width 0.2 :height 0.47058823529411764 :edges (0.0 0.5098039215686274 0.2 0.9803921568627451))) (t (28 0 157 50) (:purpose edit :purpose-dedicated t :width
0.63 :height 0.8823529411764706 :edges (0.20 0.0 0.83 0.8823529411764706)) (:purpose misc :purpose-dedicated t :width 0.63 :height 0.09803921568627451 :edges
(0.2 0.8823529411764706 0.83 0.9803921568627451)))) (t (157 0 225 50) (:purpose ilist :purpose-dedicated nil :width 0.17 :height 0.9803921568627451 :edges
(0.83 0.0 1 0.9803921568627451)) ))
(nil
(0 0 225 50)
(t
(0 0 45 50)
(:purpose Neotree :purpose-dedicated t :width 0.2 :height 0.5098039215686274 :edges (0.0 0.0 0.2 0.5098039215686274))
(:purpose buffers :purpose-dedicated t :width 0.2 :height 0.47058823529411764 :edges (0.0 0.0 0.2 0.9803921568627451)))
(t
(45 0 187 50)
(:purpose edit :purpose-dedicated t :width 0.63 :height 0.8823529411764706 :edges (0.20 0.0 0.83 0.8823529411764706))
(:purpose misc :purpose-dedicated t :width 0.63 :height 0.09803921568627451 :edges (0.2 0.8823529411764706 0.83 0.9803921568627451)))
(t
(187 0 225 50)
(:purpose ilist :purpose-dedicated t :width 0.17 :height 0.9803921568627451 :edges (0.83 0.0 1 0.9803921568627451))))

0 comments on commit 91f0956

Please sign in to comment.