How to Install Verilog-Mode version 3.29 for EmacsClick here if you've got it installed, but got no colors... Click here if you want to see some frequently
asked questions and answers.
% uudecode < foo This will create a file called verilog-mode.el.gz in your current directory. Now you can remove the file called foo.If your uudecode doesn't work right, feel free to use this perl version of uudecode.
% gunzip verilog-mode.el.gz
verilog-mode.el
(defun prepend-path ( my-path ) (setq load-path (cons (expand-file-name my-path) load-path))) (defun append-path ( my-path ) (setq load-path (append load-path (list (expand-file-name my-path))))) ;; Look first in the directory ~/elisp for elisp files (prepend-path "~/elisp") ;; Load verilog mode only when needed (autoload 'verilog-mode "verilog-mode" "Verilog mode" t ) ;; Any files that end in .v should be in verilog mode (setq auto-mode-alist (cons '("\\.v\\'" . verilog-mode) auto-mode-alist)) ;; Any files in verilog mode should have their keywords colorized (add-hook 'verilog-mode-hook '(lambda () (font-lock-mode 1)))
load-path's value is ("/home/mac/emacs/lisp" "/usr/local/share/emacs/19.34/site-lisp" "/usr/local/share/emacs/site-lisp" "/usr/local/share/emacs/19.34/lisp") Documentation: *List of directories to search for files to load. From examining this, I deduce that /usr/local/share/emacs/site-lisp seems appropriate. I didn't choose /usr/local/share/emacs/19.34/site-lisp as verilog-mode.el is not emacs-version specific.
;; Load verilog mode only when needed (autoload 'verilog-mode "verilog-mode" "Verilog mode" t ) ;; Any files that end in .v should be in verilog mode (setq auto-mode-alist (cons '("\\.v\\'" . verilog-mode) auto-mode-alist)) ;; Any files in verilog mode should have their keywords colorized (add-hook 'verilog-mode-hook '(lambda () (font-lock-mode 1)))
ColorsColoring your code is really cool, impresses your friends, and actually does help one code quicker, and helps one understand others code. The only problem is that each version of emacs has different ways of specifying what color should be used, and hence it is a bear.For a while, I distributed code folks could put in their .emacs that would attempt to figure out what version of emacs (FSF or XEmacs) was installed, and which sub version of the two major packages was in use. Further, it attempted to determine if the user had a dark, or a light background, and then would install my notion of what might be nice colors. The world is changing too fast; and both XEmacs and FSF emacs now have easy to modify, and quite reasonable defaults. Therefore I removed my distributed code, and have added this section to support folks still using older emacsen. Find your version below, and see what hints I have for getting colors to work. First: install verilog-mode as per the above instructions.
(setq font-lock-face-attributes '((font-lock-comment-face "Firebrick") (font-lock-string-face "RosyBrown") (font-lock-keyword-face "Purple") (font-lock-function-name-face "Blue") (font-lock-variable-name-face "DarkGoldenrod") (font-lock-type-face "DarkOliveGreen") (font-lock-reference-face "CadetBlue"))) These are the defaults; go ahead and change the values in quotes to anything you'd rather have. Clicking on the Edit->Text Properties->Display Colors gives you a buffer of color names, alternatively with the foreground, or background in that color. This can be useful for addressing the question, "That's ugly, what would be a better color?" Going to Edit->Text Properties->Display Faces will show you the faces that have already been set up. To learn more about how to use emacs in general, type control-h t to an emacs process; it will lead you through a step by step tutorial about emacs.
Frequently Asked Questions (and Answers!)
(add-hook 'verilog-mode-hook '(lambda () (add-hook 'local-write-file-hooks (lambda() (untabify (point-min) (point-max))))))Some explanation: This arranges so that any file in verilog mode (the "add-hook 'verilog-mode-hook" part) gets added to it's 'local-write-file-hooks' a call to the function 'untabify' with arguments that are the first and last character in the buffer. untabify does: `untabify' is an interactive autoloaded Lisp function -- autoloads from "tabify" Convert all tabs in region to multiple spaces, preserving columns. Called non-interactively, the region is specified by arguments START and END, rather than by the position of point and mark. The variable `tab-width' controls the spacing of tab stops. Is there any way to indent a whole module/function/if clause etc. like c-indent-exp [M-C-q] in C-mode ? Last modified: Thu Feb 11 13:38:51 PST 1999 |