From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Riley Subject: Re: Q : select current org item as region Date: Thu, 09 Sep 2010 15:03:55 +0200 Message-ID: References: <87lj7bw0a6.fsf@dasa3.iem.pw.edu.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=46571 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtgnT-0008H3-0S for emacs-orgmode@gnu.org; Thu, 09 Sep 2010 09:04:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtgnQ-0001lF-KT for emacs-orgmode@gnu.org; Thu, 09 Sep 2010 09:04:10 -0400 Received: from lo.gmane.org ([80.91.229.12]:48076) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtgnQ-0001l3-Fj for emacs-orgmode@gnu.org; Thu, 09 Sep 2010 09:04:08 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OtgnN-0007oj-VT for emacs-orgmode@gnu.org; Thu, 09 Sep 2010 15:04:05 +0200 Received: from 85.183.18.158 ([85.183.18.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Sep 2010 15:04:05 +0200 Received: from rileyrg by 85.183.18.158 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Sep 2010 15:04:05 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Ɓukasz Stelmach writes: > Richard Riley 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.