-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f5d4d8
commit 0b3c86d
Showing
34 changed files
with
815 additions
and
127 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
layout: post | ||
title: Emacs Org mode 时间戳 (Time Stamp) 设置为中文的方法 | ||
categories: [技术] | ||
tags: [Emacs, Org mode] | ||
icon: code | ||
--- | ||
<h1>Emacs和Org mode介绍</h1> | ||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
先简要介绍一下Emacs和Org mode。Emacs可以算是GNU(关于GNU,可以参考其<a href="http://www.gnu.org/" target="_blank">官网介绍</a> )社区王牌性的作品。简单来说,它是一个文本编辑器,但由于其可定制性极强,使用者可以依据自己的喜好将它“改装”成各种样子。也正是由于其自由度极高,一句经典的调侃是 | ||
</p> | ||
|
||
<blockquote> | ||
Emacs is anything but an editor. | ||
</blockquote> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
此外,由于<a href="www.vim.org" target="_blank">Vim</a>也是十分强大的编辑器,二者之间的圣战也是程序员们津津乐道的话题,可以参考 <a href="http://en.wikipedia.org/wiki/Editor_war" target="_blank">Wiki: Editor War</a>。 | ||
</p> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
<a href="orgmode.org" target="_blank">Org mode</a>是以Emacs中的Outline Mode为基础进行扩展后的强大模式,利用Org mode可以方便地按照大纲方式组织文本。因此Org mode非常适合于写作长文章或其他组织性较强的工作,此外它也有其他一些应用,例如可以作为GTD工具(详见<a href="http://doc.norang.ca/org-mode.html#ChangeHistory" target="_blank">Org Mode - Organize Your Life In Plain Text!</a>)等。 | ||
</p> | ||
|
||
<h1>Emacs Org mode中的时间戳</h1> | ||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
Org mode中有一个功能,就是插入时间戳(time stamp),可以参考<a href="http://orgmode.org/manual/Timestamps.html#Timestamps" target="_blank">The Org Manual 8.1 Timestamps</a>,PDF版本可以从<a href="http://orgmode.org/org.pdf" target="_blank">这里</a>下载。正常情况下,Org mode中默认的时间戳是英文的,如下图所示(最下面一行的Saturday): | ||
</p> | ||
|
||
<img class = "center" src="{{site.url}}/image/2014-08/org mode time stamp.png" width="800px"/> | ||
|
||
<h1>系统环境及解决方案</h1> | ||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
系统环境Mac OS 10.9.4,Emacs版本(<a href="http://emacsformacosx.com/" target="_blank">Emacs for Mac OS X</a>)24.3。现在我想实现的是将Org mode中的时间戳最后的Saturday由英文改为中文。在网上看到一篇文章很受启发:<a href="http://blog.aizhet.com/Windows/3941.html" target="_blank">org-mode里时间戳显示语言的问题</a>。但该文章叙述的是如何从中文改成英文,而我是要反其道而行之。借鉴他文章中的思路,在Emacs的启动配置文件(.emacs或.emacs.d/init.el)中添加如下代码: | ||
</p> | ||
|
||
{% highlight lisp %} | ||
|
||
(set-locale-environment "zh_CN.utf-8") | ||
|
||
{% endhighlight %} | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
添加上述代码之后再在Org mode中插入的时间戳即为中文。但我的Mac系统上还有个问题,例如星期一的缩写应为周一,但我的系统上显示的是一。在Windows下利用cygwin安装的Emacs就没有这个问题,怀疑是Mac系统设置的问题。好在Org mode中还提供了自定义时间戳格式的设置,只能暂时先用全称代替缩写了。在Emacs的启动配置文件(.emacs或.emacs.d/init.el)中添加如下代码: | ||
</p> | ||
|
||
{% highlight lisp %} | ||
|
||
(setq-default org-display-custom-times t) | ||
(setq org-time-stamp-custom-formats '("<%Y-%m-%d %A>" . "<%Y-%m-%d %A %H:%M>")) | ||
|
||
{% endhighlight %} | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
其中的%A代替了默认设置中的%a,即为星期几(weekday)的全称。有关时间戳格式更详细的介绍可以参考 <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Time-Parsing.html#Time-Parsing" target="_blank">GNU Emacs Lisp Reference Manual 39.7 Parsing and Formatting Times</a>,PDF版本可以从<a href="https://www.gnu.org/software/emacs/manual/pdf/elisp.pdf" target="_blank">这里</a>下载。 | ||
</p> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
最后补上一张设置好之后的图: | ||
</p> | ||
|
||
<img class="center" src="{{site.url}}/image/2014-08/time stamp Chinese.png"/ width="800px"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
layout: post | ||
title: 国航相关信息汇总 | ||
categories: [生活] | ||
tags: [博士, 国航] | ||
icon: leaf | ||
--- | ||
<h1>国航常旅客计划</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
250 changes: 250 additions & 0 deletions
250
_site/2014/08/23/emacs-org-mode-time-stamp-language/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<html lang="cn"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Emacs Org mode 时间戳 (Time Stamp) 设置为中文的方法</title> | ||
|
||
|
||
<meta name="author" content="Tommy"> | ||
|
||
<!-- Enable responsive viewport --> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> | ||
<!--[if lt IE 9]> | ||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
|
||
<!-- Le styles --> | ||
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> | ||
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> | ||
<link href="/css/typo.css" rel="stylesheet"> | ||
<link href="/css/solarized.css" rel="stylesheet" type="text/css" media="all"> | ||
<link href="/css/datatables-bootstrap.css" rel="stylesheet"> | ||
<link href="/css/codepiano.css" rel="stylesheet"> | ||
|
||
<!-- javascript files --> | ||
<script type="text/javascript" src="/js/jquery-2.0.0.min.js"></script> | ||
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> | ||
<script type="text/javascript" src="/js/jquery.dataTables.min.js"></script> | ||
<script type="text/javascript" src="/js/datatables-bootstrap.js"></script> | ||
<script type="text/javascript" src="/js/codepiano.js"></script> | ||
|
||
<!-- Le fav and touch icons --> | ||
<!-- Update these with your own images | ||
<link rel="shortcut icon" href="images/favicon.ico"> | ||
<link rel="apple-touch-icon" href="images/apple-touch-icon.png"> | ||
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png"> | ||
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png"> | ||
--> | ||
|
||
<!-- atom & rss feed --> | ||
<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed"> | ||
<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="Sitewide RSS Feed"> | ||
|
||
<script type="text/javascript"> | ||
</script> | ||
|
||
</head> | ||
|
||
<body id="scroll-pane" data-spy="scroll" data-target="#time-list-nav"> | ||
<div class="wrapper"> | ||
<!-- 导航条 --> | ||
<div class="nav navbar-nav" id="nav-wrap"> | ||
<div class="navbar-header"> | ||
<div class="col-md-2"> | ||
</div> | ||
<div class="col-md-8"> | ||
<a class="navbar-brand" href="/"> | ||
<span class="site-author"> Tommy </span> | ||
<span class="site-title"> /* 电力引领生活 */ </span> | ||
</a> | ||
<ul id="nav-menu" class="nav navbar-nav"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="posts"><a href="/posts.html">文章</a></li> | ||
<li class="timeline"><a href="/timeline.html">归档</a></li> | ||
<li class="categories"><a href="/categories.html">目录</a></li> | ||
<li class="about"><a href="/about.html">关于</a></li> | ||
|
||
</ul> | ||
</div> | ||
<div class="col-md-2"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<!-- 正文 --> | ||
|
||
|
||
<div class="row post-full typo"> | ||
<div class="col-md-2"></div> | ||
<div class="col-md-8 typo"> | ||
<h2>Emacs Org mode 时间戳 (Time Stamp) 设置为中文的方法 </h2> | ||
<div class="post_info"> | ||
|
||
<ul id="post_info" class="tag_box inline"> | ||
<li><i class="fa fa-calendar"></i></li> | ||
<li> 2014 年 08 月 23 日</li> | ||
<li><i class="fa fa-folder-open"></i></li> | ||
|
||
|
||
|
||
<li> | ||
<a href="/categories.html#技术-ref"> | ||
技术 | ||
</a> | ||
</li> | ||
|
||
|
||
|
||
|
||
</ul> | ||
|
||
</div> | ||
<div class="content"> | ||
<h1>Emacs和Org mode介绍</h1> | ||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
先简要介绍一下Emacs和Org mode。Emacs可以算是GNU(关于GNU,可以参考其<a href="http://www.gnu.org/" target="_blank">官网介绍</a> )社区王牌性的作品。简单来说,它是一个文本编辑器,但由于其可定制性极强,使用者可以依据自己的喜好将它“改装”成各种样子。也正是由于其自由度极高,一句经典的调侃是 | ||
</p> | ||
|
||
<blockquote> | ||
Emacs is anything but an editor. | ||
</blockquote> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
此外,由于<a href="www.vim.org" target="_blank">Vim</a>也是十分强大的编辑器,二者之间的圣战也是程序员们津津乐道的话题,可以参考 <a href="http://en.wikipedia.org/wiki/Editor_war" target="_blank">Wiki: Editor War</a>。 | ||
</p> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
<a href="orgmode.org" target="_blank">Org mode</a>是以Emacs中的Outline Mode为基础进行扩展后的强大模式,利用Org mode可以方便地按照大纲方式组织文本。因此Org mode非常适合于写作长文章或其他组织性较强的工作,此外它也有其他一些应用,例如可以作为GTD工具(详见<a href="http://doc.norang.ca/org-mode.html#ChangeHistory" target="_blank">Org Mode - Organize Your Life In Plain Text!</a>)等。 | ||
</p> | ||
|
||
<h1>Emacs Org mode中的时间戳</h1> | ||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
Org mode中有一个功能,就是插入时间戳(time stamp),可以参考<a href="http://orgmode.org/manual/Timestamps.html#Timestamps" target="_blank">The Org Manual 8.1 Timestamps</a>,PDF版本可以从<a href="http://orgmode.org/org.pdf" target="_blank">这里</a>下载。正常情况下,Org mode中默认的时间戳是英文的,如下图所示(最下面一行的Saturday): | ||
</p> | ||
|
||
<img class = "center" src="/image/2014-08/org mode time stamp.png" width="800px"/> | ||
|
||
<h1>系统环境及解决方案</h1> | ||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
系统环境Mac OS 10.9.4,Emacs版本(<a href="http://emacsformacosx.com/" target="_blank">Emacs for Mac OS X</a>)24.3。现在我想实现的是将Org mode中的时间戳最后的Saturday由英文改为中文。在网上看到一篇文章很受启发:<a href="http://blog.aizhet.com/Windows/3941.html" target="_blank">org-mode里时间戳显示语言的问题</a>。但该文章叙述的是如何从中文改成英文,而我是要反其道而行之。借鉴他文章中的思路,在Emacs的启动配置文件(.emacs或.emacs.d/init.el)中添加如下代码: | ||
</p> | ||
|
||
<div class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nv">set-locale-environment</span> <span class="s">"zh_CN.utf-8"</span><span class="p">)</span></code></pre></div> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
添加上述代码之后再在Org mode中插入的时间戳即为中文。但我的Mac系统上还有个问题,例如星期一的缩写应为周一,但我的系统上显示的是一。在Windows下利用cygwin安装的Emacs就没有这个问题,怀疑是Mac系统设置的问题。好在Org mode中还提供了自定义时间戳格式的设置,只能暂时先用全称代替缩写了。在Emacs的启动配置文件(.emacs或.emacs.d/init.el)中添加如下代码: | ||
</p> | ||
|
||
<div class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nv">setq-default</span> <span class="nv">org-display-custom-times</span> <span class="no">t</span><span class="p">)</span> | ||
<span class="p">(</span><span class="k">setq</span> <span class="nv">org-time-stamp-custom-formats</span> <span class="o">'</span><span class="p">(</span><span class="s">"<%Y-%m-%d %A>"</span> <span class="o">.</span> <span class="s">"<%Y-%m-%d %A %H:%M>"</span><span class="p">))</span></code></pre></div> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
其中的%A代替了默认设置中的%a,即为星期几(weekday)的全称。有关时间戳格式更详细的介绍可以参考 <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Time-Parsing.html#Time-Parsing" target="_blank">GNU Emacs Lisp Reference Manual 39.7 Parsing and Formatting Times</a>,PDF版本可以从<a href="https://www.gnu.org/software/emacs/manual/pdf/elisp.pdf" target="_blank">这里</a>下载。 | ||
</p> | ||
|
||
<p class="paragraph" style="text-align:justify; text-justify:inter-ideograph;"> | ||
最后补上一张设置好之后的图: | ||
</p> | ||
|
||
<img class="center" src="/image/2014-08/time stamp Chinese.png"/ width="800px"> | ||
|
||
</div> | ||
|
||
|
||
<ul id="tag_info" class="tag_box inline"> | ||
<li><i class="fa fa-tags"></i></li> | ||
|
||
|
||
|
||
<li><a href="/posts.html#Emacs">Emacs <span>2</span></a></li> | ||
|
||
<li><a href="/posts.html#Org mode">Org mode <span>1</span></a></li> | ||
|
||
|
||
|
||
|
||
</ul> | ||
|
||
|
||
<hr> | ||
<ul class="pagination pull-right"> | ||
|
||
<li class="prev"><a href="/2014/08/16/pt-share" title="我与PT">← 前一篇</a></li> | ||
|
||
<li><a href="/posts.html">索引</a></li> | ||
|
||
<li class="next disabled"><a>后一篇 →</a> | ||
|
||
</ul> | ||
<br /> | ||
<div id="comment-hook"></div> | ||
|
||
|
||
|
||
<!-- 多说评论框 start --> | ||
<div class="ds-thread" data-thread-key="Emacs Org mode 时间戳 (Time Stamp) 设置为中文的方法" data-title="Emacs Org mode 时间戳 (Time Stamp) 设置为中文的方法" data-url="page.url"></div> | ||
<!-- 多说评论框 end --> | ||
<!-- 多说公共JS代码 start (一个网页只需插入一次) --> | ||
<script type="text/javascript"> | ||
var duoshuoQuery = {short_name:"tommyjiang"}; | ||
(function() { | ||
var ds = document.createElement('script'); | ||
ds.type = 'text/javascript';ds.async = true; | ||
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js'; | ||
ds.charset = 'UTF-8'; | ||
(document.getElementsByTagName('head')[0] | ||
|| document.getElementsByTagName('body')[0]).appendChild(ds); | ||
})(); | ||
</script> | ||
<!-- 多说公共JS代码 end --> | ||
|
||
|
||
|
||
|
||
|
||
</div> | ||
<div class="col-md-2"></div> | ||
</div> | ||
<script type="text/javascript" | ||
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> | ||
</script> | ||
|
||
<script type="text/x-mathjax-config"> | ||
MathJax.Hub.Config({ | ||
TeX: {equationNumbers: {autoNumber: ["AMS"], useLabelIds: true}}, | ||
"HTML-CSS": {linebreaks: {automatic: true}}, | ||
SVG: {linebreaks: {automatic: true}} | ||
}); | ||
</script> | ||
|
||
|
||
|
||
|
||
</div> | ||
<!-- 底部声明 --> | ||
<div class="row bottom"> | ||
<div class="col-md-2"> | ||
</div> | ||
<div class="col-md-8 text-center"> | ||
— <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh" class="license">原创作品许可 — 署名-非商业性使用-禁止演绎 3.0 未本地化版本 — CC BY-NC-ND 3.0 </a> — | ||
</div> | ||
<div class="col-md-2"> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
</body> | ||
</html> | ||
|
Binary file not shown.
Oops, something went wrong.