每次 Emacs 启动时赋诗一首

这个还没来得及写,等过年吧

facbeook-stickers-1

强烈赞成!并期待中。。。

我的配置文档已经绵绵无绝期了。但前段时间给company-mode传一个简短的bug fix,还是被“吐槽”的一踏糊涂

http://www.gotlisp.com/lambda/lambda.txt

每次启动 Emacs 讲一個关于 Lisp 的笑話

1 个赞

刚刚更新了 变量设置的一些内容,也许有用

你不会步入田春的后尘吧? 成为一个lisp历史学家?

1 个赞

晚了,我已經是了⋯⋯不過我对其他完全不同于 Lisp 的语言也有兴趣。

2 个赞

其实我对这一块也挺感兴趣的:joy:

我在zsh里是这么用的, 多谢 我抄下来了

我也有个启动赋诗 :grinning: 用的今日诗词接口,分享下

(defvar poem-file "~/.emacs.d/.poem.json")
(defvar poem-cache nil)

(defun poem-update ()
  "Download poem from `jinrishici.com`"
  (let ((url-request-extra-headers
	 '(("X-User-Token" . "======今日诗词网站申请的token======"))))
    (ignore-errors
      (url-retrieve
       "https://v2.jinrishici.com/sentence"
       (lambda (status)
	 (write-region url-http-end-of-headers (point-max) poem-file)))))
  (setq poem-cache nil))

(defun poem-get (prop)
  "Get poem from cache file, PROP can be 'content, 'origin"
  (ignore-errors
    (if poem-cache
        (alist-get prop poem-cache)
      (with-temp-buffer
        (insert-file-contents poem-file)
        (let ((data (alist-get 'data (json-read))))
          (setq poem-cache data)
          (alist-get prop data))))))

(defun poem-get-formatted ()
  (let* ((poem (poem-get 'origin))
         (lines (alist-get 'content poem))
         (content (mapconcat #'identity lines "\n")))
    (format "%s\n%s · %s\n%s"
            (alist-get 'title poem)
            (alist-get 'dynasty poem)
            (alist-get 'author poem)
            content)))

然后放到dashboard上,就可以按g刷新了(刷新好像还有bug :bug:

(advice-add #'dashboard-refresh-buffer :after #'poem-update)

(defun dashboard-poem (list-size)
   (insert (poem-get-formatted)))
(add-to-list 'dashboard-item-generators '(poem . dashboard-poem))

连标题栏都是诗

(setq frame-title-format '(multiple-frames "%e" (:eval (poem-get 'content))))

顺便看了下,我今天的标题栏是 君子死知己,提剑出燕京 :rofl:

3 个赞

emacser遇到的最悲哀的事情就是想象力慢慢的失去了。。。。

1 个赞