Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use org-ids for linking wiki files #11

Open
kiuuik opened this issue Feb 6, 2017 · 2 comments
Open

use org-ids for linking wiki files #11

kiuuik opened this issue Feb 6, 2017 · 2 comments

Comments

@kiuuik
Copy link

kiuuik commented Feb 6, 2017

At the moment I use org-ids for my links so that later I can freely adjust my headlines and file locations. I have about 1 million words among 250 files and everything works as expected.

I like the features of org-wiki and have tried it out for a while but I haven't found a way to use wiki-links with org-ids. Is that possible? Did I miss something obvious?

Thanks for this useful software.

PS: Do you know these essays about personal wikis in general http://connectedtext.com/manfred.php and http://luhmann.surge.sh/communicating-with-slip-boxes ? I thought they were quite interesting.

@ayyess
Copy link

ayyess commented Feb 10, 2018

Do you mean using search options in file links?
You could replicate the behavior of wiki:keyword links by changing org-wiki--open-page to:

(defun org-wiki--open-page (pagename_section)
  "Open or create new a org-wiki page (PAGENAME) by name.
Example:  (org-wiki--open-page \"Linux\")
Will open the the wiki file Linux.org in
`org-wiki-location`"
  (let* ((pagename (car (split-string pagename_section "::")))
	 (section (car (cdr (split-string pagename_section "::"))))
	 (org-wiki-file (org-wiki--page->file pagename))
	)
    (if (not (file-exists-p org-wiki-file))
        ;; Action executed if file doesn't exist.
        (progn (find-file  org-wiki-file)
               ;; Insert header at top of page
               (org-wiki-header)
               ;; Save current page buffer
               (save-buffer)
               ;; Create assets directory
               (org-wiki--assets-make-dir pagename))

      ;; Action executed if file exists.
      (if org-wiki-default-read-only
          ;; open file in read-only mode. 
          (progn  (org-open-file org-wiki-file t nil section)
                  (read-only-mode 1))
          ;; open file in writable mode. 
	  (org-open-file org-wiki-file t nil section))
        ))) 

this would allow links like

wiki:file
wiki:file::#custom_id
[[wiki:file::*section name]]

@kiuuik
Copy link
Author

kiuuik commented Feb 10, 2018

thank you very much for your answer. This is still an unsolved problem for me.

I was thinking of External Links using IDs like [[id:B7423F4D-2E8A-471B-8810-C40F074717E9][Link to heading by ID]]. This allows me to rename the file that contains the target heading without breaking the link. The search options you linked to don't allow for changed file names as far as I can see.

I thought that offering to use IDs would require modifications at many different parts of org-wiki (for the index, etc.) so that I didn't even try to change a function to jump to a different wiki heading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants