aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-12-19 02:56:45 +0000
committerGlenn Morris2007-12-19 02:56:45 +0000
commit5b57e6c6286b916db1bf946640296f873afd9b50 (patch)
treec16c741c1824c83eec4665a2b3f1ce723f4ff252
parentc34dc850cedfae203930643fcef7a8f39e0aed09 (diff)
downloademacs-5b57e6c6286b916db1bf946640296f873afd9b50.tar.gz
emacs-5b57e6c6286b916db1bf946640296f873afd9b50.zip
(top-level): Don't require compile.
(compilation-error-regexp-alist, compilation-last-buffer): Define for compiler. (verilog-insert-1): New function. (verilog-insert-indices, verilog-generate-numbers): Doc fixes. Use verilog-insert-1. (verilog-surelint-off): Use next-error-last-buffer if bound. Check compile buffer is live.
-rw-r--r--lisp/ChangeLog16
-rw-r--r--lisp/progmodes/verilog-mode.el188
2 files changed, 116 insertions, 88 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0c0db1539a4..41c6f9a17c1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,19 @@
12007-12-19 Glenn Morris <rgm@gnu.org>
2
3 * progmodes/verilog-mode.el (top-level): Don't require compile.
4 (compilation-error-regexp-alist, compilation-last-buffer):
5 Define for compiler.
6 (verilog-insert-1): New function.
7 (verilog-insert-indices, verilog-generate-numbers): Doc fixes.
8 Use verilog-insert-1.
9 (verilog-surelint-off): Use next-error-last-buffer if bound.
10 Check compile buffer is live.
11
122007-12-19 John J Foerch <jjfoerch@earthlink.net> (tiny change)
13
14 * progmodes/compile.el (compilation-start): Don't pass a FRAME
15 argument to display-buffer.
16
12007-12-19 Jason Rumney <jasonr@gnu.org> 172007-12-19 Jason Rumney <jasonr@gnu.org>
2 18
3 * nxml/rng-maint.el (rng-format-manual): Do not autoload. 19 * nxml/rng-maint.el (rng-format-manual): Do not autoload.
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 884e85e47f2..655352e1365 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -117,8 +117,6 @@
117 (interactive) 117 (interactive)
118 (message "Using verilog-mode version %s" verilog-mode-version)) 118 (message "Using verilog-mode version %s" verilog-mode-version))
119 119
120(require 'compile)
121
122;; Insure we have certain packages, and deal with it if we don't 120;; Insure we have certain packages, and deal with it if we don't
123(eval-when-compile 121(eval-when-compile
124 (when (featurep 'xemacs) 122 (when (featurep 'xemacs)
@@ -1184,6 +1182,9 @@ without the directory portion, will be substituted."
1184 "\\b__FILE__\\b" (file-name-nondirectory (buffer-file-name)) 1182 "\\b__FILE__\\b" (file-name-nondirectory (buffer-file-name))
1185 t t compile-command)))) 1183 t t compile-command))))
1186 1184
1185;; Following code only gets called from compilation-mode-hook.
1186(defvar compilation-error-regexp-alist)
1187
1187(defun verilog-error-regexp-add () 1188(defun verilog-error-regexp-add ()
1188 "Add the messages to the `compilation-error-regexp-alist'. 1189 "Add the messages to the `compilation-error-regexp-alist'.
1189Called by `compilation-mode-hook'. This allows \\[next-error] to find the errors." 1190Called by `compilation-mode-hook'. This allows \\[next-error] to find the errors."
@@ -2681,13 +2682,30 @@ To call this from the command line, see \\[verilog-batch-indent]."
2681 (newline) 2682 (newline)
2682 (insert " * ")) 2683 (insert " * "))
2683 2684
2684(defun verilog-insert-indices (MAX) 2685(defun verilog-insert-1 (fmt max)
2685 "Insert a set of indices at into the rectangle. 2686 "Insert integers 0 to MAX-1 according to format string FMT.
2686The upper left corner is defined by the current point. Indices always 2687Inserts one integer per line, at the current column. Stops early
2687begin with 0 and extend to the MAX - 1. If no prefix arg is given, the 2688if it reaches the end of the buffer."
2688user is prompted for a value. The indices are surrounded by square brackets 2689 (let ((col (current-column))
2689\[]. For example, the following code with the point located after the first 2690 (n 0))
2690'a' gives: 2691 (save-excursion
2692 (while (< n max)
2693 (insert (format fmt n))
2694 (forward-line 1)
2695 ;; Note that this function does not bother to check for lines
2696 ;; shorter than col.
2697 (if (eobp)
2698 (setq n max)
2699 (setq n (1+ n))
2700 (move-to-column col))))))
2701
2702(defun verilog-insert-indices (max)
2703 "Insert a set of indices into a rectangle.
2704The upper left corner is defined by point. Indices begin with 0
2705and extend to the MAX - 1. If no prefix arg is given, the user
2706is prompted for a value. The indices are surrounded by square
2707brackets \[]. For example, the following code with the point
2708located after the first 'a' gives:
2691 2709
2692 a = b a[ 0] = b 2710 a = b a[ 0] = b
2693 a = b a[ 1] = b 2711 a = b a[ 1] = b
@@ -2699,41 +2717,28 @@ user is prompted for a value. The indices are surrounded by square brackets
2699 a = b a[ 7] = b 2717 a = b a[ 7] = b
2700 a = b a[ 8] = b" 2718 a = b a[ 8] = b"
2701 2719
2702 (interactive "NMAX?") 2720 (interactive "NMAX? ")
2703 (save-excursion 2721 (verilog-insert-1 "[%3d]" max))
2704 (let ((n 0))
2705 (while (< n MAX)
2706 (save-excursion
2707 (insert (format "[%3d]" n)))
2708 (next-line 1)
2709 (setq n (1+ n))))))
2710
2711 2722
2712(defun verilog-generate-numbers (MAX) 2723(defun verilog-generate-numbers (max)
2713 "Insert a set of generated numbers into a rectangle. 2724 "Insert a set of generated numbers into a rectangle.
2714The upper left corner is defined by point. The numbers are padded to three 2725The upper left corner is defined by point. The numbers are padded to three
2715digits, starting with 000 and extending to (MAX - 1). If no prefix argument 2726digits, starting with 000 and extending to (MAX - 1). If no prefix argument
2716is supplied, then the user is prompted for the MAX number. consider the 2727is supplied, then the user is prompted for the MAX number. Consider the
2717following code fragment: 2728following code fragment:
2718 2729
2719 buf buf buf buf000 2730 buf buf buf buf000
2720 buf buf buf buf001 2731 buf buf buf buf001
2721 buf buf buf buf002 2732 buf buf buf buf002
2722 buf buf buf buf003 2733 buf buf buf buf003
2723 buf buf ==> insert-indices ==> buf buf004 2734 buf buf ==> generate-numbers ==> buf buf004
2724 buf buf buf buf005 2735 buf buf buf buf005
2725 buf buf buf buf006 2736 buf buf buf buf006
2726 buf buf buf buf007 2737 buf buf buf buf007
2727 buf buf buf buf008" 2738 buf buf buf buf008"
2728 2739
2729 (interactive "NMAX?") 2740 (interactive "NMAX? ")
2730 (save-excursion 2741 (verilog-insert-1 "%3.3d" max))
2731 (let ((n 0))
2732 (while (< n MAX)
2733 (save-excursion
2734 (insert (format "%3.3d" n)))
2735 (next-line 1)
2736 (setq n (1+ n))))))
2737 2742
2738(defun verilog-mark-defun () 2743(defun verilog-mark-defun ()
2739 "Mark the current verilog function (or procedure). 2744 "Mark the current verilog function (or procedure).
@@ -3686,6 +3691,8 @@ See \\[verilog-surelint-off] and \\[verilog-verilint-off]."
3686 (verilog-verilint-off)) 3691 (verilog-verilint-off))
3687 (t (error "Linter name not set"))))) 3692 (t (error "Linter name not set")))))
3688 3693
3694(defvar compilation-last-buffer)
3695
3689(defun verilog-surelint-off () 3696(defun verilog-surelint-off ()
3690 "Convert a SureLint warning line into a disable statement. 3697 "Convert a SureLint warning line into a disable statement.
3691Run from Verilog source window; assumes there is a *compile* buffer 3698Run from Verilog source window; assumes there is a *compile* buffer
@@ -3696,56 +3703,61 @@ For example:
3696becomes: 3703becomes:
3697 // surefire lint_line_off UDDONX" 3704 // surefire lint_line_off UDDONX"
3698 (interactive) 3705 (interactive)
3699 (save-excursion 3706 (let ((buff (if (boundp 'next-error-last-buffer)
3700 (switch-to-buffer compilation-last-buffer) 3707 next-error-last-buffer
3701 (beginning-of-line) 3708 compilation-last-buffer)))
3702 (when 3709 (when (buffer-live-p buff)
3703 (looking-at "\\(INFO\\|WARNING\\|ERROR\\) \\[[^-]+-\\([^]]+\\)\\]: \\([^,]+\\), line \\([0-9]+\\): \\(.*\\)$") 3710 ;; FIXME with-current-buffer?
3704 (let* ((code (match-string 2)) 3711 (save-excursion
3705 (file (match-string 3)) 3712 (switch-to-buffer buff)
3706 (line (match-string 4)) 3713 (beginning-of-line)
3707 (buffer (get-file-buffer file)) 3714 (when
3708 dir filename) 3715 (looking-at "\\(INFO\\|WARNING\\|ERROR\\) \\[[^-]+-\\([^]]+\\)\\]: \\([^,]+\\), line \\([0-9]+\\): \\(.*\\)$")
3709 (unless buffer 3716 (let* ((code (match-string 2))
3710 (progn 3717 (file (match-string 3))
3711 (setq buffer 3718 (line (match-string 4))
3712 (and (file-exists-p file) 3719 (buffer (get-file-buffer file))
3713 (find-file-noselect file))) 3720 dir filename)
3714 (or buffer 3721 (unless buffer
3715 (let* ((pop-up-windows t)) 3722 (progn
3716 (let ((name (expand-file-name 3723 (setq buffer
3717 (read-file-name 3724 (and (file-exists-p file)
3718 (format "Find this error in: (default %s) " 3725 (find-file-noselect file)))
3719 file) 3726 (or buffer
3720 dir file t)))) 3727 (let* ((pop-up-windows t))
3721 (if (file-directory-p name) 3728 (let ((name (expand-file-name
3722 (setq name (expand-file-name filename name))) 3729 (read-file-name
3723 (setq buffer 3730 (format "Find this error in: (default %s) "
3724 (and (file-exists-p name) 3731 file)
3725 (find-file-noselect name)))))))) 3732 dir file t))))
3726 (switch-to-buffer buffer) 3733 (if (file-directory-p name)
3727 (goto-line (string-to-number line)) 3734 (setq name (expand-file-name filename name)))
3728 (end-of-line) 3735 (setq buffer
3729 (catch 'already 3736 (and (file-exists-p name)
3730 (cond 3737 (find-file-noselect name))))))))
3731 ((verilog-in-slash-comment-p) 3738 (switch-to-buffer buffer)
3732 (re-search-backward "//") 3739 (goto-line (string-to-number line))
3733 (cond 3740 (end-of-line)
3734 ((looking-at "// surefire lint_off_line ") 3741 (catch 'already
3735 (goto-char (match-end 0)) 3742 (cond
3736 (let ((lim (save-excursion (end-of-line) (point)))) 3743 ((verilog-in-slash-comment-p)
3737 (if (re-search-forward code lim 'move) 3744 (re-search-backward "//")
3738 (throw 'already t) 3745 (cond
3739 (insert (concat " " code))))) 3746 ((looking-at "// surefire lint_off_line ")
3740 (t 3747 (goto-char (match-end 0))
3741 ))) 3748 (let ((lim (save-excursion (end-of-line) (point))))
3742 ((verilog-in-star-comment-p) 3749 (if (re-search-forward code lim 'move)
3743 (re-search-backward "/\*") 3750 (throw 'already t)
3744 (insert (format " // surefire lint_off_line %6s" code )) 3751 (insert (concat " " code)))))
3745 ) 3752 (t
3746 (t 3753 )))
3747 (insert (format " // surefire lint_off_line %6s" code )) 3754 ((verilog-in-star-comment-p)
3748 ))))))) 3755 (re-search-backward "/\*")
3756 (insert (format " // surefire lint_off_line %6s" code ))
3757 )
3758 (t
3759 (insert (format " // surefire lint_off_line %6s" code ))
3760 )))))))))
3749 3761
3750(defun verilog-verilint-off () 3762(defun verilog-verilint-off ()
3751 "Convert a Verilint warning line into a disable statement. 3763 "Convert a Verilint warning line into a disable statement.