aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorJoakim Verona2011-12-28 11:34:15 +0100
committerJoakim Verona2011-12-28 11:34:15 +0100
commit2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f (patch)
tree034e65ef002631d0aba8fc1a41e9984fc557e630 /lisp/progmodes
parentbb29f044aa967831cd664c54eba0de0c701436ce (diff)
parentd23ab8e8726ecb7e3554644857b4a58e5f7408f1 (diff)
downloademacs-2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f.tar.gz
emacs-2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f.zip
upstream
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/ada-mode.el6
-rw-r--r--lisp/progmodes/ada-stmt.el2
-rw-r--r--lisp/progmodes/ada-xref.el2
-rw-r--r--lisp/progmodes/cc-awk.el8
-rw-r--r--lisp/progmodes/cc-cmds.el6
-rw-r--r--lisp/progmodes/cc-defs.el2
-rw-r--r--lisp/progmodes/cc-engine.el234
-rw-r--r--lisp/progmodes/cc-fonts.el32
-rw-r--r--lisp/progmodes/cc-langs.el72
-rw-r--r--lisp/progmodes/cc-mode.el196
-rw-r--r--lisp/progmodes/cc-vars.el2
-rw-r--r--lisp/progmodes/cfengine.el142
-rw-r--r--lisp/progmodes/cperl-mode.el14
-rw-r--r--lisp/progmodes/dcl-mode.el4
-rw-r--r--lisp/progmodes/ebnf2ps.el8
-rw-r--r--lisp/progmodes/gdb-mi.el223
-rw-r--r--lisp/progmodes/grep.el7
-rw-r--r--lisp/progmodes/gud.el108
-rw-r--r--lisp/progmodes/hideif.el2
-rw-r--r--lisp/progmodes/idlwave.el4
-rw-r--r--lisp/progmodes/inf-lisp.el2
-rw-r--r--lisp/progmodes/js.el2
-rw-r--r--lisp/progmodes/make-mode.el58
-rw-r--r--lisp/progmodes/pascal.el1
-rw-r--r--lisp/progmodes/prolog.el6
-rw-r--r--lisp/progmodes/python.el2
-rw-r--r--lisp/progmodes/sql.el2
-rw-r--r--lisp/progmodes/vera-mode.el4
-rw-r--r--lisp/progmodes/verilog-mode.el20
-rw-r--r--lisp/progmodes/vhdl-mode.el26
30 files changed, 670 insertions, 527 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index 64734420a8c..17ff4bd32a6 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -499,7 +499,7 @@ Used to define `ada-*-keywords.'"))
499 499
500(defvar ada-case-exception-substring '() 500(defvar ada-case-exception-substring '()
501 "Alist of substrings (entities) that have special casing. 501 "Alist of substrings (entities) that have special casing.
502The substrings are detected for word constituant when the word 502The substrings are detected for word constituent when the word
503is not itself in `ada-case-exception', and only for substrings that 503is not itself in `ada-case-exception', and only for substrings that
504either are at the beginning or end of the word, or start after '_'.") 504either are at the beginning or end of the word, or start after '_'.")
505 505
@@ -1773,7 +1773,7 @@ ATTENTION: This function might take very long for big buffers!"
1773;; `ada-insert-paramlist'. 1773;; `ada-insert-paramlist'.
1774;; Both steps are called from `ada-format-paramlist'. 1774;; Both steps are called from `ada-format-paramlist'.
1775;; Note: Comments inside the parameter list are lost. 1775;; Note: Comments inside the parameter list are lost.
1776;; The syntax has to be correct, or the reformating will fail. 1776;; The syntax has to be correct, or the reformatting will fail.
1777;;-------------------------------------------------------------- 1777;;--------------------------------------------------------------
1778 1778
1779(defun ada-format-paramlist () 1779(defun ada-format-paramlist ()
@@ -2139,7 +2139,7 @@ command like:
2139 2139
2140 (while command-line-args-left 2140 (while command-line-args-left
2141 (let ((source (car command-line-args-left))) 2141 (let ((source (car command-line-args-left)))
2142 (message "Formating %s" source) 2142 (message "Formatting %s" source)
2143 (find-file source) 2143 (find-file source)
2144 (ada-indent-region (point-min) (point-max)) 2144 (ada-indent-region (point-min) (point-max))
2145 (ada-adjust-case-buffer) 2145 (ada-adjust-case-buffer)
diff --git a/lisp/progmodes/ada-stmt.el b/lisp/progmodes/ada-stmt.el
index e48055c9f50..b33da441eeb 100644
--- a/lisp/progmodes/ada-stmt.el
+++ b/lisp/progmodes/ada-stmt.el
@@ -56,7 +56,7 @@
56;; BUGS: 56;; BUGS:
57;;;> I have the following suggestions for the function template: 1) I 57;;;> I have the following suggestions for the function template: 1) I
58;;;> don't want it automatically assigning it a name for the return variable. I 58;;;> don't want it automatically assigning it a name for the return variable. I
59;;;> never want it to be called "Result" because that is nondescriptive. If you 59;;;> never want it to be called "Result" because that is nondescript. If you
60;;;> must define a variable, give me the ability to specify its name. 60;;;> must define a variable, give me the ability to specify its name.
61;;;> 61;;;>
62;;;> 2) You do not provide a type for variable 'Result'. Its type is the same 62;;;> 2) You do not provide a type for variable 'Result'. Its type is the same
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 2f6a7be393a..f30457992a3 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -30,7 +30,7 @@
30;;; for lookup and completion in Ada mode. 30;;; for lookup and completion in Ada mode.
31;;; 31;;;
32;;; If a file *.`adp' exists in the ada-file directory, then it is 32;;; If a file *.`adp' exists in the ada-file directory, then it is
33;;; read for configuration informations. It is read only the first 33;;; read for configuration information. It is read only the first
34;;; time a cross-reference is asked for, and is not read later. 34;;; time a cross-reference is asked for, and is not read later.
35 35
36;;; You need Emacs >= 20.2 to run this package 36;;; You need Emacs >= 20.2 to run this package
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el
index 8213a83461b..ef67a18d807 100644
--- a/lisp/progmodes/cc-awk.el
+++ b/lisp/progmodes/cc-awk.el
@@ -545,7 +545,7 @@
545(defun c-awk-vsemi-status-unknown-p () 545(defun c-awk-vsemi-status-unknown-p ()
546 ;; Are we unsure whether there is a virtual semicolon on the current line? 546 ;; Are we unsure whether there is a virtual semicolon on the current line?
547 ;; DO NOT under any circumstances attempt to calculate this; that would 547 ;; DO NOT under any circumstances attempt to calculate this; that would
548 ;; defeat the (admittedly kludgey) purpose of this function, which is to 548 ;; defeat the (admittedly kludgy) purpose of this function, which is to
549 ;; prevent an infinite recursion in c-beginning-of-statement-1 when point 549 ;; prevent an infinite recursion in c-beginning-of-statement-1 when point
550 ;; starts at a `while' token. 550 ;; starts at a `while' token.
551 (not (c-get-char-property (c-point 'eol) 'c-awk-NL-prop))) 551 (not (c-get-char-property (c-point 'eol) 'c-awk-NL-prop)))
@@ -894,9 +894,9 @@ std\\(err\\|in\\|out\\)\\|user\\)\\)\\>\
894 ;; Keywords. 894 ;; Keywords.
895 (concat "\\<" 895 (concat "\\<"
896 (regexp-opt 896 (regexp-opt
897 '("BEGIN" "END" "break" "continue" "delete" "do" "else" 897 '("BEGIN" "END" "break" "case" "continue" "default" "delete"
898 "exit" "for" "getline" "if" "in" "next" "nextfile" 898 "do" "else" "exit" "for" "getline" "if" "in" "next"
899 "return" "while") 899 "nextfile" "return" "switch" "while")
900 t) "\\>") 900 t) "\\>")
901 901
902 ;; Builtins. 902 ;; Builtins.
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 8e4ac92d96f..686695bc838 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1360,7 +1360,7 @@ No indentation or other \"electric\" behavior is performed."
1360 ;; Determine where we are with respect to functions (or other brace 1360 ;; Determine where we are with respect to functions (or other brace
1361 ;; constructs, included in the term "function" in the rest of this comment). 1361 ;; constructs, included in the term "function" in the rest of this comment).
1362 ;; Point is assumed to be outside any macro or literal. 1362 ;; Point is assumed to be outside any macro or literal.
1363 ;; This is used by c-\(begining\|end\)-of-defun. 1363 ;; This is used by c-\(beginning\|end\)-of-defun.
1364 ;; 1364 ;;
1365 ;; Return one of these symbols: 1365 ;; Return one of these symbols:
1366 ;; at-header : we're at the start of a function's header. 1366 ;; at-header : we're at the start of a function's header.
@@ -2051,7 +2051,7 @@ function does not require the declaration to contain a brace block."
2051 (c-narrow-to-comment-innards range) ; This may move point back. 2051 (c-narrow-to-comment-innards range) ; This may move point back.
2052 (let* ((here (point)) 2052 (let* ((here (point))
2053 last 2053 last
2054 (here-filler ; matches WS and comment-prefices at point. 2054 (here-filler ; matches WS and comment-prefixes at point.
2055 (concat "\\=\\(^[ \t]*\\(" c-current-comment-prefix "\\)" 2055 (concat "\\=\\(^[ \t]*\\(" c-current-comment-prefix "\\)"
2056 "\\|[ \t\n\r\f]\\)*")) 2056 "\\|[ \t\n\r\f]\\)*"))
2057 (prefix-at-bol-here ; matches WS and prefix at BOL, just before point 2057 (prefix-at-bol-here ; matches WS and prefix at BOL, just before point
@@ -2071,7 +2071,7 @@ function does not require the declaration to contain a brace block."
2071 2071
2072 ;; Now seek successively earlier sentence ends between PAR-BEG and 2072 ;; Now seek successively earlier sentence ends between PAR-BEG and
2073 ;; HERE, until the "start of sentence" following it is earlier than 2073 ;; HERE, until the "start of sentence" following it is earlier than
2074 ;; HERE, or we hit PAR-BEG. Beware of comment prefices! 2074 ;; HERE, or we hit PAR-BEG. Beware of comment prefixes!
2075 (while (and (re-search-backward (c-sentence-end) par-beg 'limit) 2075 (while (and (re-search-backward (c-sentence-end) par-beg 'limit)
2076 (setq last (point)) 2076 (setq last (point))
2077 (goto-char (match-end 0)) ; tentative beginning of sentence 2077 (goto-char (match-end 0)) ; tentative beginning of sentence
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index c91fe13543a..2991b511830 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -473,7 +473,7 @@ various buffer change hooks."
473 473
474 (let ((saved-undo-list (elt saved-state 0))) 474 (let ((saved-undo-list (elt saved-state 0)))
475 (if (eq buffer-undo-list saved-undo-list) 475 (if (eq buffer-undo-list saved-undo-list)
476 ;; No change was done afterall. 476 ;; No change was done after all.
477 (setq buffer-undo-list (cdr saved-undo-list)) 477 (setq buffer-undo-list (cdr saved-undo-list))
478 478
479 (if keep 479 (if keep
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 9544c4f8728..0865ddfed69 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -195,9 +195,6 @@
195 (not prevstate) 195 (not prevstate)
196 (> arg 0))) 196 (> arg 0)))
197 197
198;; Dynamically bound cache for `c-in-literal'.
199(defvar c-in-literal-cache t)
200
201 198
202;; Basic handling of preprocessor directives. 199;; Basic handling of preprocessor directives.
203 200
@@ -2093,28 +2090,35 @@ comment at the start of cc-engine.el for more info."
2093;; `c-state-literal-at'. 2090;; `c-state-literal-at'.
2094 2091
2095(defsubst c-state-pp-to-literal (from to) 2092(defsubst c-state-pp-to-literal (from to)
2096 ;; Do a parse-partial-sexp from FROM to TO, returning the bounds of any 2093 ;; Do a parse-partial-sexp from FROM to TO, returning either
2097 ;; literal at TO as a cons, otherwise NIL. 2094 ;; (STATE TYPE (BEG . END)) if TO is in a literal; or
2098 ;; FROM must not be in a literal, and the buffer should already be wide 2095 ;; (STATE) otherwise,
2099 ;; enough. 2096 ;; where STATE is the parsing state at TO, TYPE is the type of the literal
2097 ;; (one of 'c, 'c++, 'string) and (BEG . END) is the boundaries of the literal.
2098 ;;
2099 ;; Only elements 3 (in a string), 4 (in a comment), 5 (following a quote),
2100 ;; 7 (comment type) and 8 (start of comment/string) (and possibly 9) of
2101 ;; STATE are valid.
2100 (save-excursion 2102 (save-excursion
2101 (let ((s (parse-partial-sexp from to))) 2103 (let ((s (parse-partial-sexp from to))
2104 ty)
2102 (when (or (nth 3 s) (nth 4 s)) ; in a string or comment 2105 (when (or (nth 3 s) (nth 4 s)) ; in a string or comment
2106 (setq ty (cond
2107 ((nth 3 s) 'string)
2108 ((eq (nth 7 s) t) 'c++)
2109 (t 'c)))
2103 (parse-partial-sexp (point) (point-max) 2110 (parse-partial-sexp (point) (point-max)
2104 nil ; TARGETDEPTH 2111 nil ; TARGETDEPTH
2105 nil ; STOPBEFORE 2112 nil ; STOPBEFORE
2106 s ; OLDSTATE 2113 s ; OLDSTATE
2107 'syntax-table) ; stop at end of literal 2114 'syntax-table)) ; stop at end of literal
2108 (cons (nth 8 s) (point)))))) 2115 (if ty
2116 `(,s ,ty (,(nth 8 s) . ,(point)))
2117 `(,s)))))
2109 2118
2110(defun c-state-literal-at (here) 2119(defun c-state-safe-place (here)
2111 ;; If position HERE is inside a literal, return (START . END), the 2120 ;; Return a buffer position before HERE which is "safe", i.e. outside any
2112 ;; boundaries of the literal (which may be outside the accessible bit of the 2121 ;; string, comment, or macro.
2113 ;; buffer). Otherwise, return nil.
2114 ;;
2115 ;; This function is almost the same as `c-literal-limits'. It differs in
2116 ;; that it is a lower level function, and that it rigourously follows the
2117 ;; syntax from BOB, whereas `c-literal-limits' uses a "local" safe position.
2118 ;; 2122 ;;
2119 ;; NOTE: This function manipulates `c-state-nonlit-pos-cache'. This cache 2123 ;; NOTE: This function manipulates `c-state-nonlit-pos-cache'. This cache
2120 ;; MAY NOT contain any positions within macros, since macros are frequently 2124 ;; MAY NOT contain any positions within macros, since macros are frequently
@@ -2137,7 +2141,7 @@ comment at the start of cc-engine.el for more info."
2137 2141
2138 (while (<= (setq npos (+ pos c-state-nonlit-pos-interval)) 2142 (while (<= (setq npos (+ pos c-state-nonlit-pos-interval))
2139 here) 2143 here)
2140 (setq lit (c-state-pp-to-literal pos npos)) 2144 (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
2141 (setq pos (or (cdr lit) npos)) ; end of literal containing npos. 2145 (setq pos (or (cdr lit) npos)) ; end of literal containing npos.
2142 (goto-char pos) 2146 (goto-char pos)
2143 (when (and (c-beginning-of-macro) (/= (point) pos)) 2147 (when (and (c-beginning-of-macro) (/= (point) pos))
@@ -2148,9 +2152,22 @@ comment at the start of cc-engine.el for more info."
2148 2152
2149 (if (> pos c-state-nonlit-pos-cache-limit) 2153 (if (> pos c-state-nonlit-pos-cache-limit)
2150 (setq c-state-nonlit-pos-cache-limit pos)) 2154 (setq c-state-nonlit-pos-cache-limit pos))
2151 (if (< pos here) 2155 pos))))
2152 (setq lit (c-state-pp-to-literal pos here))) 2156
2153 lit)))) 2157(defun c-state-literal-at (here)
2158 ;; If position HERE is inside a literal, return (START . END), the
2159 ;; boundaries of the literal (which may be outside the accessible bit of the
2160 ;; buffer). Otherwise, return nil.
2161 ;;
2162 ;; This function is almost the same as `c-literal-limits'. Previously, it
2163 ;; differed in that it was a lower level function, and that it rigourously
2164 ;; followed the syntax from BOB. `c-literal-limits' is now (2011-12)
2165 ;; virtually identical to this function.
2166 (save-restriction
2167 (widen)
2168 (save-excursion
2169 (let ((pos (c-state-safe-place here)))
2170 (car (cddr (c-state-pp-to-literal pos here)))))))
2154 2171
2155(defsubst c-state-lit-beg (pos) 2172(defsubst c-state-lit-beg (pos)
2156 ;; Return the start of the literal containing POS, or POS itself. 2173 ;; Return the start of the literal containing POS, or POS itself.
@@ -4181,7 +4198,7 @@ comment at the start of cc-engine.el for more info."
4181 4198
4182;; Tools for handling comments and string literals. 4199;; Tools for handling comments and string literals.
4183 4200
4184(defun c-slow-in-literal (&optional lim detect-cpp) 4201(defun c-in-literal (&optional lim detect-cpp)
4185 "Return the type of literal point is in, if any. 4202 "Return the type of literal point is in, if any.
4186The return value is `c' if in a C-style comment, `c++' if in a C++ 4203The return value is `c' if in a C-style comment, `c++' if in a C++
4187style comment, `string' if in a string literal, `pound' if DETECT-CPP 4204style comment, `string' if in a string literal, `pound' if DETECT-CPP
@@ -4194,67 +4211,12 @@ The last point calculated is cached if the cache is enabled, i.e. if
4194 4211
4195Note that this function might do hidden buffer changes. See the 4212Note that this function might do hidden buffer changes. See the
4196comment at the start of cc-engine.el for more info." 4213comment at the start of cc-engine.el for more info."
4197 4214 (let* ((safe-place (c-state-safe-place (point)))
4198 (if (and (vectorp c-in-literal-cache) 4215 (lit (c-state-pp-to-literal safe-place (point))))
4199 (= (point) (aref c-in-literal-cache 0))) 4216 (or (cadr lit)
4200 (aref c-in-literal-cache 1) 4217 (and detect-cpp
4201 (let ((rtn (save-excursion 4218 (save-excursion (c-beginning-of-macro))
4202 (let* ((pos (point)) 4219 'pound))))
4203 (lim (or lim (progn
4204 (c-beginning-of-syntax)
4205 (point))))
4206 (state (parse-partial-sexp lim pos)))
4207 (cond
4208 ((elt state 3) 'string)
4209 ((elt state 4) (if (elt state 7) 'c++ 'c))
4210 ((and detect-cpp (c-beginning-of-macro lim)) 'pound)
4211 (t nil))))))
4212 ;; cache this result if the cache is enabled
4213 (if (not c-in-literal-cache)
4214 (setq c-in-literal-cache (vector (point) rtn)))
4215 rtn)))
4216
4217;; XEmacs has a built-in function that should make this much quicker.
4218;; I don't think we even need the cache, which makes our lives more
4219;; complicated anyway. In this case, lim is only used to detect
4220;; cpp directives.
4221;;
4222;; Note that there is a bug in XEmacs's buffer-syntactic-context when used in
4223;; conjunction with syntax-table-properties. The bug is present in, e.g.,
4224;; XEmacs 21.4.4. It manifested itself thus:
4225;;
4226;; Starting with an empty AWK Mode buffer, type
4227;; /regexp/ {<C-j>
4228;; Point gets wrongly left at column 0, rather than being indented to tab-width.
4229;;
4230;; AWK Mode is designed such that when the first / is typed, it gets the
4231;; syntax-table property "string fence". When the second / is typed, BOTH /s
4232;; are given the s-t property "string". However, buffer-syntactic-context
4233;; fails to take account of the change of the s-t property on the opening / to
4234;; "string", and reports that the { is within a string started by the second /.
4235;;
4236;; The workaround for this is for the AWK Mode initialization to switch the
4237;; defalias for c-in-literal to c-slow-in-literal. This will slow down other
4238;; cc-modes in XEmacs whenever an awk-buffer has been initialized.
4239;;
4240;; (Alan Mackenzie, 2003/4/30).
4241
4242(defun c-fast-in-literal (&optional lim detect-cpp)
4243 ;; This function might do hidden buffer changes.
4244 (let ((context (buffer-syntactic-context)))
4245 (cond
4246 ((eq context 'string) 'string)
4247 ((eq context 'comment) 'c++)
4248 ((eq context 'block-comment) 'c)
4249 ((and detect-cpp (save-excursion (c-beginning-of-macro lim))) 'pound))))
4250
4251(defalias 'c-in-literal
4252 (if (fboundp 'buffer-syntactic-context)
4253 'c-fast-in-literal ; XEmacs
4254 'c-slow-in-literal)) ; GNU Emacs
4255
4256;; The defalias above isn't enough to shut up the byte compiler.
4257(cc-bytecomp-defun c-in-literal)
4258 4220
4259(defun c-literal-limits (&optional lim near not-in-delimiter) 4221(defun c-literal-limits (&optional lim near not-in-delimiter)
4260 "Return a cons of the beginning and end positions of the comment or 4222 "Return a cons of the beginning and end positions of the comment or
@@ -4273,64 +4235,56 @@ comment at the start of cc-engine.el for more info."
4273 4235
4274 (save-excursion 4236 (save-excursion
4275 (let* ((pos (point)) 4237 (let* ((pos (point))
4276 (lim (or lim (progn 4238 (lim (or lim (c-state-safe-place pos)))
4277 (c-beginning-of-syntax) 4239 (pp-to-lit (c-state-pp-to-literal lim pos))
4278 (point)))) 4240 (state (car pp-to-lit))
4279 (state (parse-partial-sexp lim pos))) 4241 (lit-type (cadr pp-to-lit))
4280 4242 (lit-limits (car (cddr pp-to-lit))))
4281 (cond ((elt state 3) ; String.
4282 (goto-char (elt state 8))
4283 (cons (point) (or (c-safe (c-forward-sexp 1) (point))
4284 (point-max))))
4285
4286 ((elt state 4) ; Comment.
4287 (goto-char (elt state 8))
4288 (cons (point) (progn (c-forward-single-comment) (point))))
4289
4290 ((and (not not-in-delimiter)
4291 (not (elt state 5))
4292 (eq (char-before) ?/)
4293 (looking-at "[/*]"))
4294 ;; We're standing in a comment starter.
4295 (backward-char 1)
4296 (cons (point) (progn (c-forward-single-comment) (point))))
4297
4298 (near
4299 (goto-char pos)
4300
4301 ;; Search forward for a literal.
4302 (skip-chars-forward " \t")
4303 4243
4304 (cond 4244 (cond
4305 ((looking-at c-string-limit-regexp) ; String. 4245 (lit-limits)
4306 (cons (point) (or (c-safe (c-forward-sexp 1) (point)) 4246 ((and (not not-in-delimiter)
4307 (point-max)))) 4247 (not (elt state 5))
4248 (eq (char-before) ?/)
4249 (looking-at "[/*]")) ; FIXME!!! use c-line/block-comment-starter. 2008-09-28.
4250 ;; We're standing in a comment starter.
4251 (backward-char 1)
4252 (cons (point) (progn (c-forward-single-comment) (point))))
4253
4254 (near
4255 (goto-char pos)
4256 ;; Search forward for a literal.
4257 (skip-chars-forward " \t")
4258 (cond
4259 ((looking-at c-string-limit-regexp) ; String.
4260 (cons (point) (or (c-safe (c-forward-sexp 1) (point))
4261 (point-max))))
4308 4262
4309 ((looking-at c-comment-start-regexp) ; Line or block comment. 4263 ((looking-at c-comment-start-regexp) ; Line or block comment.
4310 (cons (point) (progn (c-forward-single-comment) (point)))) 4264 (cons (point) (progn (c-forward-single-comment) (point))))
4311 4265
4312 (t 4266 (t
4313 ;; Search backward. 4267 ;; Search backward.
4314 (skip-chars-backward " \t") 4268 (skip-chars-backward " \t")
4315 4269
4316 (let ((end (point)) beg) 4270 (let ((end (point)) beg)
4317 (cond 4271 (cond
4318 ((save-excursion 4272 ((save-excursion
4319 (< (skip-syntax-backward c-string-syntax) 0)) ; String. 4273 (< (skip-syntax-backward c-string-syntax) 0)) ; String.
4320 (setq beg (c-safe (c-backward-sexp 1) (point)))) 4274 (setq beg (c-safe (c-backward-sexp 1) (point))))
4321 4275
4322 ((and (c-safe (forward-char -2) t) 4276 ((and (c-safe (forward-char -2) t)
4323 (looking-at "*/")) 4277 (looking-at "*/"))
4324 ;; Block comment. Due to the nature of line 4278 ;; Block comment. Due to the nature of line
4325 ;; comments, they will always be covered by the 4279 ;; comments, they will always be covered by the
4326 ;; normal case above. 4280 ;; normal case above.
4327 (goto-char end) 4281 (goto-char end)
4328 (c-backward-single-comment) 4282 (c-backward-single-comment)
4329 ;; If LIM is bogus, beg will be bogus. 4283 ;; If LIM is bogus, beg will be bogus.
4330 (setq beg (point)))) 4284 (setq beg (point))))
4331 4285
4332 (if beg (cons beg end)))))) 4286 (if beg (cons beg end))))))
4333 )))) 4287 ))))
4334 4288
4335;; In case external callers use this; it did have a docstring. 4289;; In case external callers use this; it did have a docstring.
4336(defalias 'c-literal-limits-fast 'c-literal-limits) 4290(defalias 'c-literal-limits-fast 'c-literal-limits)
@@ -6832,7 +6786,7 @@ comment at the start of cc-engine.el for more info."
6832 got-suffix-after-parens 6786 got-suffix-after-parens
6833 (eq (char-after got-suffix-after-parens) ?\()) 6787 (eq (char-after got-suffix-after-parens) ?\())
6834 ;; Got a type, no declarator but a paren suffix. I.e. it's a 6788 ;; Got a type, no declarator but a paren suffix. I.e. it's a
6835 ;; normal function call afterall (or perhaps a C++ style object 6789 ;; normal function call after all (or perhaps a C++ style object
6836 ;; instantiation expression). 6790 ;; instantiation expression).
6837 (throw 'at-decl-or-cast nil)))) 6791 (throw 'at-decl-or-cast nil))))
6838 6792
@@ -9151,7 +9105,7 @@ comment at the start of cc-engine.el for more info."
9151 'label)) 9105 'label))
9152 (if (eq step 'up) 9106 (if (eq step 'up)
9153 (setq placeholder (point)) 9107 (setq placeholder (point))
9154 ;; There was no containing statement afterall. 9108 ;; There was no containing statement after all.
9155 (goto-char placeholder))))) 9109 (goto-char placeholder)))))
9156 placeholder)) 9110 placeholder))
9157 (if (looking-at c-block-stmt-2-key) 9111 (if (looking-at c-block-stmt-2-key)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index a31de35f3ba..97cfe808322 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -194,9 +194,13 @@
194 (unless (face-property-instance oldface 'reverse) 194 (unless (face-property-instance oldface 'reverse)
195 (invert-face newface))))) 195 (invert-face newface)))))
196 196
197(defvar c-annotation-face (make-face 'c-annotation-face) 197(defvar c-annotation-face 'c-annotation-face)
198 "Face used to highlight annotations in java-mode and other modes that may wish to use it.") 198
199(set-face-foreground 'c-annotation-face "blue") 199(defface c-annotation-face
200 '((default :inherit font-lock-constant-face))
201 "Face for highlighting annotations in Java mode and similar modes."
202 :version "24.1"
203 :group 'c)
200 204
201(eval-and-compile 205(eval-and-compile
202 ;; We need the following definitions during compilation since they're 206 ;; We need the following definitions during compilation since they're
@@ -1207,7 +1211,7 @@ casts and declarations are fontified. Used on level 2 and higher."
1207 ;; o - '<> if the arglist is of angle bracket type; 1211 ;; o - '<> if the arglist is of angle bracket type;
1208 ;; o - 'arglist if it's some other arglist; 1212 ;; o - 'arglist if it's some other arglist;
1209 ;; o - nil, if not in an arglist at all. This includes the 1213 ;; o - nil, if not in an arglist at all. This includes the
1210 ;; parenthesised condition which follows "if", "while", etc. 1214 ;; parenthesized condition which follows "if", "while", etc.
1211 context 1215 context
1212 ;; The position of the next token after the closing paren of 1216 ;; The position of the next token after the closing paren of
1213 ;; the last detected cast. 1217 ;; the last detected cast.
@@ -1534,24 +1538,8 @@ casts and declarations are fontified. Used on level 2 and higher."
1534 ;; prevent a repeat invocation. See elisp/lispref page "Search-based 1538 ;; prevent a repeat invocation. See elisp/lispref page "Search-based
1535 ;; Fontification". 1539 ;; Fontification".
1536 (let* ((paren-state (c-parse-state)) 1540 (let* ((paren-state (c-parse-state))
1537 (start (point)) 1541 decl-context in-typedef ps-elt)
1538 decl-context bo-decl in-typedef type-type ps-elt) 1542 ;; Are we in any nested struct/union/class/etc. braces?
1539
1540 ;; First, are we actually in a "local" declaration?
1541 (setq decl-context (c-beginning-of-decl-1)
1542 bo-decl (point)
1543 in-typedef (looking-at c-typedef-key))
1544 (if in-typedef (c-forward-token-2))
1545 (when (and (eq (car decl-context) 'same)
1546 (< bo-decl start))
1547 ;; Are we genuinely at a type?
1548 (setq type-type (c-forward-type t))
1549 (if (and type-type
1550 (or (not (eq type-type 'maybe))
1551 (looking-at c-symbol-key)))
1552 (c-font-lock-declarators limit t in-typedef)))
1553
1554 ;; Secondly, are we in any nested struct/union/class/etc. braces?
1555 (while paren-state 1543 (while paren-state
1556 (setq ps-elt (car paren-state) 1544 (setq ps-elt (car paren-state)
1557 paren-state (cdr paren-state)) 1545 paren-state (cdr paren-state))
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 37818638d41..2aca885ca35 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -485,28 +485,56 @@ The functions are called even when font locking isn't enabled.
485When the mode is initialized, the functions are called with 485When the mode is initialized, the functions are called with
486parameters \(point-min) and \(point-max).") 486parameters \(point-min) and \(point-max).")
487 487
488(c-lang-defconst c-before-font-lock-function 488(c-lang-defconst c-before-font-lock-functions
489 "If non-nil, a function called just before font locking. 489 ;; For documentation see the following c-lang-defvar of the same name.
490Typically it will extend the region about to be fontified \(see 490 ;; The value here may be a list of functions or a single function.
491 t 'c-change-set-fl-decl-start
492 (c c++ objc) '(c-neutralize-syntax-in-and-mark-CPP
493 c-change-set-fl-decl-start)
494 awk 'c-awk-extend-and-syntax-tablify-region)
495(c-lang-defvar c-before-font-lock-functions
496 (let ((fs (c-lang-const c-before-font-lock-functions)))
497 (if (listp fs)
498 fs
499 (list fs)))
500 "If non-nil, a list of functions called just before font locking.
501Typically they will extend the region about to be fontified \(see
491below) and will set `syntax-table' text properties on the region. 502below) and will set `syntax-table' text properties on the region.
492 503
493It takes 3 parameters, the BEG, END, and OLD-LEN supplied to 504These functions will be run in the order given. Each of them
494every after-change function; point is undefined on both entry and 505takes 3 parameters, the BEG, END, and OLD-LEN supplied to every
495exit; on entry, the buffer will have been widened and match-data 506after-change function; point is undefined on both entry and exit;
496will have been saved; the return value is ignored. 507on entry, the buffer will have been widened and match-data will
508have been saved; the return value is ignored.
497 509
498The function may extend the region to be fontified by setting the 510The functions may extend the region to be fontified by setting the
499buffer local variables c-new-BEG and c-new-END. 511buffer local variables c-new-BEG and c-new-END.
500 512
501The function is called even when font locking is disabled. 513The functions are called even when font locking is disabled.
502 514
503When the mode is initialized, this function is called with 515When the mode is initialized, these functions are called with
504parameters \(point-min), \(point-max) and <buffer size>." 516parameters \(point-min), \(point-max) and <buffer size>.")
505 t nil 517
506 (c c++ objc) 'c-neutralize-syntax-in-and-mark-CPP 518(c-lang-defconst c-before-context-fontification-functions
507 awk 'c-awk-extend-and-syntax-tablify-region) 519 awk nil
508(c-lang-defvar c-before-font-lock-function 520 t 'c-context-set-fl-decl-start)
509 (c-lang-const c-before-font-lock-function)) 521 ;; For documentation see the following c-lang-defvar of the same name.
522 ;; The value here may be a list of functions or a single function.
523(c-lang-defvar c-before-context-fontification-functions
524 (let ((fs (c-lang-const c-before-context-fontification-functions)))
525 (if (listp fs)
526 fs
527 (list fs)))
528 "If non-nil, a list of functions called just before context (or
529other non-change) fontification is done. Typically they will
530extend the region.
531
532These functions will be run in the order given. Each of them
533takes 2 parameters, the BEG and END of the region to be
534fontified. Point is undefined on both entry and exit. On entry,
535the buffer will have been widened and match-data will have been
536saved; the return value is a cons of the adjusted
537region, (NEW-BEG . NEW-END).")
510 538
511 539
512;;; Syntactic analysis ("virtual semicolons") for line-oriented languages (AWK). 540;;; Syntactic analysis ("virtual semicolons") for line-oriented languages (AWK).
@@ -522,7 +550,7 @@ don't have EOL terminated statements. "
522 550
523(c-lang-defconst c-vsemi-status-unknown-p-fn 551(c-lang-defconst c-vsemi-status-unknown-p-fn
524 "Contains a function \"are we unsure whether there is a virtual semicolon on this line?\". 552 "Contains a function \"are we unsure whether there is a virtual semicolon on this line?\".
525The (admittedly kludgey) purpose of such a function is to prevent an infinite 553The (admittedly kludgy) purpose of such a function is to prevent an infinite
526recursion in c-beginning-of-statement-1 when point starts at a `while' token. 554recursion in c-beginning-of-statement-1 when point starts at a `while' token.
527The function MUST NOT UNDER ANY CIRCUMSTANCES call c-beginning-of-statement-1, 555The function MUST NOT UNDER ANY CIRCUMSTANCES call c-beginning-of-statement-1,
528even indirectly. This variable contains nil for languages which don't have 556even indirectly. This variable contains nil for languages which don't have
@@ -2242,8 +2270,7 @@ This construct is \"<keyword> <expression> :\"."
2242 2270
2243(c-lang-defconst c-label-kwds 2271(c-lang-defconst c-label-kwds
2244 "Keywords introducing colon terminated labels in blocks." 2272 "Keywords introducing colon terminated labels in blocks."
2245 t '("case" "default") 2273 t '("case" "default"))
2246 awk nil)
2247 2274
2248(c-lang-defconst c-label-kwds-regexp 2275(c-lang-defconst c-label-kwds-regexp
2249 ;; Adorned regexp matching any keyword that introduces a label. 2276 ;; Adorned regexp matching any keyword that introduces a label.
@@ -2998,18 +3025,19 @@ neither in a statement nor in a declaration context. The regexp is
2998tested at the beginning of every sexp in a suspected label, 3025tested at the beginning of every sexp in a suspected label,
2999i.e. before \":\". Only used if `c-recognize-colon-labels' is set." 3026i.e. before \":\". Only used if `c-recognize-colon-labels' is set."
3000 t (concat 3027 t (concat
3001 ;; Don't allow string literals.
3002 "\"\\|"
3003 ;; All keywords except `c-label-kwds' and `c-protection-kwds'. 3028 ;; All keywords except `c-label-kwds' and `c-protection-kwds'.
3004 (c-make-keywords-re t 3029 (c-make-keywords-re t
3005 (set-difference (c-lang-const c-keywords) 3030 (set-difference (c-lang-const c-keywords)
3006 (append (c-lang-const c-label-kwds) 3031 (append (c-lang-const c-label-kwds)
3007 (c-lang-const c-protection-kwds)) 3032 (c-lang-const c-protection-kwds))
3008 :test 'string-equal))) 3033 :test 'string-equal)))
3034 ;; Don't allow string literals, except in AWK. Character constants are OK.
3035 (c objc java pike idl) (concat "\"\\|"
3036 (c-lang-const c-nonlabel-token-key))
3009 ;; Also check for open parens in C++, to catch member init lists in 3037 ;; Also check for open parens in C++, to catch member init lists in
3010 ;; constructors. We normally allow it so that macros with arguments 3038 ;; constructors. We normally allow it so that macros with arguments
3011 ;; work in labels. 3039 ;; work in labels.
3012 c++ (concat "\\s\(\\|" (c-lang-const c-nonlabel-token-key))) 3040 c++ (concat "\\s\(\\|\"\\|" (c-lang-const c-nonlabel-token-key)))
3013(c-lang-defvar c-nonlabel-token-key (c-lang-const c-nonlabel-token-key)) 3041(c-lang-defvar c-nonlabel-token-key (c-lang-const c-nonlabel-token-key))
3014 3042
3015(c-lang-defconst c-nonlabel-token-2-key 3043(c-lang-defconst c-nonlabel-token-2-key
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index cc5a5236255..1bc0741b0aa 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -599,8 +599,8 @@ that requires a literal mode spec at compile time."
599 599
600;; Buffer local variables defining the region to be fontified by a font lock 600;; Buffer local variables defining the region to be fontified by a font lock
601;; after-change function. They are set in c-after-change to 601;; after-change function. They are set in c-after-change to
602;; after-change-function's BEG and END, and may be modified by a 602;; after-change-functions' BEG and END, and may be modified by functions in
603;; `c-before-font-lock-function'. 603;; `c-before-font-lock-functions'.
604(defvar c-new-BEG 0) 604(defvar c-new-BEG 0)
605(make-variable-buffer-local 'c-new-BEG) 605(make-variable-buffer-local 'c-new-BEG)
606(defvar c-new-END 0) 606(defvar c-new-END 0)
@@ -633,13 +633,13 @@ compatible with old code; callers should always specify it."
633 (setq c-new-BEG (point-min)) 633 (setq c-new-BEG (point-min))
634 (setq c-new-END (point-max)) 634 (setq c-new-END (point-max))
635 (save-excursion 635 (save-excursion
636 (if c-get-state-before-change-functions 636 (mapc (lambda (fn)
637 (mapc (lambda (fn) 637 (funcall fn (point-min) (point-max)))
638 (funcall fn (point-min) (point-max))) 638 c-get-state-before-change-functions)
639 c-get-state-before-change-functions)) 639 (mapc (lambda (fn)
640 (if c-before-font-lock-function 640 (funcall fn (point-min) (point-max)
641 (funcall c-before-font-lock-function (point-min) (point-max) 641 (- (point-max) (point-min))))
642 (- (point-max) (point-min)))))) 642 c-before-font-lock-functions)))
643 643
644 (set (make-local-variable 'outline-regexp) "[^#\n\^M]") 644 (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
645 (set (make-local-variable 'outline-level) 'c-outline-level) 645 (set (make-local-variable 'outline-level) 'c-outline-level)
@@ -830,6 +830,35 @@ Note that the style variables are always made local to the buffer."
830 ; with a c-cpp-delimiter category property 830 ; with a c-cpp-delimiter category property
831 (setq c-old-EOM (point))) 831 (setq c-old-EOM (point)))
832 832
833(defun c-extend-font-lock-region-for-macros (begg endd &optional old-len)
834 ;; Extend the region (BEGG ENDD) to cover all (possibly changed)
835 ;; preprocessor macros; return the cons (new-BEG . new-END). OLD-LEN should
836 ;; be either the old length parameter when called from an
837 ;; after-change-function, or nil otherwise. This defun uses the variables
838 ;; c-old-BOM, c-new-BOM.
839 ;;
840 ;; Point is undefined on both entry and exit to this function. The buffer
841 ;; will have been widened on entry.
842 (let (limits new-beg new-end)
843 (goto-char c-old-BOM) ; already set to old start of macro or begg.
844 (setq new-beg
845 (min begg
846 (if (setq limits (c-state-literal-at (point)))
847 (cdr limits) ; go forward out of any string or comment.
848 (point))))
849
850 (goto-char endd)
851 (if (setq limits (c-state-literal-at (point)))
852 (goto-char (car limits))) ; go backward out of any string or comment.
853 (if (c-beginning-of-macro)
854 (c-end-of-macro))
855 (setq new-end (max endd
856 (if old-len
857 (+ (- c-old-EOM old-len) (- endd begg))
858 c-old-EOM)
859 (point)))
860 (cons new-beg new-end)))
861
833(defun c-neutralize-CPP-line (beg end) 862(defun c-neutralize-CPP-line (beg end)
834 ;; BEG and END bound a region, typically a preprocessor line. Put a 863 ;; BEG and END bound a region, typically a preprocessor line. Put a
835 ;; "punctuation" syntax-table property on syntactically obtrusive 864 ;; "punctuation" syntax-table property on syntactically obtrusive
@@ -881,31 +910,19 @@ Note that the style variables are always made local to the buffer."
881 ;; Point is undefined both before and after this function call, the buffer 910 ;; Point is undefined both before and after this function call, the buffer
882 ;; has been widened, and match-data saved. The return value is ignored. 911 ;; has been widened, and match-data saved. The return value is ignored.
883 ;; 912 ;;
884 ;; This function is the C/C++/ObjC value of `c-before-font-lock-function'. 913 ;; This function is in the C/C++/ObjC value of `c-before-font-lock-functions'.
885 ;; 914 ;;
886 ;; Note: SPEED _MATTERS_ IN THIS FUNCTION!!! 915 ;; Note: SPEED _MATTERS_ IN THIS FUNCTION!!!
887 ;; 916 ;;
888 ;; This function might make hidden buffer changes. 917 ;; This function might make hidden buffer changes.
889 (c-save-buffer-state (limits) 918 (c-save-buffer-state (new-bounds)
890 ;; First determine the region, (c-new-BEG c-new-END), which will get font 919 ;; First determine the region, (c-new-BEG c-new-END), which will get font
891 ;; locked. It might need "neutralizing". This region may not start 920 ;; locked. It might need "neutralizing". This region may not start
892 ;; inside a string, comment, or macro. 921 ;; inside a string, comment, or macro.
893 (goto-char c-old-BOM) ; already set to old start of macro or begg. 922 (setq new-bounds (c-extend-font-lock-region-for-macros
894 (setq c-new-BEG 923 c-new-BEG c-new-END old-len))
895 (min c-new-BEG 924 (setq c-new-BEG (car new-bounds)
896 (if (setq limits (c-state-literal-at (point))) 925 c-new-END (cdr new-bounds))
897 (cdr limits) ; go forward out of any string or comment.
898 (point))))
899
900 (goto-char endd)
901 (if (setq limits (c-state-literal-at (point)))
902 (goto-char (car limits))) ; go backward out of any string or comment.
903 (if (c-beginning-of-macro)
904 (c-end-of-macro))
905 (setq c-new-END (max c-new-END
906 (+ (- c-old-EOM old-len) (- endd begg))
907 (point)))
908
909 ;; Clear all old relevant properties. 926 ;; Clear all old relevant properties.
910 (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1)) 927 (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1))
911 (c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter) 928 (c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter)
@@ -943,7 +960,7 @@ Note that the style variables are always made local to the buffer."
943 ;; Note that this function must be FAST rather than accurate. Note 960 ;; Note that this function must be FAST rather than accurate. Note
944 ;; also that it only has any effect when font locking is enabled. 961 ;; also that it only has any effect when font locking is enabled.
945 ;; We exploit this by checking for font-lock-*-face instead of doing 962 ;; We exploit this by checking for font-lock-*-face instead of doing
946 ;; rigourous syntactic analysis. 963 ;; rigorous syntactic analysis.
947 964
948 ;; If either change boundary is wholly inside an identifier, delete 965 ;; If either change boundary is wholly inside an identifier, delete
949 ;; it/them from the cache. Don't worry about being inside a string 966 ;; it/them from the cache. Don't worry about being inside a string
@@ -1015,6 +1032,11 @@ Note that the style variables are always made local to the buffer."
1015 c-get-state-before-change-functions)) 1032 c-get-state-before-change-functions))
1016 )))) 1033 ))))
1017 1034
1035(defvar c-in-after-change-fontification nil)
1036(make-variable-buffer-local 'c-in-after-change-fontification)
1037;; A flag to prevent region expanding stuff being done twice for after-change
1038;; fontification.
1039
1018(defun c-after-change (beg end old-len) 1040(defun c-after-change (beg end old-len)
1019 ;; Function put on `after-change-functions' to adjust various caches 1041 ;; Function put on `after-change-functions' to adjust various caches
1020 ;; etc. Prefer speed to finesse here, since there will be an order 1042 ;; etc. Prefer speed to finesse here, since there will be an order
@@ -1026,7 +1048,7 @@ Note that the style variables are always made local to the buffer."
1026 ;; these caches from inside them, and we must thus be sure that this 1048 ;; these caches from inside them, and we must thus be sure that this
1027 ;; has already been executed. 1049 ;; has already been executed.
1028 ;; 1050 ;;
1029 ;; This calls the language variable c-before-font-lock-function, if non nil. 1051 ;; This calls the language variable c-before-font-lock-functions, if non nil.
1030 ;; This typically sets `syntax-table' properties. 1052 ;; This typically sets `syntax-table' properties.
1031 1053
1032 (c-save-buffer-state () 1054 (c-save-buffer-state ()
@@ -1066,19 +1088,113 @@ Note that the style variables are always made local to the buffer."
1066 ;; larger than (beg end). 1088 ;; larger than (beg end).
1067 (setq c-new-BEG beg 1089 (setq c-new-BEG beg
1068 c-new-END end) 1090 c-new-END end)
1069 (if c-before-font-lock-function 1091 (setq c-in-after-change-fontification t)
1070 (save-excursion 1092 (save-excursion
1071 (funcall c-before-font-lock-function beg end old-len))))))) 1093 (mapc (lambda (fn)
1072 1094 (funcall fn beg end old-len))
1095 c-before-font-lock-functions))))))
1096
1097(defun c-set-fl-decl-start (pos)
1098 ;; If the beginning of the line containing POS is in the middle of a "local"
1099 ;; declaration (i.e. one which does not start outside of braces enclosing
1100 ;; POS, such as a struct), return the beginning of that declaration.
1101 ;; Otherwise return POS. Note that declarations, in this sense, can be
1102 ;; nested.
1103 ;;
1104 ;; This function is called indirectly from font locking stuff - either from
1105 ;; c-after-change (to prepare for after-change font-lockng) or from font
1106 ;; lock context (etc.) fontification.
1107 (let ((lit-limits (c-literal-limits))
1108 (new-pos pos)
1109 bod-lim bo-decl)
1110 (goto-char (c-point 'bol new-pos))
1111 (when lit-limits ; Comment or string.
1112 (goto-char (car lit-limits)))
1113 (setq bod-lim (max (- (point) 500) (point-min)))
1114
1115 (while
1116 ;; Go to a less nested declaration each time round this loop.
1117 (and
1118 (eq (car (c-beginning-of-decl-1 bod-lim)) 'same)
1119 (progn (setq bo-decl (point))
1120 ;; Are we looking at a keyword such as "template" or
1121 ;; "typedef" which can decorate a type, or the type itself?
1122 (when (or (looking-at c-prefix-spec-kwds-re)
1123 (c-forward-type t))
1124 ;; We've found another candidate position.
1125 (setq new-pos (min new-pos bo-decl))
1126 (goto-char bo-decl))
1127 t)
1128 ;; Try and go out a level to search again.
1129 (progn
1130 (c-backward-syntactic-ws bod-lim)
1131 (or (memq (char-before) '(?\( ?\[))
1132 (and (eq (char-before) ?\<)
1133 (eq (c-get-char-property
1134 (1- (point)) 'syntax-table)
1135 c-<-as-paren-syntax))))
1136 (not (bobp)))
1137 (backward-char))
1138 new-pos)) ; back over (, [, <.
1139
1140(defun c-change-set-fl-decl-start (beg end old-len)
1141 ;; Set c-new-BEG to the beginning of a "local" declaration if it('s BOL) is
1142 ;; inside one. This is called from an after-change-function, but the
1143 ;; parameters BEG END and OLD-LEN are ignored. See `c-set-fl-decl-start'
1144 ;; for the detailed functionality.
1145 (if font-lock-mode
1146 (setq c-new-BEG (c-set-fl-decl-start c-new-BEG))))
1147
1148(defun c-context-set-fl-decl-start (beg end)
1149 ;; Return a cons (NEW-BEG . END), where NEW-BEG is the beginning of a
1150 ;; "local" declaration (BOL at) NEW is inside or BEG. See
1151 ;; `c-set-fl-decl-start' for the detailed functionality.
1152 (cons (c-set-fl-decl-start beg) end))
1153
1154(defvar c-standard-font-lock-fontify-region-function nil
1155 "Standard value of `font-lock-fontify-region-function'")
1156
1157(defun c-font-lock-fontify-region (beg end &optional verbose)
1158 ;; Effectively advice around `font-lock-fontify-region' which extends the
1159 ;; region (BEG END), for example, to avoid context fontification chopping
1160 ;; off the start of the context. Do not do anything if it's already been
1161 ;; done (i.e. from and after-change fontification. An example (C++) where
1162 ;; this used to happen is this:
1163 ;;
1164 ;; template <typename T>
1165 ;;
1166 ;;
1167 ;; void myfunc(T* p) {}
1168 ;;
1169 ;; Type a space in the first blank line, and the fontification of the next
1170 ;; line was fouled up by context fontification.
1171 (let ((new-beg beg) (new-end end) new-region)
1172 (if c-in-after-change-fontification
1173 (setq c-in-after-change-fontification nil)
1174 (save-restriction
1175 (widen)
1176 (save-excursion
1177 (mapc (lambda (fn)
1178 (setq new-region (funcall fn new-beg new-end))
1179 (setq new-beg (car new-region) new-end (cdr new-region)))
1180 c-before-context-fontification-functions))))
1181 (funcall c-standard-font-lock-fontify-region-function
1182 new-beg new-end verbose)))
1183
1073(defun c-after-font-lock-init () 1184(defun c-after-font-lock-init ()
1074 ;; Put on `font-lock-mode-hook'. 1185 ;; Put on `font-lock-mode-hook'. This function ensures our after-change
1186 ;; function will get excuted before the font-lock one. Amongst other
1187 ;; things.
1075 (remove-hook 'after-change-functions 'c-after-change t) 1188 (remove-hook 'after-change-functions 'c-after-change t)
1076 (add-hook 'after-change-functions 'c-after-change nil t)) 1189 (add-hook 'after-change-functions 'c-after-change nil t)
1190 (setq c-standard-font-lock-fontify-region-function
1191 (default-value 'font-lock-fontify-region-function)))
1077 1192
1078(defun c-font-lock-init () 1193(defun c-font-lock-init ()
1079 "Set up the font-lock variables for using the font-lock support in CC Mode. 1194 "Set up the font-lock variables for using the font-lock support in CC Mode.
1080This does not load the font-lock package. Use after 1195This does not load the font-lock package. Use after
1081`c-basic-common-init' and after cc-fonts has been loaded." 1196`c-basic-common-init' and after cc-fonts has been loaded.
1197This function is called from `c-common-init', once per mode initialization."
1082 1198
1083 (set (make-local-variable 'font-lock-defaults) 1199 (set (make-local-variable 'font-lock-defaults)
1084 `(,(if (c-major-mode-is 'awk-mode) 1200 `(,(if (c-major-mode-is 'awk-mode)
@@ -1092,6 +1208,10 @@ This does not load the font-lock package. Use after
1092 c-beginning-of-syntax 1208 c-beginning-of-syntax
1093 (font-lock-mark-block-function 1209 (font-lock-mark-block-function
1094 . c-mark-function))) 1210 . c-mark-function)))
1211
1212 (make-local-variable 'font-lock-fontify-region-function)
1213 (setq font-lock-fontify-region-function 'c-font-lock-fontify-region)
1214
1095 (if (featurep 'xemacs) 1215 (if (featurep 'xemacs)
1096 (make-local-hook 'font-lock-mode-hook)) 1216 (make-local-hook 'font-lock-mode-hook))
1097 (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t)) 1217 (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t))
@@ -1562,10 +1682,6 @@ Key bindings:
1562 (c-common-init 'awk-mode) 1682 (c-common-init 'awk-mode)
1563 (c-awk-unstick-NL-prop) 1683 (c-awk-unstick-NL-prop)
1564 1684
1565 ;; Prevent XEmacs's buffer-syntactic-context being used. See the comment
1566 ;; in cc-engine.el, just before (defun c-fast-in-literal ...
1567 (defalias 'c-in-literal 'c-slow-in-literal)
1568
1569 (c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook) 1685 (c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook)
1570 (c-update-modeline)) 1686 (c-update-modeline))
1571 1687
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 549f94387d2..a4338a3193b 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -586,7 +586,7 @@ in a mode hook, you have to call `c-setup-doc-comment-style'
586afterwards to redo that work." 586afterwards to redo that work."
587 ;; Symbols other than those documented above may be used on this 587 ;; Symbols other than those documented above may be used on this
588 ;; variable. If a variable exists that has that name with 588 ;; variable. If a variable exists that has that name with
589 ;; "-font-lock-keywords" appended, it's value is prepended to the 589 ;; "-font-lock-keywords" appended, its value is prepended to the
590 ;; font lock keywords list. If it's a function then it's called and 590 ;; font lock keywords list. If it's a function then it's called and
591 ;; the result is prepended. 591 ;; the result is prepended.
592 :type '(radio 592 :type '(radio
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index 823304bd250..ffe8edfaeb6 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -5,6 +5,7 @@
5;; Author: Dave Love <fx@gnu.org> 5;; Author: Dave Love <fx@gnu.org>
6;; Maintainer: Ted Zlatanov <tzz@lifelogs.com> 6;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
7;; Keywords: languages 7;; Keywords: languages
8;; Version: 1.1
8 9
9;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
10 11
@@ -29,18 +30,18 @@
29;; The CFEngine 3.x support doesn't have Imenu support but patches are 30;; The CFEngine 3.x support doesn't have Imenu support but patches are
30;; welcome. 31;; welcome.
31 32
32;; You can set it up so either cfengine-mode (2.x and earlier) or 33;; You can set it up so either `cfengine2-mode' (2.x and earlier) or
33;; cfengine3-mode (3.x) will be picked, depending on the buffer 34;; `cfengine3-mode' (3.x) will be picked, depending on the buffer
34;; contents: 35;; contents:
35 36
36;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine-auto-mode)) 37;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine-mode))
37 38
38;; OR you can choose to always use a specific version, if you prefer 39;; OR you can choose to always use a specific version, if you prefer
39;; it 40;; it:
40 41
41;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine3-mode)) 42;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine3-mode))
42;; (add-to-list 'auto-mode-alist '("^cf\\." . cfengine-mode)) 43;; (add-to-list 'auto-mode-alist '("^cf\\." . cfengine2-mode))
43;; (add-to-list 'auto-mode-alist '("^cfagent.conf\\'" . cfengine-mode)) 44;; (add-to-list 'auto-mode-alist '("^cfagent.conf\\'" . cfengine2-mode))
44 45
45;; This is not the same as the mode written by Rolf Ebert 46;; This is not the same as the mode written by Rolf Ebert
46;; <ebert@waporo.muc.de>, distributed with cfengine-2.0.5. It does 47;; <ebert@waporo.muc.de>, distributed with cfengine-2.0.5. It does
@@ -49,31 +50,36 @@
49;;; Code: 50;;; Code:
50 51
51(defgroup cfengine () 52(defgroup cfengine ()
52 "Editing Cfengine files." 53 "Editing CFEngine files."
53 :group 'languages) 54 :group 'languages)
54 55
55(defcustom cfengine-indent 2 56(defcustom cfengine-indent 2
56 "*Size of a Cfengine indentation step in columns." 57 "*Size of a CFEngine indentation step in columns."
57 :group 'cfengine 58 :group 'cfengine
58 :type 'integer) 59 :type 'integer)
59 60
61(defvar cfengine-mode-debug nil
62 "Whether `cfengine-mode' should print debugging info.")
63
60(defcustom cfengine-mode-abbrevs nil 64(defcustom cfengine-mode-abbrevs nil
61 "Abbrevs for Cfengine mode." 65 "Abbrevs for CFEngine2 mode."
62 :group 'cfengine 66 :group 'cfengine
63 :type '(repeat (list (string :tag "Name") 67 :type '(repeat (list (string :tag "Name")
64 (string :tag "Expansion") 68 (string :tag "Expansion")
65 (choice :tag "Hook" (const nil) function)))) 69 (choice :tag "Hook" (const nil) function))))
66 70
71(make-obsolete-variable 'cfengine-mode-abbrevs 'edit-abbrevs "24.1")
72
67;; Taken from the doc for pre-release 2.1. 73;; Taken from the doc for pre-release 2.1.
68(eval-and-compile 74(eval-and-compile
69 (defconst cfengine-actions 75 (defconst cfengine2-actions
70 '("acl" "alerts" "binservers" "broadcast" "control" "classes" "copy" 76 '("acl" "alerts" "binservers" "broadcast" "control" "classes" "copy"
71 "defaultroute" "disks" "directories" "disable" "editfiles" "files" 77 "defaultroute" "disks" "directories" "disable" "editfiles" "files"
72 "filters" "groups" "homeservers" "ignore" "import" "interfaces" 78 "filters" "groups" "homeservers" "ignore" "import" "interfaces"
73 "links" "mailserver" "methods" "miscmounts" "mountables" 79 "links" "mailserver" "methods" "miscmounts" "mountables"
74 "processes" "packages" "rename" "required" "resolve" 80 "processes" "packages" "rename" "required" "resolve"
75 "shellcommands" "tidy" "unmount" 81 "shellcommands" "tidy" "unmount"
76 ;; cfservd 82 ;; Keywords for cfservd.
77 "admit" "grant" "deny") 83 "admit" "grant" "deny")
78 "List of the action keywords supported by Cfengine. 84 "List of the action keywords supported by Cfengine.
79This includes those for cfservd as well as cfagent.") 85This includes those for cfservd as well as cfagent.")
@@ -98,11 +104,11 @@ This includes those for cfservd as well as cfagent.")
98 '(string int real slist ilist rlist irange rrange counter)) 104 '(string int real slist ilist rlist irange rrange counter))
99 "List of the CFEngine 3.x variable types.")) 105 "List of the CFEngine 3.x variable types."))
100 106
101(defvar cfengine-font-lock-keywords 107(defvar cfengine2-font-lock-keywords
102 `(;; Actions. 108 `(;; Actions.
103 ;; List the allowed actions explicitly, so that errors are more obvious. 109 ;; List the allowed actions explicitly, so that errors are more obvious.
104 (,(concat "^[ \t]*" (eval-when-compile 110 (,(concat "^[ \t]*" (eval-when-compile
105 (regexp-opt cfengine-actions t)) 111 (regexp-opt cfengine2-actions t))
106 ":") 112 ":")
107 1 font-lock-keyword-face) 113 1 font-lock-keyword-face)
108 ;; Classes. 114 ;; Classes.
@@ -117,46 +123,54 @@ This includes those for cfservd as well as cfagent.")
117 123
118(defvar cfengine3-font-lock-keywords 124(defvar cfengine3-font-lock-keywords
119 `( 125 `(
126 ;; Defuns. This happens early so they don't get caught by looser
127 ;; patterns.
128 (,(concat "\\<" cfengine3-defuns-regex "\\>"
129 "[ \t]+\\<\\([[:alnum:]_]+\\)\\>"
130 "[ \t]+\\<\\([[:alnum:]_]+\\)"
131 ;; Optional parentheses with variable names inside.
132 "\\(?:(\\([^)]*\\))\\)?")
133 (1 font-lock-builtin-face)
134 (2 font-lock-constant-face)
135 (3 font-lock-function-name-face)
136 (4 font-lock-variable-name-face nil t))
137
138 ;; Class selectors.
120 (,(concat "^[ \t]*" cfengine3-class-selector-regex) 139 (,(concat "^[ \t]*" cfengine3-class-selector-regex)
121 1 font-lock-keyword-face) 140 1 font-lock-keyword-face)
141
142 ;; Categories.
122 (,(concat "^[ \t]*" cfengine3-category-regex) 143 (,(concat "^[ \t]*" cfengine3-category-regex)
123 1 font-lock-builtin-face) 144 1 font-lock-builtin-face)
145
124 ;; Variables, including scope, e.g. module.var 146 ;; Variables, including scope, e.g. module.var
125 ("[@$](\\([[:alnum:]_.]+\\))" 1 font-lock-variable-name-face) 147 ("[@$](\\([[:alnum:]_.]+\\))" 1 font-lock-variable-name-face)
126 ("[@$]{\\([[:alnum:]_.]+\\)}" 1 font-lock-variable-name-face) 148 ("[@$]{\\([[:alnum:]_.]+\\)}" 1 font-lock-variable-name-face)
149
127 ;; Variable definitions. 150 ;; Variable definitions.
128 ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) 151 ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face)
129 152
130 ;; CFEngine 3.x faces 153 ;; Variable types.
131 ;; defuns
132 (,(concat "\\<" cfengine3-defuns-regex "\\>"
133 "[ \t]+\\<\\([[:alnum:]_]+\\)\\>"
134 "[ \t]+\\<\\([[:alnum:]_]+\\)\\((\\([^)]*\\))\\)?")
135 (1 font-lock-builtin-face)
136 (2 font-lock-constant-name-face)
137 (3 font-lock-function-name-face)
138 (5 font-lock-variable-name-face))
139 ;; variable types
140 (,(concat "\\<" (eval-when-compile (regexp-opt cfengine3-vartypes t)) "\\>") 154 (,(concat "\\<" (eval-when-compile (regexp-opt cfengine3-vartypes t)) "\\>")
141 1 font-lock-type-face))) 155 1 font-lock-type-face)))
142 156
143(defvar cfengine-imenu-expression 157(defvar cfengine2-imenu-expression
144 `((nil ,(concat "^[ \t]*" (eval-when-compile 158 `((nil ,(concat "^[ \t]*" (eval-when-compile
145 (regexp-opt cfengine-actions t)) 159 (regexp-opt cfengine2-actions t))
146 ":[^:]") 160 ":[^:]")
147 1) 161 1)
148 ("Variables/classes" "\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1) 162 ("Variables/classes" "\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1)
149 ("Variables/classes" "\\<define=\\([[:alnum:]_]+\\)" 1) 163 ("Variables/classes" "\\<define=\\([[:alnum:]_]+\\)" 1)
150 ("Variables/classes" "\\<DefineClass\\>[ \t]+\\([[:alnum:]_]+\\)" 1)) 164 ("Variables/classes" "\\<DefineClass\\>[ \t]+\\([[:alnum:]_]+\\)" 1))
151 "`imenu-generic-expression' for Cfengine mode.") 165 "`imenu-generic-expression' for CFEngine mode.")
152 166
153(defun cfengine-outline-level () 167(defun cfengine2-outline-level ()
154 "`outline-level' function for Cfengine mode." 168 "`outline-level' function for CFEngine mode."
155 (if (looking-at "[^:]+\\(?:[:]+\\)$") 169 (if (looking-at "[^:]+\\(?:[:]+\\)$")
156 (length (match-string 1)))) 170 (length (match-string 1))))
157 171
158(defun cfengine-beginning-of-defun () 172(defun cfengine2-beginning-of-defun ()
159 "`beginning-of-defun' function for Cfengine mode. 173 "`beginning-of-defun' function for CFEngine mode.
160Treats actions as defuns." 174Treats actions as defuns."
161 (unless (<= (current-column) (current-indentation)) 175 (unless (<= (current-column) (current-indentation))
162 (end-of-line)) 176 (end-of-line))
@@ -165,8 +179,8 @@ Treats actions as defuns."
165 (goto-char (point-min))) 179 (goto-char (point-min)))
166 t) 180 t)
167 181
168(defun cfengine-end-of-defun () 182(defun cfengine2-end-of-defun ()
169 "`end-of-defun' function for Cfengine mode. 183 "`end-of-defun' function for CFEngine mode.
170Treats actions as defuns." 184Treats actions as defuns."
171 (end-of-line) 185 (end-of-line)
172 (if (re-search-forward "^[[:alpha:]]+: *$" nil t) 186 (if (re-search-forward "^[[:alpha:]]+: *$" nil t)
@@ -176,7 +190,7 @@ Treats actions as defuns."
176 190
177;; Fixme: Should get an extra indent step in editfiles BeginGroup...s. 191;; Fixme: Should get an extra indent step in editfiles BeginGroup...s.
178 192
179(defun cfengine-indent-line () 193(defun cfengine2-indent-line ()
180 "Indent a line in Cfengine mode. 194 "Indent a line in Cfengine mode.
181Intended as the value of `indent-line-function'." 195Intended as the value of `indent-line-function'."
182 (let ((pos (- (point-max) (point)))) 196 (let ((pos (- (point-max) (point))))
@@ -283,15 +297,17 @@ Intended as the value of `indent-line-function'."
283 (narrow-to-defun) 297 (narrow-to-defun)
284 (back-to-indentation) 298 (back-to-indentation)
285 (setq parse (parse-partial-sexp (point-min) (point))) 299 (setq parse (parse-partial-sexp (point-min) (point)))
286 (message "%S" parse) 300 (when cfengine-mode-debug
301 (message "%S" parse))
302
287 (cond 303 (cond
288 ;; body/bundle blocks start at 0 304 ;; Body/bundle blocks start at 0.
289 ((looking-at (concat cfengine3-defuns-regex "\\>")) 305 ((looking-at (concat cfengine3-defuns-regex "\\>"))
290 (indent-line-to 0)) 306 (indent-line-to 0))
291 ;; categories are indented one step 307 ;; Categories are indented one step.
292 ((looking-at (concat cfengine3-category-regex "[ \t]*$")) 308 ((looking-at (concat cfengine3-category-regex "[ \t]*$"))
293 (indent-line-to cfengine-indent)) 309 (indent-line-to cfengine-indent))
294 ;; class selectors are indented two steps 310 ;; Class selectors are indented two steps.
295 ((looking-at (concat cfengine3-class-selector-regex "[ \t]*$")) 311 ((looking-at (concat cfengine3-class-selector-regex "[ \t]*$"))
296 (indent-line-to (* 2 cfengine-indent))) 312 (indent-line-to (* 2 cfengine-indent)))
297 ;; Outdent leading close brackets one step. 313 ;; Outdent leading close brackets one step.
@@ -303,11 +319,17 @@ Intended as the value of `indent-line-function'."
303 (backward-sexp) 319 (backward-sexp)
304 (current-column))) 320 (current-column)))
305 (error nil))) 321 (error nil)))
306 ;; inside a string and it starts before this line 322 ;; Inside a string and it starts before this line.
307 ((and (nth 3 parse) 323 ((and (nth 3 parse)
308 (< (nth 8 parse) (save-excursion (beginning-of-line) (point)))) 324 (< (nth 8 parse) (save-excursion (beginning-of-line) (point))))
309 (indent-line-to 0)) 325 (indent-line-to 0))
310 ;; inside a defun, but not a nested list (depth is 1) 326
327 ;; Inside a defun, but not a nested list (depth is 1). This is
328 ;; a promise, usually.
329
330 ;; Indent to cfengine-indent times the nested depth
331 ;; plus 2. That way, promises indent deeper than class
332 ;; selectors, which in turn are one deeper than categories.
311 ((= 1 (nth 0 parse)) 333 ((= 1 (nth 0 parse))
312 (indent-line-to (* (+ 2 (nth 0 parse)) cfengine-indent))) 334 (indent-line-to (* (+ 2 (nth 0 parse)) cfengine-indent)))
313 ;; Inside brackets/parens: indent to start column of non-comment 335 ;; Inside brackets/parens: indent to start column of non-comment
@@ -411,18 +433,18 @@ Intended as the value of `indent-line-function'."
411 (set (make-local-variable 'parse-sexp-ignore-comments) t)) 433 (set (make-local-variable 'parse-sexp-ignore-comments) t))
412 434
413(defun cfengine-common-syntax (table) 435(defun cfengine-common-syntax (table)
414 ;; the syntax defaults seem OK to give reasonable word movement 436 ;; The syntax defaults seem OK to give reasonable word movement.
415 (modify-syntax-entry ?# "<" table) 437 (modify-syntax-entry ?# "<" table)
416 (modify-syntax-entry ?\n ">#" table) 438 (modify-syntax-entry ?\n ">#" table)
417 (modify-syntax-entry ?\" "\"" table) 439 (modify-syntax-entry ?\" "\"" table)
418 ;; variable substitution: 440 ;; Variable substitution.
419 (modify-syntax-entry ?$ "." table) 441 (modify-syntax-entry ?$ "." table)
420 ;; Doze path separators: 442 ;; Doze path separators.
421 (modify-syntax-entry ?\\ "." table)) 443 (modify-syntax-entry ?\\ "." table))
422 444
423;;;###autoload 445;;;###autoload
424(define-derived-mode cfengine3-mode prog-mode "CFEngine3" 446(define-derived-mode cfengine3-mode prog-mode "CFE3"
425 "Major mode for editing cfengine input. 447 "Major mode for editing CFEngine3 input.
426There are no special keybindings by default. 448There are no special keybindings by default.
427 449
428Action blocks are treated as defuns, i.e. \\[beginning-of-defun] moves 450Action blocks are treated as defuns, i.e. \\[beginning-of-defun] moves
@@ -434,46 +456,46 @@ to the action header."
434 (setq font-lock-defaults 456 (setq font-lock-defaults
435 '(cfengine3-font-lock-keywords nil nil nil beginning-of-defun)) 457 '(cfengine3-font-lock-keywords nil nil nil beginning-of-defun))
436 458
437 ;; use defuns as the essential syntax block 459 ;; Use defuns as the essential syntax block.
438 (set (make-local-variable 'beginning-of-defun-function) 460 (set (make-local-variable 'beginning-of-defun-function)
439 #'cfengine3-beginning-of-defun) 461 #'cfengine3-beginning-of-defun)
440 (set (make-local-variable 'end-of-defun-function) 462 (set (make-local-variable 'end-of-defun-function)
441 #'cfengine3-end-of-defun)) 463 #'cfengine3-end-of-defun))
442 464
443;;;###autoload 465;;;###autoload
444(define-derived-mode cfengine-mode prog-mode "Cfengine" 466(define-derived-mode cfengine2-mode prog-mode "CFE2"
445 "Major mode for editing cfengine input. 467 "Major mode for editing CFEngine2 input.
446There are no special keybindings by default. 468There are no special keybindings by default.
447 469
448Action blocks are treated as defuns, i.e. \\[beginning-of-defun] moves 470Action blocks are treated as defuns, i.e. \\[beginning-of-defun] moves
449to the action header." 471to the action header."
450 (cfengine-common-settings) 472 (cfengine-common-settings)
451 (cfengine-common-syntax cfengine-mode-syntax-table) 473 (cfengine-common-syntax cfengine2-mode-syntax-table)
452 474
453 ;; Shell commands can be quoted by single, double or back quotes. 475 ;; Shell commands can be quoted by single, double or back quotes.
454 ;; It's debatable whether we should define string syntax, but it 476 ;; It's debatable whether we should define string syntax, but it
455 ;; should avoid potential confusion in some cases. 477 ;; should avoid potential confusion in some cases.
456 (modify-syntax-entry ?\' "\"" cfengine-mode-syntax-table) 478 (modify-syntax-entry ?\' "\"" cfengine2-mode-syntax-table)
457 (modify-syntax-entry ?\` "\"" cfengine-mode-syntax-table) 479 (modify-syntax-entry ?\` "\"" cfengine2-mode-syntax-table)
458 480
459 (set (make-local-variable 'indent-line-function) #'cfengine-indent-line) 481 (set (make-local-variable 'indent-line-function) #'cfengine2-indent-line)
460 (set (make-local-variable 'outline-regexp) "[ \t]*\\(\\sw\\|\\s_\\)+:+") 482 (set (make-local-variable 'outline-regexp) "[ \t]*\\(\\sw\\|\\s_\\)+:+")
461 (set (make-local-variable 'outline-level) #'cfengine-outline-level) 483 (set (make-local-variable 'outline-level) #'cfengine2-outline-level)
462 (set (make-local-variable 'fill-paragraph-function) 484 (set (make-local-variable 'fill-paragraph-function)
463 #'cfengine-fill-paragraph) 485 #'cfengine-fill-paragraph)
464 (define-abbrev-table 'cfengine-mode-abbrev-table cfengine-mode-abbrevs) 486 (define-abbrev-table 'cfengine2-mode-abbrev-table cfengine-mode-abbrevs)
465 (setq font-lock-defaults 487 (setq font-lock-defaults
466 '(cfengine-font-lock-keywords nil nil nil beginning-of-line)) 488 '(cfengine2-font-lock-keywords nil nil nil beginning-of-line))
467 ;; Fixme: set the args of functions in evaluated classes to string 489 ;; Fixme: set the args of functions in evaluated classes to string
468 ;; syntax, and then obey syntax properties. 490 ;; syntax, and then obey syntax properties.
469 (setq imenu-generic-expression cfengine-imenu-expression) 491 (setq imenu-generic-expression cfengine2-imenu-expression)
470 (set (make-local-variable 'beginning-of-defun-function) 492 (set (make-local-variable 'beginning-of-defun-function)
471 #'cfengine-beginning-of-defun) 493 #'cfengine2-beginning-of-defun)
472 (set (make-local-variable 'end-of-defun-function) #'cfengine-end-of-defun)) 494 (set (make-local-variable 'end-of-defun-function) #'cfengine2-end-of-defun))
473 495
474;;;###autoload 496;;;###autoload
475(defun cfengine-auto-mode () 497(defun cfengine-auto-mode ()
476 "Choose between `cfengine-mode' and `cfengine3-mode' depending 498 "Choose between `cfengine2-mode' and `cfengine3-mode' depending
477on the buffer contents" 499on the buffer contents"
478 (let ((v3 nil)) 500 (let ((v3 nil))
479 (save-restriction 501 (save-restriction
@@ -481,7 +503,9 @@ on the buffer contents"
481 (while (not (or (eobp) v3)) 503 (while (not (or (eobp) v3))
482 (setq v3 (looking-at (concat cfengine3-defuns-regex "\\>"))) 504 (setq v3 (looking-at (concat cfengine3-defuns-regex "\\>")))
483 (forward-line))) 505 (forward-line)))
484 (if v3 (cfengine3-mode) (cfengine-mode)))) 506 (if v3 (cfengine3-mode) (cfengine2-mode))))
507
508(defalias 'cfengine-mode 'cfengine-auto-mode)
485 509
486(provide 'cfengine3) 510(provide 'cfengine3)
487(provide 'cfengine) 511(provide 'cfengine)
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 13fa310106c..86284eaa30a 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -958,7 +958,7 @@ B) Speed of editing operations.
958 `cperl-array-face' Array names 958 `cperl-array-face' Array names
959 `cperl-hash-face' Hash names 959 `cperl-hash-face' Hash names
960 `font-lock-comment-face' Comments, PODs and whatever is considered 960 `font-lock-comment-face' Comments, PODs and whatever is considered
961 syntaxically to be not code 961 syntactically to be not code
962 `font-lock-constant-face' HERE-doc delimiters, labels, delimiters of 962 `font-lock-constant-face' HERE-doc delimiters, labels, delimiters of
963 2-arg operators s/y/tr/ or of RExen, 963 2-arg operators s/y/tr/ or of RExen,
964 `font-lock-warning-face' Special-cased m// and s//foo/, 964 `font-lock-warning-face' Special-cased m// and s//foo/,
@@ -970,7 +970,7 @@ B) Speed of editing operations.
970 `cperl-nonoverridable-face' Non-overridable keywords, modifiers of RExen 970 `cperl-nonoverridable-face' Non-overridable keywords, modifiers of RExen
971 `font-lock-string-face' Strings, qw() constructs, RExen, POD sections, 971 `font-lock-string-face' Strings, qw() constructs, RExen, POD sections,
972 literal parts and the terminator of formats 972 literal parts and the terminator of formats
973 and whatever is syntaxically considered 973 and whatever is syntactically considered
974 as string literals 974 as string literals
975 `font-lock-type-face' Overridable keywords 975 `font-lock-type-face' Overridable keywords
976 `font-lock-variable-name-face' Variable declarations, indirect array and 976 `font-lock-variable-name-face' Variable declarations, indirect array and
@@ -1537,8 +1537,8 @@ default.) You can always quote (with \\[quoted-insert]) the left
1537since most the time you mean \"less\". CPerl mode tries to guess 1537since most the time you mean \"less\". CPerl mode tries to guess
1538whether you want to type pair <>, and inserts is if it 1538whether you want to type pair <>, and inserts is if it
1539appropriate. You can set `cperl-electric-parens-string' to the string that 1539appropriate. You can set `cperl-electric-parens-string' to the string that
1540contains the parenths from the above list you want to be electrical. 1540contains the parens from the above list you want to be electrical.
1541Electricity of parenths is controlled by `cperl-electric-parens'. 1541Electricity of parens is controlled by `cperl-electric-parens'.
1542You may also set `cperl-electric-parens-mark' to have electric parens 1542You may also set `cperl-electric-parens-mark' to have electric parens
1543look for active mark and \"embrace\" a region if possible.' 1543look for active mark and \"embrace\" a region if possible.'
1544 1544
@@ -3517,7 +3517,7 @@ Works before syntax recognition is done."
3517(defvar font-lock-warning-face) 3517(defvar font-lock-warning-face)
3518 3518
3519(defun cperl-find-sub-attrs (&optional st-l b-fname e-fname pos) 3519(defun cperl-find-sub-attrs (&optional st-l b-fname e-fname pos)
3520 "Syntaxically mark (and fontify) attributes of a subroutine. 3520 "Syntactically mark (and fontify) attributes of a subroutine.
3521Should be called with the point before leading colon of an attribute." 3521Should be called with the point before leading colon of an attribute."
3522 ;; Works *before* syntax recognition is done 3522 ;; Works *before* syntax recognition is done
3523 (or st-l (setq st-l (list nil))) ; Avoid overwriting '() 3523 (or st-l (setq st-l (list nil))) ; Avoid overwriting '()
@@ -4994,7 +4994,7 @@ conditional/loop constructs."
4994 (setq top (point)) 4994 (setq top (point))
4995 ;; Plan A: if line has an unfinished paren-group, go to end-of-group 4995 ;; Plan A: if line has an unfinished paren-group, go to end-of-group
4996 (while (= -1 (nth 0 (parse-partial-sexp (point) tmp-end -1))) 4996 (while (= -1 (nth 0 (parse-partial-sexp (point) tmp-end -1)))
4997 (setq top (point))) ; Get the outermost parenths in line 4997 (setq top (point))) ; Get the outermost parens in line
4998 (goto-char top) 4998 (goto-char top)
4999 (while (< (point) tmp-end) 4999 (while (< (point) tmp-end)
5000 (parse-partial-sexp (point) tmp-end nil t) ; To start-sexp or eol 5000 (parse-partial-sexp (point) tmp-end nil t) ; To start-sexp or eol
@@ -5906,7 +5906,7 @@ indentation and initial hashes. Behaves usually outside of comment."
5906 3 font-lock-variable-name-face))) 5906 3 font-lock-variable-name-face)))
5907 '("\\<for\\(each\\)?\\([ \t]+\\(my\\|local\\|our\\)\\)?[ \t]*\\(\\$[a-zA-Z_][a-zA-Z_0-9]*\\)[ \t]*(" 5907 '("\\<for\\(each\\)?\\([ \t]+\\(my\\|local\\|our\\)\\)?[ \t]*\\(\\$[a-zA-Z_][a-zA-Z_0-9]*\\)[ \t]*("
5908 4 font-lock-variable-name-face) 5908 4 font-lock-variable-name-face)
5909 ;; Avoid $!, and s!!, qq!! etc. when not fontifying syntaxically 5909 ;; Avoid $!, and s!!, qq!! etc. when not fontifying syntactically
5910 '("\\(?:^\\|[^smywqrx$]\\)\\(!\\)" 1 font-lock-negation-char-face) 5910 '("\\(?:^\\|[^smywqrx$]\\)\\(!\\)" 1 font-lock-negation-char-face)
5911 '("\\[\\(\\^\\)" 1 font-lock-negation-char-face prepend))) 5911 '("\\[\\(\\^\\)" 1 font-lock-negation-char-face prepend)))
5912 (setq 5912 (setq
diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el
index d855861d552..eeb145e2b1a 100644
--- a/lisp/progmodes/dcl-mode.el
+++ b/lisp/progmodes/dcl-mode.el
@@ -708,7 +708,7 @@ Returns point of the found command line or nil if not able to move."
708 (setq done t) ; not a label-only line, exit the loop 708 (setq done t) ; not a label-only line, exit the loop
709 (setq retval (point)))) 709 (setq retval (point))))
710 ;; We couldn't go further back, and we haven't found a command yet. 710 ;; We couldn't go further back, and we haven't found a command yet.
711 ;; Return to the start positionn 711 ;; Return to the start position.
712 (goto-char start) 712 (goto-char start)
713 (setq done t) 713 (setq done t)
714 (setq retval nil))) 714 (setq retval nil)))
@@ -756,7 +756,7 @@ Returns point of the found command line or nil if not able to move."
756 (setq done t) ; not a label-only line, exit the loop 756 (setq done t) ; not a label-only line, exit the loop
757 (setq retval (point))))) 757 (setq retval (point)))))
758 ;; We couldn't go further back, and we haven't found a command yet. 758 ;; We couldn't go further back, and we haven't found a command yet.
759 ;; Return to the start positionn 759 ;; Return to the start position.
760 (goto-char start) 760 (goto-char start)
761 (setq done t) 761 (setq done t)
762 (setq retval nil))) 762 (setq retval nil)))
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index d9adff6c8b8..240deb39ce3 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -3260,7 +3260,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3260 3260
3261% --- Corners 3261% --- Corners
3262 3262
3263%>corner Right Descendent: height arrow corner_RD 3263%>corner Right Descendant: height arrow corner_RD
3264% _ | arrow 3264% _ | arrow
3265% / height > 0 | 0 - none 3265% / height > 0 | 0 - none
3266% | | 1 - right 3266% | | 1 - right
@@ -3299,7 +3299,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3299 Gstroke 3299 Gstroke
3300}def 3300}def
3301 3301
3302%>corner Right Ascendent: height arrow corner_RA 3302%>corner Right Ascendant: height arrow corner_RA
3303% | arrow 3303% | arrow
3304% | height > 0 | 0 - none 3304% | height > 0 | 0 - none
3305% / | 1 - right 3305% / | 1 - right
@@ -3338,7 +3338,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3338 Gstroke 3338 Gstroke
3339}def 3339}def
3340 3340
3341%>corner Left Descendent: height arrow corner_LD 3341%>corner Left Descendant: height arrow corner_LD
3342% _ | arrow 3342% _ | arrow
3343% \\ height > 0 | 0 - none 3343% \\ height > 0 | 0 - none
3344% | | 1 - right 3344% | | 1 - right
@@ -3377,7 +3377,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3377 Gstroke 3377 Gstroke
3378}def 3378}def
3379 3379
3380%>corner Left Ascendent: height arrow corner_LA 3380%>corner Left Ascendant: height arrow corner_LA
3381% | arrow 3381% | arrow
3382% | height > 0 | 0 - none 3382% | height > 0 | 0 - none
3383% \\ | 1 - right 3383% \\ | 1 - right
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index ab40dff24f1..1c38c59bba6 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -811,6 +811,9 @@ detailed description of this mode.
811 (define-key gud-minor-mode-map [left-margin C-mouse-3] 811 (define-key gud-minor-mode-map [left-margin C-mouse-3]
812 'gdb-mouse-jump) 812 'gdb-mouse-jump)
813 813
814 (set (make-local-variable 'gud-gdb-completion-function)
815 'gud-gdbmi-completions)
816
814 (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point 817 (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point
815 nil 'local) 818 nil 'local)
816 (local-set-key "\C-i" 'completion-at-point) 819 (local-set-key "\C-i" 'completion-at-point)
@@ -859,31 +862,28 @@ detailed description of this mode.
859 (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter) 862 (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter)
860 (gdb-input 863 (gdb-input
861 ;; Needs GDB 6.4 onwards 864 ;; Needs GDB 6.4 onwards
862 (list (concat "-inferior-tty-set " 865 (concat "-inferior-tty-set "
863 (or 866 (or
864 ;; The process can run on a remote host. 867 ;; The process can run on a remote host.
865 (process-get (get-process "gdb-inferior") 'remote-tty) 868 (process-get (get-process "gdb-inferior") 'remote-tty)
866 (process-tty-name (get-process "gdb-inferior")))) 869 (process-tty-name (get-process "gdb-inferior"))))
867 'ignore)) 870 'ignore)
868 (if (eq window-system 'w32) 871 (if (eq window-system 'w32)
869 (gdb-input (list "-gdb-set new-console off" 'ignore))) 872 (gdb-input "-gdb-set new-console off" 'ignore))
870 (gdb-input (list "-gdb-set height 0" 'ignore)) 873 (gdb-input "-gdb-set height 0" 'ignore)
871 874
872 (when gdb-non-stop 875 (when gdb-non-stop
873 (gdb-input (list "-gdb-set non-stop 1" 'gdb-non-stop-handler))) 876 (gdb-input "-gdb-set non-stop 1" 'gdb-non-stop-handler))
874 877
875 (gdb-input (list "-enable-pretty-printing" 'ignore)) 878 (gdb-input "-enable-pretty-printing" 'ignore)
876 879
877 ;; find source file and compilation directory here 880 ;; find source file and compilation directory here
878 (if gdb-create-source-file-list 881 (if gdb-create-source-file-list
879 (gdb-input 882 ;; Needs GDB 6.2 onwards.
880 ; Needs GDB 6.2 onwards. 883 (gdb-input "-file-list-exec-source-files" 'gdb-get-source-file-list))
881 (list "-file-list-exec-source-files" 'gdb-get-source-file-list))) 884 ;; Needs GDB 6.0 onwards.
882 (gdb-input 885 (gdb-input "-file-list-exec-source-file" 'gdb-get-source-file)
883 ; Needs GDB 6.0 onwards. 886 (gdb-input "-gdb-show prompt" 'gdb-get-prompt))
884 (list "-file-list-exec-source-file" 'gdb-get-source-file))
885 (gdb-input
886 (list "-gdb-show prompt" 'gdb-get-prompt)))
887 887
888(defun gdb-non-stop-handler () 888(defun gdb-non-stop-handler ()
889 (goto-char (point-min)) 889 (goto-char (point-min))
@@ -894,8 +894,8 @@ detailed description of this mode.
894 (setq gdb-non-stop nil) 894 (setq gdb-non-stop nil)
895 (setq gdb-supports-non-stop nil)) 895 (setq gdb-supports-non-stop nil))
896 (setq gdb-supports-non-stop t) 896 (setq gdb-supports-non-stop t)
897 (gdb-input (list "-gdb-set target-async 1" 'ignore)) 897 (gdb-input "-gdb-set target-async 1" 'ignore)
898 (gdb-input (list "-list-target-features" 'gdb-check-target-async)))) 898 (gdb-input "-list-target-features" 'gdb-check-target-async)))
899 899
900(defun gdb-check-target-async () 900(defun gdb-check-target-async ()
901 (goto-char (point-min)) 901 (goto-char (point-min))
@@ -903,7 +903,7 @@ detailed description of this mode.
903 (message 903 (message
904 "Target doesn't support non-stop mode. Turning it off.") 904 "Target doesn't support non-stop mode. Turning it off.")
905 (setq gdb-non-stop nil) 905 (setq gdb-non-stop nil)
906 (gdb-input (list "-gdb-set non-stop 0" 'ignore)))) 906 (gdb-input "-gdb-set non-stop 0" 'ignore)))
907 907
908(defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") 908(defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
909 909
@@ -948,9 +948,8 @@ detailed description of this mode.
948 (goto-char (point-min)) 948 (goto-char (point-min))
949 (if (search-forward "expands to: " nil t) 949 (if (search-forward "expands to: " nil t)
950 (unless (looking-at "\\S-+.*(.*).*") 950 (unless (looking-at "\\S-+.*(.*).*")
951 (gdb-input 951 (gdb-input (concat "-data-evaluate-expression " expr)
952 (list (concat "-data-evaluate-expression " expr) 952 `(lambda () (gdb-tooltip-print ,expr)))))))
953 `(lambda () (gdb-tooltip-print ,expr))))))))
954 953
955(defun gdb-init-buffer () 954(defun gdb-init-buffer ()
956 (set (make-local-variable 'gud-minor-mode) 'gdbmi) 955 (set (make-local-variable 'gud-minor-mode) 'gdbmi)
@@ -1080,9 +1079,8 @@ With arg, enter name of variable to be watched in the minibuffer."
1080 (concat (if (derived-mode-p 'gdb-registers-mode) "$") 1079 (concat (if (derived-mode-p 'gdb-registers-mode) "$")
1081 (tooltip-identifier-from-point (point))))))) 1080 (tooltip-identifier-from-point (point)))))))
1082 (set-text-properties 0 (length expr) nil expr) 1081 (set-text-properties 0 (length expr) nil expr)
1083 (gdb-input 1082 (gdb-input (concat "-var-create - * " expr "")
1084 (list (concat "-var-create - * " expr "") 1083 `(lambda () (gdb-var-create-handler ,expr))))))
1085 `(lambda () (gdb-var-create-handler ,expr)))))))
1086 (message "gud-watch is a no-op in this mode.")))) 1084 (message "gud-watch is a no-op in this mode."))))
1087 1085
1088(defun gdb-var-create-handler (expr) 1086(defun gdb-var-create-handler (expr)
@@ -1111,7 +1109,7 @@ With arg, enter name of variable to be watched in the minibuffer."
1111 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame) 1109 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)
1112 (not (gdb-pending-p 'gdb-speedbar-timer))) 1110 (not (gdb-pending-p 'gdb-speedbar-timer)))
1113 ;; Dummy command to update speedbar even when idle. 1111 ;; Dummy command to update speedbar even when idle.
1114 (gdb-input (list "-environment-pwd" 'gdb-speedbar-timer-fn)) 1112 (gdb-input "-environment-pwd" 'gdb-speedbar-timer-fn)
1115 ;; Keep gdb-pending-triggers non-nil till end. 1113 ;; Keep gdb-pending-triggers non-nil till end.
1116 (gdb-add-pending 'gdb-speedbar-timer))) 1114 (gdb-add-pending 'gdb-speedbar-timer)))
1117 1115
@@ -1132,12 +1130,9 @@ With arg, enter name of variable to be watched in the minibuffer."
1132 1130
1133 ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. 1131 ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards.
1134(defun gdb-var-list-children (varnum) 1132(defun gdb-var-list-children (varnum)
1135 (gdb-input 1133 (gdb-input (concat "-var-update " varnum) 'ignore)
1136 (list (concat "-var-update " varnum) 'ignore)) 1134 (gdb-input (concat "-var-list-children --all-values " varnum)
1137 (gdb-input 1135 `(lambda () (gdb-var-list-children-handler ,varnum))))
1138 (list (concat "-var-list-children --all-values "
1139 varnum)
1140 `(lambda () (gdb-var-list-children-handler ,varnum)))))
1141 1136
1142(defun gdb-var-list-children-handler (varnum) 1137(defun gdb-var-list-children-handler (varnum)
1143 (let* ((var-list nil) 1138 (let* ((var-list nil)
@@ -1169,13 +1164,11 @@ With arg, enter name of variable to be watched in the minibuffer."
1169 "Set the output format for a variable displayed in the speedbar." 1164 "Set the output format for a variable displayed in the speedbar."
1170 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) 1165 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
1171 (varnum (car var))) 1166 (varnum (car var)))
1172 (gdb-input 1167 (gdb-input (concat "-var-set-format " varnum " " format) 'ignore)
1173 (list (concat "-var-set-format " varnum " " format) 'ignore))
1174 (gdb-var-update))) 1168 (gdb-var-update)))
1175 1169
1176(defun gdb-var-delete-1 (var varnum) 1170(defun gdb-var-delete-1 (var varnum)
1177 (gdb-input 1171 (gdb-input (concat "-var-delete " varnum) 'ignore)
1178 (list (concat "-var-delete " varnum) 'ignore))
1179 (setq gdb-var-list (delq var gdb-var-list)) 1172 (setq gdb-var-list (delq var gdb-var-list))
1180 (dolist (varchild gdb-var-list) 1173 (dolist (varchild gdb-var-list)
1181 (if (string-match (concat (car var) "\\.") (car varchild)) 1174 (if (string-match (concat (car var) "\\.") (car varchild))
@@ -1194,17 +1187,15 @@ With arg, enter name of variable to be watched in the minibuffer."
1194 1187
1195(defun gdb-var-delete-children (varnum) 1188(defun gdb-var-delete-children (varnum)
1196 "Delete children of variable object at point from the speedbar." 1189 "Delete children of variable object at point from the speedbar."
1197 (gdb-input 1190 (gdb-input (concat "-var-delete -c " varnum) 'ignore))
1198 (list (concat "-var-delete -c " varnum) 'ignore)))
1199 1191
1200(defun gdb-edit-value (_text _token _indent) 1192(defun gdb-edit-value (_text _token _indent)
1201 "Assign a value to a variable displayed in the speedbar." 1193 "Assign a value to a variable displayed in the speedbar."
1202 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) 1194 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
1203 (varnum (car var)) (value)) 1195 (varnum (car var)) (value))
1204 (setq value (read-string "New value: ")) 1196 (setq value (read-string "New value: "))
1205 (gdb-input 1197 (gdb-input (concat "-var-assign " varnum " " value)
1206 (list (concat "-var-assign " varnum " " value) 1198 `(lambda () (gdb-edit-value-handler ,value)))))
1207 `(lambda () (gdb-edit-value-handler ,value))))))
1208 1199
1209(defconst gdb-error-regexp "\\^error,msg=\\(\".+\"\\)") 1200(defconst gdb-error-regexp "\\^error,msg=\\(\".+\"\\)")
1210 1201
@@ -1216,8 +1207,7 @@ With arg, enter name of variable to be watched in the minibuffer."
1216 ; Uses "-var-update --all-values". Needs GDB 6.4 onwards. 1207 ; Uses "-var-update --all-values". Needs GDB 6.4 onwards.
1217(defun gdb-var-update () 1208(defun gdb-var-update ()
1218 (if (not (gdb-pending-p 'gdb-var-update)) 1209 (if (not (gdb-pending-p 'gdb-var-update))
1219 (gdb-input 1210 (gdb-input "-var-update --all-values *" 'gdb-var-update-handler))
1220 (list "-var-update --all-values *" 'gdb-var-update-handler)))
1221 (gdb-add-pending 'gdb-var-update)) 1211 (gdb-add-pending 'gdb-var-update))
1222 1212
1223(defun gdb-var-update-handler () 1213(defun gdb-var-update-handler ()
@@ -1697,13 +1687,17 @@ static char *magick[] = {
1697 gdb-continuation string "\"\n")) 1687 gdb-continuation string "\"\n"))
1698 (setq gdb-continuation nil)))) 1688 (setq gdb-continuation nil))))
1699 1689
1700(defun gdb-input (item) 1690(defun gdb-input (command handler-function)
1701 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log)) 1691 "Send COMMAND to GDB via the MI interface.
1692Run the function HANDLER-FUNCTION, with no arguments, once the command is
1693complete."
1694 (if gdb-enable-debug (push (list 'send-item command handler-function)
1695 gdb-debug-log))
1702 (setq gdb-token-number (1+ gdb-token-number)) 1696 (setq gdb-token-number (1+ gdb-token-number))
1703 (setcar item (concat (number-to-string gdb-token-number) (car item))) 1697 (setq command (concat (number-to-string gdb-token-number) command))
1704 (push (cons gdb-token-number (car (cdr item))) gdb-handler-alist) 1698 (push (cons gdb-token-number handler-function) gdb-handler-alist)
1705 (process-send-string (get-buffer-process gud-comint-buffer) 1699 (process-send-string (get-buffer-process gud-comint-buffer)
1706 (concat (car item) "\n"))) 1700 (concat command "\n")))
1707 1701
1708;; NOFRAME is used for gud execution control commands 1702;; NOFRAME is used for gud execution control commands
1709(defun gdb-current-context-command (command) 1703(defun gdb-current-context-command (command)
@@ -1890,15 +1884,16 @@ is running."
1890 (let ((record-type (cadr output-record)) 1884 (let ((record-type (cadr output-record))
1891 (arg1 (nth 2 output-record)) 1885 (arg1 (nth 2 output-record))
1892 (arg2 (nth 3 output-record))) 1886 (arg2 (nth 3 output-record)))
1893 (if (eq record-type 'gdb-error) 1887 (cond ((eq record-type 'gdb-error)
1894 (gdb-done-or-error arg2 arg1 'error) 1888 (gdb-done-or-error arg2 arg1 'error))
1895 (if (eq record-type 'gdb-done) 1889 ((eq record-type 'gdb-done)
1896 (gdb-done-or-error arg2 arg1 'done) 1890 (gdb-done-or-error arg2 arg1 'done))
1897 ;; Suppress "No registers." since GDB 6.8 and earlier duplicates MI 1891 ;; Suppress "No registers." GDB 6.8 and earlier
1898 ;; error message on internal stream. Don't print to GUD buffer. 1892 ;; duplicates MI error message on internal stream.
1899 (unless (and (eq record-type 'gdb-internals) 1893 ;; Don't print to GUD buffer.
1900 (string-equal (read arg1) "No registers.\n")) 1894 ((not (and (eq record-type 'gdb-internals)
1901 (funcall record-type arg1)))))) 1895 (string-equal (read arg1) "No registers.\n")))
1896 (funcall record-type arg1)))))
1902 1897
1903 (setq gdb-output-sink 'user) 1898 (setq gdb-output-sink 'user)
1904 ;; Remove padding. 1899 ;; Remove padding.
@@ -1991,11 +1986,10 @@ current thread and update GDB buffers."
1991 ;; -data-list-register-names needs to be issued for any stopped 1986 ;; -data-list-register-names needs to be issued for any stopped
1992 ;; thread 1987 ;; thread
1993 (when (not gdb-register-names) 1988 (when (not gdb-register-names)
1994 (gdb-input 1989 (gdb-input (concat "-data-list-register-names"
1995 (list (concat "-data-list-register-names" 1990 (if gdb-supports-non-stop
1996 (if gdb-supports-non-stop 1991 (concat " --thread " thread-id)))
1997 (concat " --thread " thread-id))) 1992 'gdb-register-names-handler))
1998 'gdb-register-names-handler)))
1999 1993
2000;;; Don't set gud-last-frame here as it's currently done in gdb-frame-handler 1994;;; Don't set gud-last-frame here as it's currently done in gdb-frame-handler
2001;;; because synchronous GDB doesn't give these fields with CLI. 1995;;; because synchronous GDB doesn't give these fields with CLI.
@@ -2062,9 +2056,7 @@ current thread and update GDB buffers."
2062;; (frontend MI commands should not print to this stream) 2056;; (frontend MI commands should not print to this stream)
2063(defun gdb-console (output-field) 2057(defun gdb-console (output-field)
2064 (setq gdb-filter-output 2058 (setq gdb-filter-output
2065 (gdb-concat-output 2059 (gdb-concat-output gdb-filter-output (read output-field))))
2066 gdb-filter-output
2067 (read output-field))))
2068 2060
2069(defun gdb-done-or-error (output-field token-number type) 2061(defun gdb-done-or-error (output-field token-number type)
2070 (if (string-equal token-number "") 2062 (if (string-equal token-number "")
@@ -2102,12 +2094,11 @@ current thread and update GDB buffers."
2102 (assq-delete-all token-number gdb-handler-alist))))) 2094 (assq-delete-all token-number gdb-handler-alist)))))
2103 2095
2104(defun gdb-concat-output (so-far new) 2096(defun gdb-concat-output (so-far new)
2105 (let ((sink gdb-output-sink)) 2097 (cond
2106 (cond 2098 ((eq gdb-output-sink 'user) (concat so-far new))
2107 ((eq sink 'user) (concat so-far new)) 2099 ((eq gdb-output-sink 'emacs)
2108 ((eq sink 'emacs) 2100 (gdb-append-to-partial-output new)
2109 (gdb-append-to-partial-output new) 2101 so-far)))
2110 so-far))))
2111 2102
2112(defun gdb-append-to-partial-output (string) 2103(defun gdb-append-to-partial-output (string)
2113 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) 2104 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
@@ -2317,9 +2308,8 @@ trigger argument when describing buffer types with
2317 (memq signal ,signal-list)) 2308 (memq signal ,signal-list))
2318 (when (not (gdb-pending-p 2309 (when (not (gdb-pending-p
2319 (cons (current-buffer) ',trigger-name))) 2310 (cons (current-buffer) ',trigger-name)))
2320 (gdb-input 2311 (gdb-input ,gdb-command
2321 (list ,gdb-command 2312 (gdb-bind-function-to-buffer ',handler-name (current-buffer)))
2322 (gdb-bind-function-to-buffer ',handler-name (current-buffer))))
2323 (gdb-add-pending (cons (current-buffer) ',trigger-name)))))) 2313 (gdb-add-pending (cons (current-buffer) ',trigger-name))))))
2324 2314
2325;; Used by disassembly buffer only, the rest use 2315;; Used by disassembly buffer only, the rest use
@@ -2446,13 +2436,10 @@ HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See
2446 ;; Only want one breakpoint icon at each location. 2436 ;; Only want one breakpoint icon at each location.
2447 (gdb-put-breakpoint-icon (string-equal flag "y") bptno 2437 (gdb-put-breakpoint-icon (string-equal flag "y") bptno
2448 (string-to-number line))) 2438 (string-to-number line)))
2449 (gdb-input 2439 (gdb-input (concat "list " file ":1") 'ignore)
2450 (list (concat "list " file ":1") 2440 (gdb-input "-file-list-exec-source-file"
2451 'ignore)) 2441 `(lambda () (gdb-get-location
2452 (gdb-input 2442 ,bptno ,line ,flag)))))))))
2453 (list "-file-list-exec-source-file"
2454 `(lambda () (gdb-get-location
2455 ,bptno ,line ,flag))))))))))
2456 2443
2457(defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"") 2444(defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"")
2458 2445
@@ -2782,7 +2769,7 @@ on the current line."
2782(def-gdb-thread-buffer-command gdb-select-thread 2769(def-gdb-thread-buffer-command gdb-select-thread
2783 (let ((new-id (bindat-get-field thread 'id))) 2770 (let ((new-id (bindat-get-field thread 'id)))
2784 (gdb-setq-thread-number new-id) 2771 (gdb-setq-thread-number new-id)
2785 (gdb-input (list (concat "-thread-select " new-id) 'ignore)) 2772 (gdb-input (concat "-thread-select " new-id) 'ignore)
2786 (gdb-update)) 2773 (gdb-update))
2787 "Select the thread at current line of threads buffer.") 2774 "Select the thread at current line of threads buffer.")
2788 2775
@@ -3538,8 +3525,8 @@ member."
3538 (if (gdb-buffer-shows-main-thread-p) 3525 (if (gdb-buffer-shows-main-thread-p)
3539 (let ((new-level (bindat-get-field frame 'level))) 3526 (let ((new-level (bindat-get-field frame 'level)))
3540 (setq gdb-frame-number new-level) 3527 (setq gdb-frame-number new-level)
3541 (gdb-input (list (concat "-stack-select-frame " new-level) 3528 (gdb-input (concat "-stack-select-frame " new-level)
3542 'ignore)) 3529 'ignore)
3543 (gdb-update)) 3530 (gdb-update))
3544 (error "Could not select frame for non-current thread")) 3531 (error "Could not select frame for non-current thread"))
3545 (error "Not recognized as frame line")))) 3532 (error "Not recognized as frame line"))))
@@ -3767,14 +3754,11 @@ member."
3767 3754
3768;; Needs GDB 6.4 onwards (used to fail with no stack). 3755;; Needs GDB 6.4 onwards (used to fail with no stack).
3769(defun gdb-get-changed-registers () 3756(defun gdb-get-changed-registers ()
3770 (if (and (gdb-get-buffer 'gdb-registers-buffer) 3757 (when (and (gdb-get-buffer 'gdb-registers-buffer)
3771 (not (gdb-pending-p 'gdb-get-changed-registers))) 3758 (not (gdb-pending-p 'gdb-get-changed-registers)))
3772 (progn 3759 (gdb-input "-data-list-changed-registers"
3773 (gdb-input 3760 'gdb-changed-registers-handler)
3774 (list 3761 (gdb-add-pending 'gdb-get-changed-registers)))
3775 "-data-list-changed-registers"
3776 'gdb-changed-registers-handler))
3777 (gdb-add-pending 'gdb-get-changed-registers))))
3778 3762
3779(defun gdb-changed-registers-handler () 3763(defun gdb-changed-registers-handler ()
3780 (gdb-delete-pending 'gdb-get-changed-registers) 3764 (gdb-delete-pending 'gdb-get-changed-registers)
@@ -3803,18 +3787,15 @@ is set in them."
3803 (dolist (buffer (buffer-list)) 3787 (dolist (buffer (buffer-list))
3804 (with-current-buffer buffer 3788 (with-current-buffer buffer
3805 (when (member buffer-file-name gdb-source-file-list) 3789 (when (member buffer-file-name gdb-source-file-list)
3806 (gdb-init-buffer)))) 3790 (gdb-init-buffer)))))
3807 (gdb-force-mode-line-update
3808 (propertize "ready" 'face font-lock-variable-name-face)))
3809 3791
3810(defun gdb-get-main-selected-frame () 3792(defun gdb-get-main-selected-frame ()
3811 "Trigger for `gdb-frame-handler' which uses main current 3793 "Trigger for `gdb-frame-handler' which uses main current
3812thread. Called from `gdb-update'." 3794thread. Called from `gdb-update'."
3813 (if (not (gdb-pending-p 'gdb-get-main-selected-frame)) 3795 (if (not (gdb-pending-p 'gdb-get-main-selected-frame))
3814 (progn 3796 (progn
3815 (gdb-input 3797 (gdb-input (gdb-current-context-command "-stack-info-frame")
3816 (list (gdb-current-context-command "-stack-info-frame") 3798 'gdb-frame-handler)
3817 'gdb-frame-handler))
3818 (gdb-add-pending 'gdb-get-main-selected-frame)))) 3799 (gdb-add-pending 'gdb-get-main-selected-frame))))
3819 3800
3820(defun gdb-frame-handler () 3801(defun gdb-frame-handler ()
@@ -3862,7 +3843,7 @@ overlay arrow in source buffer."
3862If BUF is already displayed in some window, show it, deiconifying 3843If BUF is already displayed in some window, show it, deiconifying
3863the frame if necessary. Otherwise, find least recently used 3844the frame if necessary. Otherwise, find least recently used
3864window and show BUF there, if the window is not used for GDB 3845window and show BUF there, if the window is not used for GDB
3865already, in which case that window is splitted first." 3846already, in which case that window is split first."
3866 (let ((answer (get-buffer-window buf (or frame 0)))) 3847 (let ((answer (get-buffer-window buf (or frame 0))))
3867 (if answer 3848 (if answer
3868 (display-buffer buf nil (or frame 0)) ;Deiconify frame if necessary. 3849 (display-buffer buf nil (or frame 0)) ;Deiconify frame if necessary.
@@ -4145,7 +4126,9 @@ buffers, if required."
4145 (gdb-get-buffer-create 'gdb-breakpoints-buffer) 4126 (gdb-get-buffer-create 'gdb-breakpoints-buffer)
4146 (if (and gdb-show-main gdb-main-file) 4127 (if (and gdb-show-main gdb-main-file)
4147 (let ((pop-up-windows t)) 4128 (let ((pop-up-windows t))
4148 (display-buffer (gud-find-file gdb-main-file)))))) 4129 (display-buffer (gud-find-file gdb-main-file)))))
4130 (gdb-force-mode-line-update
4131 (propertize "ready" 'face font-lock-variable-name-face)))
4149 4132
4150;;from put-image 4133;;from put-image
4151(defun gdb-put-string (putstring pos &optional dprop &rest sprops) 4134(defun gdb-put-string (putstring pos &optional dprop &rest sprops)
@@ -4256,6 +4239,42 @@ BUFFER nil or omitted means use the current buffer."
4256 (set-window-margins 4239 (set-window-margins
4257 window left-margin-width right-margin-width))))) 4240 window left-margin-width right-margin-width)))))
4258 4241
4242
4243;;; Functions for inline completion.
4244
4245(defvar gud-gdb-fetch-lines-in-progress)
4246(defvar gud-gdb-fetch-lines-string)
4247(defvar gud-gdb-fetch-lines-break)
4248(defvar gud-gdb-fetched-lines)
4249
4250(defun gud-gdbmi-completions (context command)
4251 "Completion table for GDB/MI commands.
4252COMMAND is the prefix for which we seek completion.
4253CONTEXT is the text before COMMAND on the line."
4254 (let ((gud-gdb-fetch-lines-in-progress t)
4255 (gud-gdb-fetch-lines-string nil)
4256 (gud-gdb-fetch-lines-break (length context))
4257 (gud-gdb-fetched-lines nil)
4258 ;; This filter dumps output lines to `gud-gdb-fetched-lines'.
4259 (gud-marker-filter #'gud-gdbmi-fetch-lines-filter)
4260 complete-list)
4261 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
4262 (gdb-input (concat "complete " context command)
4263 (lambda () (setq gud-gdb-fetch-lines-in-progress nil)))
4264 (while gud-gdb-fetch-lines-in-progress
4265 (accept-process-output (get-buffer-process gud-comint-buffer))))
4266 (gud-gdb-completions-1 gud-gdb-fetched-lines)))
4267
4268(defun gud-gdbmi-fetch-lines-filter (string)
4269 "Custom filter function for `gud-gdbmi-completions'."
4270 (setq string (concat gud-gdb-fetch-lines-string
4271 (gud-gdbmi-marker-filter string)))
4272 (while (string-match "\n" string)
4273 (push (substring string gud-gdb-fetch-lines-break (match-beginning 0))
4274 gud-gdb-fetched-lines)
4275 (setq string (substring string (match-end 0))))
4276 "")
4277
4259(provide 'gdb-mi) 4278(provide 'gdb-mi)
4260 4279
4261;;; gdb-mi.el ends here 4280;;; gdb-mi.el ends here
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 75d71d2d8a9..38b17a9b1ee 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -108,7 +108,7 @@ To change the default value, use Customize or call the function
108 108
109Setting it causes the grep commands to put point at the end of their 109Setting it causes the grep commands to put point at the end of their
110output window so that the end of the output is always visible rather 110output window so that the end of the output is always visible rather
111than the begining." 111than the beginning."
112 :type 'boolean 112 :type 'boolean
113 :version "22.1" 113 :version "22.1"
114 :group 'grep) 114 :group 'grep)
@@ -959,7 +959,10 @@ can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-err
959in the grep output buffer, 959in the grep output buffer,
960to go to the lines where grep found matches. 960to go to the lines where grep found matches.
961 961
962This command shares argument histories with \\[lgrep] and \\[grep-find]." 962This command shares argument histories with \\[lgrep] and \\[grep-find].
963
964When called programmatically and FILES is nil, REGEXP is expected
965to specify a command to run."
963 (interactive 966 (interactive
964 (progn 967 (progn
965 (grep-compute-defaults) 968 (grep-compute-defaults)
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 406db76487d..7215ac4ea73 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -756,6 +756,8 @@ directory and source-file directory for your debugger."
756 756
757 (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point 757 (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point
758 nil 'local) 758 nil 'local)
759 (set (make-local-variable 'gud-gdb-completion-function) 'gud-gdb-completions)
760
759 (local-set-key "\C-i" 'completion-at-point) 761 (local-set-key "\C-i" 'completion-at-point)
760 (setq comint-prompt-regexp "^(.*gdb[+]?) *") 762 (setq comint-prompt-regexp "^(.*gdb[+]?) *")
761 (setq paragraph-start comint-prompt-regexp) 763 (setq paragraph-start comint-prompt-regexp)
@@ -768,6 +770,12 @@ directory and source-file directory for your debugger."
768;; context-sensitive command completion. We preserve that feature 770;; context-sensitive command completion. We preserve that feature
769;; in the GUD buffer by using a GDB command designed just for Emacs. 771;; in the GUD buffer by using a GDB command designed just for Emacs.
770 772
773(defvar gud-gdb-completion-function nil
774 "Completion function for GDB commands.
775It receives two arguments: COMMAND, the prefix for which we seek
776completion; and CONTEXT, the text before COMMAND on the line.
777It should return a list of completion strings.")
778
771;; The completion process filter indicates when it is finished. 779;; The completion process filter indicates when it is finished.
772(defvar gud-gdb-fetch-lines-in-progress) 780(defvar gud-gdb-fetch-lines-in-progress)
773 781
@@ -806,28 +814,32 @@ CONTEXT is the text before COMMAND on the line."
806 (and complete-list 814 (and complete-list
807 (string-match "^Undefined command: \"complete\"" (car complete-list)) 815 (string-match "^Undefined command: \"complete\"" (car complete-list))
808 (error "This version of GDB doesn't support the `complete' command")) 816 (error "This version of GDB doesn't support the `complete' command"))
809 ;; Sort the list like readline. 817 (gud-gdb-completions-1 complete-list)))
810 (setq complete-list (sort complete-list (function string-lessp))) 818
811 ;; Remove duplicates. 819;; This function is also used by `gud-gdbmi-completions'.
812 (let ((first complete-list) 820(defun gud-gdb-completions-1 (complete-list)
813 (second (cdr complete-list))) 821 ;; Sort the list like readline.
814 (while second 822 (setq complete-list (sort complete-list (function string-lessp)))
815 (if (string-equal (car first) (car second)) 823 ;; Remove duplicates.
816 (setcdr first (setq second (cdr second))) 824 (let ((first complete-list)
817 (setq first second 825 (second (cdr complete-list)))
818 second (cdr second))))) 826 (while second
819 ;; Add a trailing single quote if there is a unique completion 827 (if (string-equal (car first) (car second))
820 ;; and it contains an odd number of unquoted single quotes. 828 (setcdr first (setq second (cdr second)))
821 (and (= (length complete-list) 1) 829 (setq first second
822 (let ((str (car complete-list)) 830 second (cdr second)))))
823 (pos 0) 831 ;; Add a trailing single quote if there is a unique completion
824 (count 0)) 832 ;; and it contains an odd number of unquoted single quotes.
825 (while (string-match "\\([^'\\]\\|\\\\'\\)*'" str pos) 833 (and (= (length complete-list) 1)
826 (setq count (1+ count) 834 (let ((str (car complete-list))
827 pos (match-end 0))) 835 (pos 0)
828 (and (= (mod count 2) 1) 836 (count 0))
829 (setq complete-list (list (concat str "'")))))) 837 (while (string-match "\\([^'\\]\\|\\\\'\\)*'" str pos)
830 complete-list)) 838 (setq count (1+ count)
839 pos (match-end 0)))
840 (and (= (mod count 2) 1)
841 (setq complete-list (list (concat str "'"))))))
842 complete-list)
831 843
832(defun gud-gdb-completion-at-point () 844(defun gud-gdb-completion-at-point ()
833 "Return the data to complete the GDB command before point." 845 "Return the data to complete the GDB command before point."
@@ -838,7 +850,7 @@ CONTEXT is the text before COMMAND on the line."
838 (point)))) 850 (point))))
839 (list start end 851 (list start end
840 (completion-table-dynamic 852 (completion-table-dynamic
841 (apply-partially #'gud-gdb-completions 853 (apply-partially gud-gdb-completion-function
842 (buffer-substring (comint-line-beginning-position) 854 (buffer-substring (comint-line-beginning-position)
843 start)))))) 855 start))))))
844 856
@@ -851,11 +863,11 @@ CONTEXT is the text before COMMAND on the line."
851 863
852;; The completion process filter is installed temporarily to slurp the 864;; The completion process filter is installed temporarily to slurp the
853;; output of GDB up to the next prompt and build the completion list. 865;; output of GDB up to the next prompt and build the completion list.
854(defun gud-gdb-fetch-lines-filter (string filter) 866(defun gud-gdb-fetch-lines-filter (string)
855 "Filter used to read the list of lines output by a command. 867 "Filter used to read the list of lines output by a command.
856STRING is the output to filter. 868STRING is the output to filter.
857It is passed through FILTER before we look at it." 869It is passed through `gud-gdb-marker-filter' before we look at it."
858 (setq string (funcall filter string)) 870 (setq string (gud-gdb-marker-filter string))
859 (setq string (concat gud-gdb-fetch-lines-string string)) 871 (setq string (concat gud-gdb-fetch-lines-string string))
860 (while (string-match "\n" string) 872 (while (string-match "\n" string)
861 (push (substring string gud-gdb-fetch-lines-break (match-beginning 0)) 873 (push (substring string gud-gdb-fetch-lines-break (match-beginning 0))
@@ -880,17 +892,6 @@ It is passed through FILTER before we look at it."
880(defvar gud-gdb-fetched-stack-frame nil 892(defvar gud-gdb-fetched-stack-frame nil
881 "Stack frames we are fetching from GDB.") 893 "Stack frames we are fetching from GDB.")
882 894
883;(defun gud-gdb-get-scope-data (text token indent)
884; ;; checkdoc-params: (indent)
885; "Fetch data associated with a stack frame, and expand/contract it.
886;Data to do this is retrieved from TEXT and TOKEN."
887; (let ((args nil) (scope nil))
888; (gud-gdb-run-command-fetch-lines "info args")
889;
890; (gud-gdb-run-command-fetch-lines "info local")
891;
892; ))
893
894(defun gud-gdb-get-stackframe (buffer) 895(defun gud-gdb-get-stackframe (buffer)
895 "Extract the current stack frame out of the GUD GDB BUFFER." 896 "Extract the current stack frame out of the GUD GDB BUFFER."
896 (let ((newlst nil) 897 (let ((newlst nil)
@@ -934,21 +935,16 @@ It is passed through FILTER before we look at it."
934BUFFER is the current buffer which may be the GUD buffer in which to run. 935BUFFER is the current buffer which may be the GUD buffer in which to run.
935SKIP is the number of chars to skip on each line, it defaults to 0." 936SKIP is the number of chars to skip on each line, it defaults to 0."
936 (with-current-buffer gud-comint-buffer 937 (with-current-buffer gud-comint-buffer
937 (if (and (eq gud-comint-buffer buffer) 938 (unless (and (eq gud-comint-buffer buffer)
938 (save-excursion 939 (save-excursion
939 (goto-char (point-max)) 940 (goto-char (point-max))
940 (forward-line 0) 941 (forward-line 0)
941 (not (looking-at comint-prompt-regexp)))) 942 (not (looking-at comint-prompt-regexp))))
942 nil
943 ;; Much of this copied from GDB complete, but I'm grabbing the stack
944 ;; frame instead.
945 (let ((gud-gdb-fetch-lines-in-progress t) 943 (let ((gud-gdb-fetch-lines-in-progress t)
946 (gud-gdb-fetched-lines nil) 944 (gud-gdb-fetched-lines nil)
947 (gud-gdb-fetch-lines-string nil) 945 (gud-gdb-fetch-lines-string nil)
948 (gud-gdb-fetch-lines-break (or skip 0)) 946 (gud-gdb-fetch-lines-break (or skip 0))
949 (gud-marker-filter 947 (gud-marker-filter #'gud-gdb-fetch-lines-filter))
950 `(lambda (string)
951 (gud-gdb-fetch-lines-filter string ',gud-marker-filter))))
952 ;; Issue the command to GDB. 948 ;; Issue the command to GDB.
953 (gud-basic-call command) 949 (gud-basic-call command)
954 ;; Slurp the output. 950 ;; Slurp the output.
@@ -1919,7 +1915,7 @@ extension EXTN. Normally EXTN is given as the regular expression
1919;; in petticoat junction. 1915;; in petticoat junction.
1920(defun gud-jdb-skip-block () 1916(defun gud-jdb-skip-block ()
1921 1917
1922 ;; Find the begining of the block. 1918 ;; Find the beginning of the block.
1923 (while 1919 (while
1924 (not (eq (following-char) ?{)) 1920 (not (eq (following-char) ?{))
1925 1921
@@ -1936,7 +1932,7 @@ extension EXTN. Normally EXTN is given as the regular expression
1936 (gud-jdb-skip-character-literal)) 1932 (gud-jdb-skip-character-literal))
1937 (t (forward-char)))) 1933 (t (forward-char))))
1938 1934
1939 ;; Now at the begining of the block. 1935 ;; Now at the beginning of the block.
1940 (forward-char) 1936 (forward-char)
1941 1937
1942 ;; Skip over the body of the block as well as the final brace. 1938 ;; Skip over the body of the block as well as the final brace.
@@ -3422,7 +3418,7 @@ With arg, dereference expr if ARG is positive, otherwise do not dereference."
3422 ((xdb pdb) (concat "p " expr)) 3418 ((xdb pdb) (concat "p " expr))
3423 (sdb (concat expr "/")))) 3419 (sdb (concat expr "/"))))
3424 3420
3425(declare-function gdb-input "gdb-mi" (item)) 3421(declare-function gdb-input "gdb-mi" (command handler))
3426(declare-function tooltip-expr-to-print "tooltip" (event)) 3422(declare-function tooltip-expr-to-print "tooltip" (event))
3427(declare-function tooltip-event-buffer "tooltip" (event)) 3423(declare-function tooltip-event-buffer "tooltip" (event))
3428 3424
@@ -3468,12 +3464,12 @@ so they have been disabled."))
3468 (if (eq gud-minor-mode 'gdbmi) 3464 (if (eq gud-minor-mode 'gdbmi)
3469 (if gdb-macro-info 3465 (if gdb-macro-info
3470 (gdb-input 3466 (gdb-input
3471 (list (concat 3467 (concat
3472 "server macro expand " expr "\n") 3468 "server macro expand " expr "\n")
3473 `(lambda () (gdb-tooltip-print-1 ,expr)))) 3469 `(lambda () (gdb-tooltip-print-1 ,expr)))
3474 (gdb-input 3470 (gdb-input
3475 (list (concat cmd "\n") 3471 (concat cmd "\n")
3476 `(lambda () (gdb-tooltip-print ,expr))))) 3472 `(lambda () (gdb-tooltip-print ,expr))))
3477 (setq gud-tooltip-original-filter (process-filter process)) 3473 (setq gud-tooltip-original-filter (process-filter process))
3478 (set-process-filter process 'gud-tooltip-process-output) 3474 (set-process-filter process 'gud-tooltip-process-output)
3479 (gud-basic-call cmd)) 3475 (gud-basic-call cmd))
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index 374a45acec6..82961376669 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -822,7 +822,7 @@ Point is left unchanged."
822 822
823(defun hif-possibly-hide () 823(defun hif-possibly-hide ()
824 "Called at #ifX expression, this hides those parts that should be hidden. 824 "Called at #ifX expression, this hides those parts that should be hidden.
825It uses the judgement of `hide-ifdef-evaluator'." 825It uses the judgment of `hide-ifdef-evaluator'."
826 ;; (message "hif-possibly-hide") (sit-for 1) 826 ;; (message "hif-possibly-hide") (sit-for 1)
827 (let ((test (hif-canonicalize)) 827 (let ((test (hif-canonicalize))
828 (range (hif-find-range))) 828 (range (hif-find-range)))
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index d8715599d74..6ce415b563d 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -2464,7 +2464,7 @@ If prefix ARG < 0 then move forward to enclosing block end."
2464(defun idlwave-down-block (&optional arg) 2464(defun idlwave-down-block (&optional arg)
2465 "Go down a block. 2465 "Go down a block.
2466With ARG: ARG >= 0 go forwards, ARG < 0 go backwards. 2466With ARG: ARG >= 0 go forwards, ARG < 0 go backwards.
2467Returns non-nil if successfull." 2467Returns non-nil if successful."
2468 (interactive "p") 2468 (interactive "p")
2469 (let (status) 2469 (let (status)
2470 (if (< arg 0) 2470 (if (< arg 0)
@@ -7866,7 +7866,7 @@ itself."
7866 "Display online help about the completion at point." 7866 "Display online help about the completion at point."
7867 (interactive "eP") 7867 (interactive "eP")
7868 ;; Restore last-command for next command, to make 7868 ;; Restore last-command for next command, to make
7869 ;; scrolling/cancelling of completions work. 7869 ;; scrolling/canceling of completions work.
7870 (setq this-command last-command) 7870 (setq this-command last-command)
7871 (idlwave-do-mouse-completion-help ev)) 7871 (idlwave-do-mouse-completion-help ev))
7872 7872
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 1328e303d45..dd24aeea9a3 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -36,7 +36,7 @@
36;; This makes these modes easier to use. 36;; This makes these modes easier to use.
37 37
38;; For documentation on the functionality provided by comint mode, and 38;; For documentation on the functionality provided by comint mode, and
39;; the hooks available for customising it, see the file comint.el. 39;; the hooks available for customizing it, see the file comint.el.
40;; For further information on inferior-lisp mode, see the comments below. 40;; For further information on inferior-lisp mode, see the comments below.
41 41
42;; Needs fixin: 42;; Needs fixin:
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 94a9c250fee..f0c86265232 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3000,7 +3000,7 @@ browser, respectively."
3000 '(js> ((fifth hitab) "selectedTab") (fourth hitab)) 3000 '(js> ((fifth hitab) "selectedTab") (fourth hitab))
3001 cmds))) 3001 cmds)))
3002 3002
3003 ;; Hilighting whole window 3003 ;; Highlighting whole window
3004 ((third hitab) 3004 ((third hitab)
3005 (push '(js! ((third hitab) "document" 3005 (push '(js! ((third hitab) "document"
3006 "documentElement" "setAttribute") 3006 "documentElement" "setAttribute")
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index c1a87a9d033..024744957c6 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -315,25 +315,32 @@ not be enclosed in { } or ( )."
315 "List of keywords understood by automake.") 315 "List of keywords understood by automake.")
316 316
317(defconst makefile-gmake-statements 317(defconst makefile-gmake-statements
318 `("-sinclude" "sinclude" "vpath" ; makefile-makepp-statements takes rest 318 `("-sinclude" "sinclude" ; makefile-makepp-statements takes rest
319 "ifdef" "ifndef" "ifeq" "ifneq" "-include" "define" "endef" "export" 319 "ifdef" "ifndef" "ifeq" "ifneq" "-include" "define" "endef" "export"
320 "override define" "override" "unexport" 320 "override define" "override" "unexport" "vpath"
321 ,@(cdr makefile-automake-statements)) 321 ,@(cdr makefile-automake-statements))
322 "List of keywords understood by gmake.") 322 "List of keywords understood by gmake.")
323 323
324;; These are even more silly, because you can have more spaces in between.
325(defconst makefile-makepp-statements 324(defconst makefile-makepp-statements
326 `("and ifdef" "and ifndef" "and ifeq" "and ifneq" "and ifperl" 325 `(t ; - alternately means _
327 "and ifmakeperl" "and ifsys" "and ifnsys" "build_cache" "build_check" 326 ;; todo: take if* out of these lists, and let the negation regexp do it all
327 "ifperl" "ifmakeperl" "ifsys" "ifnsys" "iftrue" "ifntrue"
328 "and ifdef" "and ifndef" "and ifeq" "and ifneq" "and ifperl"
329 "and ifmakeperl" "and ifsys" "and ifnsys" "and iftrue" "and ifntrue"
328 "else ifdef" "else ifndef" "else ifeq" "else ifneq" "else ifperl" 330 "else ifdef" "else ifndef" "else ifeq" "else ifneq" "else ifperl"
329 "else ifmakeperl" "else ifsys" "else ifnsys" "enddef" "global" 331 "else ifmakeperl" "else ifsys" "else ifnsys" "else iftrue" "else ifntrue"
330 "load_makefile" "ifperl" "ifmakeperl" "ifsys" "ifnsys" "_include" 332 "or ifdef" "or ifndef" "or ifeq" "or ifneq" "or ifperl"
331 "makeperl" "makesub" "no_implicit_load" "perl" "perl-begin" "perl_begin" 333 "or ifmakeperl" "or ifsys" "or ifnsys" "or iftrue" "or ifntrue"
332 "perl-end" "perl_end" "prebuild" "or ifdef" "or ifndef" "or ifeq" 334
333 "or ifneq" "or ifperl" "or ifmakeperl" "or ifsys" "or ifnsys" 335 "autoload" "build-cache" "build-check" "enddef" "export define"
334 "override export" "override global" "register_command_parser" 336 "global" "global build-cache" "global build-check" "global define"
335 "register_scanner" "repository" "runtime" "signature" "sub" 337 "global signature" "global override signature" "load-makefile"
336 ,@(nthcdr 3 makefile-gmake-statements)) 338 "make" "makeperl" "makesub" "no-implicit-load" "perl" "perl-begin"
339 "perl-end" "prebuild" "override export" "override global" "register-parser"
340 "register-command-parser" "register-input-suffix"
341 "register-scanner" "repository" "runtime" "signature" "sub"
342
343 ,@(nthcdr 2 makefile-gmake-statements))
337 "List of keywords understood by gmake.") 344 "List of keywords understood by gmake.")
338 345
339(defconst makefile-bsdmake-statements 346(defconst makefile-bsdmake-statements
@@ -372,7 +379,12 @@ not be enclosed in { } or ( )."
372 379
373 ;; Fontify conditionals and includes. 380 ;; Fontify conditionals and includes.
374 (,(concat "^\\(?: [ \t]*\\)?" 381 (,(concat "^\\(?: [ \t]*\\)?"
375 (regexp-opt keywords t) 382 (replace-regexp-in-string
383 " " "[ \t]+"
384 (if (eq (car keywords) t)
385 (replace-regexp-in-string "-" "[_-]"
386 (regexp-opt (cdr keywords) t))
387 (regexp-opt keywords t)))
376 "\\>[ \t]*\\([^: \t\n#]*\\)") 388 "\\>[ \t]*\\([^: \t\n#]*\\)")
377 (1 font-lock-keyword-face) (2 font-lock-variable-name-face)) 389 (1 font-lock-keyword-face) (2 font-lock-variable-name-face))
378 390
@@ -436,7 +448,7 @@ not be enclosed in { } or ( )."
436 makefile-var-use-regex 448 makefile-var-use-regex
437 makefile-makepp-statements 449 makefile-makepp-statements
438 nil 450 nil
439 "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\)\\>" 451 "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\|true\\)\\>"
440 452
441 '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)" 453 '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)"
442 1 'makefile-targets append) 454 1 'makefile-targets append)
@@ -447,17 +459,17 @@ not be enclosed in { } or ( )."
447 (2 font-lock-keyword-face t) 459 (2 font-lock-keyword-face t)
448 (3 font-lock-variable-name-face t)) 460 (3 font-lock-variable-name-face t))
449 461
450 ;; $(function ...) $((function ...)) ${function ...} ${{function ...}} 462 ;; $(function ...) $((function ...)) ${...} ${{...}} $[...] $[[...]]
451 '("[^$]\\$\\(?:((?\\|{{?\\)\\([-a-zA-Z0-9_.]+\\s \\)" 463 '("[^$]\\$\\(?:((?\\|{{?\\|\\[\\[?\\)\\([-a-zA-Z0-9_.]+\\s \\)"
452 1 font-lock-function-name-face prepend) 464 1 font-lock-function-name-face prepend)
453 465
454 ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}} 466 ;; $(shell ...) $((shell ...)) ${...} ${{...}} $[...] $[[...]]
455 '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+" 467 '("[^$]\\$\\(((?\\|{{?\\|\\[\\[?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+"
456 makefile-match-function-end nil nil 468 makefile-match-function-end nil nil
457 (1 'makefile-shell prepend t)) 469 (1 'makefile-shell prepend t))
458 470
459 ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}} 471 ;; $(perl ...) $((perl ...)) ${...} ${{...}} $[...] $[[...]]
460 '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+" 472 '("[^$]\\$\\(((?\\|{{?\\|\\[\\[?\\)makeperl[ \t]+"
461 makefile-match-function-end nil nil 473 makefile-match-function-end nil nil
462 (1 'makefile-makepp-perl prepend t)) 474 (1 'makefile-makepp-perl prepend t))
463 '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+" 475 '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+"
@@ -1688,8 +1700,10 @@ The anchor must have matched the opening parens in the first group."
1688 ;; FIXME forward-sexp or somesuch would be better? 1700 ;; FIXME forward-sexp or somesuch would be better?
1689 (if (setq s (cond ((string= s "(") ")") 1701 (if (setq s (cond ((string= s "(") ")")
1690 ((string= s "{") "}") 1702 ((string= s "{") "}")
1703 ((string= s "[") "]")
1691 ((string= s "((") "))") 1704 ((string= s "((") "))")
1692 ((string= s "{{") "}}"))) 1705 ((string= s "{{") "}}")
1706 ((string= s "[[") "]]")))
1693 (re-search-forward (concat "\\(.*\\)[ \t]*" s) (line-end-position) t)))) 1707 (re-search-forward (concat "\\(.*\\)[ \t]*" s) (line-end-position) t))))
1694 1708
1695(defun makefile-match-dependency (bound) 1709(defun makefile-match-dependency (bound)
diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el
index b1502adbeb1..2db4309d9e0 100644
--- a/lisp/progmodes/pascal.el
+++ b/lisp/progmodes/pascal.el
@@ -786,6 +786,7 @@ on the line which ends a function or procedure named NAME."
786 (if (looking-at "[ \t]+$") 786 (if (looking-at "[ \t]+$")
787 (skip-chars-forward " \t")))) 787 (skip-chars-forward " \t"))))
788 788
789(defvar ind) ;Used via `eval' in pascal-indent-alist.
789(defun pascal-indent-line () 790(defun pascal-indent-line ()
790 "Indent current line as a Pascal statement." 791 "Indent current line as a Pascal statement."
791 (let* ((indent-str (pascal-calculate-indent)) 792 (let* ((indent-str (pascal-calculate-indent))
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 5b229cc0c24..0efc2ca231b 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -147,9 +147,9 @@
147;; o Introduced three new customizable variables: electric colon 147;; o Introduced three new customizable variables: electric colon
148;; (`prolog-electric-colon-flag', default nil), electric dash 148;; (`prolog-electric-colon-flag', default nil), electric dash
149;; (`prolog-electric-dash-flag', default nil), and a possibility 149;; (`prolog-electric-dash-flag', default nil), and a possibility
150;; to prevent the predicate template insertion from adding commata 150;; to prevent the predicate template insertion from adding commas
151;; (`prolog-electric-dot-full-predicate-template', defaults to t 151;; (`prolog-electric-dot-full-predicate-template', defaults to t
152;; since it seems quicker to me to just type those commata). A 152;; since it seems quicker to me to just type those commas). A
153;; trivial adaptation of a patch by Markus Triska. 153;; trivial adaptation of a patch by Markus Triska.
154;; o Improved the behavior of electric if-then-else to only skip 154;; o Improved the behavior of electric if-then-else to only skip
155;; forward if the parenthesis/semicolon is preceded by 155;; forward if the parenthesis/semicolon is preceded by
@@ -512,7 +512,7 @@ It does not apply in strings and comments."
512(defcustom prolog-electric-dot-full-predicate-template nil 512(defcustom prolog-electric-dot-full-predicate-template nil
513 "*If nil, electric dot inserts only the current predicate's name and `(' 513 "*If nil, electric dot inserts only the current predicate's name and `('
514for recursive calls or new clause heads. Non-nil means to also 514for recursive calls or new clause heads. Non-nil means to also
515insert enough commata to cover the predicate's arity and `)', 515insert enough commas to cover the predicate's arity and `)',
516and dot and newline for recursive calls." 516and dot and newline for recursive calls."
517 :group 'prolog-keyboard 517 :group 'prolog-keyboard
518 :type 'boolean) 518 :type 'boolean)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index fbf7c3c42f7..6081d8e838b 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2343,7 +2343,7 @@ Interactively, prompt for the name with completion."
2343;;;; Bicycle Repair Man support 2343;;;; Bicycle Repair Man support
2344 2344
2345(autoload 'pymacs-load "pymacs" nil t) 2345(autoload 'pymacs-load "pymacs" nil t)
2346(autoload 'brm-init "bikemacs") 2346(autoload 'brm-init "bikeemacs")
2347(defvar brm-menu) 2347(defvar brm-menu)
2348 2348
2349;; I'm not sure how useful BRM really is, and it's certainly dangerous 2349;; I'm not sure how useful BRM really is, and it's certainly dangerous
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 03e095b6bfc..60ba768a80e 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4224,7 +4224,7 @@ The default comes from `process-coding-system-alist' and
4224 "^\\(.+\\) (hex ..)$" 4224 "^\\(.+\\) (hex ..)$"
4225 "SET \\1") 4225 "SET \\1")
4226 4226
4227 ;; FEDDBACK ON for 99 or more rows 4227 ;; FEEDBACK ON for 99 or more rows
4228 ;; feedback OFF 4228 ;; feedback OFF
4229 (sql-redirect-value 4229 (sql-redirect-value
4230 sqlbuf 4230 sqlbuf
diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el
index b02324871ff..434984c8bf1 100644
--- a/lisp/progmodes/vera-mode.el
+++ b/lisp/progmodes/vera-mode.el
@@ -427,7 +427,7 @@ Key bindings:
427 "icompare" "insert" "inst_get_at_least" "inst_get_auto_bin_max" 427 "icompare" "insert" "inst_get_at_least" "inst_get_auto_bin_max"
428 "inst_get_collect" "inst_get_cov_weight" "inst_get_coverage_goal" 428 "inst_get_collect" "inst_get_cov_weight" "inst_get_coverage_goal"
429 "inst_getcross_bin_max" "inst_query" "inst_set_at_least" 429 "inst_getcross_bin_max" "inst_query" "inst_set_at_least"
430 "inst_set_auto_bin_max" "inst_set_bin_activiation" "inst_set_collect" 430 "inst_set_auto_bin_max" "inst_set_bin_activation" "inst_set_collect"
431 "inst_set_cov_weight" "inst_set_coverage_goal" "inst_set_cross_bin_max" 431 "inst_set_cov_weight" "inst_set_coverage_goal" "inst_set_cross_bin_max"
432 "itoa" 432 "itoa"
433 "last" "last_index" "len" "load" 433 "last" "last_index" "len" "load"
@@ -438,7 +438,7 @@ Key bindings:
438 "push_front" "putc" 438 "push_front" "putc"
439 "query" "query_str" 439 "query" "query_str"
440 "rand_mode" "randomize" "reserve" "reverse" "rsort" 440 "rand_mode" "randomize" "reserve" "reverse" "rsort"
441 "search" "set_at_least" "set_auto_bin_max" "set_bin_activiation" 441 "search" "set_at_least" "set_auto_bin_max" "set_bin_activation"
442 "set_cov_weight" "set_coverage_goal" "set_cross_bin_max" "set_name" "size" 442 "set_cov_weight" "set_coverage_goal" "set_cross_bin_max" "set_name" "size"
443 "sort" "substr" "sum" 443 "sort" "substr" "sum"
444 "thismatch" "tolower" "toupper" 444 "thismatch" "tolower" "toupper"
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 3ae66a477e8..52e7b6e2429 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -981,7 +981,7 @@ of each Verilog file that requires it, rather than being set globally."
981 "*If true, AUTORESET will reset those signals which were 981 "*If true, AUTORESET will reset those signals which were
982assigned with blocking assignments (=) even in a block with 982assigned with blocking assignments (=) even in a block with
983non-blocking assignments (<=). 983non-blocking assignments (<=).
984 984
985If nil, all blocking assigned signals are ignored when any 985If nil, all blocking assigned signals are ignored when any
986non-blocking assignment is in the AUTORESET block. This allows 986non-blocking assignment is in the AUTORESET block. This allows
987blocking assignments to be used for temporary values and not have 987blocking assignments to be used for temporary values and not have
@@ -2011,7 +2011,7 @@ find the errors."
2011 "`uvm_component_utils" 2011 "`uvm_component_utils"
2012 "`uvm_create" 2012 "`uvm_create"
2013 "`uvm_create_on" 2013 "`uvm_create_on"
2014 "`uvm_create_seq" ;; Undocumented in 1.1 2014 "`uvm_create_seq" ;; Undocumented in 1.1
2015 "`uvm_declare_p_sequencer" 2015 "`uvm_declare_p_sequencer"
2016 "`uvm_declare_sequence_lib" ;; Deprecated in 1.1 2016 "`uvm_declare_sequence_lib" ;; Deprecated in 1.1
2017 "`uvm_do" 2017 "`uvm_do"
@@ -7505,7 +7505,7 @@ Signals must be in standard (base vector) form."
7505 (nreverse out-list))) 7505 (nreverse out-list)))
7506 7506
7507(defun verilog-signals-combine-bus (in-list) 7507(defun verilog-signals-combine-bus (in-list)
7508 "Return a list of signals in IN-LIST, with busses combined. 7508 "Return a list of signals in IN-LIST, with buses combined.
7509Duplicate signals are also removed. For example A[2] and A[1] become A[2:1]." 7509Duplicate signals are also removed. For example A[2] and A[1] become A[2:1]."
7510 (let (combo buswarn 7510 (let (combo buswarn
7511 out-list 7511 out-list
@@ -9907,7 +9907,7 @@ If optional WHITESPACE true, ignore whitespace."
9907 (p2 (with-current-buffer b2 (goto-char (point-min)))) 9907 (p2 (with-current-buffer b2 (goto-char (point-min))))
9908 (maxp1 (with-current-buffer b1 (point-max))) 9908 (maxp1 (with-current-buffer b1 (point-max)))
9909 (maxp2 (with-current-buffer b2 (point-max))) 9909 (maxp2 (with-current-buffer b2 (point-max)))
9910 (op1 -1) (op2 -1) 9910 (op1 -1) (op2 -1)
9911 progress size) 9911 progress size)
9912 (while (not (and (eq p1 op1) (eq p2 op2))) 9912 (while (not (and (eq p1 op1) (eq p2 op2)))
9913 ;; If both windows have whitespace optionally skip over it. 9913 ;; If both windows have whitespace optionally skip over it.
@@ -10100,7 +10100,7 @@ instantiating the resulting module. Long lines are split based
10100on the `fill-column', see \\[set-fill-column]. 10100on the `fill-column', see \\[set-fill-column].
10101 10101
10102Limitations: 10102Limitations:
10103 Concatenation and outputting partial busses is not supported. 10103 Concatenation and outputting partial buses is not supported.
10104 10104
10105 Typedefs must match `verilog-typedef-regexp', which is disabled by default. 10105 Typedefs must match `verilog-typedef-regexp', which is disabled by default.
10106 10106
@@ -10932,7 +10932,7 @@ Typing \\[verilog-auto] will make this into:
10932(defun verilog-auto-logic () 10932(defun verilog-auto-logic ()
10933 "Expand AUTOLOGIC statements, as part of \\[verilog-auto]. 10933 "Expand AUTOLOGIC statements, as part of \\[verilog-auto].
10934Make wire statements using the SystemVerilog logic keyword. 10934Make wire statements using the SystemVerilog logic keyword.
10935This is currently equivelent to: 10935This is currently equivalent to:
10936 10936
10937 /*AUTOWIRE*/ 10937 /*AUTOWIRE*/
10938 10938
@@ -10958,7 +10958,7 @@ the datatype of the declarations.
10958 10958
10959Limitations: 10959Limitations:
10960 This ONLY detects outputs of AUTOINSTants (see `verilog-read-sub-decls'), 10960 This ONLY detects outputs of AUTOINSTants (see `verilog-read-sub-decls'),
10961 and all busses must have widths, such as those from AUTOINST, or using [] 10961 and all buses must have widths, such as those from AUTOINST, or using []
10962 in AUTO_TEMPLATEs. 10962 in AUTO_TEMPLATEs.
10963 10963
10964 This does NOT work on memories or SystemVerilog .name connections, 10964 This does NOT work on memories or SystemVerilog .name connections,
@@ -11315,7 +11315,7 @@ Limitations:
11315 If placed inside the parenthesis of a module declaration, it creates 11315 If placed inside the parenthesis of a module declaration, it creates
11316 Verilog 2001 style, else uses Verilog 1995 style. 11316 Verilog 2001 style, else uses Verilog 1995 style.
11317 11317
11318 Concatenation and outputting partial busses is not supported. 11318 Concatenation and outputting partial buses is not supported.
11319 11319
11320 Module names must be resolvable to filenames. See `verilog-auto-inst'. 11320 Module names must be resolvable to filenames. See `verilog-auto-inst'.
11321 11321
@@ -11439,7 +11439,7 @@ Limitations:
11439 If placed inside the parenthesis of a module declaration, it creates 11439 If placed inside the parenthesis of a module declaration, it creates
11440 Verilog 2001 style, else uses Verilog 1995 style. 11440 Verilog 2001 style, else uses Verilog 1995 style.
11441 11441
11442 Concatenation and outputting partial busses is not supported. 11442 Concatenation and outputting partial buses is not supported.
11443 11443
11444 Module names must be resolvable to filenames. See `verilog-auto-inst'. 11444 Module names must be resolvable to filenames. See `verilog-auto-inst'.
11445 11445
@@ -11490,7 +11490,7 @@ Limitations:
11490 If placed inside the parenthesis of a module declaration, it creates 11490 If placed inside the parenthesis of a module declaration, it creates
11491 Verilog 2001 style, else uses Verilog 1995 style. 11491 Verilog 2001 style, else uses Verilog 1995 style.
11492 11492
11493 Concatenation and outputting partial busses is not supported. 11493 Concatenation and outputting partial buses is not supported.
11494 11494
11495 Module names must be resolvable to filenames. See `verilog-auto-inst'. 11495 Module names must be resolvable to filenames. See `verilog-auto-inst'.
11496 11496
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 3a94601768d..deac85581d2 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -1714,7 +1714,7 @@ an absolute path (i.e. all caches can be stored in one global directory)."
1714 1714
1715 1715
1716(defgroup vhdl-menu nil 1716(defgroup vhdl-menu nil
1717 "Customizations for menues." 1717 "Customizations for menus."
1718 :group 'vhdl) 1718 :group 'vhdl)
1719 1719
1720(defcustom vhdl-index-menu nil 1720(defcustom vhdl-index-menu nil
@@ -1844,7 +1844,7 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
1844;; Internal variables 1844;; Internal variables
1845 1845
1846(defvar vhdl-menu-max-size 20 1846(defvar vhdl-menu-max-size 20
1847 "*Specifies the maximum size of a menu before splitting it into submenues.") 1847 "*Specifies the maximum size of a menu before splitting it into submenus.")
1848 1848
1849(defvar vhdl-progress-interval 1 1849(defvar vhdl-progress-interval 1
1850 "*Interval used to update progress status during long operations. 1850 "*Interval used to update progress status during long operations.
@@ -2468,7 +2468,7 @@ conversion."
2468 (goto-char marker)) 2468 (goto-char marker))
2469 2469
2470(defun vhdl-menu-split (list title) 2470(defun vhdl-menu-split (list title)
2471 "Split menu LIST into several submenues, if number of 2471 "Split menu LIST into several submenus, if number of
2472elements > `vhdl-menu-max-size'." 2472elements > `vhdl-menu-max-size'."
2473 (if (> (length list) vhdl-menu-max-size) 2473 (if (> (length list) vhdl-menu-max-size)
2474 (let ((remain list) 2474 (let ((remain list)
@@ -4266,7 +4266,7 @@ Usage:
4266 4266
4267 CODE BEAUTIFICATION: 4267 CODE BEAUTIFICATION:
4268 `C-c M-b' and `C-c C-b' beautify the code of a region or of the entire 4268 `C-c M-b' and `C-c C-b' beautify the code of a region or of the entire
4269 buffer respectively. This inludes indentation, alignment, and case 4269 buffer respectively. This includes indentation, alignment, and case
4270 fixing. Code beautification can also be run non-interactively using the 4270 fixing. Code beautification can also be run non-interactively using the
4271 command: 4271 command:
4272 4272
@@ -10812,7 +10812,7 @@ but not if inside a comment or quote."
10812 10812
10813(defvar vhdl-port-list nil 10813(defvar vhdl-port-list nil
10814 "Variable to hold last port map parsed.") 10814 "Variable to hold last port map parsed.")
10815;; structure: (parenthesised expression means list of such entries) 10815;; structure: (parenthesized expression means list of such entries)
10816;; (ent-name 10816;; (ent-name
10817;; ((generic-names) generic-type generic-init generic-comment group-comment) 10817;; ((generic-names) generic-type generic-init generic-comment group-comment)
10818;; ((port-names) port-object port-direct port-type port-comment group-comment) 10818;; ((port-names) port-object port-direct port-type port-comment group-comment)
@@ -11660,7 +11660,7 @@ reflected in a subsequent paste operation."
11660 11660
11661(defvar vhdl-subprog-list nil 11661(defvar vhdl-subprog-list nil
11662 "Variable to hold last subprogram interface parsed.") 11662 "Variable to hold last subprogram interface parsed.")
11663;; structure: (parenthesised expression means list of such entries) 11663;; structure: (parenthesized expression means list of such entries)
11664;; (subprog-name kind 11664;; (subprog-name kind
11665;; ((names) object direct type init comment group-comment) 11665;; ((names) object direct type init comment group-comment)
11666;; return-type return-comment group-comment) 11666;; return-type return-comment group-comment)
@@ -12971,7 +12971,7 @@ This does background highlighting of translate-off regions.")
12971(defvar vhdl-entity-alist nil 12971(defvar vhdl-entity-alist nil
12972 "Cache with entities and corresponding architectures for each 12972 "Cache with entities and corresponding architectures for each
12973project/directory.") 12973project/directory.")
12974;; structure: (parenthesised expression means list of such entries) 12974;; structure: (parenthesized expression means list of such entries)
12975;; (cache-key 12975;; (cache-key
12976;; (ent-key ent-name ent-file ent-line 12976;; (ent-key ent-name ent-file ent-line
12977;; (arch-key arch-name arch-file arch-line 12977;; (arch-key arch-name arch-file arch-line
@@ -12982,7 +12982,7 @@ project/directory.")
12982 12982
12983(defvar vhdl-config-alist nil 12983(defvar vhdl-config-alist nil
12984 "Cache with configurations for each project/directory.") 12984 "Cache with configurations for each project/directory.")
12985;; structure: (parenthesised expression means list of such entries) 12985;; structure: (parenthesized expression means list of such entries)
12986;; (cache-key 12986;; (cache-key
12987;; (conf-key conf-name conf-file conf-line ent-key arch-key 12987;; (conf-key conf-name conf-file conf-line ent-key arch-key
12988;; (inst-key inst-comp-name inst-ent-key inst-arch-key 12988;; (inst-key inst-comp-name inst-ent-key inst-arch-key
@@ -12991,7 +12991,7 @@ project/directory.")
12991 12991
12992(defvar vhdl-package-alist nil 12992(defvar vhdl-package-alist nil
12993 "Cache with packages for each project/directory.") 12993 "Cache with packages for each project/directory.")
12994;; structure: (parenthesised expression means list of such entries) 12994;; structure: (parenthesized expression means list of such entries)
12995;; (cache-key 12995;; (cache-key
12996;; (pack-key pack-name pack-file pack-line 12996;; (pack-key pack-name pack-file pack-line
12997;; (comp-key comp-name comp-file comp-line) 12997;; (comp-key comp-name comp-file comp-line)
@@ -13003,19 +13003,19 @@ project/directory.")
13003 13003
13004(defvar vhdl-ent-inst-alist nil 13004(defvar vhdl-ent-inst-alist nil
13005 "Cache with instantiated entities for each project/directory.") 13005 "Cache with instantiated entities for each project/directory.")
13006;; structure: (parenthesised expression means list of such entries) 13006;; structure: (parenthesized expression means list of such entries)
13007;; (cache-key (inst-ent-key)) 13007;; (cache-key (inst-ent-key))
13008 13008
13009(defvar vhdl-file-alist nil 13009(defvar vhdl-file-alist nil
13010 "Cache with design units in each file for each project/directory.") 13010 "Cache with design units in each file for each project/directory.")
13011;; structure: (parenthesised expression means list of such entries) 13011;; structure: (parenthesized expression means list of such entries)
13012;; (cache-key 13012;; (cache-key
13013;; (file-name (ent-list) (arch-list) (arch-ent-list) (conf-list) 13013;; (file-name (ent-list) (arch-list) (arch-ent-list) (conf-list)
13014;; (pack-list) (pack-body-list) (inst-list) (inst-ent-list)) 13014;; (pack-list) (pack-body-list) (inst-list) (inst-ent-list))
13015 13015
13016(defvar vhdl-directory-alist nil 13016(defvar vhdl-directory-alist nil
13017 "Cache with source directories for each project.") 13017 "Cache with source directories for each project.")
13018;; structure: (parenthesised expression means list of such entries) 13018;; structure: (parenthesized expression means list of such entries)
13019;; (cache-key (directory)) 13019;; (cache-key (directory))
13020 13020
13021(defvar vhdl-speedbar-shown-unit-alist nil 13021(defvar vhdl-speedbar-shown-unit-alist nil
@@ -13655,7 +13655,7 @@ of PROJECT."
13655 (vhdl-speedbar-update-current-unit) 13655 (vhdl-speedbar-update-current-unit)
13656 (when updated (message "Updating hierarchy...done"))))) 13656 (when updated (message "Updating hierarchy...done")))))
13657 13657
13658;; structure (parenthesised expression means list of such entries) 13658;; structure (parenthesized expression means list of such entries)
13659;; (inst-key inst-file-marker comp-ent-key comp-ent-file-marker 13659;; (inst-key inst-file-marker comp-ent-key comp-ent-file-marker
13660;; comp-arch-key comp-arch-file-marker comp-conf-key comp-conf-file-marker 13660;; comp-arch-key comp-arch-file-marker comp-conf-key comp-conf-file-marker
13661;; comp-lib-name level) 13661;; comp-lib-name level)