Emacs lua-mode (File mode specification error) - emacs

I get the following error
File mode specification error: (error "Unknown rx form `group-n'")
when I try to edit a .lua file in emacs. I use GNU Emacs 23.3.1, and I have the following in my .emacs file:
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
I installed lua-mode from http://immerrr.github.com/lua-mode/.
I have tried to run emacs with the --debug-init option, but it did not enter the debugger, instead the .lua file opens in text-mode and not lua-mode..
(See also Emacs lua-mode issue: (void-function interactively-called-p))

Your Emacs is complaining because it knows nothing about group-n symbol used in rx macro in one of the recent commits, and that is probably because that symbol was only introduced in Emacs 24.2 and your one is a bit older.
I must admit, when coding that I thought that rx package was much more mature and didn't even bother looking up its changes in Emacs news. So, there are two options here:
either you update your Emacs to 24.2
or you could downgrade to older revision and wait while I have the chance to rewrite that piece of code.
UPD: the issue is fixed in upstream, the code is compatible with Emacs23 again.

Related

emacs cannot load file highlight-current-line file-error

Emacs version : GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
of 2013-03-18 on MARVIN
Copied the code for highlight-current-line from here. Created a text-file in .emacs.d, pasted the entire text on page in the text-file and saved it as highlight-current-line.el in the same folder.
Added the following lines to .emacs :
(add-to-list 'load-path "~/.emacs.d/")
(require 'highlight-current-line)
(global-hl-line-mode t)
(set-face-background 'hl-line "white")
(setq highlight-current-line-globally t)
Restarted emacs and got this message :
Warning (initialization): An error occurred while loading
`c:/Users/Owner/AppData/Roaming/.emacs':
File error: Cannot open load file, highlight-current-line
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with the
`--debug-init' option to view a complete error backtrace.
Started emacs in debug mode and got this error in backtrace:
Debugger entered--Lisp error: (file-error "Cannot open load file"
"highlight-current-line") require(highlight-current-line)
eval-buffer(# nil
"c:/Users/Owner/AppData/Roaming/.emacs" nil t) ; Reading at buffer
position 1209
load-with-code-conversion("c:/Users/Owner/AppData/Roaming/.emacs"
"c:/Users/Owner/AppData/Roaming/.emacs" t t) load("~/.emacs" t t)
My system : Windows 7 32bit
Once upon a time it made sense to copy snippets from EmacsWiki into your configuration, but between new high-quality built-in features and third-party package repositories like MELPA that is rarely the case anymore.
Your version of Emacs should be new enough to include hl-line.el, which contains a some useful functions:
To make the cursor even more visible, you can use HL Line mode, a minor mode that highlights the line containing point. Use M-x hl-line-mode to enable or disable it in the current buffer. M-x global-hl-line-mode enables or disables the same mode globally.
To enable highlighting of the current line globally, simply add
(global-hl-line-mode)
to your init file.
Edit: Upon re-reading your question, I see that you are already using hl-line.el, though this is interspersed with things relating to highlight-current-line.el. I recommend removing the following lines from your configuration:
(add-to-list 'load-path "~/.emacs.d/") ;; Unless you need it for another reason
(require 'highlight-current-line)
(setq highlight-current-line-globally t)
You can additionally remove the t from you call to (global-hl-line-mode), since this function turns the feature on when called from lisp.
Turns out copying text into notepad, saving it with .el in the file name and All files in the file type simply saves the file as highlight-current-line.el.txt .
I used the Save link as option in the dropdown menu on the download link instead, which worked perfectly.

Emacs polymode gives error when opening file

I downloaded the polymode zip-file from GitHub, open the zip-file which gives a folder named polymode-master . I renamed the folder to polymode and put it on my .emacs.d folder. Then I inserted the following lines into my .emacs file:
;; Polymode
(setq load-path
(append '("~/.emacs.d/polymode/" "~/.emacs.d/polymode/modes")
load-path))
(require 'poly-R)
(require 'poly-markdown)
When I open a file with emacs it gives me the following error:
Warning (initialization): An error occurred while loading `c:/Users/ab/.emacs':
File error: Cannot open load file, markdown-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
Any idea what I did wrong?
Thanks for help.
PS:
Windows 7
GNU Emacs 24.3.1
ESS
polymode depends on markdown-mode for its Markdown support, and it doesn't look like you have it installed.
Since you're using Emacs 24, which has package.el built-in, I strongly recommend installing it via MELPA stable (also available in regular MELPA and Marmalade), but if you're still installing packages manually you can find it on its website.

Loading packages installed through 'package.el' in Emacs24 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Emacs 24 Package System Initialization Problems
I am using Emacs 24. I have the ELPA and Marmalade repos added. Using 'package' I installed 'auto-complete'. I have the following lines added to my init.el:
(require 'auto-complete-config)
(ac-config-default)
When I start Emacs, I get the error
File error: Cannot open load file, auto-complete-config
But then I use
M-x load-file
and load the same ~/.emacs.d/init.el file, it then works fine with the prompt saying
Loading /home/user/.emacs.d/init.el (source)...done
How is the usual loading different from the 'M-x load-file' command? In the start of the init.el file I do the following, is this somehow effecting the package from loading.
(add-to-list 'load-path "~/.emacs.d")
(load "custom_code")
As mentioned in the comment below: The answer by phils to the duplicate question is probably more helpful than this one
This almost certainly means that your init.el file is getting run before the code that sorts out the packages for package.el. The latter code adds the directory with the auto-complete library to your load path.
I'm still using ELPA, rather than package.el. With elpa, there's a snippet that looks like this that gets installed at the bottom of your .emacs.
;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))
As the comment suggests, you probably want to put your equivalent package.el initialization code before the stuff that loads init.el.
Finally: I notice you mention adding .emacs.d to your load-path. The Emacs load path is not recursive, so that probably won't do what you need (assuming that your libraries live in subdirectories). Years ago, I wrote this snippet to load up various libraries of elisp code that I'd written. You might find it useful. (Obviously, it'll only work on unixy systems with a shell and a find command. It's reasonably slow, but this seems to be shell-command-to-string, which takes several milliseconds even running "echo hello" or the like)
(defun find-elisp-dirs (dir)
"Find all directories below DIR containing elisp sources, ignoring those"
(split-string
(shell-command-to-string
(format "find %s -iname '*.el' -printf '%%h\\n' | sort -u"
(expand-file-name dir t)))))

Wrong number of arguments: called-interactively-p, 1

~/.emacs
;; http://cx4a.org/software/auto-complete/manual.html
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)
when I load emacs, it complains the error as "Wrong number of arguments: called-interactively-p, 1". In other words, emacs finds error until the line (ac-config-default).
when I check the file .emacs.d/auto-complete.elc, I found the string "called-interactively-p".
Question> I have used the same setting for ubuntu without problems. Now I am switching centos 6.2. Is there a way that I fix this problem?
emacs --debug-init shows the following errors:
͂
It is worth mentioning that this error may arise if you move your emacs.d directory from one machine to another.
If this is the case, removing the compiled *.elc files should do the trick.
In recent Emacsen, called-interactively-p requires an argument.
Do C-h f ac-quick-help RET, then replace (called-interactively-p) by (called-interactively-p 'any) and recompile/reload. Or send this bug to the package's author.
[ As I mentioned recently in some other stackoverflow question, it is strongly recommended to not put "~/.emacs.d" in your load-path since the ~/.emacs.d directory can/will hold configuration files whose name clashes with real emacs packages. I.e. put the auto-complete files in a *sub*directory of ~/.emacs.d. ]
Your error looks very strange: while called-interactively-p is declared in Emacs-23 as taking exactly 1 argument, it actually accepts 0 arguments as well (to ease up the pain for external packages that want to support both Emacs-22 and Emacs-23).
So seems to be something else in your config which somehow redefines called-interactively-p.

Start C++ syntax highlighting for .cu (CUDA) files

I use Emacs as an editor. Of late whenever I use CUDA files (which usually have extensions .cu) I have to manually do M-x c++-mode to turn on syntax highlighting and other yasnippet features.
How do I do I ensure that all .cu files when started in EMACS automatically borrow all the C++ mode features. In other words .cu extension becomes an alias for .cpp extension.
( I know there is a CUDA mode for EMACS, (not inbuilt) but when I installed this mode it does not turn on many of the useful features present in the C++-mode of emacs )
Putting this into your .emacs should do the trick:
(add-to-list 'auto-mode-alist '("\\.cu\\'" . c++-mode))
Just in case people have missed it; there's a slightly more official cuda-mode available: http://www.emacswiki.org/emacs/CudaMode
You need to put it somewhere in your load-path; for example on my Mac, I put the code in $HOME/Library/emacs/cuda-mode.el and added the following lines to my .emacs file.
(add-to-list 'load-path "~/Library/emacs")
(autoload 'cuda-mode "cuda-mode.el")
(add-to-list 'auto-mode-alist '("\\.cu\\'" . cuda-mode))