From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: More wiki-like behaviour Date: Sat, 7 Aug 2010 08:27:44 +0200 Message-ID: <99CACA02-DD88-4F27-A0EA-D11560E94728@uva.nl> References: Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=52878 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oi9nH-00067O-Ul for emacs-orgmode@gnu.org; Sun, 08 Aug 2010 13:36:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ohcsr-0004Mr-BK for emacs-orgmode@gnu.org; Sat, 07 Aug 2010 02:27:54 -0400 Received: from postduif.ic.uva.nl ([145.18.40.180]:38779) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ohcsr-0004MB-4P for emacs-orgmode@gnu.org; Sat, 07 Aug 2010 02:27:53 -0400 In-Reply-To: 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: Paul Sexton Cc: emacs-orgmode@gnu.org On Feb 5, 2009, at 8:48 PM, Paul Sexton wrote: > Hi, > I am interested in using Org mode to create a personal wiki (along > the lines of Wikidpad: http://wikidpad.sourceforge.net/ ), treating > top level headings (one star) as wiki topics. > > To do this, I have added 2 behaviours to Org-mode. > > 1. Always narrow to subtree after following an internal link > (ideally I would like to only narrow to the relevant one-star > heading). > Added to .emacs: > > (add-hook 'org-follow-link-hook (lambda () (org-narrow-to-subtree))) > 2. More difficult: create a new wikiword if the internal link is not > found. I have just pushed a change which does the following: 1. It makes a link like [[Find this text]] only match if there is an exact headline like this. The fuzzy text search that used to result from such a link at least I never use in Org files 2. If there is no match, it offers to create this headline. Let me know if this works for you. Also: does this break things for anyone else? - Carsten > > In .emacs, add a new function to create the new topic: > > (defun org-create-new-wikiword (word) > (interactive "s") > (widen) > (end-of-buffer) > (newline 2) > (insert (format "* <<<%s>>>" word)) ; create as radio link > (backward-char 4) > (org-update-radio-target-regexp) > (newline 2) > (org-narrow-to-subtree)) > > > > Modification to the (VERY long) function org-open-at-point in org.el: > > > ((string= type "thisfile") > (if in-emacs > (switch-to-buffer-other-window > (org-get-buffer-for-internal-link (current-buffer))) > (org-mark-ring-push)) > (let ((cmd `(org-link-search > ,path > ,(cond ((equal in-emacs '(4)) 'occur) > ((equal in-emacs '(16)) 'org-occur) > (t nil)) > ,pos))) > (condition-case nil (eval cmd) > (error (progn (widen) > ;; BEGIN CHANGE > (condition-case nil (eval cmd) > (error > (when (yes-or-no-p > (format "Topic '%s' not found; create?" > path)) > (org-create-new-wikiword path))))))))) > ;; END CHANGE > > I am not the greatest emacs-lisp orgrammer. Is there an easier way > to do this? If not, is it possible to create a 'link-not-found' hook > so that I don't need to modify org.el? > > Thanks > > Paul > > > _______________________________________________ > 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 - Carsten