在Emacs组织模式下设置个人wiki [英] Setup a personal wiki in Emacs Org-mode

查看:145
本文介绍了在Emacs组织模式下设置个人wiki的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在组织模式中设置一个个人wiki。

I would like to setup a personal wiki in org-mode.

到目前为止,我已经尝试了这两种方式。我第一次尝试使用一个Scientific Notebook.org文件。在这里,我所有的笔记 - 每个都有自己的标题,日期和标签(与博文相同的格式)。然后我打开组织速度来快速浏览文件。

So far, I have tried this two ways. My first attempt was using a single "Scientific Notebook.org" file. In this went all my notes - each with its own headline, date and tags (same format as a blog post). I then turned on org-velocity to quickly navigate the file.

但是这造成了两个问题:首先,我在笔记中使用了很多数学(LaTeX预览是一个的原因我想给我们组织)。但是这些需要很长时间才能加载,我无法尝试打开一个包含数千个条目的文件(全部填写数学!!)

But this created two problems: first, I use a lot of math in my notes (LaTeX previews are one of the reasons I want to us org). But these take sooooo long to load, I can't images trying to open a file with several thousand entries (all filled with math!!)

我有其他问题是与标签。我喜欢使用很多多字标签来交叉引用我的笔记。但是,组织模式将它们包装在缓冲区中,使我的标题完全无法理解。另外(也许这只是我,但是)我发现CamelCase真的很难阅读,特别是当面对以下东西:

The other problem I have is with tags. I like to use a lot of multi-word tags to cross-reference my notes. But the way org-mode wraps these in the buffer, makes my headings completely unintelligible. Also (maybe it's just me but) I find CamelCase really hard to read, especially when faced with something like:

:monotonicTransformations:homogeneousFunctions:orderedSets:proofs:

现在我第二次尝试使用Deft。在这里,我将每个音符分解成自己的.org文件,并创建一个专用的〜/ org /文件夹来保存我的维基。但是这是我被困的地方:

Now my second attempt is with Deft. Here, I have broken up each note into its own .org file and creating a dedicated ~/org/ folder to hold my wiki. But this is where I am stuck:

1)如何设置自动链接,以便在一个注释中输入foo bar,创建一个foo bar.org?这可以用无线电目标完成吗?如果没有,可以覆盖这个语法[[foo bar]]来搜索〜/ org /目录中的所有文件中的头条新闻?我尝试添加维基作为次要模式,但没有骰子...

1) How do you setup auto linking, so that typing say "foo bar" in one note, creates a link to "foo bar.org"? Can this be done with radio target? If not, can this syntax [[foo bar]] be overridden to search for headlines in all files in the ~/org/ directory? I tried adding Wiki.el as a minor mode but no dice...

2)你如何标记单个文件?那么如何才能拉出所有标签的列表,并用它来过滤您的笔记列表?我看过书签+可以让你做文件标记。但是我在网络文档中迷失了...

2) How do you tag individual files? And how can you then pull up a list of all tags and use this to filter your list of notes? I have read that bookmark+ lets you do file tagging. But I got so lost in the online docs...

我很想听听别人如何解决这些问题,你使用的是什么小型模式,工作流和键盘快捷方式或其他mods!

I would love to hear how others have solved these problem, what minor modes you are using, workflows and keyboard shortcuts or other mods!

谢谢!

-Adam

推荐答案

在我看来,只有一个笔记文件更灵活和兼容。然而,即使是中等大小的文件,它往往变慢。多个小文件很快,但是他们需要更多的努力来设置,而且只能在该设置下工作。

Having only one note file is, in my opinion, more flexible and compatible. It tends, however, to get slow for even moderatly sized files. Multiple small files are quick, but they need more effort to set up, and they only work within that setup.

