我一个菜鸟的心愿

A tag code in file name based knowledge management system

I am using org files to keep notes with

As time goes by, the file is getting bigger and bigger, which bring a lot of duplication, also makes auto save and backup files big and cause a lot more extra disk io, not good for the hard drive. :slight_smile:

So I am thinking about a purely simple tag base system:

  1. a tag datafile: (tag . value), tag is a string without blank characters, value is a numeric value, eg. ((linux . 10) (debian . 2) (emacs . 3))
  2. a notes folder: note file name is the joined string of tag values sort in ascending order, eg. a note with both linux and debian tag should be named 2-10, just plain org files without the .org extension

The search operation is simple too:

  1. a search tag function: search tag datafile with keywords separated by space to find all the matched values, each single tag uses fuzzy matching, eg. search for “dbian linx” will retrun files match the glob pattern *2*10* , but the file name list is converted to tag names like “1. debian linux 2. debian emacs linux”, you can select the file to open with number, or you can goto 2.
  2. open them all in a temp buffer with all files inserted using GitHub - whacked/transclusion-minor-mode: emacs minor mode for org-mode file transclusion using embedded overlays , the nice thing is you can view all of them in one buffer, and maybe cut and paste from one file to another

The tag manipulation is very simple:

  1. Delete a tag: remove the tag from the datafile, replace the tag value from all notes files names, move file name the same as tag value to trash and warn the user. save the tag value to a file named available-tag-values.
  2. Add a new tag: search the tag datafile if no match, create a new tag value and associate to the tag name, the value in available-tag-values will used first.
  3. Add a tag to the current note: rename it to a name include the tag value
  4. rename a tag: just rename it in the tag datafile.

This will break big notes files into smaller ones and does not affect the viewing thanks to org translusion. However, I only have a very limited knowledge of emacs. I am looking forward to hear your opinion and on how to bring the feature to this repo. Thank you!

ref: “Feature request: A tag code in file name based knowledge management system · Issue #69 · jrblevin/deft · GitHub

Feature request: A tag code in file name based knowledge management system · Issue #22 · EFLS/zetteldeft · GitHub

Feature request: A tag code in file name based knowledge management system · Issue #8 · abo-abo/plain-org-wiki · GitHub

Feature request: A tag code in file name based knowledge management system · Issue #27 · caiorss/org-wiki · GitHub

1 个赞

所以org本身就可以用#+INCLUDE来管理被分割开的内容啊

很好 你的目标很明确

但是 我觉得

你需要 sqlite3 而不是 emacs

1 个赞

大伙英文都这么好吗?我这费劲看半天才看明白

[quote=“QiangF, post:1, topic:10395”] note file name is the joined string of tag values sort in ascending order, [/quote] 你是要tag 文件么 后面tag变了 文件名也要改不是

tag如果只是改名了,文件名不需要改啊。tag删除了文件名就要改了。

那个translusion mode好像比include好点。

嗯 差不多有那个意思,我只是觉得笔记文件大了重复的内容不好清理。

用git其实也不错

有一个问题

tag的数据结构

是一个set 还是一个list 如何让他成为一个图 或是一棵树

还有一个问题

你怎么处理引用呢?

如何查看一段文字被其它文字所引用

http://xanadu.net/

上世纪最大 vaporware。

然而我觉得他们的实现方法不太靠谱

这个是不是靠谱点 GitHub - leo-editor/leo-editor: Leo is an Outliner, Editor, IDE and PIM written in 100% Python.

这个想法的本意是用很多小文件代替大文件,最好的应用实现我觉得应该是这个 https://leoeditor.com/tutorial-pim.html#clones

也许应该用 leo Leo and Emacs, including org mode — Leo 6.7.1 documentation

那个不错 还有一个uve的版本 可以在浏览器上查看

用python写的 可以随便改 只是pymacs已经很久没有更新了

我已经放弃了使用org作为收集知识的工具

一是因为需emcas才能打开 虽说有类似Orgzly的App 但显示效果觉得不是很好 编辑功能也觉得不好

二是因为需要整理(虽说不整理就不能变成自己的 但是 我真的整理了 他也没有变成我的呀)

三是因为我只能使用终端里的emacs 连个简单的文字大小也不能调节 更别说看图片了

四是因为我喜欢上了浏览器 虽说没有编辑的能力 但是预览的效果是超好的 用js代码给html加上折叠功能我已经实现了 搜索的话应该也不是很难(js的潜力真的很大)

2 个赞

能否分享一下浏览器里的方案?

只是简单的隐藏与显示

function is_node(node_name){
  return function(i){
    return node_name === i;
  }
}

function is_h2_h3(node){
   var ar = ["H2","H3","HR"];
   return ar.some(is_node(node.nodeName));
}

function is_h2_h3_h4(node){
   var ar = ["H2","H3","H4","HR"];
   return ar.some(is_node(node.nodeName));
}

function hide_node(node){
  $(node).css("display","none");
  $(node).removeClass("show");
  $(node).addClass("hide");
}

function show_node(node){
  $(node).css("display","block");
  $(node).removeClass("hide");
  $(node).addClass("show");
}

function hide(jq,pre){
  var subs = jq.nextAll();
  jq.removeClass("show");jq.addClass("hide");
  for(var i = 0; i< subs.length ;i++){
      if (pre(subs[i])){
	  return;
      }else{
	  hide_node(subs[i]);
      }
  }
}
function show(jq,pre){
  var subs = jq.nextAll();
  jq.removeClass("hide");jq.addClass("show");
  for(var i = 0; i< subs.length ;i++){
    if (pre(subs[i])){
      return;
    }else{
      show_node(subs[i]);
    }
  } 
}

function toggle(){
   var jq = $(this);
   if (jq.attr("class").indexOf("hide") >=0 ){
       show(jq,is_h2_h3);
   }else{
       hide(jq,is_h2_h3);
   }
}
function hideall(all){
  for(var i = 0; i< all.length;i++){
    hide($(all[i]) , is_h2_h3);
  }
}

function toggle_h4(){
  var jq = $(this);
  if (jq.attr("class").indexOf("hide") >=0 ){
     show(jq,is_h2_h3_h4);
  }else{
     hide(jq,is_h2_h3_h4);
  }
}

function  add_clicks(){
   $("h2").click(toggle);
   $("h3").click(toggle);
   $("h4").click(toggle_h4);
}
function  hides(){
   hideall($("h2"));
   hideall($("h3"));
}

$(document).ready(function(){
    add_clicks();
    var hash = window.location.hash;
    if(!hash){hides();}
});

1 个赞

我发现了浏览器的另一个好处

可能是因为自己有点强迫症 想要记住任何的细节 但又想改变原有的内容

这个矛盾在浏览器里只用几个css样式就可以解决了

比如说 我可以将原有的一大段文字设置为 span class=“removed”

还可以将我的笔记设置为 span class=“my-note ocaml”

显示及隐藏这些内容都是非常方便的

跑题了 上面代码的效果如下

未隐藏之前的

隐藏之后的