错误的类型参数:stringp,nil [英] wrong type argument: stringp, nil

查看:1132
本文介绍了错误的类型参数:stringp,nil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我刚刚将代码剪切并粘贴到.emacs文件中,但是我决定为emacs添加一些maven功能。现在,我看不到我怎么能搞定这个问题,但是昨天晚上,当我运行M-x jarl-mvn-exec时,我一直在收到错误。我睡着了,第二天回来了,但我还没到任何地方。

 (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。



我的猜测是 buffer-file-name 正在返回nil,这就是问题所在(不是所有缓冲区都有文件名)。查看调试部分://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/> Emacs Lisp中的编程介绍,或

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.

(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"))

You'll need to provide more information to be sure. Try setting

(setq debug-on-error t)

which will give you a stack trace showing what function is complaining about the string being nil.

My guess is that 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.

这篇关于错误的类型参数:stringp,nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