I am tryping out org-wiki.el to create a personal wiki in org-mode. The package offers a custom link type wiki:<page> which creates a link like wiki:myPage that matches up with myPage.org.

I'm wondering if there is any way to set the default description for this link type to hide the wiki: prefix, so that on completing the link, it converts to [[wiki:myPage][myPage]]?

Or better yet, typing [[wiki:My page]] which automatically displays as [[wiki:My page][My page]] so we can ditch the camelCase!

Any ideas?


1 Answer 1


The function org-wiki-insert inserts a wiki: link of the form [[wiki:MyHeading][MyHeading]].

But, it's more convenient to use the built-in org-insert-link. For that we need two things: completions for the link target and a default description. For the first, we just need to define a function called org-wiki-complete-link and org-mode will pick it up for completing wiki: links:

(defun org-wiki-complete-link (&optional arg)
   (lambda (page)
     (format "wiki:%s" page))))

The only way to set default descriptions seems to be to set org-make-link-description-function. There isn't a per-type function like there is with the targets. We just have to make sure that we only complete wiki: type links:

(defun org-make-wiki-link-description (link desc)
  (when (string-prefix-p "wiki:" link)
    (string-remove-prefix "wiki:" link)
(setq org-make-link-description-function #'org-make-wiki-link-description)

Now, hit C-c C-l and type wiki:[return]. You will be prompted for the wiki heading and then a default description will be added.

  • Wow, thanks @erikstokes ! I added your functions to my init.el file. I then reloaded Emacs. I hit C-c C-l and type wiki: and [return]. Then Helm presents me with a list of existing wiki pages and prompts me for a pattern:. So I type Test wiki article. But when I hit [return] I receive an error: "Wrong type argument: stringp, nil". Any ideas?
    – Adam
    Oct 19, 2016 at 21:06
  • It works for me so I'm not sure. org-make-wiki-link-description does return nil sometimes so it's probably from that somehow. Can you get a trackback on the error and post it somewhere?
    – erikstokes
    Oct 20, 2016 at 0:06
  • Okay, it looks like this works for pages that already exist. But if you type the name of a page you want to create, it triggers an error...
    – Adam
    Oct 23, 2016 at 13:20
  • It would be nice if the default description was autofilled in the minibuffer as Description: This is the default description so that you can change this if you want...
    – Adam
    Oct 23, 2016 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.