automatically use python-mode with psp files in emacs - emacs

I am using Emacs 24.3, and would like to have .psp (python server pages) files automatically be in python-mode when opened as opposed to the default Fundamental mode. Thanks.

Use auto-mode-alist. Something like this in your configuration should do the trick:
(add-to-list 'auto-mode-alist
'("\\.psp\\'" . python-mode))

Related

Loading python-mode.el with use-package - still get python.el

I just discovered use-package and I'd like to use it with python-mode.el. I'm trying this:
(use-package python-mode
:mode ("\\.py\\'" . python-mode)
:interpreter ("python" . python-mode))
but am still getting python.el for python-mode. The use-package example specifically describes using python.el for python-mode, but I want the opposite. Can I accomplish that with use-package?
(I'm using GNU Emacs 24.5.1 on OS X if that's important.)
Don't use the keywords :mode and :interpreter. It works for me, like this:
(use-package python-mode
:init
...
:config
...)
The only working solution I found is there:
https://superuser.com/questions/108233/how-can-i-prevent-the-python-el-that-ships-with-emacs-23-from-ever-loading/999608#999608
In your .emacs, force the loading of the bad package first, then override it with the correct one:
(require 'python)
(require 'python-mode)

R-mode is named r-mode and causing issues

I'm trying to get polymode to work with .Rnw files, but it assumes that R-mode is named R-mode and on my system, ESS installed it as r-mode. How can I tell it that this is the same thing? I have this in my .emacs file:
;;; R modes
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
Strangely, if I open up a .Rmd file, it recognizes everything properly.
I was able to solve this by installing ESS via sudo apt-get install ess rather than from MELPA. I don't really understand why this would make a difference, but it fixed the problem for me!

cannot open load file: /yasnippet

I receive this message every time I start emacs
Emacs 24.2
Win7 64 and Ubuntu 12.10
yasnippet 0.8.0 installed with package-list
If there is a way to fix it ?
yasnippet doesn't get initialised automatically when installed with elpa, which I find unconventional. You still need to add the yasnippet directory into your load-path.
Here is my set up in my .emacs
;; yasnippet
(add-to-list 'load-path "~/.emacs.d/elpa/yasnippet-0.8.0")
(require 'yasnippet)
(setq yas-snippet-dirs '("~/.emacs.d/elpa/yasnippet-0.8.0/snippets" "~/Dropbox/Applications/Customise/emacs/myyassnipets"))
(yas-global-mode 1)
This is the sort of message I would expect to see if you're calling load or load-file in your init.el with a bad path. Look for any uses of those functions and correct the path if you can.
If this is in code you control, you probably want to call (require 'yasnippet) instead of directly loading the file.

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

EMACS mumamo/nxhtml mode is overriding js2-mode for js files

How do you choose which files mumamo loads on? It is now the default for all files despite what I have in my .emacs file.
I'd like to use js2-mode when it's a js file, mumamo if it's html/php/etc.
I suggest that you contact the author, Lennart Borgman, directly. He is usually quite helpful.
It worked for me when I added the following lines in my .emacs:
;; js2-mode configuration
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
;; because nxhtml-mode forces loading .js files with javascript-mode
(defalias 'javascript-mode 'js2-mode)