From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Stewart Subject: Some functions that i use. Date: Wed, 26 Nov 2008 21:58:52 +0800 Message-ID: <871vwypp0j.fsf@debian.domain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L5LAa-0001u9-Ej for emacs-orgmode@gnu.org; Wed, 26 Nov 2008 09:15:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L5LAY-0001th-Ly for emacs-orgmode@gnu.org; Wed, 26 Nov 2008 09:15:08 -0500 Received: from [199.232.76.173] (port=57732 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L5LAY-0001ta-HW for emacs-orgmode@gnu.org; Wed, 26 Nov 2008 09:15:06 -0500 Received: from main.gmane.org ([80.91.229.2]:45556 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L5LAY-0005mU-2k for emacs-orgmode@gnu.org; Wed, 26 Nov 2008 09:15:06 -0500 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1L5LAU-0000SY-PD for emacs-orgmode@gnu.org; Wed, 26 Nov 2008 14:15:02 +0000 Received: from 222.212.130.73 ([222.212.130.73]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Nov 2008 14:15:02 +0000 Received: from lazycat.manatee by 222.212.130.73 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Nov 2008 14:15:02 +0000 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 --=-=-= Hi, everyone! I like org-mode best. I write some functions for org-mode. Those functions very simple but maybe useful. I have attached them with a file. Enjoy! -- Andy. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=org-extension.el Content-Transfer-Encoding: quoted-printable Content-Description: org-extension.el ;;; org-extension.el --- Some extensions for Org mode ;; Author: Andy Stewart ;; Maintainer: Andy Stewart ;; Copyright (C) 2008, Andy Stewart, all rights reserved. ;; Created: 2008-06-17 08:34:21 ;; Version: 1.0 ;; Last-Updated: 2008-07-27 11:01:03 ;; URL: not distributed yet ;; Keywords: org ;; Compatibility: GNU Emacs 23.0.60.1 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;; Features that might be requried by this library: ;; ;; None ;; ;;; Installation: ;; ;; Copy org-extension.el to your load-path and add to your ~/.emacs ;; ;; (require 'org-extension) ;; ;; No need more ;;; Commentary: ;; ;; This packages have some extensions for more quickly operation in Org mod= e. ;; ;;; Change log: ;; ;; 2008/06/17 ;; First release. ;; ;;; Acknowledgments: ;; ;; Not yet ;; ;;; TODO ;; ;; None ;; ;;; Code: (defun org-fore-to-heading () "Move to next heading line, or end of this line if it's a heading." (interactive) (org-end-of-line) (let (found) (save-excursion (while (not found) (or (re-search-forward (concat "^\\(?:" outline-regexp "\\)") nil t) (end-of-line)) (setq found (point)))) (goto-char found) found)) (defun org-forward-same-level-or-end-subtree (arg) "Move forward same level or end of subtree" (interactive "p") (outline-back-to-heading t) (while (> arg 0) (let ((point-to-move-to (save-excursion (org-get-next-sibling)))) (if point-to-move-to (progn (goto-char point-to-move-to) (setq arg (1- arg))) (org-end-of-subtree) (setq arg 0))))) (defun org-end-of-heading () "Move end of current heading." (interactive) (org-back-to-heading t) (outline-next-heading) (if (bolp) (forward-char -1))) (defun org-archive-all-done-item () "Archive all item that have with prefix DONE." (interactive) (save-excursion (show-all) (goto-char (point-min)) (if (search-forward-regexp "^[\\*]+ DONE" nil t) (progn (goto-char (point-min)) (while (search-forward-regexp "^[\\*]+ DONE" nil t) (org-advertized-archive-subtree)) (org-display-all-todo-item) (message "Archive finished")) (org-display-all-todo-item) (message "No need to archive")))) (defun org-switch-item-to-done () "Swtich current org item to DONE." (interactive) (save-excursion (org-map-tree '(lambda () (org-todo "DONE")))) (org-display-all-todo-item)) (defun org-insert-cur-item () "Insert current item." (interactive) (if (bolp) (call-interactively 'move-beginning-of-line) (call-interactively 'org-end-of-heading)) (call-interactively 'org-insert-heading)) (defun org-insert-sub-item() "Insert one sub item" (interactive) (org-insert-cur-item) (org-metaright)) (defun org-insert-sup-item() "Insert one father item" (interactive) (org-insert-cur-item) (org-metaleft)) (defun org-display-all-todo-item() "Automatic save and display all todo items in Org mode." (interactive) (save-excursion (save-buffer) (org-show-todo-tree t))) (defun org-insert-cur-todo-heading () "Insert todo item" (interactive) (if (bolp) (call-interactively 'move-beginning-of-line) (call-interactively 'org-end-of-heading)) (call-interactively 'org-insert-todo-heading)) (defun org-insert-sup-todo-heading () "Insert todo item, and shift left." (interactive) (org-insert-cur-todo-heading) (org-metaleft)) (defun org-insert-sub-todo-heading () "Insert todo item, and shift right." (interactive) (org-insert-cur-todo-heading) (org-metaright)) (defun org-subtree-shiftleft () "Do `org-shiftleft' with element of current substree." (interactive) (save-excursion (org-map-tree 'org-shiftleft))) (defun org-subtree-shiftright () "Do `org-shiftright' with element of current substree." (interactive) (save-excursion (org-map-tree 'org-shiftright))) (provide 'org-extension) ;;; org-extension.el ends here --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--