aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/progmodes/verilog-mode.el101
2 files changed, 46 insertions, 65 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2fd6cbc1aca..66da03f4b72 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12013-11-14 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 Sync with upstream verilog-mode revision 78e66ba.
4 * progmodes/verilog-mode.el (verilog-end-of-defun)
5 (verilog-type-completion, verilog-get-list): Remove unused funcs.
6 (verilog-get-end-of-defun): Remove unused argument.
7 (verilog-comment-depth): Remove unused local `e'.
8 (verilog-read-decls, verilog-read-sub-decls, verilog-read-instants):
9 Don't pass arg to verilog-get-end-of-defun.
10
12013-11-14 Glenn Morris <rgm@gnu.org> 112013-11-14 Glenn Morris <rgm@gnu.org>
2 12
3 * obsolete/assoc.el (aget): Prefix dynamic variable. 13 * obsolete/assoc.el (aget): Prefix dynamic variable.
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index e67639b671b..3765f8afaca 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -123,7 +123,7 @@
123;;; Code: 123;;; Code:
124 124
125;; This variable will always hold the version number of the mode 125;; This variable will always hold the version number of the mode
126(defconst verilog-mode-version "2013-10-09-1a6ecec-vpo" 126(defconst verilog-mode-version "2013-11-05-78e66ba-vpo"
127 "Version of this Verilog mode.") 127 "Version of this Verilog mode.")
128(defconst verilog-mode-release-emacs t 128(defconst verilog-mode-release-emacs t
129 "If non-nil, this version of Verilog mode was released with Emacs itself.") 129 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -163,12 +163,12 @@
163 (condition-case nil 163 (condition-case nil
164 (if (fboundp 'store-match-data) 164 (if (fboundp 'store-match-data)
165 nil ;; fab 165 nil ;; fab
166 (defmacro store-match-data (&rest args) nil)) 166 (defmacro store-match-data (&rest _args) nil))
167 (error nil)) 167 (error nil))
168 (condition-case nil 168 (condition-case nil
169 (if (fboundp 'char-before) 169 (if (fboundp 'char-before)
170 nil ;; great 170 nil ;; great
171 (defmacro char-before (&rest body) 171 (defmacro char-before (&rest _body)
172 (char-after (1- (point))))) 172 (char-after (1- (point)))))
173 (error nil)) 173 (error nil))
174 (condition-case nil 174 (condition-case nil
@@ -210,23 +210,23 @@ STRING should be given if the last search was by `string-match' on STRING."
210 (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) 210 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
211 nil ;; We've got what we needed 211 nil ;; We've got what we needed
212 ;; We have the old custom-library, hack around it! 212 ;; We have the old custom-library, hack around it!
213 (defmacro defgroup (&rest args) nil) 213 (defmacro defgroup (&rest _args) nil)
214 (defmacro customize (&rest args) 214 (defmacro customize (&rest _args)
215 (message 215 (message
216 "Sorry, Customize is not available with this version of Emacs")) 216 "Sorry, Customize is not available with this version of Emacs"))
217 (defmacro defcustom (var value doc &rest args) 217 (defmacro defcustom (var value doc &rest _args)
218 `(defvar ,var ,value ,doc)) 218 `(defvar ,var ,value ,doc))
219 ) 219 )
220 (if (fboundp 'defface) 220 (if (fboundp 'defface)
221 nil ; great! 221 nil ; great!
222 (defmacro defface (var values doc &rest args) 222 (defmacro defface (var values doc &rest _args)
223 `(make-face ,var)) 223 `(make-face ,var))
224 ) 224 )
225 225
226 (if (and (featurep 'custom) (fboundp 'customize-group)) 226 (if (and (featurep 'custom) (fboundp 'customize-group))
227 nil ;; We've got what we needed 227 nil ;; We've got what we needed
228 ;; We have an intermediate custom-library, hack around it! 228 ;; We have an intermediate custom-library, hack around it!
229 (defmacro customize-group (var &rest args) 229 (defmacro customize-group (var &rest _args)
230 `(customize ,var)) 230 `(customize ,var))
231 ) 231 )
232 232
@@ -259,23 +259,23 @@ STRING should be given if the last search was by `string-match' on STRING."
259 ;with just a two input regexp 259 ;with just a two input regexp
260 (defun verilog-regexp-opt (a b) 260 (defun verilog-regexp-opt (a b)
261 "Deal with differing number of required arguments for `regexp-opt'. 261 "Deal with differing number of required arguments for `regexp-opt'.
262 Call 'regexp-opt' on A and B." 262 Call `regexp-opt' on A and B."
263 (regexp-opt a b 't)) 263 (regexp-opt a b t))
264 (error nil)) 264 (error nil))
265 ) 265 )
266 ((eq args 2) ;; It takes 2 266 ((eq args 2) ;; It takes 2
267 (defun verilog-regexp-opt (a b) 267 (defun verilog-regexp-opt (a b)
268 "Call 'regexp-opt' on A and B." 268 "Call `regexp-opt' on A and B."
269 (regexp-opt a b)) 269 (regexp-opt a b))
270 ) 270 )
271 (t nil))) 271 (t nil)))
272 ;; We can't tell; assume it takes 2 272 ;; We can't tell; assume it takes 2
273 (defun verilog-regexp-opt (a b) 273 (defun verilog-regexp-opt (a b)
274 "Call 'regexp-opt' on A and B." 274 "Call `regexp-opt' on A and B."
275 (regexp-opt a b)) 275 (regexp-opt a b))
276 ) 276 )
277 ;; There is no regexp-opt, provide our own 277 ;; There is no regexp-opt, provide our own
278 (defun verilog-regexp-opt (strings &optional paren shy) 278 (defun verilog-regexp-opt (strings &optional paren _shy)
279 (let ((open (if paren "\\(" "")) (close (if paren "\\)" ""))) 279 (let ((open (if paren "\\(" "")) (close (if paren "\\)" "")))
280 (concat open (mapconcat 'regexp-quote strings "\\|") close))) 280 (concat open (mapconcat 'regexp-quote strings "\\|") close)))
281 ) 281 )
@@ -4081,14 +4081,7 @@ Uses `verilog-scan' cache."
4081 (interactive) 4081 (interactive)
4082 (verilog-re-search-forward verilog-end-defun-re nil 'move)) 4082 (verilog-re-search-forward verilog-end-defun-re nil 'move))
4083 4083
4084(defun verilog-get-beg-of-defun (&optional warn) 4084(defun verilog-get-end-of-defun ()
4085 (save-excursion
4086 (cond ((verilog-re-search-forward-quick verilog-defun-re nil t)
4087 (point))
4088 (t
4089 (error "%s: Can't find module beginning" (verilog-point-text))
4090 (point-max)))))
4091(defun verilog-get-end-of-defun (&optional warn)
4092 (save-excursion 4085 (save-excursion
4093 (cond ((verilog-re-search-forward-quick verilog-end-defun-re nil t) 4086 (cond ((verilog-re-search-forward-quick verilog-end-defun-re nil t)
4094 (point)) 4087 (point))
@@ -6486,9 +6479,9 @@ Do not count named blocks or case-statements."
6486 (looking-at "\*"))) 6479 (looking-at "\*")))
6487 (insert "* "))))) 6480 (insert "* ")))))
6488 6481
6489(defun verilog-comment-indent (&optional arg) 6482(defun verilog-comment-indent (&optional _arg)
6490 "Return the column number the line should be indented to. 6483 "Return the column number the line should be indented to.
6491ARG is ignored, for `comment-indent-function' compatibility." 6484_ARG is ignored, for `comment-indent-function' compatibility."
6492 (cond 6485 (cond
6493 ((verilog-in-star-comment-p) 6486 ((verilog-in-star-comment-p)
6494 (save-excursion 6487 (save-excursion
@@ -6650,8 +6643,8 @@ Be verbose about progress unless optional QUIET set."
6650 (forward-line 1)) 6643 (forward-line 1))
6651 (unless quiet (message ""))))))) 6644 (unless quiet (message "")))))))
6652 6645
6653(defun verilog-pretty-expr (&optional quiet myre) 6646(defun verilog-pretty-expr (&optional quiet _myre)
6654 "Line up expressions around point, optionally QUIET with regexp MYRE ignored." 6647 "Line up expressions around point, optionally QUIET with regexp _MYRE ignored."
6655 (interactive) 6648 (interactive)
6656 (if (not (verilog-in-comment-or-string-p)) 6649 (if (not (verilog-in-comment-or-string-p))
6657 (save-excursion 6650 (save-excursion
@@ -6888,8 +6881,7 @@ Region is defined by B and EDPOS."
6888 ((b (prog2 6881 ((b (prog2
6889 (beginning-of-line) 6882 (beginning-of-line)
6890 (point-marker) 6883 (point-marker)
6891 (end-of-line))) 6884 (end-of-line))))
6892 (e (point-marker)))
6893 (if (re-search-backward " /\\* \[#-\]# \[a-zA-Z\]+ \[0-9\]+ ## \\*/" b t) 6885 (if (re-search-backward " /\\* \[#-\]# \[a-zA-Z\]+ \[0-9\]+ ## \\*/" b t)
6894 (progn 6886 (progn
6895 (replace-match " /* -# ## */") 6887 (replace-match " /* -# ## */")
@@ -7081,24 +7073,6 @@ for matches of `str' and adding the occurrence tp `all' through point END."
7081 (forward-line 1))) 7073 (forward-line 1)))
7082 verilog-all) 7074 verilog-all)
7083 7075
7084(defun verilog-type-completion ()
7085 "Calculate all possible completions for types."
7086 (let ((start (point))
7087 goon)
7088 ;; Search for all reachable type declarations
7089 (while (or (verilog-beg-of-defun)
7090 (setq goon (not goon)))
7091 (save-excursion
7092 (if (and (< start (prog1 (save-excursion (verilog-end-of-defun)
7093 (point))
7094 (forward-char 1)))
7095 (verilog-re-search-forward
7096 "\\<type\\>\\|\\<\\(begin\\|function\\|procedure\\)\\>"
7097 start t)
7098 (not (match-end 1)))
7099 ;; Check current type declaration
7100 (verilog-get-completion-decl start))))))
7101
7102(defun verilog-var-completion () 7076(defun verilog-var-completion ()
7103 "Calculate all possible completions for variables (or constants)." 7077 "Calculate all possible completions for variables (or constants)."
7104 (let ((start (point))) 7078 (let ((start (point)))
@@ -7182,6 +7156,7 @@ exact match, nil otherwise."
7182 ;; Return nil if there was no matching label 7156 ;; Return nil if there was no matching label
7183 nil 7157 nil
7184 ;; Get longest string common in the labels 7158 ;; Get longest string common in the labels
7159 ;; FIXME: Why not use `try-completion'?
7185 (let* ((elm (cdr verilog-all)) 7160 (let* ((elm (cdr verilog-all))
7186 (match (car verilog-all)) 7161 (match (car verilog-all))
7187 (min (length match)) 7162 (min (length match))
@@ -7218,6 +7193,7 @@ exact match, nil otherwise."
7218 "Complete word at current point. 7193 "Complete word at current point.
7219\(See also `verilog-toggle-completions', `verilog-type-keywords', 7194\(See also `verilog-toggle-completions', `verilog-type-keywords',
7220and `verilog-separator-keywords'.)" 7195and `verilog-separator-keywords'.)"
7196 ;; FIXME: Provide completion-at-point-function.
7221 (interactive) 7197 (interactive)
7222 (let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point))) 7198 (let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point)))
7223 (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point))) 7199 (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point)))
@@ -7789,6 +7765,7 @@ Signals must be in standard (base vector) form."
7789 "Return list of signals in IN-LIST that aren't parameters or numeric constants." 7765 "Return list of signals in IN-LIST that aren't parameters or numeric constants."
7790 (let (out-list) 7766 (let (out-list)
7791 (while in-list 7767 (while in-list
7768 ;; Namespace intentionally short for AUTOs and compatibility
7792 (unless (boundp (intern (concat "vh-" (verilog-sig-name (car in-list))))) 7769 (unless (boundp (intern (concat "vh-" (verilog-sig-name (car in-list)))))
7793 (setq out-list (cons (car in-list) out-list))) 7770 (setq out-list (cons (car in-list) out-list)))
7794 (setq in-list (cdr in-list))) 7771 (setq in-list (cdr in-list)))
@@ -8086,7 +8063,7 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
8086(defun verilog-read-decls () 8063(defun verilog-read-decls ()
8087 "Compute signal declaration information for the current module at point. 8064 "Compute signal declaration information for the current module at point.
8088Return an array of [outputs inouts inputs wire reg assign const]." 8065Return an array of [outputs inouts inputs wire reg assign const]."
8089 (let ((end-mod-point (or (verilog-get-end-of-defun t) (point-max))) 8066 (let ((end-mod-point (or (verilog-get-end-of-defun) (point-max)))
8090 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t) 8067 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t)
8091 in-modport in-clocking ptype ign-prop 8068 in-modport in-clocking ptype ign-prop
8092 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const 8069 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const
@@ -8592,7 +8569,7 @@ Outputs comments above subcell signals, for example:
8592 // Inputs 8569 // Inputs
8593 .in (in));" 8570 .in (in));"
8594 (save-excursion 8571 (save-excursion
8595 (let ((end-mod-point (verilog-get-end-of-defun t)) 8572 (let ((end-mod-point (verilog-get-end-of-defun))
8596 st-point end-inst-point 8573 st-point end-inst-point
8597 ;; below 3 modified by verilog-read-sub-decls-line 8574 ;; below 3 modified by verilog-read-sub-decls-line
8598 sigs-out sigs-inout sigs-in sigs-intf sigs-intfd) 8575 sigs-out sigs-inout sigs-in sigs-intf sigs-intfd)
@@ -8887,7 +8864,7 @@ IGNORE-NEXT is true to ignore next token, fake from inside case statement."
8887(defun verilog-read-instants () 8864(defun verilog-read-instants ()
8888 "Parse module at point and return list of ( ( file instance ) ... )." 8865 "Parse module at point and return list of ( ( file instance ) ... )."
8889 (verilog-beg-of-defun-quick) 8866 (verilog-beg-of-defun-quick)
8890 (let* ((end-mod-point (verilog-get-end-of-defun t)) 8867 (let* ((end-mod-point (verilog-get-end-of-defun))
8891 (state nil) 8868 (state nil)
8892 (instants-list nil)) 8869 (instants-list nil))
8893 (save-excursion 8870 (save-excursion
@@ -9034,12 +9011,14 @@ If found returns `verilog-read-auto-template-inside' structure."
9034 "Set the definition DEFNAME to the DEFVALUE in the given BUFFER. 9011 "Set the definition DEFNAME to the DEFVALUE in the given BUFFER.
9035Optionally associate it with the specified enumeration ENUMNAME." 9012Optionally associate it with the specified enumeration ENUMNAME."
9036 (with-current-buffer (or buffer (current-buffer)) 9013 (with-current-buffer (or buffer (current-buffer))
9014 ;; Namespace intentionally short for AUTOs and compatibility
9037 (let ((mac (intern (concat "vh-" defname)))) 9015 (let ((mac (intern (concat "vh-" defname))))
9038 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1) 9016 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1)
9039 ;; Need to define to a constant if no value given 9017 ;; Need to define to a constant if no value given
9040 (set (make-local-variable mac) 9018 (set (make-local-variable mac)
9041 (if (equal defvalue "") "1" defvalue))) 9019 (if (equal defvalue "") "1" defvalue)))
9042 (if enumname 9020 (if enumname
9021 ;; Namespace intentionally short for AUTOs and compatibility
9043 (let ((enumvar (intern (concat "venum-" enumname)))) 9022 (let ((enumvar (intern (concat "venum-" enumname))))
9044 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1) 9023 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1)
9045 (unless (boundp enumvar) (set enumvar nil)) 9024 (unless (boundp enumvar) (set enumvar nil))
@@ -9424,10 +9403,12 @@ If undefined, and WING-IT, return just SYMBOL without the tick, else nil."
9424 (while (and symbol (string-match "^`" symbol)) 9403 (while (and symbol (string-match "^`" symbol))
9425 (setq symbol (substring symbol 1)) 9404 (setq symbol (substring symbol 1))
9426 (setq symbol 9405 (setq symbol
9406 ;; Namespace intentionally short for AUTOs and compatibility
9427 (if (boundp (intern (concat "vh-" symbol))) 9407 (if (boundp (intern (concat "vh-" symbol)))
9428 ;; Emacs has a bug where boundp on a buffer-local 9408 ;; Emacs has a bug where boundp on a buffer-local
9429 ;; variable in only one buffer returns t in another. 9409 ;; variable in only one buffer returns t in another.
9430 ;; This can confuse, so check for nil. 9410 ;; This can confuse, so check for nil.
9411 ;; Namespace intentionally short for AUTOs and compatibility
9431 (let ((val (eval (intern (concat "vh-" symbol))))) 9412 (let ((val (eval (intern (concat "vh-" symbol)))))
9432 (if (eq val nil) 9413 (if (eq val nil)
9433 (if wing-it symbol nil) 9414 (if wing-it symbol nil)
@@ -9460,10 +9441,12 @@ If the variable vh-{symbol} is defined, substitute that value."
9460 (setq symbol (match-string 1 text)) 9441 (setq symbol (match-string 1 text))
9461 ;;(message symbol) 9442 ;;(message symbol)
9462 (cond ((and 9443 (cond ((and
9444 ;; Namespace intentionally short for AUTOs and compatibility
9463 (boundp (intern (concat "vh-" symbol))) 9445 (boundp (intern (concat "vh-" symbol)))
9464 ;; Emacs has a bug where boundp on a buffer-local 9446 ;; Emacs has a bug where boundp on a buffer-local
9465 ;; variable in only one buffer returns t in another. 9447 ;; variable in only one buffer returns t in another.
9466 ;; This can confuse, so check for nil. 9448 ;; This can confuse, so check for nil.
9449 ;; Namespace intentionally short for AUTOs and compatibility
9467 (setq val (eval (intern (concat "vh-" symbol))))) 9450 (setq val (eval (intern (concat "vh-" symbol)))))
9468 (setq text (replace-match val nil nil text))) 9451 (setq text (replace-match val nil nil text)))
9469 (t (setq ok nil))))) 9452 (t (setq ok nil)))))
@@ -9807,6 +9790,7 @@ those clocking block's signals."
9807 (setq out-list (cons (car in-list) out-list))) 9790 (setq out-list (cons (car in-list) out-list)))
9808 (setq in-list (cdr in-list))) 9791 (setq in-list (cdr in-list)))
9809 ;; New scheme 9792 ;; New scheme
9793 ;; Namespace intentionally short for AUTOs and compatibility
9810 (let* ((enumvar (intern (concat "venum-" enum))) 9794 (let* ((enumvar (intern (concat "venum-" enum)))
9811 (enumlist (and (boundp enumvar) (eval enumvar)))) 9795 (enumlist (and (boundp enumvar) (eval enumvar))))
9812 (while enumlist 9796 (while enumlist
@@ -10033,19 +10017,6 @@ This repairs those mis-inserted by an AUTOARG."
10033 (when (looking-at ",") 10017 (when (looking-at ",")
10034 (delete-char 1)))) 10018 (delete-char 1))))
10035 10019
10036(defun verilog-get-list (start end)
10037 "Return the elements of a comma separated list between START and END."
10038 (interactive)
10039 (let ((my-list (list))
10040 my-string)
10041 (save-excursion
10042 (while (< (point) end)
10043 (when (re-search-forward "\\([^,{]+\\)" end t)
10044 (setq my-string (verilog-string-remove-spaces (match-string 1)))
10045 (setq my-list (nconc my-list (list my-string) ))
10046 (goto-char (match-end 0))))
10047 my-list)))
10048
10049(defun verilog-make-width-expression (range-exp) 10020(defun verilog-make-width-expression (range-exp)
10050 "Return an expression calculating the length of a range [x:y] in RANGE-EXP." 10021 "Return an expression calculating the length of a range [x:y] in RANGE-EXP."
10051 ;; strip off the [] 10022 ;; strip off the []
@@ -10799,7 +10770,7 @@ See the example in `verilog-auto-inout-modport'."
10799 (setq sigs (cdr sigs)))) 10770 (setq sigs (cdr sigs))))
10800 (verilog-insert-indent "// End of automatics\n"))))))) 10771 (verilog-insert-indent "// End of automatics\n")))))))
10801 10772
10802(defun verilog-auto-inst-port-map (port-st) 10773(defun verilog-auto-inst-port-map (_port-st)
10803 nil) 10774 nil)
10804 10775
10805(defvar vl-cell-type nil "See `verilog-auto-inst'.") ; Prevent compile warning 10776(defvar vl-cell-type nil "See `verilog-auto-inst'.") ; Prevent compile warning
@@ -10887,7 +10858,7 @@ If PAR-VALUES replace final strings with these parameter values."
10887 (setq expr (verilog-string-replace-matches "\\\\\"" "\"" nil nil expr)) 10858 (setq expr (verilog-string-replace-matches "\\\\\"" "\"" nil nil expr))
10888 (setq expr (verilog-string-replace-matches "@" tpl-num nil nil expr)) 10859 (setq expr (verilog-string-replace-matches "@" tpl-num nil nil expr))
10889 (prin1 (eval (car (read-from-string expr))) 10860 (prin1 (eval (car (read-from-string expr)))
10890 (lambda (ch) ()))))) 10861 (lambda (_ch) ())))))
10891 (if (numberp value) (setq value (number-to-string value))) 10862 (if (numberp value) (setq value (number-to-string value)))
10892 value)) 10863 value))
10893 (substring tpl-net (match-end 0)))))) 10864 (substring tpl-net (match-end 0))))))
@@ -12303,7 +12274,7 @@ Limitations:
12303 Interface names must be resolvable to filenames. See `verilog-auto-inst'. 12274 Interface names must be resolvable to filenames. See `verilog-auto-inst'.
12304 12275
12305As with other autos, any inputs/outputs declared in the module 12276As with other autos, any inputs/outputs declared in the module
12306will suppress the AUTO from redeclaring an input/output by 12277will suppress the AUTO from redeclaring an inputs/outputs by
12307the same name. 12278the same name.
12308 12279
12309An example: 12280An example:
@@ -13766,7 +13737,7 @@ and the case items."
13766 "Map containing mouse bindings for `verilog-mode'.") 13737 "Map containing mouse bindings for `verilog-mode'.")
13767 13738
13768 13739
13769(defun verilog-highlight-region (beg end old-len) 13740(defun verilog-highlight-region (beg end _old-len)
13770 "Colorize included files and modules in the (changed?) region. 13741 "Colorize included files and modules in the (changed?) region.
13771Clicking on the middle-mouse button loads them in a buffer (as in dired)." 13742Clicking on the middle-mouse button loads them in a buffer (as in dired)."
13772 (when (or verilog-highlight-includes 13743 (when (or verilog-highlight-includes