help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: configuring emacs as a programmer's editor


From: David Kastrup
Subject: Re: configuring emacs as a programmer's editor
Date: Fri, 30 Jun 2006 09:03:02 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Ted" <r.ted.byers@rogers.com> writes:

> OK, I have used emacs as just a clone of Notepad for quite a while.  I
> know that is under-using it, but I found configuring it to be more
> useful to me a bit onerous.  I find the emacs documentation a bit dense
> on one side, and short of the details and examples I need on the other.
>
> I have a basic .emacs file, appended below, that seems like it
> should support most of the programming languages I use.  I
> constructed it by copying and pasting portions of .emacs files I
> found published on the web.

That is the worst thing one can possibly do.  You'll get a hotch potch
of what various people with various skills considered to be a good
idea for various versions of Emacs.

Instead, start from an empty .emacs and add things you need by
referring to the manual and/or using M-x customize RET.

The Emacs manual also contains a section about configuration.

> (setq auto-mode-alist
>       '(
>         ("\\.bashrc\\'" . sh-mode)

VERY VERY VERY bad idea: you destroy all of Emacs' built-in knowledge
about types.  Instead you should add only those things that you need
specifically to the front of auto-mode-alist.

Probably even nothing is necessary here.
>       (delete-frame)
>     (if (y-or-n-p "Are you sure you want to quit? ")
>       (save-buffers-kill-emacs)
>       (message "Quit aborted."))))
> (defun paren-match ()
>   "Jumps to the paren matching the one under point,
> and does nothing if there isn't one."
>   (interactive)
>   (cond
>    ((looking-at "[({[]") (forward-sexp 1) (backward-char))
>    ((looking-at "[]})]") (forward-char) (backward-sexp 1))
>    (t           (message "Could not find matching paren."))) )
>
> ;; pretty-print hashes:
> (if (fboundp 'maphash)
>     (defun pp-hash (H)
>       (let (s)
>       (maphash
>        (lambda (K V)
>          (setq s (concat s (format "%S => \n%s" K (pp V))))) H) s)))
>

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

[Prev in Thread] Current Thread [Next in Thread]