gk-roam: 轻量的 roam 插件

org-roam对我来说太重了,在mac上折腾了两次没有搞定。于是,写了一个轻量级的 roam插件,设计逻辑参考 RoamResearch, 即在文档底部自动插入和更新 reference。Reference 包括 backlink 和 引用的上下文。

具体操作可以看下面的视频: demo1 demo2。欢迎大家试用,并给我提提建议。


更新

以上是旧版本的demo,最近的更新,界面更简洁,但基本函数的使用逻辑没有变。

7 个赞

好像不错 :+1:

1 个赞

谢谢!用一下就知道了,感觉超级实用的。主要是上手简单。

支持,希望能长期维护下去。

1 个赞

衡量类roam软件的好坏,在我看来有两个指标是最重要的:一是backlink;二是overview。backlink先不提,谈谈全局预览。对全部节点的预览的衡量标准(个人)有以下几点:

在新建笔记时能否快速找到与之相关的节点;

后续整理笔记时能否快速定位笔记;

回顾的时候能否有效激发灵感并快速建立链接和笔记。

看了lz的预览示范后,我感觉更像是一组带超链接的网页,这更适合用来发表博客(看到publish函数后这种感觉更强烈了)。网状结构笔记的overview最好能给使用者一个宏观、全局的角度来思考和整理自己的笔记。网状关系图在我看来是非常好的一个方法。

anyway,这是个人想法,仅供参考。

2 个赞

感谢建言!只是初步的想法,做了backlink,还没有考虑全局预览。可能是我对roam的思想领悟的还不够深刻,不太懂它是如何激发灵感的。

刚刚了解了 block references 和 block embeds 的概念。 看来我的理解还有欠缺,油管上找到了介绍 Roam Research的视频,打算学习一下然后完善功能。

Thanks to aaronbieber’s PR, now you can use gk-roam in Windows.

rx-form: Unknown rx form ‘anychar’ 应该是rx正则没有anychar定义,请问怎么处理?

你用的什么版本的emacs?rx是emacs自带的库。我用的27.1。

果然,我的是26.3 :sweat_smile:

manjaro当前为26.3,用emacs-git是28不稳定

你 C-h f “rx” 把文档贴给我看一下,我看看26.3里用的什么代替 anychar。

rx is an autoloaded Lisp macro in ‘rx.el’.

(rx &rest REGEXPS)

Translate regular expressions REGEXPS in sexp form to a regexp string. REGEXPS is a non-empty sequence of forms of the sort listed below.

Note that ‘rx’ is a Lisp macro; when used in a Lisp program being compiled, the translation is performed by the compiler. See ‘rx-to-string’ for how to do such a translation at run-time.

The following are valid subforms of regular expressions in sexp notation.

STRING matches string STRING literally.

CHAR matches character CHAR literally.

‘not-newline’, ‘nonl’ matches any character except a newline.

‘anything’ matches any character

‘(any SET …)’ ‘(in SET …)’ ‘(char SET …)’ matches any character in SET … SET may be a character or string. Ranges of characters can be specified as ‘A-Z’ in strings. Ranges may also be specified as conses like ‘(?A . ?Z)’.

 SET may also be the name of a character class: ‘digit’,
 ‘control’, ‘hex-digit’, ‘blank’, ‘graph’, ‘print’, ‘alnum’,
 ‘alpha’, ‘ascii’, ‘nonascii’, ‘lower’, ‘punct’, ‘space’, ‘upper’,
 ‘word’, or one of their synonyms.

‘(not (any SET …))’ matches any character not in SET …

‘line-start’, ‘bol’ matches the empty string, but only at the beginning of a line in the text being matched

‘line-end’, ‘eol’ is similar to ‘line-start’ but matches only at the end of a line

‘string-start’, ‘bos’, ‘bot’ matches the empty string, but only at the beginning of the string being matched against.

‘string-end’, ‘eos’, ‘eot’ matches the empty string, but only at the end of the string being matched against.

‘buffer-start’ matches the empty string, but only at the beginning of the buffer being matched against. Actually equivalent to ‘string-start’.

‘buffer-end’ matches the empty string, but only at the end of the buffer being matched against. Actually equivalent to ‘string-end’.

‘point’ matches the empty string, but only at point.

‘word-start’, ‘bow’ matches the empty string, but only at the beginning of a word.

‘word-end’, ‘eow’ matches the empty string, but only at the end of a word.

‘word-boundary’ matches the empty string, but only at the beginning or end of a word.

