From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Roehler Newsgroups: gmane.emacs.help Subject: Re: configuring emacs as a programmer's editor Date: Fri, 30 Jun 2006 09:04:44 +0200 Organization: 1&1 Internet AG Message-ID: References: <1151627894.208462.326680@m73g2000cwd.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: sea.gmane.org 1151653414 19137 80.91.229.2 (30 Jun 2006 07:43:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 30 Jun 2006 07:43:34 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 30 09:43:24 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FwDeo-0006bF-4b for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jun 2006 09:43:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FwDen-00064B-MH for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jun 2006 03:43:17 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 202 Original-NNTP-Posting-Host: p54beb54f.dip0.t-ipconnect.de Original-X-Trace: online.de 1151651061 16984 84.190.181.79 (30 Jun 2006 07:04:21 GMT) Original-X-Complaints-To: abuse@einsundeins.com Original-NNTP-Posting-Date: Fri, 30 Jun 2006 07:04:21 +0000 (UTC) User-Agent: KNode/0.9.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:140124 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35749 Archived-At: Ted wrote: > 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. > Agree and don't agree. Beside the Emacs manual there is Elisp manual with a rather detailed explanation of the underlying concepts, vars and functions. > 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. Probably you will or should use two different init files: If you are in windows the .emacs from Linux will not be known there. Also the windows Emacs is a different machine as such AFAIU. (Basically its possible the have a combined init file at the windows part and read it in from Linux, but that will complicate the task.) > 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? Programs may partly rely at system facilities as the Linux-Shell - and respective windows facilities. To solve a problem, it's necessary to know where you are, which modes are on, which commands have been called last etc. Suggest to use the bug-report facilities (without sending it) M-x report-emacs-bug just after the command failed. This way a lot of useful information is collected, which may help. > 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. It's understood. At the other side: Without elisp knowledge it's possible, with it starts the fun. (And much more fun as I expected.) > 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) > )) What's with the auto-mode-alist. Usually it's defined by files.el and should be OK. Are there reasons to redefine it? __ Andreas Roehler PS: Myself I'm still exploring Emacs and interested in questions of convenience and usability. Please feel free to send your precise questions with email too. I'm using GNU Emacs 22.0.50.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) at Suse 10.0. Windows rather not. > (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)))