Use org instead of muse to keep a diary

Source: Internet
Author: User

I have been writing a diary with Emacs for several years, from the first emacs-wiki to the later muse. Some time ago, I saw a lot of prawns recommending org-mode. In addition, some time ago I began to learn how to use org-mode for todo management, and org-mode was already included in Emacs, I don't need to install it separately like Muse, So I'm also going to use Org to keep a diary.

Here, we will only record the settings of org instead of Muse diary, because there are many tutorials to write the basic operations and time management functions of Org.

When using Muse, I will classify the diary by function. The following directory structure will probably exist:

I need to manage it with git (managed on GitHub) so that I can use it at home and in my organization. I use it in windows at home. The unit is OSX. Sometimes I use it in Linux, and I can use it everywhere once I configure it. So I wrote a note-init.el In the Wiki directory to set up the org project, the content is as follows:

(require 'org-publish)(setq note-root-dir      (file-name-directory (or load-file-name (buffer-file-name))))(setq note-publish-dir      (expand-file-name "public_html" (directory-file-name                                       (file-name-directory                                        (directory-file-name note-root-dir)))))(setq org-publish-project-alist      `(("note-org"         :base-directory ,note-root-dir         :publishing-directory ,note-publish-dir         :base-extension "org"         :recursive t         :publishing-function org-publish-org-to-html         :auto-index t         :index-filename "index.org"         :index-title "index"         :link-home "index.html")        ("note-static"         :base-directory ,note-root-dir         :publishing-directory ,note-publish-dir         :recursive t         :base-extension "css//|js//|png//|jpg//|gif//|pdf//|mp3//|swf//|zip//|gz//|txt//|el"         :publishing-function org-publish-attachment)        ("note" :components ("note-org" "note-static"))))

Then you just need to write a sentence (load "/path/to/note-init.el") in. emacs.

The purpose of the above Code is to get the directory where the note-init.el file is located (that is, the root directory of Wiki) set to org base-directory, use the publishhtml directory on the upper layer as the org publishing-directory (publishhtml cannot be put under the Note root directory, because publishhtml is published to the root directory and then published again next time, will re-publish the published content & hellip ;.... ).

The preceding settings are described as follows:

  • First, a note-org project is set, recursively returning (: recursive t) All. the org file (: Base-extension "org") is published as HTML (: publishing-function org-publish-org-to-html) to the upper-layer publishhtml directory.
  • Next we will have a note-static project, recursively convert all extensions in the directory to "CSS // | JS // | PNG // | JPG // | GIF // | PDF // | MP3 // | SWF/ /| zip // | GZ // | TXT // | El "file is copied to publishhtml on the upper layer.
  • Finally, a components named note is set to merge note-ORG and note-static together. In this way, you can use the org-publish command in Emacs to publish the note project, which is equivalent to releasing the note-ORG and note-static together.

Finally, Let's explain the auto-index settings in note-org separately. This function is not available for Muse (at least I did not find it), that is, to generate an index for all org files. Previously, in Muse, I wrote an index. Muse file for each sub-directory. The content is the link to each sub-file. In this way, it is quite troublesome to update the index file every time you write a new. Muse file. Org has this auto-index function: After you set it as above, it will use all the searched items every time you use org-publish to publish this project. the org file generates the index.org file in the root directory (index-FILENAME "index.org" contains all orglinks, and index.org will be converted into index.html (: Link-home "index.html") at the same time, which looks like a small website, you do not need to manually maintain the index file as before.

After taking notes using org-mode for several days, I feel that it is better than muse, and its editing and publishing functions are no worse than muse, the table function is better than muse. In the past, the table of muse must be published in HTML to see the effect, which can be described as miserable when viewed directly in Muse. The table function of Org is much more powerful, and the preview effect in org-mode is quite good, and the operation is very simple (or even more convenient than table. El ).

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.