Emacs Lisp docstring 的 Onebox

https://whispering-beach-14031.herokuapp.com/append

链接格式为(最后一个单词为函数或变量名):

数据来源:

(concat doc-directory internal-doc-file-name)
;; => "/Users/xcy/src/emacs-mac/etc/DOC"

最近在学 Python,上午看了个 Flask 教程,想到以前的这个想法,花了一下午写了三十来行代码,花了一晚上部署,第一次尝试写 Web 应用,心里一点数都没有。

2 个赞

不考虑一下继续提升 Common Lisp 嘛?

Freenode 的 #lisp 还是很活跃的,讨论的质量很高,虽然整天都在研究怎么用 Lisp 实现操作系统(误),高于语言本身的算法和设计的讨论也是很多的。

你想说的是不是心里一点底都没有 :rofl:

主帖好像没说这个Onebox到底是怎么实现的。我看网页源码里有一些<meta .../>,是你把你的flask app放到herokuapp.com上,给文档文本加些meta输出,然后discourse就能显示Onebox了?

对,那些 meta 是 Open Graph 协议规定的,Discourse 的 Onebox 支持这个协议。

这个东西不错,论坛里引用出来。基于相同的资料讨论,省去很多口水。

是不是可以直接从 Emacs 读取 dostring:

$ emacs-nightly --batch --eval "(progn
> (describe-function 'append)
> (other-window 1)
> (princ (buffer-substring-no-properties (line-beginning-position 3) (point-max))))" 2> /dev/null
append is a built-in function in ‘C source code’.

(append &rest SEQUENCES)

Concatenate all the arguments and make the result a list.
The result is a list whose elements are the elements of all the arguments.
Each argument may be a list, vector or string.
The last argument is not copied, just used as the tail of the new list.

可以提供更多信息,例如, 是否 Interactive 函数,是 C 函数还是 Elisp 函数,函数自那个版本开始存在,不同 Emacs 版本之间的差异:

  • Emacs 25

    $ curl http://~/25/string-to-unibyte
    string-to-unibyte is a built-in function in ‘C source code’.
    
    (string-to-unibyte STRING)
    
    Return a unibyte string with the same individual chars as STRING.
    If STRING is unibyte, the result is STRING itself.
    Otherwise it is a newly created string, with no text properties,
    where each ‘eight-bit’ character is converted to the corresponding byte.
    If STRING contains a non-ASCII, non-‘eight-bit’ character,
    an error is signaled.
    
  • Emacs 27

    $ curl http://~/27/string-to-unibyte
    string-to-unibyte is a built-in function in ‘C source code’.
    
    (string-to-unibyte STRING)
    
    
    This function is obsolete since 26.1;
    use `encode-coding-string'.
    
    
    Return a unibyte string with the same individual chars as STRING.
    If STRING is unibyte, the result is STRING itself.
    Otherwise it is a newly created string, with no text properties,
    where each ‘eight-bit’ character is converted to the corresponding byte.
    If STRING contains a non-ASCII, non-‘eight-bit’ character,
    an error is signaled.