* color coding in emacs
@ 2006-03-27 13:59 Inge
2006-03-27 16:01 ` Kevin Rodgers
[not found] ` <mailman.35.1143475858.14013.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: Inge @ 2006-03-27 13:59 UTC (permalink / raw)
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: color coding in emacs
2006-03-27 13:59 color coding in emacs Inge
@ 2006-03-27 16:01 ` Kevin Rodgers
[not found] ` <mailman.35.1143475858.14013.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2006-03-27 16:01 UTC (permalink / raw)
Inge wrote:
> 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?
Googling for emacs and dna yields many results, including
http://www.mahalito.net/~harley/elisp/dna-mode.el
> 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)
If you want to roll your own, see
http://www.emacswiki.org/cgi-bin/wiki/CreateNewMajorMode
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: color coding in emacs
[not found] ` <mailman.35.1143475858.14013.help-gnu-emacs@gnu.org>
@ 2006-03-28 7:33 ` Inge
0 siblings, 0 replies; 3+ messages in thread
From: Inge @ 2006-03-28 7:33 UTC (permalink / raw)
thank you!
somehow I only did google searches for emacs and coloring/highlighting,
not thinking of the more obvious emacs and dna.
cheers,
Inge
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-28 7:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-27 13:59 color coding in emacs Inge
2006-03-27 16:01 ` Kevin Rodgers
[not found] ` <mailman.35.1143475858.14013.help-gnu-emacs@gnu.org>
2006-03-28 7:33 ` Inge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).