From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard KLINDA Subject: two new functions: org-move-thing-up org-move-thing-down Date: Thu, 12 Feb 2009 16:56:48 +0100 Message-ID: <874oyzabsv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LXdyE-0005SV-3O for emacs-orgmode@gnu.org; Thu, 12 Feb 2009 10:59:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LXdyC-0005Qr-JB for emacs-orgmode@gnu.org; Thu, 12 Feb 2009 10:59:21 -0500 Received: from [199.232.76.173] (port=33675 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXdyC-0005Qn-Hc for emacs-orgmode@gnu.org; Thu, 12 Feb 2009 10:59:20 -0500 Received: from viefep12-int.chello.at ([62.179.121.32]:56764) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LXdyB-0005be-Ot for emacs-orgmode@gnu.org; Thu, 12 Feb 2009 10:59:20 -0500 Received: from edge05.upc.biz ([192.168.13.212]) by viefep12-int.chello.at (InterMail vM.7.09.01.00 201-2219-108-20080618) with ESMTP id <20090212155918.TQIP28197.viefep12-int.chello.at@edge05.upc.biz> for ; Thu, 12 Feb 2009 16:59:18 +0100 Received: from ignotus by localhost with local (masqmail 0.2.21) id 1LXdvl-5Vh-00 for ; Thu, 12 Feb 2009 16:56:49 +0100 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 Here are two functions for moving things around. Useful to bind them to keys. Carsten, please include these functions in org if you think it's ok. ,----[ for me it is ] | (define-key org-mode-map [(alt ?N)] 'org-move-thing-up) | (define-key org-mode-map [(alt ?T)] 'org-move-thing-down) `---- ,---- | (defun org-move-thing-up () | "Move table row, headline or list item up." | (interactive) | (let ((headline-p (save-excursion | (beginning-of-line) | (when (looking-at (concat "^\\(" outline-regexp "\\)")) | t)))) | (cond ((org-at-table-p) (org-table-move-row-up)) | (headline-p (org-move-subtree-up)) | (t (org-move-item-up 1))))) | | (defun org-move-thing-down () | "Move table row, headline or list item down." | (interactive) | (let ((headline-p (save-excursion | (beginning-of-line) | (when (looking-at (concat "^\\(" outline-regexp "\\)")) | t)))) | (cond ((org-at-table-p) (org-table-move-row-down)) | (headline-p (org-move-subtree-down)) | (t (org-move-item-down))))) `---- -- Udv, Richard