Loading ...
Sorry, an error occurred while loading the content.

Possible bug with :redir

Expand Messages
  • Christian Brabandt
    Hi, I tried posting this to vim-dev@vim.org but apparently I am not allowed to post there, so I ll post here. Do I need to subscribe to that group in order to
    Message 1 of 2 , Oct 1, 2009
    • 0 Attachment
      Hi,

      I tried posting this to vim-dev@... but apparently I am not
      allowed to post there, so I'll post here. Do I need to subscribe to
      that group in order to post there?

      While reading a similar problem about capturing the output from any
      vim command, I played around with :redir and I think I found a bug
      when redirecting to a file. Here is what I did:

      :e foobar
      :redir >>%
      :verbose map!
      :redir END

      And surprisingly I did not get a warning message, that the file
      changed (:h W11) This is at least surprising and if I write the file,
      I will have silently overwritten the appended messages, without vim
      noticing of unsaved changes.

      Here is my version:
      VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jul 30 2009 14:28:53)
      Included patches: 1-245
      Compiled by jamessan@...
      Huge version with GTK2 GUI. Features included (+) or not (-):
      +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
      +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
      +cryptv +cscope +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 +fork() +gettext -hangul_input +iconv +insert_expand
      +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap
      +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm
      -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte
      +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl +postscript
      +printer +profile +python +quickfix +reltime +rightleft +ruby +scrollbind
      +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary
      +tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
      +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
      +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim
      +xsmp_interact +xterm_clipboard -xterm_save
      system vimrc file: "$VIM/vimrc"
      user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
      system gvimrc file: "$VIM/gvimrc"
      user gvimrc file: "$HOME/.gvimrc"
      system menu file: "$VIMRUNTIME/menu.vim"
      fall-back for $VIM: "/usr/share/vim"

      Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -D_REENTRANT
      -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0
      -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1
      -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12
      -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -g -O2
      -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -I/usr/local/include -D_LARGEFILE_SOURCE
      -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.10/CORE -I/usr/include/python2.5
      -pthread -I/usr/include/tcl8.4 -D_REENTRANT=1 -D_THREAD_SAFE=1
      -D_LARGEFILE64_SOURCE=1 -I/usr/lib/ruby/1.8/i486-linux

      Linking: gcc -L. -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,--as-needed -o
      vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0
      -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig
      -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lXt -lncurses -lselinux -lacl -lgpm
      -Wl,-E -L/usr/local/lib -L/usr/lib/perl/5.10/CORE -lperl
      -L/usr/lib/python2.5/config -lpython2.5 -lutil -Xlinker -export-dynamic -Wl,-O1
      -Wl,-Bsymbolic-functions -L/usr/lib -ltcl8.4 -lieee -lruby1.8 -lrt -lm


      regards,
      Christian

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Raúl Núñez de Arenas Coronado
      Saluton Christian :) ... Yes. If you plan to post to vim_dev in the future, I can subscribe you by hand. This way your first post there won t be moderated.
      Message 2 of 2 , Oct 1, 2009
      • 0 Attachment
        Saluton Christian :)

        Christian Brabandt <c...@...> skribis:
        > I tried posting this to vim-dev@... but apparently I am not
        > allowed to post there, so I'll post here. Do I need to subscribe to
        > that group in order to post there?

        Yes. If you plan to post to vim_dev in the future, I can subscribe you
        by hand. This way your first post there won't be moderated.

        Just in case I'm CCing this message to vim_dev. That's why I quote so
        much material, so the thread can be followed there.

        > While reading a similar problem about capturing the output from any
        > vim command, I played around with :redir and I think I found a bug
        > when redirecting to a file. Here is what I did:
        >
        > :e foobar
        > :redir >>%
        > :verbose map!
        > :redir END
        >
        > And surprisingly I did not get a warning message, that the file
        > changed (:h W11) This is at least surprising and if I write the file,
        > I will have silently overwritten the appended messages, without vim
        > noticing of unsaved changes.

        You are right, I can reproduce it here: the contents dump to the
        "foobar" file are not shown on the screen (the file is not updated) but
        are written on the file on disk. If you (like me) are using a swap file,
        then the problem is that vim works with the swap file, not the disk
        file, and the disk file is not updated until you :w it.

        > Here is my version:
        > VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jul 30 2009 14:28:53)
        > Included patches: 1-245

        Same here but 1-266.

        > Compiled by jamessan@...
        > Huge version with GTK2 GUI. Features included (+) or not (-):
        > +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
        > +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
        > +cryptv +cscope +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 +fork() +gettext -hangul_input +iconv +insert_expand
        > +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap
        > +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm
        > -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte
        > +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl +postscript
        > +printer +profile +python +quickfix +reltime +rightleft +ruby +scrollbind
        > +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary
        > +tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
        > +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
        > +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim
        > +xsmp_interact +xterm_clipboard -xterm_save
        > system vimrc file: "$VIM/vimrc"
        > user vimrc file: "$HOME/.vimrc"
        > user exrc file: "$HOME/.exrc"
        > system gvimrc file: "$VIM/gvimrc"
        > user gvimrc file: "$HOME/.gvimrc"
        > system menu file: "$VIMRUNTIME/menu.vim"
        > fall-back for $VIM: "/usr/share/vim"
        >
        > Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -D_REENTRANT
        > -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0
        > -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1
        > -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12
        > -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -g -O2
        > -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -I/usr/local/include -D_LARGEFILE_SOURCE
        > -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.10/CORE -I/usr/include/python2.5
        > -pthread -I/usr/include/tcl8.4 -D_REENTRANT=1 -D_THREAD_SAFE=1
        > -D_LARGEFILE64_SOURCE=1 -I/usr/lib/ruby/1.8/i486-linux
        >
        > Linking: gcc -L. -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,--as-needed -o
        > vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0
        > -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig
        > -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lXt -lncurses -lselinux -lacl -lgpm
        > -Wl,-E -L/usr/local/lib -L/usr/lib/perl/5.10/CORE -lperl
        > -L/usr/lib/python2.5/config -lpython2.5 -lutil -Xlinker -export-dynamic -Wl,-O1
        > -Wl,-Bsymbolic-functions -L/usr/lib -ltcl8.4 -lieee -lruby1.8 -lrt -lm

        End of message.

        --
        Raúl "DervishD" Núñez de Arenas Coronado
        Linux Registered User 88736 | http://www.dervishd.net
        It's my PC and I'll cry if I want to... RAmen!

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.