unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Ted" <r.ted.byers@rogers.com>
Subject: configuring emacs as a programmer's editor
Date: 29 Jun 2006 17:38:14 -0700	[thread overview]
Message-ID: <1151627894.208462.326680@m73g2000cwd.googlegroups.com> (raw)

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.

I need something that will work for me on both Windows XP and SUSE
Linux 10.  But on Windows, I have MS Visual Studio, and so need emacs
to support primarily SQL, Perl, PHP, while on Linux, I need it to
support these plus the C++ and fortran gcc compilers.  While I do a lot
of Java, I use Netbeans almost exclusively for my java programming.
Finally, I need to be able to specify whether to submit my SQL to
PostgreSQL or to MySQL, if that is possible.

I suppose I have two questions.  1) How do I modify the .emacs file
I've managed to cobble together to fully support my needs?  and 2)
Although I can get into perl mode (using cperl-mode, I think), by
loading or creating a perl script file, I find invariably that the run,
kill, next error, and check syntax items on the Perl submenu are
disabled.  Why?  And how do I fix that?  I have guessed that emacs is
largely written in, and configured using lisp, and that to really
understand this, I should learn lisp, but the time I have for that in a
significant way is not yet available, so lisp code, for this
fortran/C++,Java/SQL coder, is about as intelligible as Greek (which I
don't understand, being a unilingual anglophone).  There is only so
much time in a day and I can't get to everything I want to do.  :-(
I'd make better progress if I could find a resource that relates lisp
syntax and style to their counterparts in the languages I know, but
that is another issue.

For the present, I'll be content if someone could help me get emacs
configured on Windows and Linux to meet my proximate needs.

Thanks.

Ted

====my .emacs file==================
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Emacs appearance
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-background-color "white")
(set-foreground-color "black") ;; slategray
(set-cursor-color "red")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Display the time on the status line
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq display-time-24hr-format t)
(display-time)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Associate different modes with different file types.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defalias 'perl-mode 'cperl-mode)
(autoload 'c++-mode  "cc-mode"  "C++ Editing Mode"         t)
(autoload 'c-mode    "cc-mode"  "C Editing Mode"           t)
(autoload 'plsql-mode       "plsql"      "PL/SQL mode"
t)
(setq interpreter-mode-alist
      (append '(("perl"  . cperl-mode)
		("perl5" . cperl-mode)) interpreter-mode-alist))

(setq auto-mode-alist
      '(
        ("\\.bashrc\\'" . sh-mode)
        ("\\.bib\\'" . bibtex-mode)
        ("\\.c\\'" . c-mode)
        ("\\.cgi\\'" . python-mode)
        ("\\.cpp\\'" . c++-mode)
        ("\\.css\\'" . css-mode)
        ("\\.dtd\\'" . sgml-mode)
        ("\\.el\\'"  . emacs-lisp-mode)
        ("\\.emacs\\'" . emacs-lisp-mode)
        ("\\.es$" . c++-mode)
        ("\\.htm\\'" . html-mode)
        ("\\.html\\'" . xml-mode)
        ("\\.shtml\\'" . html-mode)
        ("\\.idl\\'" . c++-mode)
        ("\\.java\\'" . jde-mode)
		  ("\\.js$" . c++-mode)
        ("\\.odl\\'" . c++-mode)
        ("\\.py\\'" . python-mode)
        ("\\.php\\'" . php-mode)
        ("\\.phtml\\'" . php-mode)
        ("\\.pl\\'" . perl-mode)
        ("\\.properties\\'" . perl-mode)
        ("\\.py$" . python-mode)
        ("\\.sh\\'" . sh-mode)
        ("\\.sql\\'" . sql-mode)
        ("\\.text\\'" . text-mode)
        ("\\.txt\\'" . text-mode)
        ("\\.tex\\'" . latex-mode)
        ("\\.vm\\'" . emacs-lisp-mode)
        ("\\.wfcfg\\'" . perl-mode)
        ("\\.wsdd\\'" . xml-mode)
        ("\\.xml\\'" . xml-mode)
		  ))
(defun query-kill-emacs ()
  "Asks if you want to quit emacs before quiting."
  (interactive)
  (if (nth 1 (frame-list))
      (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)))

             reply	other threads:[~2006-06-30  0:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-30  0:38 Ted [this message]
2006-06-30  7:03 ` configuring emacs as a programmer's editor David Kastrup
2006-06-30  7:04 ` Andreas Roehler
2006-06-30  8:02   ` Le Wang
2006-06-30 12:13     ` Eli Zaretskii
     [not found]     ` <mailman.3562.1151669638.9609.help-gnu-emacs@gnu.org>
2006-07-01  4:20       ` Le Wang
2006-06-30  7:37 ` Le Wang
2006-06-30 16:14   ` Ted
2006-07-01 23:19     ` Le Wang
2006-07-02  3:46     ` B. T. Raven
2006-07-02  8:32       ` Tim X
2006-07-03 20:15     ` Ted
2006-07-04  8:34       ` Tim X
2006-07-03 22:09 ` Jason Rumney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1151627894.208462.326680@m73g2000cwd.googlegroups.com \
    --to=r.ted.byers@rogers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).