‘(not word-boundary)’ ‘not-word-boundary’ matches the empty string, but not at the beginning or end of a word.

‘symbol-start’ matches the empty string, but only at the beginning of a symbol.

‘symbol-end’ matches the empty string, but only at the end of a symbol.

‘digit’, ‘numeric’, ‘num’ matches 0 through 9.

‘control’, ‘cntrl’ matches ASCII control characters.

‘hex-digit’, ‘hex’, ‘xdigit’ matches 0 through 9, a through f and A through F.

‘blank’ matches horizontal whitespace, as defined by Annex C of the Unicode Technical Standard #18. In particular, it matches spaces, tabs, and other characters whose Unicode ‘general-category’ property indicates they are spacing separators.

‘graphic’, ‘graph’ matches graphic characters–everything except whitespace, ASCII and non-ASCII control characters, surrogates, and codepoints unassigned by Unicode.

‘printing’, ‘print’ matches whitespace and graphic characters.

‘alphanumeric’, ‘alnum’ matches alphabetic characters and digits. For multibyte characters, it matches characters whose Unicode ‘general-category’ property indicates they are alphabetic or decimal number characters.

‘letter’, ‘alphabetic’, ‘alpha’ matches alphabetic characters. For multibyte characters, it matches characters whose Unicode ‘general-category’ property indicates they are alphabetic characters.

‘ascii’ matches ASCII (unibyte) characters.

‘nonascii’ matches non-ASCII (multibyte) characters.

‘lower’, ‘lower-case’ matches anything lower-case, as determined by the current case table. If ‘case-fold-search’ is non-nil, this also matches any upper-case letter.

‘upper’, ‘upper-case’ matches anything upper-case, as determined by the current case table. If ‘case-fold-search’ is non-nil, this also matches any lower-case letter.

‘punctuation’, ‘punct’ matches punctuation. (But at present, for multibyte characters, it matches anything that has non-word syntax.)

‘space’, ‘whitespace’, ‘white’ matches anything that has whitespace syntax.

‘word’, ‘wordchar’ matches anything that has word syntax.

‘not-wordchar’ matches anything that has non-word syntax.

