From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Jackson Subject: Annotate files in org syntax Date: Sat, 12 Jan 2008 15:29:26 +0000 Message-ID: <87abnb6p0p.fsf@shellarchive.co.uk> 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 1JDiIg-0002jv-VF for emacs-orgmode@gnu.org; Sat, 12 Jan 2008 10:29:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDiId-0002gj-I6 for emacs-orgmode@gnu.org; Sat, 12 Jan 2008 10:29:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDiId-0002gV-DC for emacs-orgmode@gnu.org; Sat, 12 Jan 2008 10:29:31 -0500 Received: from b.painless.aaisp.net.uk ([81.187.81.52]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JDiIc-0001Rc-S7 for emacs-orgmode@gnu.org; Sat, 12 Jan 2008 10:29:31 -0500 Received: from 241.28.187.81.in-addr.arpa ([81.187.28.241] helo=phil-desktop) by b.painless.aaisp.net.uk with esmtp (Exim 4.62) (envelope-from ) id 1JDiIa-0008JR-AL for emacs-orgmode@gnu.org; Sat, 12 Jan 2008 15:29:28 +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, Thought I might share this with you: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=org-annotate-file.el ;;; org-annotate-file.el --- Annotate a file with org syntax ;; Copyright (C) 2008 Philip Jackson ;; Author: Philip Jackson ;; Version: 0.1 ;; This file is not currently part of GNU Emacs. ;; 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., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; This is yet another implementation to allow the annotation of a ;; file without modification of the file itself. The annotation is in ;; org syntax. ;; To use you might put the following in your .emacs: ;; ;; (require 'org-annotate-file) ;; (global-set-key (kbd "C-c C-l") 'org-annotate-file) ;; ;; To change the location of the annotation file: ;; ;; (setq org-annotate-file-storage-file "~/annotated.org") (require 'org) (defvar org-annotate-file-storage-file "~/.org-annotate-file.org" "Annotation file.") (defvar org-annotate-file-always-open t "non-nil means always expand the full tree when you visit `org-annotate-file-storage-file'.") (defun org-annotate-file () "Associate any buffer with an underlying file with an org section." (interactive) (unless (buffer-file-name) (error "This buffer has no associated file.")) (org-annotate-file-show-section)) (defun org-annotate-file-show-section (&optional buffer) (let* ((filename (abbreviate-file-name (or buffer (buffer-file-name)))) (link (concat "[[file://" filename "][" filename "]]"))) (with-current-buffer (find-file org-annotate-file-storage-file) (unless (org-mode-p) (org-mode)) (goto-char (point-min)) (widen) (when org-annotate-file-always-open (show-all)) (unless (search-forward-regexp (concat "^* " (regexp-quote link)) nil t) (progn (goto-char (point-max)) (unless (eq (current-column) 0) (insert "\n")) (insert (concat "* " link "\n")))) (beginning-of-line) (org-narrow-to-subtree)))) (provide 'org-annotate-file) ;;; org-annotate-file.el ends here --=-=-= Cheers, Phil -- Phil Jackson http://www.shellarchive.co.uk --=-=-= 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 --=-=-=--