[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and
From: |
Eli Zaretskii |
Subject: |
Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point |
Date: |
Wed, 19 Mar 2014 18:40:25 +0200 |
> From: Stefan <address@hidden>
> Date: Wed, 19 Mar 2014 09:15:27 -0400
>
> > - (- (point) (line-beginning-position) -1))))
> > + (1+ (string-bytes (buffer-substring
> > + (line-beginning-position)
> > + (point)))))))
>
> Instead of buffer-subtring composed with string-bytes, you could use
> position-bytes. You might also like to add a comment like "Hack attack:
> assume the file's encoding is the same as Emacs's internal encoding".
Why assume such a thing? It's bound to break some day, for some user.
I would suggest encoding the buffer substring using
buffer-file-coding-system, and then using (length string) on the
result (which will be a unibyte string, so there's no difference
between byte and character counts). Then this code will be portable,
I think.
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, (continued)
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Dmitry Gutov, 2014/03/19
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Eli Zaretskii, 2014/03/19
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Dmitry Gutov, 2014/03/20
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Eli Zaretskii, 2014/03/20
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Richard Stallman, 2014/03/20
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Dmitry Gutov, 2014/03/20
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Richard Stallman, 2014/03/21
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Dmitry Gutov, 2014/03/20
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Eli Zaretskii, 2014/03/21
- Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point, Eli Zaretskii, 2014/03/19
Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point,
Eli Zaretskii <=