Skip to content

Commit 30d5e4e

Browse files
committed
Fix the publish date of 4 posts.
1 parent bebcc56 commit 30d5e4e

File tree

4 files changed

+64
-62
lines changed

4 files changed

+64
-62
lines changed

content/zh/post/2017/emacs_ipython.md renamed to content/zh/post/2016/emacs_ipython.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
+++
22
title = "在Emacs中使用Ipython"
33
description = "Use Ipython in Emasc"
4-
date = 2017-02-22T00:00:00+08:00
4+
date = 2016-08-03T00:00:00-07:00
55
keywords = ["emacs", "ipython"]
6-
lastmod = 2022-02-23T19:16:07+08:00
6+
lastmod = 2024-12-31T11:48:36-08:00
77
tags = ["emacs", "python"]
88
categories = ["emacs"]
99
draft = false
@@ -64,21 +64,21 @@ similar to shell-pop"
6464
(interactive)
6565
(if (get-buffer "*Python*")
6666
(if (string= (buffer-name) "*Python*")
67-
(if (not (one-window-p))
68-
(progn (bury-buffer)
69-
(delete-window))
70-
)
71-
(progn (switch-to-buffer-other-window "*Python*")
72-
(end-of-buffer)
73-
(evil-insert-state)))
67+
(if (not (one-window-p))
68+
(progn (bury-buffer)
69+
(delete-window))
70+
)
71+
(progn (switch-to-buffer-other-window "*Python*")
72+
(end-of-buffer)
73+
(evil-insert-state)))
7474
(progn
7575
(run-python)
7676
(switch-to-buffer-other-window "*Python*")
7777
(end-of-buffer)
7878
(evil-insert-state))))
7979
```
8080

81-
如果没有使用Evil,可以把 **(evil-insert-state)**去掉
81+
如果没有使用Evil,可以把 \*(evil-insert-state)\*去掉
8282

8383

8484
### <span class="section-num">2.2</span> Ipython History {#ipython-history}
@@ -94,4 +94,4 @@ similar to shell-pop"
9494
(define-key comint-mode-map (kbd "<down>") 'comint-next-input)
9595
```
9696

97-
Enjoy Emacs :)
97+
Enjoy Emacs :)

content/zh/post/2017/emacs_startup.md renamed to content/zh/post/2016/emacs_startup.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
+++
22
title = "提高Emacs启动速度"
33
description = "Tips to reduce emacs startup time"
4-
date = 2017-02-22T00:00:00+08:00
4+
date = 2016-10-22T00:00:00-07:00
55
keywords = ["emacs"]
6-
lastmod = 2022-02-23T19:19:47+08:00
6+
lastmod = 2024-12-31T11:57:41-08:00
77
tags = ["emacs"]
88
categories = ["emacs"]
99
draft = false
@@ -20,7 +20,7 @@ toc = true
2020

2121
## <span class="section-num">1</span> 技巧1 {#技巧1}
2222

23-
在你的 **.emacs** 或者相应的初始化文件里面添加如下代码
23+
在你的 `.emacs` 或者相应的初始化文件里面添加如下代码
2424

2525
```emacs-lisp
2626
# Increase the garbage collection threshold to 128 MB to ease startup
@@ -32,14 +32,14 @@ toc = true
3232
# init.el ends here
3333
```
3434

35-
**gc-cons-threshold** 指定了emacs 进行垃圾回收的阀值,默认值是 **800000byte**,实在是太小了,所以Emacs 会在启动期间进行非常多次的垃圾回收,启动时间自然长了。
35+
`gc-cons-threshold` 指定了emacs 进行垃圾回收的阀值,默认值是 `800000byte`,实在是太小了,所以Emacs 会在启动期间进行非常多次的垃圾回收,启动时间自然长了。
3636

37-
在加载完以后,再把 **gc-cons-threshold** 的值调低,当然,如果你的内存很大,也可以不改回来
37+
在加载完以后,再把 `gc-cons-threshold` 的值调低,当然,如果你的内存很大,也可以不改回来
3838

