On Jun 4, 10:18 am, Pablo Giménez <pablog...@gmail.com> wrote:
...[snip]...

> Well I have solved the token range problem and now I am using utf-8 rather
> than latin1.
> My trim function can also detect it ans apply a different regular expression
> depending the encoding.
> I converted my file from latin1 to utf-8 and cleaned all the chracter used
> by txtfmt. Then I formatted it again to begin from scratch with an utf-8
> file.

I suppose I should have mentioned that Txtfmt provides a command that
will translate all the tokens for you.

:help txtfmt-:MoveStartTok

You run the command from within a Txtfmt buffer to move all the tokens
to a new location. For example... Assuming you want to change the
start token of the current Txtfmt buffer from 180 to 0xE000... you
would simply run...

:MoveStartTok 0xE000

Note that this command even handles token escaping properly.


> The problem is that if I have in my modeline:
> ft=help.txtfmt
> I got the next errors when loading the help file as help, I mean using the
> :h command:
> "tdvim_houdini.txt" [readonly] 85L, 3547C
> Error detected while processing function
> <SNR>78_Define_syntax..<SNR>78_Is_match_offset_char_based:
> line    8:
> E21: Cannot make changes, 'modifiable' is off
> Error detected while processing function tdvim#StripTxtfmtTokens:
> line   17:
> E194: No alternate file name to substitute for '#':     :r #
> line   28:
> E516: No buffers were deleted:     :bd #
> "/user_data/ARCHIVE/TDVim/doc/tdvim_houdini.txt" [readonly] 85 lines --51%--
>

I can reproduce this. I believe it may be a Vim issue, because
Is_match_offset_char_based attempts to modify *only* a scratch buffer
the plugin has created -- not the Vim help buffer that has
'nomodifiable' set. Still, there's a simple workaround I can add to
the Txtfmt plugin that will fix it. I'll probably release an update
this weekend. In the meantime, if you don't mind modifying the syntax/
txtfmt.vim file yourself, you could simply add the following line...

set modifiable

...just below the `call s:Create_scratch_buffer()' on line 133 of
syntax/txtfmt.vim.

This fixes it for me... I'll do more testing later though...

Sincerely,
Brett Stahlman

> I guess the errors in tdvim#StripTxtfmtTokens are because of the previous
> errors, which seems to be problem loading the syntax for txtfmt
> The interesting thing is if I delete the txtfmt from the modeline and the
> when loading the help I manually set the filetype to hrlp.txtfmt it loads
> perfectly.
> So I have the problem with the modeline.
> I have attached the offending file if it can helps.
> Thanks for the info about the token range now I initialize it properly.
> Cheers
>
>
>
>
>
>
>
...[snip]...

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to