[lug] Can syntax highlighting be used under Emacs?

Dhruva Reddy sledgehammer2010 at yahoo.com
Mon Mar 19 13:25:43 MST 2001


Include the following in your .emacs file:

(global-font-lock-mode t)

I have a bunch of customization options in mine, which
I boosted from a colleague, who in turn boosted it
from someone on the Internet.  Therefore, I don't know
what most of these lines mean.  Here it is:


;; Highlits keywords and other syntax
(global-font-lock-mode t)

;; Tab key inserts predetermined number of spaces,
rather than tabs
(setq-default indent-tabs-mode nil)

;; Tried to display time and date in military format,
but does not seem to
;; work for date
(setq display-time-24hr-format t)
(setq european-calendar-style t)
(setq calendar-time-display-form
      '(24-hours ":" minutes
		 (if time-zone " (")
		 time-zone
		 (if time-zone ")")))
(display-time)

(require 'paren)

;; Miscellaneous niceties...
(setq next-line-add-newlines nil)
;;(setq frame-title-format "emacs - %b")
;;(setq vc-default-back-end 'CVS)
(setq make-backup-files nil)

;; Let's you delete the selection with the backspace
key
(delete-selection-mode t)

;; Time stamp
;;(defun insert-date ()
;;  "Insert the current time and date after the
point."
;;  (interactive)
;;  (insert-string (current-time-string)))

;; One touch
(global-set-key [f1] 'goto-line)
(global-set-key [f2] 'find-file)
(global-set-key [f3] 'query-replace)
(global-set-key [f4] 'save-buffer)

(global-set-key [f5] 'isearch-forward-regexp)
(global-set-key [f6] 'compile)
(global-set-key [f7] 'insert-date)
(global-set-key [f8] 'kill-compile)

(global-set-key [f9] 'repeat-complex-command)
(global-set-key [f10] 'join-line)

;; Map .jsp files to HTML mode...
(setq auto-mode-alist
      (cons '("\\.jsp$" . html-mode)
            auto-mode-alist))
(setq auto-mode-alist
      (cons '("\\.wml$" . html-mode)
            auto-mode-alist))

(setq compile-command "make")

;; Color preferences
(setq default-frame-alist
      (append default-frame-alist
	      '((foreground-color . "white")
		(background-color . "black")
		(cursor-color . "burlywood"))))

(set-face-foreground 'bold "yellow")
(set-face-background 'bold "grey40")

(set-face-foreground 'bold-italic "yellow green")
(set-face-foreground 'italic "yellow3")

(set-face-foreground 'region "white")
(set-face-foreground 'region "blue")

;; Here is more font-lock coloring stuff...
(make-face 'fl-comment-face)
(set-face-foreground 'fl-comment-face "light green")
(setq font-lock-comment-face 'fl-comment-face)

(make-face 'fl-doc-string-face)
(set-face-foreground 'fl-doc-string-face "red")
(setq font-lock-doc-string-face 'fl-doc-string-face)

(make-face 'fl-string-face)
(set-face-foreground 'fl-string-face "red")
(setq font-lock-string-face 'fl-string-face)

(make-face 'fl-function-name-face)
(set-face-foreground 'fl-function-name-face
"DeepSkyBlue")
(setq font-lock-function-name-face
'fl-function-name-face)

(make-face 'fl-keyword-face)
(set-face-foreground 'fl-keyword-face "violet")
(setq font-lock-keyword-face 'fl-keyword-face)

;; In this instace, type refers to variable types in
C:  int, char, etc.
(make-face 'fl-type-face)
(set-face-foreground 'fl-type-face "cyan")
(setq font-lock-type-face 'fl-type-face)

(set-face-foreground 'modeline "black")
(set-face-background 'modeline "white")
(set-face-foreground 'highlight "black")
(set-face-foreground 'secondary-selection "black")
(set-face-foreground 'highlight "black")

-- B O'Fallon <bof at americanisp.net> wrote:
> Can syntax highlighting be used under Emacs (not
> XEmacs), similar to
> that of vi's syntax-on option?
> 
> If it can be, how can it be set up?
> 
> Thanks.
> 
> BOF
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List:
http://lists.lug.boulder.co.us/mailman/listinfo/lug


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



More information about the LUG mailing list