为加快速度,请考虑将 org-startup-with-latex-preview 设置为nil(或添加#+ STARTUP: nolatexpreview 到您的文件)。

To speed things up, consider setting org-startup-with-latex-preview to nil (or add #+STARTUP: nolatexpreview to your file).

标签不仅在使用关键字时变得凌乱,使用它们也会随着文件增长而变慢。我已经玩了一些自定义功能,但现在大多数时候都避免了标签。相反,我使用平面层次结构,类别,否则依赖于发生和组织发生(例如 Mx org-occur begin_proof )。

Tags not only get messy when used for keywords, using them also gets rather slow as your file grows. I've played around with some custom functions, but now avoid tags most of the time. Instead I use flat hierarchies, categories and otherwise rely on occur and org-occur (e.g. M-x org-occur begin_proof).

链接到其他文件的组织语法相当简单: [[./ this idea.org] [这个想法]] 。如果这太麻烦了,应该很容易用适当的链接编写一个替换活动区域的函数。

The org syntax for linking to other files is rather simple: [[./this idea.org][this idea]]. If that is too much hassle, it should be easy to write a function that replaces the active region with an appropriate link.

如果要链接 [[this idea]] 到一个文件this idea.org,你可以添加一个函数到 org-open-at-point-functions 并自己处理。

If you want to link [[this idea]] to a file "this idea.org", you could add a function to org-open-at-point-functions and handle it yourself.

对于标签,您不会标记文件本身,而是单个顶级标题。这当然意味着你所有的麻烦与标签也是一样。
再次,我建议不要使用标签。只需确保文件在正确的位置包含正确的关键字,并使用发生和朋友。

As for tags, you don't tag a file itself, but rather a single top level headline. This of course means that all your troubles with tags a back as well. Again, I would recommend not using tags. Just make sure the file contains the right keywords at the right places and use occur and friends.

编辑:例如org-open-at-point-function

如果要在目录中的所有文件中搜索模糊链接,只能使用当前缓冲区,可以使用 org-open-at-point-functions 钩子来实现。以下是一个例子:

If you want to search for a fuzzy link in all files in a directory instead of only the current buffer, you can do this by using the org-open-at-point-functions hook. Here is an example:

(defvar my-link-search-directory "/my/notes/directory/")

(defun my-open-link-function ()
  "Open link, interpreting it a the name of a headline."
  (let* ((el (org-element-context))
         (type (first el))
         (link-type (plist-get (cadr el) :type))
         (path (let ((path-1 (plist-get (cadr el) :path)))
                 (when (stringp path-1)
                   (org-link-unescape path-1)))))
    (when (and (eql type 'link)
               path
               (string= link-type "fuzzy"))
      (let* ((path (regexp-quote path))
             (result
                 (delq nil
                       (org-map-entries
                        (lambda ()
                          (when (string-match
                                 path
                                 (org-get-heading))
                            (list (buffer-file-name) (point))))
                        nil
                        ;; Here we set the scope.
                        ;; 'agenda would search in all agenda files.
                        ;; We want a list of all org files in `my-link-search-directory'.
                        (directory-files
                         my-link-search-directory
                         t "[.]org\\'")))))
        (when result
          (when (> (length result) 1)
            (message "Warning: multiple search results for %s" path))
          (let ((file (caar result))
                (pos (cadar result)))
            (find-file file)
            (goto-char pos)))))))


(add-hook 
 'org-open-at-point-functions
 'my-open-link-function)

请注意,我还没有测试过。

Note that I haven't tested this much.

其实我建议不要使用这个,除非你真的需要它。虽然制作花式扩展是诱人的,但尽可能简单的保持笔记。如果您有一个文件,您可以使用记事本或谷歌文档编辑您的笔记,或者您需要的任何内容。

Actually, I would recommend against using this unless you really need it. While making fancy extensions is tempting, keeping your notes as simple as possible is preferably. If you have everything in one file, you could edit your notes with notepad or google docs or whatever, should you ever need to.

这篇关于在Emacs组织模式下设置个人wiki的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