From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Le Wang" Newsgroups: gmane.emacs.help Subject: Re: configuring emacs as a programmer's editor Date: 30 Jun 2006 00:37:24 -0700 Organization: http://groups.google.com Message-ID: <1151653044.648242.11230@h44g2000cwa.googlegroups.com> References: <1151627894.208462.326680@m73g2000cwd.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" X-Trace: sea.gmane.org 1151653474 19290 80.91.229.2 (30 Jun 2006 07:44:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 30 Jun 2006 07:44:34 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 30 09:44:20 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 1FwDfY-0006hq-1r for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jun 2006 09:44:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FwDfX-0006LT-Dc for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jun 2006 03:44:03 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!h44g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 92 Original-NNTP-Posting-Host: 24.19.59.244 Original-X-Trace: posting.google.com 1151653048 13087 127.0.0.1 (30 Jun 2006 07:37:28 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 30 Jun 2006 07:37:28 +0000 (UTC) In-Reply-To: <1151627894.208462.326680@m73g2000cwd.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: h44g2000cwa.googlegroups.com; posting-host=24.19.59.244; posting-account=j4OimgwAAAALo-2szSZvOyX5OE1uyIeS Original-Xref: shelby.stanford.edu gnu.emacs.help:140125 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:35750 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. > > 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 You don't need to be an Emacs lisp master to customize your Emacs. Your .emacs file looks like a good start. Although there are some obvious problems that you'll easily be able to fix, once you have a tiny bit of lisp under your belt. I actually find that there is an abundance of material to get you started in lisp, and it doesn't take that much time to get the basics down. See: 1. Google groups for past q/a 2. Emacs Wiki 3. http://www.gnu.org/software/emacs/emacs-lisp-intro/ If you have specific questions, ask them, and people will try to help. The most important thing is to just jump in and get over that "lisp is so hard" hump. It's really not. It's a different way of thinking about programming, and I find that knowing Emacs lisp (I'm a novice myself) actually helps me think about other code I write in different ways. It's kind of cool that way. The great thing about Emacs is that it's self documenting, so the trivial questions you have can be addressed by actually exploring Emacs yourself. For example, your cperl-mode compile commands are missing. So you begin by asking Emacs about "cperl-mode": f cperl-mode And Emacs shows you the help text associated this command (See the wiki for other ways Emacs documents itself, including the powerful apropos features). Now, you click on the underlined `cperl-mode', and open up the source code. You search for the name a missing menu item -- "Check Syntax", and you find: ["Check syntax" cperl-check-syntax (fboundp 'mode-compile)] This occurs in the `easy-menu-define' context, so you suspect that this is where the menu item is defined. Now what do these tokens mean? The first string is obvious. Emacs tells you "cperl-check-syntax" is the actual command that triggers the function. ( f cperl-check-syntax) And "fboundp" checks if a feature is present. You evaluate the "(fboundp 'mode-compile)" sexp by placing the cursor on "]" and pressinng , and find that it's nil, meaning that the "mode-compile" is missing. You put it all together and parse this line as -- define "Check Syntax" menu item, invoking `cperl-check-syntax' if `mode-compile' feature is present. Obviously it's failing because `mode-compile' is missing. You then do a web search and find that it's available here: "http://www.tls.cena.fr/~boubaker/Emacs/". You follow the instructions on the web page and install the package. Voila. Now you know Emacs as more than a "Notepad clone", and it all builds up from there. hth. -- Le