开发者

using emacs-mode.el to execute with arguments

I'm writing a script that takes arguments, and I'd like to use emacs-model.el's C-c C-c to execute it while I'm writing it. But this merely runs the script without arguments, which then causes my script to complain.

Is there an elegant way around this? My current solution is开发者_StackOverflow中文版 to hardcode the arguments.


C-c C-c isn't the right command to run your Python script. It will send your current buffer to the Python interpreter, just as though you had entered it there manually. If you used the recommended if __name__ == '__main__': line in your script, it won't run there anyway.

A better way is the command "shell-command", bound to M-!. You can enter the shell command to run your script in the minibuffer, and recall it the next time with M-p. See more details with C-h k M-!.


You could use M-: then at the prompt (my-func arg1 arg2)

Or you could put (my-func arg1 arg2) in the buffer somewhere near the function and C-x C-e at the end of it.


reported as a bug at https://bugs.launchpad.net/python-mode/+bug/1027679

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