vim-jp / autofmt

Text Formatting Plugin
28 stars 2 forks source link

禁則処理がされなくなった? #1

Closed h-east closed 11 years ago

h-east commented 11 years ago

ついこの間まで「、」や「。」等の禁則処理が効いていたと思うのですが、今日禁則処理がされていないことに気付きました。 autofmt自体ここ5ヶ月更新されていないようですので、Vim本体の影響か私の設定が悪い可能性が高いですが、一端こちらにissueを立てさせてもらいます。ご了承ください。

私も設定弄っていないんだけどなぁ。。

Windows 7 home (SP1) 64bit GVim 7.3.822 (Win64 kaoriya)

再現手順

  1. 以下の内容の email.txt をGVimで開く。
// vim: set et ai si ts=2 sw=2 tw=70 ft=mail:
  1. 以下の内容をクリップボード経由で上記GVimにペースト "*P
OKOME48でPCの保存先まで指定するのは開発に時間がかかると思われますので、OKOME48はメッセージをPCに送信及びPCから受信する。
  1. gqq または 2. のテキストをビジュアル選択して gq
  2. こうなっちゃう。(「、」が2行目行頭にくる)
OKOME48でPCの保存先まで指定するのは開発に時間がかかると思われますので
、OKOME48はメッセージをPCに送信及びPCから受信する。
  1. ちょっと前までは禁則処理されてこうなっていた。 (2013/03/05 20:25 訂正)
OKOME48でPCの保存先まで指定するのは開発に時間がかかると思われますの
で、OKOME48はメッセージをPCに送信及びPCから受信する。


設定など 関連する_vimrc 内の設定

autocmd FileType * setlocal formatoptions-=ro
set formatexpr=autofmt#japanese#formatexpr()

上記再現手順後の関連オプション値

:set formatexpr?
  formatexpr=autofmt#japanese#formatexpr()
:set formatoptions?
  formatoptions=mMtcql
:set encoding?
  encoding=cp932
:set fenc?
  fileencoding=
ynkdir commented 11 years ago

autofmt以外のプラグインで unicode.vim があるやつありますか

koron commented 11 years ago
OKOME48でPCの保存先まで指定するのは開発に時間がかかると思われますの
で、OKOME48はメッセージをPCに送信及びPCから受信する。

僕のところではこうなったなぁ…

h-east commented 11 years ago

autofmt以外だと vimインストールディレクトリ\vim73\tools\ に unicode.vim がありました。(サイズ7,349バイト)

ynkdir commented 11 years ago

前にmattnさんのプラグインでautoload/unicode.vimがあって同時に入れると動かないなーというのは見たんですが そのtoolsのやつは関係ないですね

h-east commented 11 years ago

はい。。 ちなみに encodingオプションはデフォルトの cp932 です。email.txt もcp932です。 (issue本文に情報追加しました)

ynkdir commented 11 years ago

エラーが出てるなら手動で実行すると見れると思います。

:let vlnum = 1
:let vcount = 1
:call autofmt#japanese#import().format_normal_mode(vlnum, vcount)

こんなかんじで

h-east commented 11 years ago

言われたまま実行して出た結果を貼り付けます。

line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
line    6:
E716: Key not present in Dictionary: uni.prop_line_break(lst[i].c)
E15: Invalid expression: self.uni.prop_line_break(lst[i].c)
line    7:
E121: Undefined variable: after
E15: Invalid expression: after == "AI"    " Ambiguous (Alphabetic or Ideograph)
line   16:
E716: Key not present in Dictionary: uni.prop_line_break(lst[j].c)
E15: Invalid expression: self.uni.prop_line_break(lst[j].c)
line   17:
E121: Undefined variable: before
E15: Invalid expression: before == "AI"   " Ambiguous (Alphabetic or Ideograph)
line   21:
E716: Key not present in Dictionary: uni.uax14_pair_table(before, after)
E15: Invalid expression: self.uni.uax14_pair_table(before, after)
line   22:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.INDIRECT_BRK
line   30:
E121: Undefined variable: brk
E15: Invalid expression: brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK
ynkdir commented 11 years ago

んーやっぱり unicode.vim が読めてないみたいですね unicode#import() の呼び出しが失敗してるんだと思いますけどなんでかはわかりませんが

h-east commented 11 years ago

了解です。解析ありがとうございます。 うーん、私も設定変えていないんだけどなぁ。。 (_vimrc のタイムスタンプが 2012/12/18) 明日、仕事場PCでも確認してみます。

