Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 XEmacs - Adding the Emacs modes you love and adore
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
haskell




PostPosted: Mon Feb 05, 2007 5:12 pm   Post subject: XEmacs - Adding the Emacs modes you love and adore

First, here are the links to the modes that will be talked about:
- SLIME
- Python-Mode
- Cc-Mode
- Ruby-Mode

XEmacs can be found here.

SLIME

SLIME is an acronymn for "Superior Lisp Interaction Mode for Emacs". It is a must for any Common Lisp user who chooses XEmacs or Emacs.

To install SLIME:
- Download SLIME[See SLIME link above]
- Extract the SLIME files to your XEmacs folder
- Open XEmacs
- Click on "Options -> Edit Init File"
- Add the following:
code:
(setq inferior-lisp-program "path-to-common-lisp")
(add-to-list 'load-path "path-to-slime-directory")
(require 'slime)
(slime-setup)

As in the example of:
code:
(setq inferior-lisp-program "C:/clisp-2.41/clisp.exe")
(add-to-list 'load-path "C:/Program Files/XEmacs/slime")
(require 'slime)
(slime-setup)

- If all is done right, then close and reopen XEMacs.
- Then do M-x slime OR for you non-Emacs people, press "Alt+X" then type "slime".
- And voila, SLIME is active Smile.

Python-Mode

This is the very nice Python mode for *macers.

- Download Python-Mode[See Python-Mode link above]
- Extract the Python-Mode files to your XEmacs folder
- Click on "Options -> Edit Init File"
- Add the following:
code:
(autoload 'python-mode "path-to-python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

As in the example of:
code:
(autoload 'python-mode "C:/Program Files/XEmacs/python-mode/python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

- If all is done right, close and reopen XEmacs
- Then open a Python file[.py]
- If you see syntax highlighting, than congratulations! If not, try again!

Cc-Mode

This is the mode for your C-based languages(besides Perl, Perl has its own mode). C/C++/Java/C#/etc...

Installation instructions are here

Once installed open a .c or . cpp or whatever. If you see syntax highlighting, congratulations! If not, try again!

Ruby-Mode

This is the "hidden-in-the-back" Ruby mode for Emacs, available from the misc folder on ruby-lang.

- Download Ruby-Mode[See Ruby-Mode link above]
- Extract the Ruby-Mode file to your XEmacs folder
- Click on "Options -> Edit Init File"
- Add the following:
code:
(autoload 'ruby-mode "path-to-ruby-mode" "Ruby Mode." t)
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))

As in the example of:
code:
(autoload 'ruby-mode "C:/Program Files/XEmacs/ruby-mode/ruby-mode" "Ruby Mode." t)
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))

- If all is done right, close and reopen XEmacs
- Then open a Ruby file[.rb]
- If you see syntax highlighting, than congratulations! If not, try again!

Thanks for looking through, I hope this will allow you to try [X]Emacs and see what all the fuss is about.

If you have any modes you'd like to see added to this guide, than tell me.

Please post any errors, comments, or etc...

Note: you can use XEMacs Packages to install any mode you may want.
Sponsor
Sponsor
Sponsor
sponsor
Naveg




PostPosted: Mon Feb 05, 2007 7:06 pm   Post subject: RE:XEmacs - Adding the Emacs modes you love and adore

Seems very useful, although personally I've never caught the Emacs craze (or Vim for that matter). Maybe I'll try it out again one of these days.
abcdefghijklmnopqrstuvwxy




PostPosted: Tue Feb 06, 2007 1:19 am   Post subject: RE:XEmacs - Adding the Emacs modes you love and adore

Thanks Very Happy Any chance you know how to set syntax highlighting as the default? I have to manually set syntax highlighting on each time I open a .cpp :/
haskell




PostPosted: Tue Feb 06, 2007 6:26 am   Post subject: RE:XEmacs - Adding the Emacs modes you love and adore

Once you add the lines to the init.el file, it should be automatic.

Such as:
code:
(autoload 'awk-mode "cc-mode" nil t)
abcdefghijklmnopqrstuvwxy




PostPosted: Tue Feb 06, 2007 11:12 am   Post subject: RE:XEmacs - Adding the Emacs modes you love and adore

Okay that worked, thanks!

I can't get slime working because of this line:

(setq inferior-lisp-program "/usr/share/a2ps/sheets/clisp.ssh")

I don't have any idea where else common-lisp is though. . . Any ideas?

EDIT: Oops nevermind, i found it in /usr/bin/
haskell




PostPosted: Fri Feb 09, 2007 5:04 pm   Post subject: RE:XEmacs - Adding the Emacs modes you love and adore

code:
;; Superior LISP Interaction Mode(SLIME)
(setq inferior-lisp-program "~/clisp-2.41/clisp.exe")
(add-to-list 'load-path "C:/emacs-21.3/modes/slime")
(require 'slime)
(slime-setup)

;; Cc-Mode
(autoload 'awkmode "cc-mode" nil t)

;; Clean-Mode
(setq load-path (cons "~/emacs-21.3/modes/clean-mode" load-path))
(setq auto-mode-alist
      (append auto-mode-alist
              '(("\\.icl$"  . clean-mode)
                ("\\.dcl$"  . clean-mode))))
(autoload 'clean-mode "clean-mode" t)

;; Haskell-Mode
(load "~/emacs-21.3/modes/haskell-mode-2.1/haskell-site-file")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)

;; Python-Mode
(setq load-path (cons "~/emacs-21.3/modes/python-mode" load-path))
(setq auto-mode-alist
      (append auto-mode-alist
              '(("\\.py$"  . python-mode)
                ("\\.pyw$"  . python-mode))))
(autoload 'python-mode "python-mode" t)

;; Ruby-Mode
(setq load-path (cons "~/emacs-21.3/modes/ruby-mode" load-path))
(setq auto-mode-alist
      (append auto-mode-alist
              '(("\\.rb$"  . ruby-mode)
                ("\\.rbw$"  . ruby-mode))))
(autoload 'ruby-mode "ruby-mode" t)

;; O'Caml-Mode
(setq auto-mode-alist
          (cons '("\\.ml[iyl]?$" .  caml-mode) auto-mode-alist))

(setq load-path (cons "~/emacs-21.3/modes/ocaml-mode" load-path))

(autoload 'caml-mode "ocaml" (interactive) t)
(autoload 'camldebug "camldebug" (interactive))

;; Emacs IRC Client
(add-to-list 'load-path "C:/emacs-21.3/modes/erc-5.1.2")
(require 'erc)


An excerpt from the .emacs file. This is may or may not work in XEMacs, but it works perfectly in Emacs.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: