Hey, folks.

I’ve been digging around to see if there’s a package for this but the closest I’ve found is expand-region and that’s not quite it…

Take the indent level and block at the line where the point currently sits and set the mark region to the end of the current block + indent level. I hope that explanation is clear.

This seems very much in the wheelhouse of Emacs and I’m guessing it exists – maybe even in core as opposed to a package – and I’m just not looking in the right place.

thx

  • desquared@alien.topB
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 months ago

    In org mode, you can select the entire heading when point is somewhere in the middle with:

    C-c p to move to the headline

    M-h to mark the “paragraph”, which in org marks the entire entry.

    Likely not quite what you want, but it seems worth mentioning.

  • JDRiverRun@alien.topB
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 months ago

    No need for a package, this is a great chance to learn some elisp. To get you started:

    (let ((cur (current-indentation)))
      (push-mark nil t t)
      (while (and (not (eobp)) (= (current-indentation) cur))
        (forward-line 1)))
    
    • InfiniteBarnacle9@alien.topOPB
      link
      fedilink
      English
      arrow-up
      0
      ·
      11 months ago

      Nice. I think mark-defun is going to work out per other comments here but this is interesting.

      Related question… I’ve not done a ton of elisp hacking but can I ask how you found uot about these functions? I’ve never heard of the two key ones: eobp and current-indentation.