From a7679c7003282dea7f4f917cf206f4a0a2cb30e7 Mon Sep 17 00:00:00 2001 From: Sergei Nosov Date: Mon, 11 Aug 2014 12:18:39 +0400 Subject: [PATCH] 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. --- editors/emacs/ac-dcd.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editors/emacs/ac-dcd.el b/editors/emacs/ac-dcd.el index 66f6911..adef7e5 100644 --- a/editors/emacs/ac-dcd.el +++ b/editors/emacs/ac-dcd.el @@ -23,8 +23,9 @@ (require 'auto-complete) (require 'rx) -(require 'yasnippet) +(require 'yasnippet nil t) (require 'eshell) + (defcustom ac-dcd-executable "dcd-client" "Location of dcd-client executable." @@ -167,7 +168,7 @@ If you want to restart server, use `ac-dcd-init-server' instead." (defsubst ac-dcd-cursor-position () "Get cursor position to pass to dcd-client. TODO: multi byte character support" - (point)) + (position-bytes (point))) (defsubst ac-dcd-build-complete-args (pos) (list