Issue #37 open

Visual selection should work with M-x comment-dwim (M-;)

srhb
created an issue

No description provided.

Comments (1)

  1. Frank Fischer repo owner
    • changed status to open

    This is a non-trivial problem. While using M-x comment-dwim should work (this is a bug I should be able to fix) the key-binding M-; is more difficult. The reason is that the interactive form of comment-dwim is "*P" and not "r" therefore there is no way how vim-mode could detect that comment-dwim uses the region. The difficulty comes from the fact that the visual-region of vim-mode does not coincide with Emacs's region which is determined by point and mark. This is especially true in visual-line-mode where point is usually not placed at one of the borders of the visual region.

    vim-mode tries to detect if a non-vim-mode command uses the region by inspecting the command's interactive form and in this case it updates mark and point temporarily to make Emacs's region correspond to the visual-region of vim-mode.

    Of course, one could also modify point and mark in all cases but then other commands that do not work on region but, e.g., move the cursor would not work anymore as expected.

    At this time I have no other idea to solve this problem except informing vim-mode somehow explicitly about comment-dwim using the region.

    Until then you can try one of the examples on EmacsWiki

    http://www.emacswiki.org/emacs/VimMode_-_Examples#toc7

    which implements a similar behavior as vim-mode-command.

  2. Log in to comment