From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.help Subject: Re: Fortran 90 Code alignments Date: Tue, 27 May 2003 15:11:17 +0100 Organization: None Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <65fef11f.0305262323.18100da3@posting.google.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1054045786 8089 80.91.224.249 (27 May 2003 14:29:46 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 27 May 2003 14:29:46 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue May 27 16:29:45 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 19KfPr-0001r9-00 for ; Tue, 27 May 2003 16:27:03 +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 19KfEW-0005Oo-GU for gnu-help-gnu-emacs@m.gmane.org; Tue, 27 May 2003 10:15:20 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.stueberl.de!fu-berlin.de!server1.netnews.ja.net!pegasus.csx.cam.ac.uk!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 52 Original-NNTP-Posting-Host: xpc14.ast.cam.ac.uk X-Attribution: GM Mail-Copies-To: never User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) Cancel-Lock: sha1:llu1+kAg7okbUjXuDZAQ0zRPuiw= Original-Xref: shelby.stanford.edu gnu.emacs.help:113737 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:10232 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10232 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.