Posts tagged Emacs
August 02th, 2009
Mac emacs control option keybindings
Topics: Howto, Mac, Emacs; Setup the Mac keys (setq mac-option-key-is-meta nil) (setq mac-command-key-is-meta t) (setq mac-option-modifier nil) (setq mac-command-modifier 'meta) (global-set-key (kbd "<kp-delete>") 'delete-char)
July 04th, 2009
Using dired-do-query-replace-regexp to rename read-only files
Topics: Howto, EmacsIf you use dired-do-query-replace-regexp to replace things in read-only files the bell will sound and the batch replace will stop. Here’s a quick workaround, cheers to bojohan in #emacs for helping me with this:
M-x set-variable RET inhibit-read-only RET t RET
Then do your replace again and finally set the variable back to nil again!
July 04th, 2009
Tramp ssh constant login problem
Topics: Emacs, Mac, HowtoI was having a problem on my macbook that I had to login every time I wanted to save or open a new file through Tramp. The weird thing was that tab completion only required me to login once.
Anyway I got to the bottom of it, just add this to your .emacs:
(setq tramp-default-method "ssh")
November 17th, 2008
SLIME connection dropping when using UTF characters
Topics: Lisp, Howto, EmacsI ran into a problem today where my Slime connection would suddenly drop if I loaded a file that contained UTF characters.
Luckily the #lisp bods saved the day, here’s how you fix it:
- Add (setq slime-net-coding-system ‘utf-8-unix) to your .emacs
- Add the :coding-system “utf-8-unix” keyword parameter to your (swank:create-server) call
There’s more information available here.
Cheers, Dave.
October 08th, 2008
Setting up a Lisp web development environment
Topics: Lisp, Howto, EmacsHere’s a guide to take a fresh Debian stable (etch) install and turn it into a viable Lisp web development environment. (Including Emacs22, SBCL, Slime, Hunchentoot, Apache2 all working together from boot)
Please note because this is aimed at a totally fresh Debian stable install you are going to need to be selective with the commands if it’s not a fresh install or if you are using a different version of Debian.
All the commands assume you are logged in as root on your soon-to-be web server.
Installation Steps
# Install Emacs 22 echo deb http://hype.sourceforge.jp/f etch backports >> /etc/apt/sources.list wget http://hype.sourceforge.jp/A7F20B7E.gpg -O- | apt-key add - apt-get update apt-get install emacs22 # Install the other required packages apt-get install darcs cvs subversion curl git-core cogito sbcl make gcc build-essential detachtty # Grab clbuild cd /usr/src darcs get http://common-lisp.net/project/clbuild/clbuild cd clbuild && chmod +x clbuild # Install the different bits and bobs with clbuild ./clbuild update sbcl ./clbuild compile-implementation sbcl echo cl-unicode get_darcs http://common-lisp.net/~loliveira/ediware/cl-unicode >> projects echo metabang-bind get_darcs http://common-lisp.net/project/metabang-bind >> projects echo stefil get_darcs http://common-lisp.net/project/stefil/darcs/stefil >> projects echo cffi get_darcs http://common-lisp.net/project/cffi/darcs/cffi >> projects ./clbuild build cl-unicode cl-ppcre hunchentoot vecto cl-who slime metabang-bind iterate stefil babel cffi # Make a lisp image ./clbuild dumpcore --installed # Setup lisp to start on boot cd /etc/init.d wget http://www.kzar.co.uk/lisp-install/lisp-boot chmod a+x lisp-boot cd /etc/rc2.d ln -s ../init.d/lisp-boot S98lispboot mkdir /var/run/lisp # Add the lisp user for lisp to run as adduser lisp-user touch /var/log/detachtty.log touch /var/log/lisp-app-dribble chown lisp-user:lisp-user /var/log/detachtty.log chown lisp-user:lisp-user -R /var/run/lisp chown lisp-user:lisp-user /var/log/lisp-app-dribble # Make it so lisp will start the webserver and swank server each time cd /usr/src/clbuild/ mkdir /var/lisp && cd /var/lisp wget http://www.kzar.co.uk/lisp-install/server.lisp mkdir images && cd images wget http://www.lisperati.com/lisplogo_alien_128.png chmod g+w -R /var/lisp chown -R lisp-user:lisp-user /var/lisp # Grab Apache2 and set it up with modlisp apt-get install apache2 cl-modlisp libapache-mod-lisp apache2-threaded-dev cd /etc/apache2/sites-available/ rm default && wget http://www.kzar.co.uk/lisp-install/default cd /etc/apache2/mods-enabled wget http://www.kzar.co.uk/lisp-install/lisp.load wget http://www.kzar.co.uk/lisp-install/lisp.conf cd /usr/lib/apache2/modules wget http://www.kzar.co.uk/lisp-install/mod_lisp2.so # Get rid of the old SBCL that comes with Debain (Thanks Todd) apt-get remove sbcl echo SBCL_HOME=/usr/src/clbuild/target/lib/sbcl >> /etc/profile ln -s /usr/src/clbuild/target/bin/sbcl /usr/bin/sbcl ln -s /usr/src/clbuild/target/lib/sbcl /usr/local/lib/sbcl cd /usr/src/clbuild/target/lib/sbcl && rm -r site-system ln -s /usr/lib/sbcl/* . # Start it all running /etc/init.d/apache2 restart /etc/init.d/lisp-boot start # Set up emacs (Do as the user who will use emacs) cd ~ && wget http://www.kzar.co.uk/lisp-install/.emacs
Usage
- Browse to http://SERVERNAME/lisp to view your website.
- Type emacs /var/lisp/server.lisp to start editing the little example page.
- Type M-x slime-connect RET RET in Emacs to connect to the running Lisp REPL
Notes
- Add your user to the lisp-user group to edit the files
- Make sure you have downloaded the .emacs for your user so slime-connect works properly
Leave a comment if you hit a problem and I’ll try and help - Dave.
Edit: Thanks to Todd for some good feedback, I have added an additional stanza of commands that helps get rid of Debian’s old SBCL version and let’s the nice new one still use some of the Debian installed cl package. (That’s the hope anyway, let me know if it worked for you / if there’s a better way to do that part)