emacs-china / EGO

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

Symbol's value as variable is void: k #87

Open zhcosin opened 7 years ago

zhcosin commented 7 years ago

I am trying ego, but when I execute ego-do-publication, the error "Symbol's value as variable is void: k" is occur. My system is ubuntu 12.04, emacs 24.5 and my configure as follow:

(require 'subr-x)
(require 'ego)

(ego-add-to-alist 'ego-project-config-alist
               `(("zhcosin.github.io" ; 站点工程的名字
                 :repository-directory "~/zhcosin.github.io" ; 站点的本地目录
                 :site-domain "http://zhcosin.github.io/" ; 站点的网址
                 :site-main-title "南下北上" ; 站点的标题
                 :site-sub-title "=============>从工具的奴隶到工具的主人" ; 站点的副标题
                 :theme (default) ; 使用的主题
                 :summary (("years" :year :updates 10) ("authors" :authors) ("tags" :tags)) ; 导航栏的设置,有 category 和 summary 两种
                 :source-browse-url ("Github" "https://github.com/zhcosin.github.io") ; 你的工程源代码所在的位置
                 ;;:personal-disqus-shortname "emacs-china" ; 使用 disqus 评论功能的话,它的短名称
                 ;;:personal-duoshuo-shortname "emacs-china" ; 使用 多说 评论功能的话,它的短名称
                 ;;:confound-email nil ; 是否保护邮件名称呢?t 是保护,nil 是不保护,默认是保护
                 :ignore-file-name-regexp "readme.org" ; 有些不想发布成 html 的 org 文件(但是又想被导入 git 进行管理),可以用这种正则表达的方式排除
                 :web-server-docroot "~/webRoot/zhcosin.github.io" ; 本地测试的目录
                 :web-server-port 5432); 本地测试的端口

                 ;; 你可以在此添加更多的站点设置
               ))

(provide 'init-ego)
kuangdash commented 7 years ago

In EGO, the symbol 'k' is only used at the following place:

(do ((k summary-alist (cdr k))
       (result-k nil (append (cdr (car k)) result-k)))
       ((equal k nil) result-k))

It's a do loop, and I don't find there is any problem, maybe you type 'k' into the source code by accident?

zhcosin commented 7 years ago

My configure is show in bellow and the output of grep in ego is as fllow:

zhcosin@zhcosin-ubuntu2:~/.emacs.d/elpa/ego-20160909.937$ grep -nH '[^a-zA-Z]k[^a-zA-Z]' *.el
ego-export.el:619:                            (sort (do ((k summary-alist (cdr k))
ego-export.el:620:                                       (result-k nil (append (cdr (car k)) result-k)))
ego-export.el:621:                                      ((equal k nil) result-k))

and I use toggle-debug-on-error, then the error information as fllow:

Debugger entered--Lisp error: (void-variable k)
  ego--update-summary(((:title "梅子黄时日日晴" :date "2016-09-12" :mod-date "2016-09-12" :description "<Add description here>" :thumb nil :tags ("tag1" "tag2" "tag3") :year "2016" :authors ("zhcosin") :category "math" :uri "/math/梅子黄时日日晴/" :pub-dir "~/.ego-tmp/math/梅子黄时日日晴/")) "~/.ego-tmp/" "years")
  #[(name) "\303   \n#\207" [file-attr-list pub-root-dir name ego--update-summary] 4]("years")
  mapc(#[(name) "\303  \n#\207" [file-attr-list pub-root-dir name ego--update-summary] 4] ("years" "authors" "tags"))
  ego--publish-changes(("/home/zhcosin/zhcosin.github.io/math/2016-09-12-1.org") nil (:update ("/home/zhcosin/zhcosin.github.io/math/2016-09-12-1.org") :delete nil) "~/.ego-tmp/")
  ego-do-publication("zhcosin.github.io" t nil "HEAD~1" "dssgs" nil)
  call-interactively(ego-do-publication record nil)
  command-execute(ego-do-publication record)
  helm-M-x(nil #("ego-do-publication" 0 18 (match-part "ego-do-publication")))
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)
kuangdash commented 7 years ago

Sorry, I can't repeat your result.

I tried many different data types in summary-alist at the following codes:

(do ((k summary-alist (cdr k))
       (result-k nil (append (cdr (car k)) result-k)))
       ((equal k nil) result-k))

But (void-variable k) warning won't happen.

And I use your configure to build new repository with no problem. That's strange.

So leave it here, maybe others can help.

zhcosin commented 7 years ago

I found the error has occur when I pass a function as a parameter for the other function, so I had to use the keyword 'funcall'. I guess it's the maybe reason, maybe the do-for-each-in-list syntax is provider by some dependency package which not in my emacs.