I'm trying to install lua-mode (version 20110428) for emacs 21.4.1 and am having problems. In my .emacs file I've got:
(add-to-list 'load-path "~/.emacs.d/lua-mode/")
...
(setq auto-mode-alist (cons '("\\.lua$" . lua-mode) auto-mode-alist))
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
I used the installation instructions from here: http://lua-mode.luaforge.net/ Also, in my .emacs.d/ dir I have lua-mode/ which contains lua-mode.el. All of those files have the correct permissions.
Except now when I use emacs to open the new file "test.lua" I get the following message in the scratch buffer:
"File mode specification error: (void-function called-interactively-p)"
I'm running RHEL5. I've looked online but haven't found much help. Does anyone have any suggestions? I don't know any LISP (so it's hard to debug lua-mode.el) and apart from a handful of shortcuts, I don't know that much about emacs.
Thanks.
You are using a version of Emacs that doesn't have the version of the "called-interactively-p" function that takes 1 argument (earlier versions of the function didn't take an argument). You can get around this by putting this workaround (posted here: http://paste.lisp.org/display/115598/raw ) in your Emacs init file:
(condition-case nil (called-interactively-p 'interactive)
(error
; Save reference to called-interactively-p in
; inglorion-system-called-interactively-p
(fset 'inglorion-system-called-interactively-p
(symbol-function 'called-interactively-p))
; Define called-interactively-p so that it discards
; its arguments and calls inglorion-system-called-interactively-p
(fset 'called-interactively-p
(lambda (&rest args)
(inglorion-system-called-interactively-p)))))
However, when I did this and attempted to test with Emacs 22, I encountered other errors as well due to certain functions not being present so you may have to upgrade your version of Emacs if you want to use lua-mode.
With Emacs 23 & 24, "lua-mode.el" seems to work (I'm not a lua programmer so I couldn't test it properly) with existing lua files but breaks when you attempt to create a new lua file. It's actually a bug in the "lua-mode.el" code that occurs when you try to open a new lua file (it doesn't occur if you attempt to open an existing lua file). The problem is that the "remove-text-properties" call at line# 1218 (in the "lua-unmark-multiline-literals" function) is calling the "remove-text-properties" function with a begin value of "1" and an end value of "0" (it's "0" because the buffer-size is "0" for a new file. You can fix this by changing line# 1218 from:
(remove-text-properties (or begin 1) (or end (buffer-size)) '(syntax-table ()))
to:
(remove-text-properties (or begin 1)
(or end
(if (> (buffer-size) 0)
(buffer-size)
(or begin 1)))
'(syntax-table ()))
You should let the developer of "lua-mode.el" know about the bug and possibly also request support for earlier Emacs versions.
I happen to be the maintainer of lua-mode. I was lucky to stumble upon your problem when surfing on the internet and I the problem was solved after someone generously provided a backup implementation of called-interactively-p
function.
Meanwhile, I must admit I was well aware that called-interactively
logics were changed somewhere before emacs23, but I didn't bother changing it until someone would have filed it as a bug. This is merely an effort optimization since there've been numerous internal API changes in Emacs recently and fixing them preemptively simply doesn't fit into my timetable.
The bottomline is that:
Cheers, immerrr.
I think the function `called-interactively-p' just did not exist in Emacs 21.4.
But actually, I think you are talking about XEmacs, not GNU Emacs. Note that these are 2 different projects.
You should upgrade your XEmacs to 21.5 beta, or better (YMMV), use GNU Emacs 23 probably.
I had this problem as well. I was able to fix it by changing it to say:
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
I can't claim to know why this makes a difference: I extrapolated from some other logic to load javascript mode which used a similar syntax to describe the file extension.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.