3939

4040
## <span class="section-num">2</span> 技巧2 {#技巧2}
4141

42-
**(let((file-name-hander-alist nil))init.file)** 包裹(wrap)你的初始化文件,即:
42+
`(let((file-name-hander-alist nil))init.file)` 包裹(wrap)你的初始化文件,即:
4343

4444
```emacs-lisp
4545
(setq gc-cons-threshold (* 500 1024 1024))
@@ -55,12 +55,12 @@ toc = true
5555
;;; init.el ends here
5656
```
5757

58-
因为 **file-name-handler-alist** 的默认值是一些正则表达式,也就是说Emacs 在启动过程中加载el和elc 文件都会将文件名和正则表达式进行匹配
58+
因为 `file-name-handler-alist` 的默认值是一些正则表达式,也就是说Emacs 在启动过程中加载el和elc 文件都会将文件名和正则表达式进行匹配
5959

6060

6161
## <span class="section-num">3</span> 技巧3 {#技巧3}
6262

63-
Emacs lisp 有一项auto-load 的技术,类似延迟加载,合理运用延迟,让笔者的Emacs启动加载时间减少一半,因为笔者用 **use-package** 这个macro,而 **use-package** 又集成了延迟加载的功能,所以笔者就直接拿自己的代码举例了
63+
Emacs lisp 有一项auto-load 的技术,类似延迟加载,合理运用延迟,让笔者的Emacs启动加载时间减少一半,因为笔者用 `use-package` 这个macro,而 `use-package` 又集成了延迟加载的功能,所以笔者就直接拿自己的代码举例了
6464

6565

6666
### <span class="section-num">3.1</span> :after {#after}
@@ -73,7 +73,7 @@ Emacs lisp 有一项auto-load 的技术,类似延迟加载,合理运用延
7373
)
7474
```
7575

76-
**:after** 关键字的作用基本跟 **with-eval-after-load** 的作用是相同的,所以笔者所
76+
`:after` 关键字的作用基本跟 `with-eval-after-load` 的作用是相同的,所以笔者所
7777
有类似的org-mode 插件包都会在org-mode 加载以后才会加载
7878

7979

@@ -90,33 +90,33 @@ Emacs lisp 有一项auto-load 的技术,类似延迟加载,合理运用延
9090
> When you use the :commands keyword, it creates autoloads for those commands
9191
> and defers loading of the module until they are used
9292
93-
也就是 **:commands** 关键字就创建了后面所接的命令的 **autoloads** 机制了
93+
也就是 `:commands` 关键字就创建了后面所接的命令的 `autoloads` 机制了
9494

9595

9696
### <span class="section-num">3.3</span> :bind :mode {#bind-mode}
9797

9898
```emacs-lisp
9999
(use-package hi-lock
100100
:bind (("M-o l" . highlight-lines-matching-regexp)
101-
("M-o r" . highlight-regexp)
102-
("M-o w" . highlight-phrase)))
101+
("M-o r" . highlight-regexp)
102+
("M-o w" . highlight-phrase)))
103103
104104
(use-package vue-mode
105105
:ensure t
106106
:mode ("\\.vue\\'" . vue-mode)
107107
:config (progn
108-
(setq mmm-submode-decoration-level 0)
109-
))
108+
(setq mmm-submode-decoration-level 0)
109+
))
110110
```
111111

112112
附上文档说明
113113

114114
> In almost all cases you don't need to manually specify :defer t. This is implied
115115
> whenever :bind or :mode or :interpreter is used
116116
117-
也就是说,当你使用了 **:bind** 或者 **:mode** 关键字的时候,不用明确指定 **:defer** 也可以实现延迟加载机制。
117+
也就是说,当你使用了 `:bind` 或者 `:mode` 关键字的时候,不用明确指定 `:defer` 也可以实现延迟加载机制。
118118

119-
当然你也可以,直接使用 **:defer** 关键字来指定延迟加载. 不过前提是,你要明确它加载的时机
119+
当然你也可以,直接使用 `:defer` 关键字来指定延迟加载. 不过前提是,你要明确它加载的时机
120120

121121
> Typically, you only need to specify :defer if you know for a fact that some
122122
> other package will do something to cause your package to load at the appropriate
@@ -130,11 +130,11 @@ Emacs lisp 有一项auto-load 的技术,类似延迟加载,合理运用延
130130
:defer t
131131
:ensure t
132132
:init(progn
133-
(add-hook 'python-mode-hook 'anaconda-mode)
134-
(add-hook 'python-mode-hook 'anaconda-eldoc-mode)
135-
))
133+
(add-hook 'python-mode-hook 'anaconda-mode)
134+
(add-hook 'python-mode-hook 'anaconda-eldoc-mode)
135+
))
136136
```
137137

