cleanup readme

This commit is contained in:
Sergei Nosov 2014-08-11 18:12:33 +04:00
parent 4758db4161
commit 887df923ef
2 changed files with 48 additions and 33 deletions

View File

@ -1,47 +1,59 @@
#Emacs Integration # Emacs Integration
##Requirements ## Requirements
* You must have the [auto-complete](https://github.com/auto-complete/auto-complete) package.
And, [yasnippet](https://github.com/capitaomorte/yasnippet) and [popwin](https://github.com/m2ym/popwin-el) is recommended. * You must have the
* Make sure dcd-client and dcd-server is in your exec-path. Otherwise, please set the variable ```dcd-exectutable``` and ```dcd-server-executable``` using ```M-x customize```. [auto-complete](https://github.com/auto-complete/auto-complete) package. Also,
[yasnippet](https://github.com/capitaomorte/yasnippet) and
[popwin](https://github.com/m2ym/popwin-el) are recommended.
* Make sure `dcd-client` and `dcd-server` is in your exec-path. Otherwise,
please set the variable `dcd-exectutable` and `dcd-server-executable`
using `M-x customize`.
## Setup ## Setup
* First, follow the Setup section in the root README.
* Second, add the following to your .emacs. With this setting, dcd-server starts automatically when you open file in d-mode. (Of course, you should edit ```path_to_ac-dcd.el``` to suit your enviroment.)
``` * Follow the Setup section in the root README.
;;; ac-dcd * Add the following to your .emacs. With this setting, dcd-server starts
(add-to-list 'load-path "path_to_ac-dcd.el") automatically when you open file in d-mode. (Of course, you should edit
(require 'ac-dcd) `path_to_ac-dcd.el` to suit your environment.)
(add-hook 'd-mode-hook ;;; ac-dcd
(add-to-list 'load-path "path_to_ac-dcd.el")
(require 'ac-dcd)
(add-hook 'd-mode-hook
'(lambda () "set up ac-dcd" '(lambda () "set up ac-dcd"
(auto-complete-mode t) (auto-complete-mode t)
(yas-minor-mode-on) (yas-minor-mode-on)
(ac-dcd-maybe-start-server) (ac-dcd-maybe-start-server)
(add-to-list 'ac-sources 'ac-source-dcd))) (add-to-list 'ac-sources 'ac-source-dcd)))
(define-key d-mode-map (kbd "C-c ?") 'ac-dcd-show-ddoc-with-buffer) (define-key d-mode-map (kbd "C-c ?") 'ac-dcd-show-ddoc-with-buffer)
(define-key d-mode-map (kbd "C-c .") 'ac-dcd-goto-definition) (define-key d-mode-map (kbd "C-c .") 'ac-dcd-goto-definition)
(define-key d-mode-map (kbd "C-c ,") 'ac-dcd-goto-def-pop-marker) (define-key d-mode-map (kbd "C-c ,") 'ac-dcd-goto-def-pop-marker)
(when (featurep 'popwin) (when (featurep 'popwin)
(add-to-list 'popwin:special-display-config (add-to-list 'popwin:special-display-config
`(,ac-dcd-error-buffer-name :noselect t)) `(,ac-dcd-error-buffer-name :noselect t))
(add-to-list 'popwin:special-display-config (add-to-list 'popwin:special-display-config
`(,ac-dcd-document-buffer-name :position right :width 80))) `(,ac-dcd-document-buffer-name :position right :width 80)))
``` * You can set import paths using `M-x customize-variable RET ac-dcd-flags`.
* Alternatively, if you're using [DUB](http://code.dlang.org/) to manage your
* Third, set import path using ```M-x customize-variable RET ac-dcd-flags```. project, you can use `M-x ac-dcd-add-imports` to add import paths of the
* When something is wrong, please check variables with ```M-x customize-apropos RET ac-dcd``` and restart server with ```M-x ac-dcd-init-server```. current project automatically.
* When something is wrong, please, check variables with `M-x customize-apropos
RET ac-dcd` and restart server with `M-x ac-dcd-init-server`.
## Features ## Features
* Dlang source for auto-complete * Dlang source for auto-complete
* Function calltip expansion with yasnippet * Function calltip expansion with yasnippet
* Show ddoc with ```C-c ?``` * Show ddoc with `C-c ?`
* Goto definition with ```C-c .``` * Goto definition with `C-c .`
* After goto definition, you can pop to previous position with ```C-c ,``` * After goto definition, you can pop to previous position with `C-c ,`
## TODO ## TODO
* Multi byte character support (Need help!)
* UTF-8 support is in place. However, UTF-16 and UTF-32 may not work correctly.
(Need help!)

View File

@ -604,7 +604,10 @@ output is just like following.\n
flags-list)))))) flags-list))))))
(defun ac-dcd-add-imports () (defun ac-dcd-add-imports ()
"Send import flags of the current DUB project to dcd-server." "Send import flags of the current DUB project to dcd-server.
The root of the project is determined by the \"closest\" dub.json
or package.json file."
(interactive) (interactive)
(ac-dcd-call-process "" (ac-dcd-call-process ""
(append (append