Total Pageviews

Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Thursday, 26 June 2014

clojure-mode:clojure语言的emacs支持

 Emacs support for the Clojure language.

Provides Emacs font-lock, indentation, and navigation for the Clojure programming language.
A more thorough walkthrough is available at clojure-doc.org

Installation

Available on both Marmalade and MELPA repos.
Marmalade is recommended as it has the latest stable version, but MELPA has a development snapshot for users who don't mind breakage but don't want to run from a git checkout.
If you're not already using Marmalade, add this to your ~/.emacs.d/init.el and load it with M-x eval-buffer.
(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
If you're feeling adventurous and you'd like to use MELPA add this bit of code instead:
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
And then you can install:
M-x package-refresh-contents
M-x package-install [RET] clojure-mode [RET]
or if you'd rather keep it in your dotfiles:
(unless (package-installed-p 'clojure-mode)
  (package-refresh-contents)
  (package-install 'clojure-mode))
On Emacs 23 you will need to get package.el yourself or install manually by placing clojure-mode.el on your load-path and requireing it.

Clojure Test Mode

This source repository also includes clojure-test-mode.el, which provides support for running Clojure tests (using the clojure.test framework) via nrepl.el and seeing feedback in the test buffer about which tests failed or errored. The installation instructions above should work for clojure-test-mode as well.
Once you have a repl session active, you can run the tests in the current buffer with C-c C-,. Failing tests and errors will be highlighted using overlays. To clear the overlays, use C-c k.
You can jump between implementation and test files with C-c C-t if your project is laid out in a way that clojure-test-mode expects. Your project root should have a src/ directory containing files that correspond to their namespace. It should also have a test/ directory containing files that correspond to their namespace, and the test namespaces should mirror the implementation namespaces with the addition of "-test" as the suffix to the last segment of the namespace.
So my.project.frob would be found in src/my/project/frob.clj and its tests would be in test/my/project/frob_test.clj in the my.project.frob-test namespace.

Paredit

Using clojure-mode with Paredit is highly recommended. It helps ensure the structure of your forms is not compromised and offers a number of operations that work on code structure at a higher level than just characters and words.
It is also available using package.el from the above archives.
Use Paredit as you normally would any other minor mode; for instance:
;; (require 'paredit) if you didn't install it via package.el
(add-hook 'clojure-mode-hook 'paredit-mode)
See the cheat sheet for Paredit usage hints.

REPL Interaction

A number of options exist for connecting to a running Clojure process and evaluating code interactively.

Basic REPL

Use M-x run-lisp to open a simple REPL subprocess using Leiningen. Once that has opened, you can use C-c C-r to evaluate the region or C-c C-l to load the whole file.
If you don't use Leiningen, you can set inferior-lisp-program to a different REPL command.

nrepl.el

You can also use Leiningen to start an enhanced REPL via nrepl.el.

Ritz

Another option is Ritz, which is a bit more complicated but offers advanced debugging functionality using SLIME.

Swank Clojure

SLIME is available via swank-clojure in clojure-mode 1.x. SLIME support was removed in version 2.x in favor of nrepl.el

from https://github.com/magnars/clojure-mode

Monday, 9 June 2014

prelude-加强版的Emacs 24

Prelude is an enhanced Emacs 24 distribution that should make your experience with Emacs both more pleasant and more powerful. 


Prelude is an Emacs distribution that aims to enhance the default Emacs experience. Prelude alters a lot of the default settings, bundles a plethora of additional packages and adds its own core library to the mix. The final product offers an easy to use Emacs configuration for Emacs newcomers and lots of additional power for Emacs power users.
Prelude is compatible ONLY with GNU Emacs 24.x. In general you're advised to always run Prelude with the latest Emacs - currently 24.3.
Table of Contents

Fast Forward

Assuming you're using an Unix-like OS (*BSD, GNU/Linux, OS X, Solaris, etc), you already have Emacs 24 installed, as well as git & curl you can skip the whole manual and just type in your favorite shell the following command:
curl -L http://git.io/epre | sh
You can now power up your Emacs, sit back and enjoy Prelude, forgetting about the rest of this manual.
There are two environment variables you can use to control the source repository and the installation directory. To change the installation directory:
export PRELUDE_INSTALL_DIR="$HOME/.emacs.d" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
To change the source repository:
export PRELUDE_URL="https://github.com/yourname/prelude.git" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
Note that the installer will back up any existing .emacs file or .emacs.d since it will unpack Prelude's code in .emacs.d. If you're doing a manual install make sure you don't have a .emacs file or back up your existing .emacs.d directory manually.
Don't forget to adjust your prelude-modules.el file once the installation is done. By default most of the modules that ship with Prelude are not loaded.

Installing Emacs 24

Obviously to use the Emacs Prelude you have to install Emacs 24 first. Have a look at the WikEmacs articles on installing Emacs.

Installation

Automated

You can install Emacs Prelude via the command line with either curl or wget. Naturally git is also required.

Via Curl

If you're using curl type the following command:
curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh

Via Wget

If you're using wget type:
wget --no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O - | sh

Manual

git clone git://github.com/bbatsov/prelude.git path/to/local/repo
ln -s path/to/local/repo ~/.emacs.d
cd ~/.emacs.d
You'd do well to replace ~/.emacs.d with the value of user-emacs-directory for your OS. You can check the value by doing C-h v user-emacs-directory inside Emacs.

Updating Prelude

Manual update

The update procedure is fairly straightforward and consists of 3 steps:

Update all bundled packages

Just run M-x package-list-packages RET U x.

Update Prelude's code

cd path/to/prelude/installation
git pull
The path/to/prelude/installation is usually ~/.emacs.d (at least on Unix systems).

Restart Prelude

It's generally a good idea to stop Emacs after you do the update. The next time Prelude starts it will install any new dependencies (if there are such).

Automatic update

Simply run M-x prelude-update from Emacs itself and restart Emacs afterwards.

Enabling additional modules

By default most of the modules that ship with Prelude are not loaded. For more information on the functionality provided by these modules visit the docs.

from https://github.com/bbatsov/prelude

Sunday, 30 March 2014

在linux vps上安装基于orgmode的静态博客程序- misaki-orgmode

git clone https://github.com/mikio/misaki-orgmode
cd misaki-orgmode
nano sample/_config.clj
把:emacs的值替换为你的emacs的执行文件的位置,我的为:
:emacs "/usr/local/bin/emacs"

cd ~
wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
ln -s /root/lein /usr/local/bin/lein
nohup lein run ~/misaki-orgmode/sample/ > /dev/null &
访问http://urdomain.com:8080就可看到网站效果。
如果你vps上的8080端口被其他程序占用了,可修改端口如下:
nano ~/misaki-orgmode/sample/_config.clj
在:emacs "/usr/local/bin/emacs"这行下面加上 :port 8083
killall lein
nohup lein run ~/misaki-orgmode/sample/ > /dev/null &
这样端口就改为了8083,访问http://urdomain.com:8083就可看到网站效果。
还需修改org-export.el文件:
nano ~/misaki-orgmode/org-export.el

(add-to-list 'load-path "~/Dropbox/site-lisp/org-8.0/lisp")
(add-to-list 'load-path "~/Dropbox/site-lisp/org-8.0/contrib/lisp" t)
分别用;;注释掉。在其下一行加上:
(add-to-list 'load-path "~/.emacs.d/elpa/org-20140310/")
这里的~/.emacs.d/elpa/org-20140310/为我的org(即orgmode)的安装路径,需改为你的org(即orgmode)的安装路径。

(add-to-list 'load-path "~/Dropbox/dotfiles/emacs/package/htmlize-20130207.2102/")
(add-to-list 'load-path "~/Dropbox/dotfiles/emacs/package/clojure-mode-20131222.444/")
(require 'clojure-mode)
(require 'htmlize)
也分别用;;注释掉。


发贴方法:
cd ~/misaki-orgmode/sample/template/posts/
nano test2.org
格式如下:
# @layout post
# @title 测试2
# @output 2099-12/test2.html
# @date 2060-1-1
# @tag tagx
#+OPTIONS: toc:t
#+BEGIN_HTML
<h2>测试2</h2>
<b>这是测试2</b>
#+END_HTML

保存更改,网站就自动更新了。(按F5键刷新网站)

as3:~/misaki-orgmode/sample/template/posts# cd ~/misaki-orgmode/sample
as3:~/misaki-orgmode/sample# ls
_config.clj  extension.clj  LICENSE  NOTICE  public  template
as3:~/misaki-orgmode/sample# cd public
as3:~/misaki-orgmode/sample/public# ls
2000-12  2060-12  archives.html  img         page2  page5  tag
2040-12  2080-12  atom.xml       index.html  page3  page6
2050-12  2099-12  css            js          page4  page7
as3:~/misaki-orgmode/sample/public#
可见~/misaki-orgmode/sample/public/就是静态网站的根目录。

演示站点:http://as3.brite.biz:8080/,http://mo.brite.biz.st
项目地址:https://github.com/mikio/misaki-orgmode

Thursday, 20 March 2014

在linux vps上搭建基于emacs orgmode的静态博客程序:o-blog

cd ~/.emacs.d/ (如果无此.emacs.d/目录,就新建它)
git clone https://github.com/renard/o-blog

添加如下内容到~/.emacs.d/init.el文件(如果无此init.el文件,就新建它)
(add-to-list 'load-path "~/.emacs.d/o-blog")
(require 'o-blog)

以上的操作其实还是不够的,还需做如下操作:
git clone https://github.com/emacsmirror/htmlize
(参见https://github.com/renard/o-blog/issues/2,官网https://github.com/renard/o-blog又不更新一下,让我遇错误,好久搞不定)

修改~/.emacs.d/init.el文件如下:(如果无此init.el文件,就新建它)
(add-to-list 'load-path "~/.emacs.d/o-blog")
(add-to-list 'load-path "~/.emacs.d/htmlize")
(require 'o-blog)
(require 'htmlize)

as3:~/.emacs.d# ls
htmlize  init.el  o-blog
as3:~/.emacs.d#

生成博客:
as3:~/.emacs.d# emacs --load init.el o-blog/example/sample.org
然后执行 M-x org-publish-blog,输出的站点默认保存在 ~/.emacs.d/o-blog/example/out/
(这个就是生成/更新静态网站的命令)
as3:~/.emacs.d# cd o-blog/example/
as3:~/.emacs.d/o-blog/example# ls
200px-Org-mode-unicorn.svg.png  oblog-min.org         out
emacs-logo.png                  org-mode-unicorn.png  sample.org
(新出现了out目录)
as3:~/.emacs.d/o-blog/example# cd out
as3:~/.emacs.d/o-blog/example/out# ls
archives.html    features.html   sitemap.xml      templates.html
bug-report.html  functions.html  structures.html  testimonials.html
changelog.html   index.html      style            tips
debug.html       index.xml       tags
faq.html         roadmap.html    tags.html
(可见~/.emacs.d/o-blog/example/out/就是静态网站的根目录)
as3:~/.emacs.d/o-blog/example/out# nohup Rwebserver 43830 > /dev/null &
访问http://as3.brite.biz:43830/就可看到网站效果。

发贴方法:
as3:~/.emacs.d/o-blog/example/out# cd ..
as3:~/.emacs.d/o-blog/example# nano test1.org
test1.org的格式为:
#+TITLE: 测试1
#+STARTUP: logdone

这是测试1.


然后,
as3:~/.emacs.d/o-blog/example# emacs --load ~/.emacs.d/init.el ~/.emacs.d/o-blog/example/sample.org
(这个就是生成/更新静态网站的命令.我用的是完整路径,以确保不会出错)

演示站点:http://as3.brite.biz:43830/index.html,HTTP://ob.brite.biz.st
http://as3.brite.biz/o-blog-output
注意:如果直接绑定域名到 ~/.emacs.d/o-blog/example/out/目录,访问域名地址会出现
Forbidden的提示。使用chown命令也无济于事。所以我运行了:
cp -r  ~/.emacs.d/o-blog/example/out/ /var/www/
mv /var/www/out/ /var/www/o-blog-output
然后绑定域名ob.brite.biz.st到/var/www/o-blog-output/,这样域名地址HTTP://ob.brite.biz.st就可正常访问了。
发贴后,要记得运行rsync命令,把 ~/.emacs.d/o-blog/example/out/目录同步到/var/www/o-blog-output/目录。
不过奇怪的是我发表的帖子test1.html不知在哪里。
项目地址:https://github.com/renard/o-blog




Wednesday, 19 March 2014

在linux vps上搭建基于emacs的orgmode的静态博客程序-bastibe

首先把如下代码添加到~/.emacs.el文件的尾部:

(setq org-publish-project-alist
      '(("blog"
         :components ("blog-content" "blog-static"))
        ("blog-content"
         :base-directory "~/Projects/blog/posts"
         :html-extension "html"
         :base-extension "org"
         :publishing-directory "~/Projects/blog/publish"
         :publishing-function (org-html-publish-to-html)
         :auto-sitemap t
         :sitemap-filename "archive.org"
         :sitemap-title "Archive"
         :sitemap-sort-files anti-chronologically
         :sitemap-style list
         :makeindex t
         :recursive t
         :section-numbers nil
         :with-toc nil
         :with-latex t
         :html-head-include-default-style nil
         :html-head-include-scripts nil
         :html-head-extra
         "<link rel=\"alternate\" type=\"appliation/rss+xml\"
                href=\"http://bastibe.de/rss.xml\"
                title=\"RSS feed for bastibe.de\">
          <link href='http://fonts.googleapis.com/css?family=Roboto&subset=latin' rel='stylesheet' type='text/css'>
          <link href='http://fonts.googleapis.com/css?family=Ubuntu+Mono' rel='stylesheet' type='text/css'>
          <link href= \"static/style.css\" rel=\"stylesheet\" type=\"text/css\" />
          <title>Basti's Scratchpad on the Internet</title>
          <meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=UTF-8\" />
          <meta name=\"viewport\" content=\"initial-scale=1,width=device-width,minimum-scale=1\">"
         :html-preamble
         "<div class=\"header\">
              <a href=\"http://bastibe.de\">Basti's Scratchpad on the Internet</a>
              <div class=\"sitelinks\">
                  <a href=\"http://alpha.app.net/bastibe\">alpha.app.net</a>  | <a href=\"http://github.com/bastibe\">Github</a>
              </div>
          </div>"
         :html-postamble
         (lambda (info)
           "Do not show disqus for Archive and Recent Posts"
           (cond ((string= (car (plist-get info :title)) "Archive") "")
                 ((string= (car (plist-get info :title)) "Recent Posts")
                  "<div id=\"archive\"><a href=\"archive.html\">Other posts</a></div>")
                 (t
             "<div id=\"archive\"><a href=\"archive.html\">Other posts</a></div>
              <div id=\"disqus_thread\"></div>
              <script type=\"text/javascript\">
              /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
              var disqus_shortname = 'bastibe';
              /* * * DON'T EDIT BELOW THIS LINE * * */
              (function() {
                var dsq = document.createElement('script');
                dsq.type = 'text/javascript';
                dsq.async = true;
                dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
                (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
                  })();
              </script>
              <noscript>Please enable JavaScript to view the
                  <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>
              <a href=\"http://disqus.com\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>")))
         :exclude "rss.org\\|archive.org\\|theindex.org")
        ("blog-static"
         :base-directory "~/Projects/blog/static"
         :base-extension "png\\|jpg\\|css"
         :publishing-directory "~/Projects/blog/publish/static"
         :recursive t
         :publishing-function org-publish-attachment)))

as3:~# mkdir -p ~/Projects/blog/posts ~/Projects/blog/static
as3:~# mkdir -p ~/Projects/blog/publish
as3:~# mkdir -p ~/Projects/blog/publish/static
as3:~# wget https://github.com/bastibe/bastibe.github.com/archive/source.zip
as3:~# unzip source.zip
as3:~# cd bastibe.github.com-source/
as3:~/bastibe.github.com-source# ls
CNAME  posts  static bastibe.github.com
as3:~/bastibe.github.com-source# ls bastibe.github.com
as3:~/bastibe.github.com-source# rm -rf bastibe.github.com
as3:~/bastibe.github.com-source# ls
CNAME  posts  static
as3:~/bastibe.github.com-source# mv posts/* ~/Projects/blog/posts/
as3:~/bastibe.github.com-source# mv static/* ~/Projects/blog/static/
as3:~/bastibe.github.com-source# cd ~/Projects/blog/posts/
as3:~/Projects/blog/posts# ls
2009-03-05-great-scott.org
2009-03-12-kompilieren-auf-windows.org
2009-03-14-get-a-mac.org
2009-03-15-debugging-und-gcc-auf-windows.org
2009-03-19-western-digital-festplatten-umtausch-mit-uberraschungen.org
2009-03-24-e-text-editor-goes-open-source.org
2009-03-28-synchronisieren-von-google.org
2009-03-29-mirrors-edge.org
2009-03-31-es-geht-um-tabs.org
2009-04-19-tagged-file-system.org
2009-04-25-gedanken-zu-user-interfaces.org
2010-07-03-strangeness-of-widescreen-displays-in-modern-operating-systems.org
2011-02-03-installing-python-slash-numpy-slash-scipy-slash-matplotlib-on-osx.org
2011-03-04-installing-pygame-using-homebrew.org
2011-08-01-compiling-scipy-and-matplotlib-using-pip-on-lion.org
2011-09-03-adobe-air-application-crashes.org
2011-10-13-compiling-scipy-and-matplotlib-again.org
2011-12-04-how-to-make-tagbar-work-with-objective-c.org
2012-02-03-text-editors.org
2012-02-22-how-to-gem-install-rlua-on-osx-slash-homebrew.org
2012-07-09-apple-is-failing-me.org
2012-07-15-solarized-for-pygments.org
2012-07-18-blogging-with-pelican.org
2012-07-29-using-raspberry-pi-as-time-machine.org
2012-08-28-errors-in-epydoc.org
2012-09-08-on-the-virtue-of-oss.org
2012-09-13-Kindle-app-does-not-start.org
2012-09-20-story-about-schemes.org
2012-10-13-emacs.org
2012-10-14-emacs-customizations.org
2012-10-20-matlab-mex-and-osx.org
2012-10-28-names.org
2012-11-01-apple-tv.org
2012-11-02-real-time-signal-processing-in-python.org
2013-01-20-a-python-primer-for-matlab-users.org
2013-05-30-speeding-up-matplotlib.org
2013-11-13-blogging-with-emacs.org
2013-11-27-audio-in-python.org
archive.org
index.org
rss.org
theindex.inc
theindex.org
as3:~/Projects/blog/posts# emacs index.org (这个就是生成/更新静态网站的命令。)

发贴方法:
as3:~/Projects/blog/publish# cd ~/Projects/blog/posts
as3:~/Projects/blog/posts# nano 2014-03-19-test1.org
按~/Projects/blog/posts/里面某个org文件的格式,新建帖子2014-03-19-test1.org,格式如下:
#+title: 测试1

这是测试1.


(如果要插入html代码,则格式为:
#+TITLE: 某个标题
#+BEGIN_HTML
这里插入html 代码
#+END_HTML

这里写一些文字。

然后,
as3:~/Projects/blog/posts# nano index.org
在此行* [[file:2013-11-27-audio-in-python.org][Sound in Python]]的上一行加上:
* [[file:2014-03-19-test1.org][测试1]]

然后,
as3:~/Projects/blog/posts# emacs index.org
(这个就是更新静态网站的命令。上面需先编辑index.org,否则所发表的帖子的超链地址不会出现在首页)
(按alt+x,输入org-publish-project,回车,输入blog,回车,可能会出现提示:
Invalid read syntax: "#",没关系,重来一次,再按alt+x,输入org-publish-project,回车,输入blog,回车,等到emacs编辑器里面的文字闪动停止,即可。按ctrl+x ctrl+c退出emacs.)
as3:~/Projects/blog/posts# cd ~/Projects/blog/publish/
as3:~/Projects/blog/publish# nohup Rwebserver 35637 > /dev/null &
访问http://as3.brite.biz:35637/即可看到网站效果。

~/Projects/blog/publish/就是静态网站的根目录。

演示地址:http://as3.brite.biz:35637/,http://bt.brite.biz.st, http://luckypoem.bitbucket.io
程序作者的演示站点:http://bastibe.de/,
教程:http://bastibe.de/2013-11-13-blogging-with-emacs.html
这个程序有个特点:所发表的帖子的超链会自动出现在http://bt.brite.biz.st/archive.html 里面。
项目地址:https://github.com/bastibe/bastibe.github.com/tree/source
源码下载地址:https://github.com/bastibe/bastibe.github.com/archive/source.zip


相关帖子:在linux vps上搭建基于emacs的orgmode的静态博客程序-Homepage

Tuesday, 18 March 2014

在linux vps上搭建基于emacs的orgmode的静态博客程序-Homepage

 在操作前,请先看完编译emacs,并安装emacs的org组件
as3:~# mkdir -p ~/Private/Homepage
as3:~# mkdir -p ~/Sites/Privat
as3:~# git clone https://github.com/pharos-alexandria/Homepage
as3:~# mv Homepage/* ~/Private/Homepage/
as3:~# cd ~/Private/Homepage/
as3:~/Private/Homepage#
as3:~/Private/Homepage# ls
Blog      index.org   org.css        Projekte        
emacs.el  preamble.html  sitemap-gen.org  sitemap.org
as3:~/Private/Homepage# cp emacs.el ~/.emacs.el

发贴方法:
as3:~/Private/Homepage# cd Blog
as3:~/Private/Homepage/Blog# nano 2014-03-18-smiling-face.org
按~/Private/Homepage/Blog/里面某个org文件的格式,新建帖子2014-03-18-smiling-face.org,格式如下:
#+TITLE:     2014 03 18 笑脸
#+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t *:t TeX:t author:nil <:t LaTeX:t
#+HTML_HEAD:     <link rel="stylesheet" href="../org.css" type="text/css" />
#+BEGIN_HTML
<h2>笑脸</h2>
<object height="315" width="420"><param name="movie" value="//www.youtube.com/v/oSnEHx-f8ik?hl=zh_CN&amp;version=3"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="//www.youtube.com/v/oSnEHx-f8ik?hl=zh_CN&amp;version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
#+END_HTML
欣赏一下笑脸。

然后,
as3:~/Private/Homepage/Blog# cd ..
as3:~/Private/Homepage# ls
Blog      index.org   org.css        Projekte         sitemap-gen.org~
emacs.el  index.org~  preamble.html  sitemap-gen.org  sitemap.org
as3:~/Private/Homepage# nano index.org
在此行** [[file:Blog/2013-03-28.org][28.03.2013 | Karte der Teilnehmer an der Synode von Serdika (342)]]的上一行加上:
** [[file:Blog/2014-03-18-smiling-face.org][笑脸]]
然后,
as3:~/Private/Homepage# emacs index.org  (这个就是更新静态网站的命令。上面需先编辑index.org,否则所发表的帖子的超链地址不会出现在首页)
(按alt+x,输入org-publish-project,回车,输入orgweb,回车,可能会出现提示:
Invalid read syntax: "#",没关系,再按alt+x,输入org-publish-project,回车,输入orgweb,回车,等到emacs编辑器里面的文字闪动停止,即可。按ctrl+x ctrl+c退出emacs.)

查看这个地址https://github.com/pharos-alexandria/Homepage/blob/master/emacs.el,可看到这行文字- :base-directory "~/Private/Homepage",
可知~/Private/Homepage/是源贴所在的目录;
看到这行文字-     :publishing-directory "~/Sites/Privat",可知~/Sites/Privat/就是静态网站的根目录。

演示站点:http://pa.brite.biz.st
项目地址:https://github.com/pharos-alexandria/Homepage

相关帖子:
http://briteming.blogspot.com/2014/03/linux-vpsemacsorgmode-bastibe.html
http://briteming.blogspot.com/2014/03/linux-vpsorgmode-misaki-orgmode.html

类似项目:https://github.com/xiaohanyu/org-site

编译emacs,并安装emacs的org组件

apt-get remove emacs (yum remove emacs)

wget http://ftp.gnu.org/gnu/emacs/emacs-24.3.tar.gz
tar zxvf emacs-24.3.tar.gz
cd emacs-24.3
./configure
make
make install (这样emacs就编译好了,版本为24.3)

然后是安装org组件.emacs自带org组件,但版本较低,建议另外安装org组件。
emacs (运行emacs)
M-x package-install RET org(意思即:按Alt+x,在emacs编辑器的最下行就会出现M-x,然后在M-x的后面空一格,输入package-install,然后回车,RET即return回车,输入org,回车。等待安装完毕。请参见
http://orgmode.org/manual/Installation.html#Installation的Using Emacs packaging system部分。安装org组件有3种方式。建议使用第一种。不建议使用另2种方式,它们麻烦多多)
C-x C-c (退出emacs)
emacs
M-x org-version
意思即:按Alt+x,在emacs编辑器的最下行就会出现M-x,然后在M-x的后面空一格,输入org-version,然后回车.emacs编辑器的最下方就会显示:
Org-mode version 8.2.5h (8.2.5h-32-g9639ed-elpa @ /root/.emacs.d/elpa/org-20140310/),表明org-mode的版本为8.2.5h

Friday, 14 March 2014

Org-blog是一个用Perl写的将Emacs Org格式文件转换静态博客的工具

Org-blog是一个用Perl写的将Emacs Org格式文件转换静态博客的工具。如果你使用Org来写博客,并想利用类似Github pages这样的静态页面host服务来搭建博客,Orgblog-pl也许是一个不错的选择。 目前支持以下功能:
  1. 支持页面模板,模板语法HTML::Template
  2. 支持总页面以及分类页面的feed输出
  3. 支持Org格式文件读入,以及附带的图片的导入。

导入过程

  1. 读取-i指定的Org文件的目录,遍历org文件,如果没有对应的导出html文件,调用emacs导出html
  2. 读取导出的html文件,读取meta信息中的generated字段,作为日期,title作为标题,org生成的TOC以下的内容为主干。将img指向的本地文件拷贝出来。读取Org文件所在的目录,作为类别
  3. 读取-t指定的页面模板目录,渲染主页、类别页、正文页面和feed页

使用方法

效果参考:http://blog.crackcell.com
  1. 将Org-blog拷贝到博客根目录下
  2. 准备好模板文件(index.html、feed.xml、category.html、post.html)和待导入的Org文件
  3. 查看org-blog/bin/org-blog,修改相应参数,在根目录下执行./orgblog-pl/bin/orgblog即可

文件用途说明

  • bin/org-blog.pl:主程序文件
  • bin/org-blog:启动的shell脚本
  • bin/simpleserver:启动简单的本地http服务器用于调试
  • 3rd:第三方库archive文件
  • lib:第三方库

主程序文件参数说明

  • i:指定org文件路径
  • o:指定博客输出的路径
  • t:指定模板路径
  • b:指定博客的base url。因为生成的站点的链接全部使用绝对路径
  • d:指定关键词提取词典
from https://github.com/crackcell/org-blog