138-
这样 **anaconda-mode** 就会在 **python-mode** 加载以后被加载
138+
这样 `anaconda-mode` 就会在 `python-mode` 加载以后被加载
139139

140-
Enjoy Emacs :)
140+
Enjoy Emacs :)

content/zh/post/2017/head_tail.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
+++
22
title = "Linux/Unix Shell 二三事之过滤器head+tail"
33
description = "An introduction about head and tail"
4-
date = 2017-02-22T00:00:00+08:00
5-
lastmod = 2022-02-23T19:51:45+08:00
4+
date = 2017-02-17T00:00:00-08:00
5+
lastmod = 2024-12-31T12:18:30-08:00
66
tags = ["shell", "linux", "command_line"]
77
categories = ["linux"]
88
draft = false
@@ -40,7 +40,7 @@ $ tail [-n line] data
4040

4141
你可能觉得 **head** **tail** 两个命令很简单,似乎用处不大。
4242

43-
是的,就笔者一直所介绍的那样,单个unix命令只是完成一个特定的工作,但是当它们组合起来的时候,就很威力无穷了
43+
是的,就我一直所介绍的那样,单个unix命令只是完成一个特定的工作,但是当它们组合起来的时候,就很威力无穷了
4444

4545

4646
### <span class="section-num">2.1</span> 场景1 {#场景1}
@@ -55,7 +55,7 @@ $ cat /dev/urandom | tr -cd "[[:alnum:]]" |head -c 32;echo
5555

5656
在Unix/Linux 的机器下,运行上面的命令就可以生成一个包含数字和字母的32个字符长的密钥了。
5757

58-
/dev/urandom 是一个可以通过收集硬件驱动的环境噪音来产生伪随机数特殊的文件,tr 是转换和删除字符的命令;更多详细的东西,以后笔者会慢慢介绍滴
58+
/dev/urandom 是一个可以通过收集硬件驱动的环境噪音来产生伪随机数特殊的文件,tr 是转换和删除字符的命令;更多详细的东西,以后我会慢慢介绍滴
5959

6060

6161
### <span class="section-num">2.2</span> 场景2 {#场景2}
@@ -94,4 +94,4 @@ cat >> something.log
9494
man head
9595
```
9696

97-
Enjoy Shell :)
97+
Enjoy Shell :)

content/zh/post/2017/percol.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
+++
22
title = "Linux/Unix Shell 二三事之神器percol"
33
description = "An introduction about percol"
4-
date = 2017-02-22T00:00:00+08:00
5-
lastmod = 2022-02-23T22:20:18+08:00
4+
date = 2017-02-13T00:00:00-08:00
5+
lastmod = 2024-12-31T12:18:10-08:00
66
tags = ["linux", "shell"]
77
categories = ["linux"]
88
draft = false
99
toc = true
1010
+++
1111

12-
[Percol](https://github.com/mooz/percol) 是Emacs 的一个非常优秀package:js2-mode作者mooz 的又一力作得益于Unix Shell的管道和重定向设计理念,percol 所有的输入输出变得可交互 percol 给我一种很熟悉的感觉,就是 Eamcs 中helm 增量补全 (incremental completion)的感觉,真的可以10倍提高工作效率。
12+
[Percol](https://github.com/mooz/percol) 是Emacs 的一个非常优秀package, js2-mode作者mooz 的又一力作得益于Unix Shell的管道和重定向设计理念,percol 所有的输入输出变得可交互 percol 给我一种很熟悉的感觉,就是 Eamcs 中helm 增量补全 (incremental completion)的感觉,真的可以10倍提高工作效率。
1313

1414

1515
## <span class="section-num">1</span> 例子 {#例子}
@@ -29,19 +29,19 @@ $ git checkout $(git branch|percol)
2929
```shell
3030
function ppgrep() {
3131
if [[ $1 == "" ]]; then
32-
PERCOL=percol
32+
PERCOL=percol
3333
else
34-
PERCOL="percol --query $1"
34+
PERCOL="percol --query $1"
3535
fi
3636
ps aux | eval $PERCOL | awk '{ print $2 }'
3737
}
3838

