From: "Paul Sexton" <psexton@xnet.co.nz>
To: emacs-orgmode@gnu.org
Subject: More wiki-like behaviour
Date: Fri, 6 Feb 2009 08:48:02 +1300 [thread overview]
Message-ID: <EBF4915C777B431884526B781E6C3896@quince> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2021 bytes --]
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.
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
[-- Attachment #1.2: Type: text/html, Size: 6721 bytes --]
[-- Attachment #2: Type: text/plain, Size: 204 bytes --]
_______________________________________________
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
next reply other threads:[~2009-02-05 19:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 19:48 Paul Sexton [this message]
2010-08-07 6:27 ` More wiki-like behaviour Carsten Dominik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=EBF4915C777B431884526B781E6C3896@quince \
--to=psexton@xnet.co.nz \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).