emacs-china / EGO

EGO is a static site generator that depends on Emacs, Git and Org-mode.
94 stars 11 forks source link

ego--current-project-name和ego--last-project-name分别有什么作用? #94

Closed lujun9972 closed 7 years ago

lujun9972 commented 7 years ago

为什么ego-test-current-page,ego-test-current-page设置ego--current-project-name为新project-name后没有再设回nil 而ego-new-post和ego-do-publication里面设置ego--current-project-name为新project-name后要再设回nil?

lujun9972 commented 7 years ago

另外,ego-do-publication里有这么一段

(if (and (ignore-errors (symbol-value 'ego--last-project-name))
           (not (equal ego--current-project-name ego--last-project-name)))
  (setq ego--publish-without-org-to-html nil))

这是什么意思?这段逻辑我看不懂

kuangdash commented 7 years ago

其实本来是不必设成 nil 的,但是 ego-new-post 和 ego-do-publication 那块的这部分代码非我所加,故而我也没动(出于安全考虑)。

那个 ignore-errors 是为了防止一开始使用 ego 的时候不存在 ego--last-project-name 这个变量而设的。如果在这里将它设为 nil 的话,就无法利用之前 org 转 html 的文件了(那些暂存在 .ego-tmp 的文件)。

其实读到这里你也该了解为啥要弄 ego 2.0 了……已经是重新设计比修补的成本低的情况了……

lujun9972 commented 7 years ago

所以你这一段的意思是如果上一次已经发布这个项目,发布不同项目时就重新再将org转成html一次? 那为什么不判断相等的时候,把这个值再重新设置成t?

lujun9972 commented 7 years ago

所以我觉得,搞出ego--current-project-name和ego--last-project-name这两个变量没什么意义啊,就为了这里比较一下给ego--publish-without-org-to-html赋一下值而已?

kuangdash commented 7 years ago

相等是常态啊,不等的时候就需要变化了。有更简单的处理办法么?我觉得那个 pull-request 更复杂了…

lujun9972 commented 7 years ago

有两个问题 1.如果先不等再相等,不用把状态改回来吗? 2.为什么只有do-publish的时候判断,其他导出函数里不判断?

kuangdash commented 7 years ago

状态改回来的话,问题多多。只有do-publish 的时候需要判断。

lujun9972 commented 7 years ago

状态改回来会有什么问题?

lujun9972 commented 7 years ago

为什么只有do-publish的时候需要判断呢?

kuangdash commented 7 years ago

如果说“状态改回来”的“状态”是 ego--publish-without-org-to-html,那么这个变量会在后面被改回来。 #95 里把 ego--last-project-name 去掉这事从减少变量的方面来看是正确的,不过这个变量名意义很明确啊…

只有 do-publish 的时候有增量发布功能,进而需要 ego--publish-without-org-to-html 变量。

这个 issue 我关掉啦,现在关注点应该放在 ego 2.0 上…