Richard Riley <rile...@gmail.com> writes:

> What would be the best elisp way to select the current org entry? I want
> a hot key to select the current item as current region (not into the
> clipboard).
>

This is mine:

--8<---------------cut here---------------start------------->8---
(defun stl/outline-mark-subtree ()
  "Mark the current subtree in an outlined document.
This puts point at the start of the current subtree, and mark at the start
of the next."
  (interactive)
  (let ((beg))
    (if (outline-on-heading-p)
        ;; we are already looking at a heading
        (beginning-of-line)
      ;; else go back to previous heading
      (outline-previous-visible-heading 1))
    (setq beg (point))
    (outline-end-of-subtree)
    (outline-next-visible-heading 1) ; just before the next heading (stl)
    (push-mark (point) nil t)
    (goto-char beg)))
--8<---------------cut here---------------end--------------->8---

it's derived from the original outline-mark subtree but marks an empty
space before a next-same-level-heading.

-- 
Miłego dnia,
Łukasz Stelmach


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to