‘(syntax SYNTAX)’ matches a character with syntax SYNTAX. SYNTAX must be one of the following symbols, or a symbol corresponding to the syntax character, e.g. ‘.’ for ‘\s.’.

 ‘whitespace’		(\s- in string notation)
 ‘punctuation’		(\s.)
 ‘word’			(\sw)
 ‘symbol’			(\s_)
 ‘open-parenthesis’		(\s()
 ‘close-parenthesis’	(\s))
 ‘expression-prefix’	(\s’)
 ‘string-quote’		(\s")
 ‘paired-delimiter’		(\s$)
 ‘escape’			(\s\)
 ‘character-quote’		(\s/)
 ‘comment-start’		(\s<)
 ‘comment-end’		(\s>)
 ‘string-delimiter’		(\s|)
 ‘comment-delimiter’	(\s!)

‘(not (syntax SYNTAX))’ matches a character that doesn’t have syntax SYNTAX.

‘(category CATEGORY)’ matches a character with category CATEGORY. CATEGORY must be either a character to use for C, or one of the following symbols.

 ‘consonant’			(\c0 in string notation)
 ‘base-vowel’			(\c1)
 ‘upper-diacritical-mark’		(\c2)
 ‘lower-diacritical-mark’		(\c3)
 ‘tone-mark’		        (\c4)
 ‘symbol’			        (\c5)
 ‘digit’			        (\c6)
 ‘vowel-modifying-diacritical-mark’	(\c7)
 ‘vowel-sign’			(\c8)
 ‘semivowel-lower’			(\c9)
 ‘not-at-end-of-line’		(\c<)
 ‘not-at-beginning-of-line’		(\c>)
 ‘alpha-numeric-two-byte’		(\cA)
 ‘chinese-two-byte’			(\cC)
 ‘greek-two-byte’			(\cG)
 ‘japanese-hiragana-two-byte’	(\cH)
 ‘indian-two-byte’			(\cI)
 ‘japanese-katakana-two-byte’	(\cK)
 ‘korean-hangul-two-byte’		(\cN)
 ‘cyrillic-two-byte’		(\cY)
 ‘combining-diacritic’		(\c^)
 ‘ascii’				(\ca)
 ‘arabic’				(\cb)
 ‘chinese’				(\cc)
 ‘ethiopic’				(\ce)
 ‘greek’				(\cg)
 ‘korean’				(\ch)
 ‘indian’				(\ci)
 ‘japanese’				(\cj)
 ‘japanese-katakana’		(\ck)
 ‘latin’				(\cl)
 ‘lao’				(\co)
 ‘tibetan’				(\cq)
 ‘japanese-roman’			(\cr)
 ‘thai’				(\ct)
 ‘vietnamese’			(\cv)
 ‘hebrew’				(\cw)
 ‘cyrillic’				(\cy)
 ‘can-break’			(\c|)

‘(not (category CATEGORY))’ matches a character that doesn’t have category CATEGORY.

‘(and SEXP1 SEXP2 …)’ ‘(: SEXP1 SEXP2 …)’ ‘(seq SEXP1 SEXP2 …)’ ‘(sequence SEXP1 SEXP2 …)’ matches what SEXP1 matches, followed by what SEXP2 matches, etc.

‘(submatch SEXP1 SEXP2 …)’ ‘(group SEXP1 SEXP2 …)’ like ‘and’, but makes the match accessible with ‘match-end’, ‘match-beginning’, and ‘match-string’.

‘(submatch-n N SEXP1 SEXP2 …)’ ‘(group-n N SEXP1 SEXP2 …)’ like ‘group’, but make it an explicitly-numbered group with group number N.

‘(or SEXP1 SEXP2 …)’ ‘(| SEXP1 SEXP2 …)’ matches anything that matches SEXP1 or SEXP2, etc. If all args are strings, use ‘regexp-opt’ to optimize the resulting regular expression.

‘(minimal-match SEXP)’ produce a non-greedy regexp for SEXP. Normally, regexps matching zero or more occurrences of something are “greedy” in that they match as much as they can, as long as the overall regexp can still match. A non-greedy regexp matches as little as possible.

‘(maximal-match SEXP)’ produce a greedy regexp for SEXP. This is the default.

Below, ‘SEXP …’ represents a sequence of regexp forms, treated as if enclosed in ‘(and …)’.

‘(zero-or-more SEXP …)’ ‘(0+ SEXP …)’ matches zero or more occurrences of what SEXP … matches.

‘(* SEXP …)’ like ‘zero-or-more’, but always produces a greedy regexp, independent of ‘rx-greedy-flag’.

‘(*? SEXP …)’ like ‘zero-or-more’, but always produces a non-greedy regexp, independent of ‘rx-greedy-flag’.

‘(one-or-more SEXP …)’ ‘(1+ SEXP …)’ matches one or more occurrences of SEXP …

‘(+ SEXP …)’ like ‘one-or-more’, but always produces a greedy regexp.

‘(+? SEXP …)’ like ‘one-or-more’, but always produces a non-greedy regexp.

‘(zero-or-one SEXP …)’ ‘(optional SEXP …)’ ‘(opt SEXP …)’ matches zero or one occurrences of A.

‘(? SEXP …)’ like ‘zero-or-one’, but always produces a greedy regexp.

‘(?? SEXP …)’ like ‘zero-or-one’, but always produces a non-greedy regexp.

‘(repeat N SEXP)’ ‘(= N SEXP …)’ matches N occurrences.

‘(>= N SEXP …)’ matches N or more occurrences.

‘(repeat N M SEXP)’ ‘(** N M SEXP …)’ matches N to M occurrences.

‘(backref N)’ matches what was matched previously by submatch N.

‘(eval FORM)’ evaluate FORM and insert result. If result is a string, ‘regexp-quote’ it.

‘(regexp REGEXP)’ include REGEXP in string notation in the result.

好的,我晚点改一下。

谢谢!!!!总体感觉比org-roam清晰,更符合我的思维习惯。期待中

发现另一处问题: 如果再headline中使用链接。Linked Reference就会混乱。

是的,目前还不支持headline,文档里有写。

1 个赞

最近的更新里没有使用 anychar了。

更新 20200911

  1. 修改page的文件名为日期数字串,去掉title。文件名只用于标识page。
  2. 新增 gk-roam-daily,快速打开当天的daily notes page。
  3. 修改page link的格式为 {[title]} ,新增hashtag格式为 #{[title]} 。
  4. 输入brackets 或 hashtag后,可以自动补全page名称。

注意

  1. 最新的master分支因为使用了特殊格式的 brackts link和hashtag,所以发布为html时链接不能正常解析,需要转化为org link。(待解决)
  2. 最新的更新由于改变了文件名的格式和链接格式,所以使用旧版的童鞋要手动改一下文件名和删掉以往的链接,重新插入。

图片

1 个赞