jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
875 stars 160 forks source link

`move-beginning-of-line` move to wrong position on heading when markdown-hide-markup is enabled #815

Open kuranari opened 7 months ago

kuranari commented 7 months ago

When markdown-hide-markup is enabled, invoking move-beginning-of-lineC-a) on a header line incorrectly moves the cursor to the previous line.

Headings do not use the invisible property. However, this appears to be an intentional choice. https://github.com/jrblevin/markdown-mode/issues/130#issuecomment-307441856

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. Place the following in /tmp/emacs/.emacs:
    
    (setq custom-file "/dev/null")

(package-initialize) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-install 'markdown-mode)

(setq markdown-hide-markup t)


2. Make `sample.md`
```md
text

# Heading 
  1. HOME=/tmp/emacs emacs -Q --load /tmp/emacs/.emacs /tmp/emacs/sample.md
  2. Move to line 3
  3. Hit C-a (move-beginning-of-line

Screenshot

https://github.com/jrblevin/markdown-mode/assets/2577343/e1975b87-9ed9-4d5a-83d3-cd621737a13e

Software Versions

kuranari commented 7 months ago

📝 Research Findings

When evaluating the following, it no longer moves to the previous line (not a fundamental solution).

(setq global-disable-point-adjustment t)

https://www.gnu.org/software/emacs/manual/html_node/elisp/Adjusting-Point.html