mattn commented 11 years ago
:echo globpath(&rtp, 'autoload/unicode.vim')

してみるといいかも。

h-east commented 11 years ago

仕事場PCで試したら @koron さんと同じ結果になりました。 Windows 7 Pro SP1 64bit GVim (7.3.797 および 7.3.831 ) win64 kaoriya

うーん、個人PCのVim環境がおかしくなってる!? 今日帰ってから調べます。

h-east commented 11 years ago

えー、gvim.exeだけ昔のもの(7.3.712, 7.3.762)に置き換えて試したら普通に禁則処理されました。www もしかして 7.3.822 特有の現象? GVim 7.3.822 for win をお持ちの方試してもらえませんか?

そういえば昨日こんな現象も起きたしw https://twitter.com/h_east/status/308617050178351104

patch 823~831の間に致命的なバグを直すようなものはないんだよなぁ。よーわからん><。

mattn commented 11 years ago

back reference ?

h-east commented 11 years ago

個人PCにも 7.3.831 win64 +kaoriya 入れました。ちゃんと禁則処理されました。

@mattn 後方参照...正規表現?

mattn commented 11 years ago

かもしれない

ynkdir commented 11 years ago

\@<! は使ってないので大丈夫なはずです あとは -iconv になってるかくらいですかねえ思い付くのは

koron commented 11 years ago

問題のあった 822 って自前ビルド?

うちにある 831 の1つ前は 816 だったので。

http://files.kaoriya.net/vim/vim73-kaoriya-win32-20130214.zip http://files.kaoriya.net/vim/vim73-kaoriya-win64-20130214.zip

h-east commented 11 years ago

8.3.822 の:verです。 ってあれ?32bit版やん!!なぜ? 付属のiconv.dllが32bitか64bitかってどうやったら判定できますか?

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 18 2013 22:24:40)
MS-Windows 32-bit GUI version
Included patches: 1-822
Compiled by h_east@h_east-Gateway2
Big version with GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal 
+cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic 
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float 
+folding -footer +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist +keymap 
+langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession 
+modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang -mzscheme +netbeans_intg
 -ole +path_extra -perl +persistent_undo -postscript +printer -profile -python -python3 
+quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +startuptime 
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl 
-tgetent -termresponse +textobjects +title +toolbar +user_commands +vertsplit 
+virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows 
+writebackup -xfontset -xim -xterm_save +xpm_w32 
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: gcc -Iproto -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -DHAVE_PATHDEF -DFEAT_BIG -DHAVE_GETTEXT -DHAVE_LOCALE_H -DDYNAMIC_GETTEXT -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -pipe -w -march=i386 -Wall -DFEAT_XPM_W32 -I xpm/x86/include -I xpm/x86/../include -O3 -fomit-frame-pointer -freg-struct-return -s
Linking: gcc -Iproto -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -DHAVE_PATHDEF -DFEAT_BIG -DHAVE_GETTEXT -DHAVE_LOCALE_H -DDYNAMIC_GETTEXT -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -pipe -w -march=i386 -Wall -DFEAT_XPM_W32 -I xpm/x86/include -I xpm/x86/../include -O3 -fomit-frame-pointer -freg-struct-return -s -mwindows -o gvim.exe -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion -lwsock32 -L xpm/x86/lib -lXpm -lole32 -luuid      
koron commented 11 years ago

付属のiconv.dllが32bitか64bitかってどうやったら判定できますか?

PEヘッダー内の IMAGE_OPTIONAL_HEADER.Magic みれば良いみたい。

ynkdir commented 11 years ago

とりあえず :echo has('iconv')

koron commented 11 years ago

@ynkdir :+1:

念のため http://msdn.microsoft.com/en-us/library/windows/desktop/ms680339.aspx

あと Python だけど判定に使ってるコードがあったので。 https://github.com/koron/online-update/blob/master/online_updater/pe32.py

h-east commented 11 years ago

問題のあった 822 って自前ビルド? うちにある 831 の1つ前は 816 だったので。

あっ?俺、知らないうちに自前ビルドしてるwww 怖いwww あー、なんとなく思い出したww

とりあえず :echo has('iconv') で

0 でした。すいません。すいません。

h-east commented 11 years ago

Win64 +kaoriya の環境に自前ビルドの32bit GVim.exeを突っ込んでいたのが原因でした。 お騒がせしました。 クローズします。m( )m

mattn commented 11 years ago

ww