emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Q : select current org item as region


From: Richard Riley
Subject: [Orgmode] Re: Q : select current org item as region
Date: Thu, 09 Sep 2010 15:03:55 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Łukasz Stelmach <address@hidden> writes:

> Richard Riley <address@hidden> 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:
>
>
>
> (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)))
>
>
>
> it's derived from the original outline-mark subtree but marks an empty
> space before a next-same-level-heading.

Thanks for the replies.

Just for google completeness

      (goto-char (org-entry-beginning-position))
      (set-mark (org-entry-end-position))

seemed the most efficient after digging about a bit.

regards

r.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]