From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: ferhun_caner@yahoo.com (Dr. F.C.Caner) Newsgroups: gmane.emacs.help Subject: Re: Fortran 90 Code alignments Date: 27 May 2003 23:21:11 -0700 Organization: http://groups.google.com/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <65fef11f.0305272221.604f40f2@posting.google.com> References: <65fef11f.0305262323.18100da3@posting.google.com> NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1054103038 5429 80.91.224.249 (28 May 2003 06:23:58 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 28 May 2003 06:23:58 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed May 28 08:23:57 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19KuLs-0001PR-00 for ; Wed, 28 May 2003 08:23:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19KuNU-0006ND-G4 for gnu-help-gnu-emacs@m.gmane.org; Wed, 28 May 2003 02:25:36 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 Original-NNTP-Posting-Host: 194.27.207.25 Original-X-Trace: posting.google.com 1054102871 24943 127.0.0.1 (28 May 2003 06:21:11 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 28 May 2003 06:21:11 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:113773 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10268 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10268 Glenn: Thanks, it seems to work OK. Best, FCC. Glenn Morris wrote in message news:... > Dr. F.C.Caner wrote: > > [aligning f90 code] > > > may be, I thought, there is some function that can do that > > independent of the programming language. Am I wrong? > > It's Emacs, of course you're not wrong! :) > > There are probably various ways to do what you ask. I use align.el, > which is a part of Emacs. I have the following in my .emacs. I > probably haven't done it the most elegant way, but It Works For Me. > > (require 'align) > (add-to-list 'align-open-comment-modes 'f90-mode) > (add-to-list 'align-dq-string-modes 'f90-mode) > (add-to-list 'align-sq-string-modes 'f90-mode) > > (add-hook 'f90-mode-hook > '(lambda () > (setq align-mode-rules-list > '((f90-bracket-in-declaration > (regexp . "\\(\\s-+\\)([^ :]+).*::")) > (f90-comma-in-declaration > (regexp . "\\(\\s-*\\),\\s-+.*::") > (spacing . 0)) > (f90-dimension-in-declaration > (regexp . "\\(\\s-*\\),\\s-*dimension.*::") > (spacing . 0) > (case-fold . t)) > (f90-alloc-in-declaration > (regexp . "\\(\\s-*\\),\\s-*allocatable.*::") > (spacing . 0) > (case-fold . t)) > (f90-intent-in-declaration > (regexp . "\\(\\s-*\\),\\s-*intent.*::") > (spacing . 0) > (case-fold . t)) > (f90-parameter-in-declaration > (regexp . "\\(\\s-*\\),\\s-*parameter.*::") > (spacing . 0) > (case-fold . t)) > (f90-save-in-declaration > (regexp . "\\(\\s-*\\),\\s-*save.*::") > (spacing . 0) > (case-fold . t)) > (f90-colon-in-declaration ; must come last > (regexp . "\\(\\s-+\\):: ")))))) > > (global-set-key "\C-ca" 'align) > > Then just mark the region of interest, and hit C-c a.