DCD/editors/emacs
Sergei Nosov a7679c7003 use position-bytes function to get the byte offset
The position-bytes function is the correct way to get byte offset for an
UTF-8 encoded source file. Probably, it still won't work for UTF-16 and
UTF-32, but at least it fixes the UTF-8.
2014-08-11 12:18:39 +04:00
..
README.md Update README.md 2014-08-09 15:49:20 +09:00
ac-dcd.el use position-bytes function to get the byte offset 2014-08-11 12:18:39 +04:00

README.md

#Emacs Integration

##Requirements

  • You must have the auto-complete package. And, yasnippet and popwin is 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

  • 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.)
;;; 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"
		     (auto-complete-mode t)
			 (yas-minor-mode-on)
			 (ac-dcd-maybe-start-server)
			 (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-goto-definition)
(define-key d-mode-map (kbd "C-c ,") 'ac-dcd-goto-def-pop-marker)

(when (featurep 'popwin)
  (add-to-list 'popwin:special-display-config
			   `(,ac-dcd-error-buffer-name :noselect t))
  (add-to-list 'popwin:special-display-config
				 `(,ac-dcd-document-buffer-name :position right :width 80)))

  • Third, set import path using M-x customize-variable RET ac-dcd-flags.
  • 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

  • Dlang source for auto-complete
  • Function calltip expansion with yasnippet
  • Show ddoc with C-c ?
  • Goto definition with C-c .
  • After goto definition, you can pop to previous position with C-c ,

TODO

  • Multi byte character support (Need help!)