emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Łukasz Stelmach" <lukasz.stelmach@iem.pw.edu.pl>
To: emacs-orgmode@gnu.org
Subject: Re: Q : select current org item as region
Date: Thu, 09 Sep 2010 14:48:17 +0200	[thread overview]
Message-ID: <87lj7bw0a6.fsf@dasa3.iem.pw.edu.pl> (raw)
In-Reply-To: i68lv4$ovn$1@dough.gmane.org

Richard Riley <rileyrg@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

  parent reply	other threads:[~2010-09-09 12:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08 18:51 Q : select current org item as region Richard Riley
2010-09-08 19:40 ` Richard Riley
2010-09-08 21:06   ` Richard Riley
2010-09-08 19:51 ` Nicolas Goaziou
2010-09-09  7:52   ` Bastien
2010-09-09 12:48 ` Łukasz Stelmach [this message]
2010-09-09 13:03   ` Richard Riley
2010-09-09 13:29     ` Nicolas Goaziou
2010-09-09 13:40       ` Richard Riley
2010-09-10 13:51     ` Łukasz Stelmach
2010-09-10 14:45       ` Richard Riley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lj7bw0a6.fsf@dasa3.iem.pw.edu.pl \
    --to=lukasz.stelmach@iem.pw.edu.pl \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).