错误的类型参数:stringp,nil [英] wrong type argument: stringp, nil
问题描述
(defun jarl-get- pom()
(concat(locate-dominating-file
(buffer-file-name
(current-buffer))
pom.xml)
pom.xml))
(defun jarl-visit-pom()
(interactive)
(find-file(jarl-get-pom)))
(defun jarl-mvn-exec()
(interactive)
(switch-to-buffer(get-buffer-createmaven))
(start-process -shell命令mvn-execmavenmvn-f(jarl-get-pom)compile)
(start-process-shell-commandmvn-execmaven mvn-f(jarl-get-pom)exec:exec))
您需要提供更多信息才能确定。尝试设置
(setq debug-on-error t)
这将给你一个堆栈跟踪,显示什么功能是抱怨字符串为nil。
我的猜测是 Before now I've just been cutting and pasting code into my .emacs file, but then I decided to add some maven functionality to emacs. Now, I don't see how I was able to mess this up, but last night I kept getting the error I put in the title when I run M-x jarl-mvn-exec. I slept on it, and came back the next day but I'm still not getting anywhere.
You'll need to provide more information to be sure. Try setting which will give you a stack trace showing what function is complaining about the string being nil. My guess is that 这篇关于错误的类型参数:stringp,nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! buffer-file-name
正在返回nil,这就是问题所在(不是所有缓冲区都有文件名)。查看调试部分://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/> Emacs Lisp中的编程介绍,或 (defun jarl-get-pom ()
(concat (locate-dominating-file
(buffer-file-name
(current-buffer))
"pom.xml")
"pom.xml"))
(defun jarl-visit-pom ()
(interactive)
(find-file (jarl-get-pom)))
(defun jarl-mvn-exec ()
(interactive)
(switch-to-buffer (get-buffer-create "maven"))
(start-process-shell-command "mvn-exec" "maven" "mvn" "-f" (jarl-get-pom) "compile")
(start-process-shell-command "mvn-exec" "maven" "mvn" "-f" (jarl-get-pom) "exec:exec"))
(setq debug-on-error t)
buffer-file-name
is returning nil, and that's where the problem lies (not all buffers have file names). Check out the debugging section of An Introduction To Programming in Emacs Lisp, or the debugging section of the Emacs Lisp manual.