Skip to content

Block marking includes a blank line at beginning #908

@hmelman

Description

@hmelman

I'm not sure if it's always done this (reminiscing about #191) but I find that in a list or a paragraph, markdown-mark-block (C-c M-h) marks from the line before the block/paragraph to the end of the block/paragraph. That is, mark is at the end of the last line of the block/paragraph as I'd expect, but point is a line above the beginning of the block/paragraph; so my region begins with a blank line, which is not what I'd expect. markdown-mark-paragraph seems to behave the same on a paragraph.

markdown-beginning-of-list and -of-text-block does return the correct position (without the blank line)

My recent use case where this came up is wanting to sort or a reverse a list of items. After marking it sort-lines works (because the blank line sorts first though that's disconcerting) but reversing it (reverse-region) doesn't because the blank line moves to the end leaving no blank line between the list and the heading. I'd expect them both to work, leaving the spacing around the list untouched. Also I'd expect symmetry with markdown-mark-subtree which puts point at the start of the heading, not on the blank line before it.

  • Markdown Mode: From melpa 2025-06-24.631, 2.8-alpha
  • Emacs: 30.1 (emacs-mac, aka macport)
  • OS: macOS 15.5 Sequoia

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions