alezost / mwim.el

Move to the beginning/end of line, code or comment
82 stars 4 forks source link

Issue when working with `(setq org-hide-emphasis-markers t)` #13

Open failable opened 3 years ago

failable commented 3 years ago

Hi, thanks for the very convenient package. I find an issue when using it in org-mode. I have (setq org-hide-emphasis-markers t) in my config.

Sample settings:

(use-package mwim
  :bind (("C-a" . mwim-beginning-of-line-or-code)
         ("C-e" . mwim-end-of-line-or-code)))

(setq org-hide-emphasis-markers t)

Reproduce steps:

  1. Create an empty org-mode buffer, and press RET to create some new lines.
  2. Move the cursor to any previous line to ensure there are at least one line below.
  3. At the end of current line, enter ~some text*~ (* denote cursor. Note that the markers are hidden at this moment.
  4. Call mwim-end-of-line-or-code or other variants to move to end of line.

Now, the cursor is moved to beginning of next line.

I do this because this is my workflow when typing and use smartparens to auto insert ~~ and type texts then move out of the markup area to continue typing.

alezost commented 3 years ago

Hello and sorry for the long delay. I often miss github issues when my name is not mentioned explicitly.

I reproduce this bug, and I have found that it occurs only when the mwim-end command is called with a key binding. But when it is called directly with M-x mwim-…, the bug does not happen to me.

Moreover, this bug does not relate to mwim package at all! I have tried the following command:

(defun tmp-end ()
  (interactive)
  (goto-char 307))

(where 307 is the "end of line" position that I checked with C-x =)

and it has the same problem: when it is called with M-x, it works as expected, but when it is called via a key binding, it moves to the next line!

So this is not an mwim bug but I would like to keep this issue open in case other people will face the same problem.

failable commented 3 years ago

Thanks for digging into this.