From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Inge" Newsgroups: gmane.emacs.help Subject: color coding in emacs Date: 27 Mar 2006 05:59:50 -0800 Organization: http://groups.google.com Message-ID: <1143467990.897885.139600@v46g2000cwv.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1143470475 14363 80.91.229.2 (27 Mar 2006 14:41:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 27 Mar 2006 14:41:15 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 27 16:41:13 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 1FNstr-0002o1-3u for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Mar 2006 16:40:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FNstq-00046n-DF for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Mar 2006 09:40:54 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v46g2000cwv.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: 131.155.59.92 Original-X-Trace: posting.google.com 1143467999 11488 127.0.0.1 (27 Mar 2006 13:59:59 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 27 Mar 2006 13:59:59 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc3 Firefox/1.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: v46g2000cwv.googlegroups.com; posting-host=131.155.59.92; posting-account=rL6spg0AAAAWdUeE5HpecpOY3zUBcSnz Original-Xref: shelby.stanford.edu gnu.emacs.help:138402 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:34004 Archived-At: hi i frequently use a text editor to view some files containing DNA info. These are just simply a great number of lines of characters, the characters can be A,C,G or T. At the moment I would like to have the text color coded, so that each A has one color, each C has another color, etc. Since emacs is my favorite editor I wanted to start and see if emacs could do it for me. However, I am having some difficulties. I thought about creating a new major mode and use font-lock. But somehow this doesn't work. The mode is recognised, but there is no highlighting or coloring. It does work when I manually use hi-lock, but I want the coloring pattern saved outside of the file. Can anyone tell me if this is at all doable with emacs? To my .emacs (init) file I added the lines: ;; load mode file for fasta mode (require 'fasta-mode "/home/ivdberg/customize/fasta-mode.el") (add-to-list 'auto-mode-alist '("\\.fa\\'" . fasta-mode)) (add-to-list 'auto-mode-alist '("\\.fasta\\'" . fasta-mode)) Fasta-mode.el looks like this: ;; fasta-mode.el ;; mode inteded for automatic highlighting of fasta files (defvar fasta-mode-hook nil) (defconst fasta-font-lock-keywords (list '("A" . "Yellow") '("C" . "Green") '("G" . "Blue") '("T" . "Pink")) ) (defun fasta-mode () "Major mode for highlighting fasta files" (interactive) (kill-all-local-variables) (set (make-local-variable 'font-lock-defaults) '(fasta-font-lock-keywords)) (setq major-mode 'fasta-mode) (setq mode-name "Fasta") (run-hooks 'fasta-mode-hook) ) (provide 'fasta-mode)