Emacs org-mode helloworld实验

安装好了org-mode之后,我们需要测试一下。

首先配置emacs


;; org
(require 'org)
(require 'org-publish)
;;    使用.org扩展的文件都使用Org mode打开
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-hook 'org-mode-hook 'turn-on-font-lock)
(add-hook 'org-mode-hook
(lambda () (setq truncate-lines nil)))

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)

;;    工程
(setq org-publish-project-alist
    '(
        ("org-note"
         :base-directory "~/git/EmacsOrg/NOTE/"
         :base-extension "org"
         :publishing-directory "~/git/EmacsOrg/Publish/"
         :recursive t
         :publishing-function org-publish-org-to-html
         :headline-levels 4
         :auto-preamble t
        )
        ("org-static"
	 :base-directory "~/git/EmacsOrg/NOTE/"
	 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|doc\\|xls\\|ppt\\|rar\\|tar.gz\\|tar\\|gz\\|zip\\|cpp\\|c\\|el"
	 :publishing-directory "~/git/EmacsOrg/Publish/"
	 :recursive t
	 :publishing-function org-publish-attachment
        )
	("org" :components ("org-note" "org-static")
	)
    )
)


这个例子是照着网上抄来的。

主要的路径就是NOTE和Publish,一个放的是源码,一个放的是输出文件。

下面写一个测试文件 test.org

* 1
abcd
** 2
abcd
*** 3
abcd

然后发布以下,C-c C-e X

如果配置文件写错了,这里就不会很顺利的执行了。

Emacs会告诉你已经发布好了,在Publish下面会有一个test.html文件。

test

Table of Contents

  • 1 1
      □ 1.1 2
          ☆ 1.1.1 3

1 1

abcd

1.1 2

abcd

1.1.1 3

abcd

Author: xxx <xxx@xxx>

Date: 2012-07-26 10:47:11 CST

HTML generated by org-mode 6.21b in emacs 23

感觉还不错,连目录都给自动生成了,后面还追加了不少信息。

当然我觉得这些都是可以定制的,只是现在还不会罢了。

以后慢慢学习,至少这个模式现在已经可以使用了。

你可能感兴趣的:(css,测试,扩展,lambda,emacs,Components)