Emacs notes
Note: I am using Emacs 23.1 on Ubuntu Jaunty Linux
js2-mode (for javascript)¶
I tried to byte-compile js2-mode in Emacs 23.0.60.1, using
M-x byte-compile-file RET js2.el RET from within
Emacs, but I got a Error: Variable binding depth exceeds max-specpdl-size
message. Luckily the comments on the
Installation
Instructions page on the wiki had help for this.
$ cd ~/.emacs.d/site-lisp $ wget http://js2-mode.googlecode.com/files/js2-20080616a.el $ emacs --batch --eval '(byte-compile-file "js2-20080616a.el")'
I added the following to my ~/.emacs:
(autoload 'js2-mode "js2-20080616a" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
Update 2010-03-11: I've
switched to
espresso-mode.
php-mode¶
http://php-mode.sourceforge.net/cd ~/incoming wget http://downloads.sourceforge.net/project/php-mode/php-mode/1.5.0/php-mode-1.5.0.tar.gz tar zxvf php-mode-1.5.0.tar.gz cp -p php-mode-1.5.0/php-mode.el ~/.emacs.d/site-lisp/php-mode-1.5.0.el
Add the following to your .emacs:
(autoload 'php-mode "php-mode-1.5.0")
(add-to-list 'auto-mode-alist
'("\\.php[34]?\\'\\|\\.phtml\\'" . php-mode))
How to manually set the major mode¶
See 28.1 How Major Modes are Chosen in the Emacs manual. For example to change to js2-mode:
M-x js2-mode
How to use sudo in Tramp¶
note the two colons
C-c C-f /sudo::/etc/apache2/httpd.conf
alternatively:
C-c C-f /sudo:root@localhost:/etc/apache2/httpd.conf
How to align columns¶
M-x align may work but M-x align-regexp is more powerful.
How to replace <br> with a newline when using replace-string¶
Via this article,
hit C-q C-j to insert a newline character.
M-x replace-string <br> RET C-q C-j
How to remove ^M characters¶
Use C-q, quoted-insert to insert a literal ^M character.
M-x replace-string C-q C-m RET RET
How to search and replace in multiple files¶
Related posts
- Colorized, interactive "git blame" in Emacs: vc-annotate — posted 2011-05-28
- My Emacs Python environment — posted 2010-05-10
- Emacs espresso-mode for jQuery — posted 2010-03-10
- Notes on C++ development with Emacs on Ubuntu Linux — posted 2009-07-08
- Creating remote server nicknames with .ssh/config — posted 2008-11-20
1
Comment
—
Comments feed for this post
Post a comment
About
I'm Eliot and this is my notepad for programming topics such as Python, Django, Ubuntu, Emacs, etc... more »
Search Blog
Tags
-
algorithms
(6)
-
android
(2)
-
aws
(10)
-
blogproject
(20)
-
c_cplusplus
(12)
-
cardstore
(8)
-
colinux
(2)
-
concurrency
(13)
-
conkeror
(2)
-
core
(2)
-
cygwin
(17)
-
datastructures
(15)
-
datetime
(4)
-
decorators
(4)
-
django
(41)
-
emacs
(22)
-
files_directories
(12)
-
git
(6)
-
hardware
(6)
-
install_setup
(8)
-
javascript
(3)
-
keyboard
(9)
-
matplotlib
(6)
-
mercurial
(4)
-
nginx
(2)
-
persistence
(6)
-
preferences
(7)
-
processes
(4)
-
pyqt
(18)
-
python
(157)
-
ratpoison
(3)
-
regexes
(6)
-
rsync
(3)
-
softwaretools
(17)
-
sql
(14)
-
ssh
(12)
-
subversion
(6)
-
twisted
(7)
-
ubuntu
(66)
-
urxvt
(5)
-
vxworks
(25)
-
webdev
(8)
-
wmii
(7)
Blogroll
- Adam Gomaa
- Alex Clemesha
- Amir Salihefendic
- Armin Ronacher
- David Beazley
- David Ziegler
- Duncan McGreggor
- Gareth Rushgrave
- Glyph Lefkowitz
- Guido van Rossum
- Ian Bicking
- Jacob Kaplan-Moss
- James Bennett
- James Tauber
- Jesper Noehr
- Marty Alchin
- Matt Harrison
- Nikolay Kolev
- Parand Darugar
- Peter Baumgartner
- Peter Bengtsson
- Rob Hudson
- Simon Willison
- Will McGugan
#1 Mihamina Rakotomandimby commented on 2011-12-08:
php-mode seems to have been forked on github and 1.6.4: http://goo.gl/jB03o