3939
function ppkill() {
4040
if [[ $1 =~ "^-" ]]; then
41-
QUERY="" # options only
41+
QUERY="" # options only
4242
else
43-
QUERY=$1 # with a query
44-
[[ $# > 0 ]] && shift
43+
QUERY=$1 # with a query
44+
[[ $# > 0 ]] && shift
4545
fi
4646
ppgrep $QUERY | xargs kill $*
4747
}
@@ -54,11 +54,11 @@ function exists { which $1 &> /dev/null }
5454

5555
if exists percol; then
5656
function percol_select_history() {
57-
local tac
58-
exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
59-
BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER")
60-
CURSOR=$#BUFFER # move cursor
61-
zle -R -c # refresh
57+
local tac
58+
exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
59+
BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER")
60+
CURSOR=$#BUFFER # move cursor
61+
zle -R -c # refresh
6262
}
6363

6464
zle -N percol_select_history
@@ -70,25 +70,27 @@ fi
7070
### <span class="section-num">1.1</span> 运行截图 {#运行截图}
7171
7272
[![](/ox-hugo/percol1.png)](/ox-hugo/percol1.png)
73-
有时候,我需要复制当前目录下,某个文件的路径,但是无论是文件管理器,还是shell都要用鼠标来复制指定文件的路径,效率不高且很不方便。在 [陈斌](http://blog.binchen.org/posts/how-to-use-git-effectively.html) 代码的启发下,我自己写了一个函数来复制当前文件夹某个特定目录的路径,很方便地解决了问题:
73+
有时候,我需要复制当前目录下,某个文件的路径,但是无论是文件管理器,还是shell都要用鼠标来复制指定文件的路径,效率不高且很不方便。
74+
75+
在 [陈斌](http://blog.binchen.org/posts/how-to-use-git-effectively.html) 代码的启发下,我自己写了一个函数来复制当前文件夹某个特定目录的路径,很方便地解决了问题:
7476
7577
```shell
7678
OS_NAME=`uname`
7779
function pclip() {
7880
if [ $OS_NAME = "CYGWIN" ]; then
79-
putclip "$@";
81+
putclip "$@";
8082
elif [ $OS_NAME = "Darwin" ]; then
81-
pbcopy "$@";
83+
pbcopy "$@";
8284
else
83-
if [ -x /usr/bin/xsel ]; then
84-
xsel -ib "$@";
85-
else
86-
if [ -x /usr/bin/xclip ]; then
87-
xclip -selection c "$@";
88-
else
89-
echo "Neither xsel or xclip is installed!"
90-
fi
91-
fi
85+
if [ -x /usr/bin/xsel ]; then
86+
xsel -ib "$@";
87+
else
88+
if [ -x /usr/bin/xclip ]; then
89+
xclip -selection c "$@";
90+
else
91+
echo "Neither xsel or xclip is installed!"
92+
fi
93+
fi
9294
fi
9395
}
9496

0 commit comments

Comments
 (0)