Emacs Lisp 中 Process 相關的玩意

這幾天在寫 hexo.el 遇到一些 Emacs Lisp 中 process 相關的處理方式,做個簡單的整理筆記(也順便試用 hexo.el )。不過有些因為目前我沒用過/用不到,所以也懶得去研究其中差異,不要打我。

Process

start-process (Async)

(start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)

這是 Emacs Lisp 中最低階的 process 呼叫方法之一,他 stdout 輸出的 BUFFER (fundamental-mode) 連 ANSI color 都沒有(所以會看到一堆亂七八糟的 ANSI color 控制字元),要自己使用 set-process-filter 來自訂 Buffer 的 IO。

Read More

[Django] String Labels in Site: Use Key-Value Pairs Model & Form

This article is to make a model used to save string label in site (e.g. site_title), like this:

1
2
3
class Label(models.Model):
key = models.CharField(max_length=32, primary_key=True)
value = models.CharField(max_length=128,blank=True, default='')

And, make a form like this to update it:

1
2
3
4
5
6
7
Site Configuration
site_title: ________________
site_subtitle: _________________
site_copyright_info: _________________
admin_email: _________________
admin_phone: _________________
[Save]

There are some package like jezdez/django-constance to do this task, but I would rather not to use too many 3rd part package in project. Though, I use django-crispy-forms.

Read More