aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorRichard Stallman2015-04-05 08:36:56 -0400
committerRichard Stallman2015-04-05 08:42:43 -0400
commit4e23cd0ccde4ad1e14fe2870ccf140487af649b2 (patch)
treeb709ac1e92a892f6ec1faa85eb59a9e5960c25dd /lisp/progmodes
parentdca743f0941909a80e3f28c023977120b6203e20 (diff)
parent16eec6fc55dcc05d1d819f18998e84a9580b2521 (diff)
downloademacs-4e23cd0ccde4ad1e14fe2870ccf140487af649b2.tar.gz
emacs-4e23cd0ccde4ad1e14fe2870ccf140487af649b2.zip
* mail/rmail.el (rmail-show-message-1): When displaying a mime message,
indicate start and finish in the echo area. * mail/rmail.el (rmail-epa-decrypt): Disregard <pre> before armor. Ignore more kinds of whitespace in mime headers. Modify the decrypted mime part's mime type so it will be displayed by default when visiting this message again. * net/browse-url.el (browse-url-firefox-program): Prefer IceCat, doc. (browse-url-firefox-arguments) (browse-url-firefox-startup-arguments): Doc fix.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-engine.el10
-rw-r--r--lisp/progmodes/cc-langs.el6
-rw-r--r--lisp/progmodes/cc-mode.el133
-rw-r--r--lisp/progmodes/cperl-mode.el6
-rw-r--r--lisp/progmodes/elisp-mode.el9
-rw-r--r--lisp/progmodes/f90.el25
-rw-r--r--lisp/progmodes/gdb-mi.el12
-rw-r--r--lisp/progmodes/gud.el4
-rw-r--r--lisp/progmodes/js.el79
-rw-r--r--lisp/progmodes/python.el392
-rw-r--r--lisp/progmodes/ruby-mode.el33
-rw-r--r--lisp/progmodes/sql.el45
-rw-r--r--lisp/progmodes/verilog-mode.el37
-rw-r--r--lisp/progmodes/vhdl-mode.el273
-rw-r--r--lisp/progmodes/xref.el23
15 files changed, 755 insertions, 332 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 328e0f79a1c..823d795b6de 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -2277,7 +2277,9 @@ comment at the start of cc-engine.el for more info."
2277 (while 2277 (while
2278 ;; Add an element to `c-state-nonlit-pos-cache' each iteration. 2278 ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
2279 (and 2279 (and
2280 (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here) 2280 (setq npos
2281 (when (<= (+ pos c-state-nonlit-pos-interval) here)
2282 (+ pos c-state-nonlit-pos-interval)))
2281 2283
2282 ;; Test for being in a literal. If so, go to after it. 2284 ;; Test for being in a literal. If so, go to after it.
2283 (progn 2285 (progn
@@ -2304,7 +2306,9 @@ comment at the start of cc-engine.el for more info."
2304 ;; Add one extra element above HERE so as to to avoid the previous 2306 ;; Add one extra element above HERE so as to to avoid the previous
2305 ;; expensive calculation when the next call is close to the current 2307 ;; expensive calculation when the next call is close to the current
2306 ;; one. This is especially useful when inside a large macro. 2308 ;; one. This is especially useful when inside a large macro.
2307 (setq c-state-nonlit-pos-cache (cons npos c-state-nonlit-pos-cache))) 2309 (when npos
2310 (setq c-state-nonlit-pos-cache
2311 (cons npos c-state-nonlit-pos-cache))))
2308 2312
2309 (if (> pos c-state-nonlit-pos-cache-limit) 2313 (if (> pos c-state-nonlit-pos-cache-limit)
2310 (setq c-state-nonlit-pos-cache-limit pos)) 2314 (setq c-state-nonlit-pos-cache-limit pos))
@@ -3069,7 +3073,7 @@ comment at the start of cc-engine.el for more info."
3069 (setq dropped-cons (consp (car c-state-cache))) 3073 (setq dropped-cons (consp (car c-state-cache)))
3070 (setq c-state-cache (cdr c-state-cache)) 3074 (setq c-state-cache (cdr c-state-cache))
3071 (setq pos pa)) 3075 (setq pos pa))
3072 ;; At this stage, (> pos here); 3076 ;; At this stage, (>= pos here);
3073 ;; (< (c-state-cache-top-lparen) here) (or is nil). 3077 ;; (< (c-state-cache-top-lparen) here) (or is nil).
3074 3078
3075 (cond 3079 (cond
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 4d16a9b9d33..ee5a5a6503f 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -495,9 +495,9 @@ parameters \(point-min) and \(point-max).")
495(c-lang-defconst c-before-font-lock-functions 495(c-lang-defconst c-before-font-lock-functions
496 ;; For documentation see the following c-lang-defvar of the same name. 496 ;; For documentation see the following c-lang-defvar of the same name.
497 ;; The value here may be a list of functions or a single function. 497 ;; The value here may be a list of functions or a single function.
498 t 'c-change-set-fl-decl-start 498 t 'c-change-expand-fl-region
499 (c c++ objc) '(c-neutralize-syntax-in-and-mark-CPP 499 (c c++ objc) '(c-neutralize-syntax-in-and-mark-CPP
500 c-change-set-fl-decl-start) 500 c-change-expand-fl-region)
501 awk 'c-awk-extend-and-syntax-tablify-region) 501 awk 'c-awk-extend-and-syntax-tablify-region)
502(c-lang-defvar c-before-font-lock-functions 502(c-lang-defvar c-before-font-lock-functions
503 (let ((fs (c-lang-const c-before-font-lock-functions))) 503 (let ((fs (c-lang-const c-before-font-lock-functions)))
@@ -524,7 +524,7 @@ parameters \(point-min), \(point-max) and <buffer size>.")
524 524
525(c-lang-defconst c-before-context-fontification-functions 525(c-lang-defconst c-before-context-fontification-functions
526 awk nil 526 awk nil
527 t 'c-context-set-fl-decl-start) 527 t 'c-context-expand-fl-region)
528 ;; For documentation see the following c-lang-defvar of the same name. 528 ;; For documentation see the following c-lang-defvar of the same name.
529 ;; The value here may be a list of functions or a single function. 529 ;; The value here may be a list of functions or a single function.
530(c-lang-defvar c-before-context-fontification-functions 530(c-lang-defvar c-before-context-fontification-functions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 01e93b3f202..42ee14072d8 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -968,12 +968,17 @@ Note that the style variables are always made local to the buffer."
968 (let ((pps-position (point)) pps-state mbeg) 968 (let ((pps-position (point)) pps-state mbeg)
969 (while (and (< (point) c-new-END) 969 (while (and (< (point) c-new-END)
970 (search-forward-regexp c-anchored-cpp-prefix c-new-END t)) 970 (search-forward-regexp c-anchored-cpp-prefix c-new-END t))
971 ;; If we've found a "#" inside a string/comment, ignore it. 971 ;; If we've found a "#" inside a macro/string/comment, ignore it.
972 (setq pps-state 972 (unless
973 (parse-partial-sexp pps-position (point) nil nil pps-state) 973 (or (save-excursion
974 pps-position (point)) 974 (goto-char (match-beginning 0))
975 (unless (or (nth 3 pps-state) ; in a string? 975 (c-beginning-of-macro))
976 (nth 4 pps-state)) ; in a comment? 976 (progn
977 (setq pps-state
978 (parse-partial-sexp pps-position (point) nil nil pps-state)
979 pps-position (point))
980 (or (nth 3 pps-state) ; in a string?
981 (nth 4 pps-state)))) ; in a comment?
977 (goto-char (match-beginning 1)) 982 (goto-char (match-beginning 1))
978 (setq mbeg (point)) 983 (setq mbeg (point))
979 (if (> (c-syntactic-end-of-macro) mbeg) 984 (if (> (c-syntactic-end-of-macro) mbeg)
@@ -1143,11 +1148,11 @@ Note that the style variables are always made local to the buffer."
1143 (funcall fn beg end old-len)) 1148 (funcall fn beg end old-len))
1144 c-before-font-lock-functions)))))) 1149 c-before-font-lock-functions))))))
1145 1150
1146(defun c-set-fl-decl-start (pos) 1151(defun c-fl-decl-start (pos)
1147 ;; If the beginning of the line containing POS is in the middle of a "local" 1152 ;; If the beginning of the line containing POS is in the middle of a "local"
1148 ;; declaration (i.e. one which does not start outside of braces enclosing 1153 ;; declaration (i.e. one which does not start outside of braces enclosing
1149 ;; POS, such as a struct), return the beginning of that declaration. 1154 ;; POS, such as a struct), return the beginning of that declaration.
1150 ;; Otherwise return POS. Note that declarations, in this sense, can be 1155 ;; Otherwise return nil. Note that declarations, in this sense, can be
1151 ;; nested. 1156 ;; nested.
1152 ;; 1157 ;;
1153 ;; This function is called indirectly from font locking stuff - either from 1158 ;; This function is called indirectly from font locking stuff - either from
@@ -1184,29 +1189,50 @@ Note that the style variables are always made local to the buffer."
1184 (1- (point)) 'syntax-table) 1189 (1- (point)) 'syntax-table)
1185 c-<-as-paren-syntax))))) 1190 c-<-as-paren-syntax)))))
1186 (not (bobp))) 1191 (not (bobp)))
1187 (backward-char)) 1192 (backward-char)) ; back over (, [, <.
1188 new-pos)) ; back over (, [, <. 1193 (and (/= new-pos pos) new-pos)))
1189 1194
1190(defun c-change-set-fl-decl-start (_beg _end _old-len) 1195(defun c-change-expand-fl-region (beg end old-len)
1191 ;; Set c-new-BEG to the beginning of a "local" declaration if it('s BOL) is 1196 ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock
1192 ;; inside one. This is called from an after-change-function, but the 1197 ;; region. This will usually be the smallest sequence of whole lines
1193 ;; parameters BEG END and OLD-LEN are ignored. See `c-set-fl-decl-start' 1198 ;; containing `c-new-BEG' and `c-new-END', but if `c-new-BEG' is in a
1194 ;; for the detailed functionality. 1199 ;; "local" declaration (see `c-fl-decl-start') the beginning of this is used
1195 (if font-lock-mode 1200 ;; as the lower bound.
1196 (setq c-new-BEG (c-set-fl-decl-start c-new-BEG)))) 1201 ;;
1197 1202 ;; This is called from an after-change-function, but the parameters BEG END
1198(defun c-context-set-fl-decl-start (beg end) 1203 ;; and OLD-LEN are not used.
1199 ;; Return a cons (NEW-BEG . END), where NEW-BEG is the beginning of a 1204 (if font-lock-mode
1200 ;; "local" declaration (BOL at) NEW is inside or BEG. See 1205 (setq c-new-BEG
1201 ;; `c-set-fl-decl-start' for the detailed functionality. 1206 (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG))
1202 (cons (c-set-fl-decl-start beg) end)) 1207 c-new-END (c-point 'bonl c-new-END))))
1208
1209(defun c-context-expand-fl-region (beg end)
1210 ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a
1211 ;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is
1212 ;; in. NEW-END is beginning of the line after the one END is in.
1213 (cons (or (c-fl-decl-start beg) (c-point 'bol beg))
1214 (c-point 'bonl end)))
1215
1216(defun c-before-context-fl-expand-region (beg end)
1217 ;; Expand the region (BEG END) as specified by
1218 ;; `c-before-context-fontification-functions'. Return a cons of the bounds
1219 ;; of the new region.
1220 (save-restriction
1221 (widen)
1222 (save-excursion
1223 (let ((new-beg beg) (new-end end) new-region)
1224 (mapc (lambda (fn)
1225 (setq new-region (funcall fn new-beg new-end))
1226 (setq new-beg (car new-region) new-end (cdr new-region)))
1227 c-before-context-fontification-functions)
1228 new-region))))
1203 1229
1204(defun c-font-lock-fontify-region (beg end &optional verbose) 1230(defun c-font-lock-fontify-region (beg end &optional verbose)
1205 ;; Effectively advice around `font-lock-fontify-region' which extends the 1231 ;; Effectively advice around `font-lock-fontify-region' which extends the
1206 ;; region (BEG END), for example, to avoid context fontification chopping 1232 ;; region (BEG END), for example, to avoid context fontification chopping
1207 ;; off the start of the context. Do not do anything if it's already been 1233 ;; off the start of the context. Do not extend the region if it's already
1208 ;; done (i.e. from an after-change fontification. An example (C++) where 1234 ;; been done (i.e. from an after-change fontification. An example (C++)
1209 ;; this used to happen is this: 1235 ;; where the chopping off used to happen is this:
1210 ;; 1236 ;;
1211 ;; template <typename T> 1237 ;; template <typename T>
1212 ;; 1238 ;;
@@ -1215,17 +1241,39 @@ Note that the style variables are always made local to the buffer."
1215 ;; 1241 ;;
1216 ;; Type a space in the first blank line, and the fontification of the next 1242 ;; Type a space in the first blank line, and the fontification of the next
1217 ;; line was fouled up by context fontification. 1243 ;; line was fouled up by context fontification.
1218 (let ((new-beg beg) (new-end end) new-region case-fold-search 1244 (let (new-beg new-end new-region case-fold-search
1219 open-paren-in-column-0-is-defun-start) 1245 open-paren-in-column-0-is-defun-start)
1220 (if c-in-after-change-fontification 1246 (if (and c-in-after-change-fontification
1221 (setq c-in-after-change-fontification nil) 1247 (< beg c-new-END) (> end c-new-BEG))
1222 (save-restriction 1248 ;; Region and the latest after-change fontification region overlap.
1223 (widen) 1249 ;; Determine the upper and lower bounds of our adjusted region
1224 (save-excursion 1250 ;; separately.
1225 (mapc (lambda (fn) 1251 (progn
1226 (setq new-region (funcall fn new-beg new-end)) 1252 (if (<= beg c-new-BEG)
1227 (setq new-beg (car new-region) new-end (cdr new-region))) 1253 (setq c-in-after-change-fontification nil))
1228 c-before-context-fontification-functions)))) 1254 (setq new-beg
1255 (if (and (>= beg (c-point 'bol c-new-BEG))
1256 (<= beg c-new-BEG))
1257 ;; Either jit-lock has accepted `c-new-BEG', or has
1258 ;; (probably) extended the change region spuriously to
1259 ;; BOL, which position likely has a syntactically
1260 ;; different position. To ensure correct fontification,
1261 ;; we start at `c-new-BEG', assuming any characters to the
1262 ;; left of `c-new-BEG' on the line do not require
1263 ;; fontification.
1264 c-new-BEG
1265 (setq new-region (c-before-context-fl-expand-region beg end)
1266 new-end (cdr new-region))
1267 (car new-region)))
1268 (setq new-end
1269 (if (and (>= end (c-point 'bol c-new-END))
1270 (<= end c-new-END))
1271 c-new-END
1272 (or new-end
1273 (cdr (c-before-context-fl-expand-region beg end))))))
1274 ;; Context (etc.) fontification.
1275 (setq new-region (c-before-context-fl-expand-region beg end)
1276 new-beg (car new-region) new-end (cdr new-region)))
1229 (funcall (default-value 'font-lock-fontify-region-function) 1277 (funcall (default-value 'font-lock-fontify-region-function)
1230 new-beg new-end verbose))) 1278 new-beg new-end verbose)))
1231 1279
@@ -1264,7 +1312,7 @@ This function is called from `c-common-init', once per mode initialization."
1264;; Emacs 22 and later. 1312;; Emacs 22 and later.
1265(defun c-extend-after-change-region (_beg _end _old-len) 1313(defun c-extend-after-change-region (_beg _end _old-len)
1266 "Extend the region to be fontified, if necessary." 1314 "Extend the region to be fontified, if necessary."
1267 ;; Note: the parameters are ignored here. This somewhat indirect 1315 ;; Note: the parameter OLD-LEN is ignored here. This somewhat indirect
1268 ;; implementation exists because it is minimally different from the 1316 ;; implementation exists because it is minimally different from the
1269 ;; stand-alone CC Mode which, lacking 1317 ;; stand-alone CC Mode which, lacking
1270 ;; font-lock-extend-after-change-region-function, is forced to use advice 1318 ;; font-lock-extend-after-change-region-function, is forced to use advice
@@ -1273,6 +1321,13 @@ This function is called from `c-common-init', once per mode initialization."
1273 ;; Of the seven CC Mode languages, currently (2009-05) only C, C++, Objc 1321 ;; Of the seven CC Mode languages, currently (2009-05) only C, C++, Objc
1274 ;; (the languages with #define) and AWK Mode make non-null use of this 1322 ;; (the languages with #define) and AWK Mode make non-null use of this
1275 ;; function. 1323 ;; function.
1324 (when (eq font-lock-support-mode 'jit-lock-mode)
1325 (save-restriction
1326 (widen)
1327 (if (< c-new-BEG beg)
1328 (put-text-property c-new-BEG beg 'fontified nil))
1329 (if (> c-new-END end)
1330 (put-text-property end c-new-END 'fontified nil))))
1276 (cons c-new-BEG c-new-END)) 1331 (cons c-new-BEG c-new-END))
1277 1332
1278;; Emacs < 22 and XEmacs 1333;; Emacs < 22 and XEmacs
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 3b8742ee842..2acfc104cf3 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -2281,8 +2281,8 @@ to nil."
2281 (search-backward ")") 2281 (search-backward ")")
2282 (if (eq last-command-event ?\() 2282 (if (eq last-command-event ?\()
2283 (progn ; Avoid "if (())" 2283 (progn ; Avoid "if (())"
2284 (delete-backward-char 1) 2284 (delete-char -1)
2285 (delete-backward-char -1)))) 2285 (delete-char 1))))
2286 (if delete 2286 (if delete
2287 (cperl-putback-char cperl-del-back-ch)) 2287 (cperl-putback-char cperl-del-back-ch))
2288 (if cperl-message-electric-keyword 2288 (if cperl-message-electric-keyword
@@ -2588,7 +2588,7 @@ Will untabify if `cperl-electric-backspace-untabify' is non-nil."
2588 (delete-region (point) p)) 2588 (delete-region (point) p))
2589 (if cperl-electric-backspace-untabify 2589 (if cperl-electric-backspace-untabify
2590 (backward-delete-char-untabify arg) 2590 (backward-delete-char-untabify arg)
2591 (delete-backward-char arg))))) 2591 (call-interactively 'delete-backward-char)))))
2592 2592
2593(put 'cperl-electric-backspace 'delete-selection 'supersede) 2593(put 'cperl-electric-backspace 'delete-selection 'supersede)
2594 2594
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index b2c5fbfe60e..29f1ee9a98c 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -883,10 +883,11 @@ If CHAR is not a character, return nil."
883 883
884(defun elisp--eval-last-sexp (eval-last-sexp-arg-internal) 884(defun elisp--eval-last-sexp (eval-last-sexp-arg-internal)
885 "Evaluate sexp before point; print value in the echo area. 885 "Evaluate sexp before point; print value in the echo area.
886With argument, print output into current buffer. 886If EVAL-LAST-SEXP-ARG-INTERNAL is non-nil, print output into
887With a zero prefix arg, print output with no limit on the length 887current buffer. If EVAL-LAST-SEXP-ARG-INTERNAL is `0', print
888and level of lists, and include additional formats for integers 888output with no limit on the length and level of lists, and
889\(octal, hexadecimal, and character)." 889include additional formats for integers \(octal, hexadecimal, and
890character)."
890 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) 891 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)))
891 ;; Setup the lexical environment if lexical-binding is enabled. 892 ;; Setup the lexical environment if lexical-binding is enabled.
892 (elisp--eval-last-sexp-print-value 893 (elisp--eval-last-sexp-print-value
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index aeb4ddee9ef..6264d3b7b82 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -342,8 +342,10 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
342 "final" "generic" "import" "non_intrinsic" "non_overridable" 342 "final" "generic" "import" "non_intrinsic" "non_overridable"
343 "nopass" "pass" "protected" "same_type_as" "value" "volatile" 343 "nopass" "pass" "protected" "same_type_as" "value" "volatile"
344 ;; F2008. 344 ;; F2008.
345 ;; FIXME f90-change-keywords does not work right if
346 ;; there are spaces.
345 "contiguous" "submodule" "concurrent" "codimension" 347 "contiguous" "submodule" "concurrent" "codimension"
346 "sync all" "sync memory" "critical" "image_index" 348 "sync all" "sync memory" "critical" "image_index" "error stop"
347 )) 349 ))
348 "\\_>") 350 "\\_>")
349 "Regexp used by the function `f90-change-keywords'.") 351 "Regexp used by the function `f90-change-keywords'.")
@@ -417,6 +419,8 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
417 "norm2" "parity" "findloc" "is_contiguous" 419 "norm2" "parity" "findloc" "is_contiguous"
418 "sync images" "lock" "unlock" "image_index" 420 "sync images" "lock" "unlock" "image_index"
419 "lcobound" "ucobound" "num_images" "this_image" 421 "lcobound" "ucobound" "num_images" "this_image"
422 "acosh" "asinh" "atanh"
423 "atomic_define" "atomic_ref" "execute_command_line"
420 ;; F2008 iso_fortran_env module. 424 ;; F2008 iso_fortran_env module.
421 "compiler_options" "compiler_version" 425 "compiler_options" "compiler_version"
422 ;; F2008 iso_c_binding module. 426 ;; F2008 iso_c_binding module.
@@ -649,7 +653,8 @@ logical\\|double[ \t]*precision\\|type[ \t]*(\\(?:\\sw\\|\\s_\\)+)\\|none\\)[ \t
649 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) 653 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
650 "\\_<else\\([ \t]*if\\|where\\)?\\_>" 654 "\\_<else\\([ \t]*if\\|where\\)?\\_>"
651 '("\\(&\\)[ \t]*\\(!\\|$\\)" (1 font-lock-keyword-face)) 655 '("\\(&\\)[ \t]*\\(!\\|$\\)" (1 font-lock-keyword-face))
652 "\\_<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\_>" 656 "\\_<\\(then\\|continue\\|format\\|include\\|\\(?:error[ \t]+\\)?stop\\|\
657return\\)\\_>"
653 '("\\_<\\(exit\\|cycle\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?\\_>" 658 '("\\_<\\(exit\\|cycle\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?\\_>"
654 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) 659 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
655 '("\\_<\\(case\\)[ \t]*\\(default\\|(\\)" . 1) 660 '("\\_<\\(case\\)[ \t]*\\(default\\|(\\)" . 1)
@@ -1629,7 +1634,10 @@ Return (TYPE NAME), or nil if not found."
1629 (re-search-backward f90-program-block-re nil 'move)) 1634 (re-search-backward f90-program-block-re nil 'move))
1630 (beginning-of-line) 1635 (beginning-of-line)
1631 (skip-chars-forward " \t0-9") 1636 (skip-chars-forward " \t0-9")
1632 (cond ((setq matching-beg (f90-looking-at-program-block-start)) 1637 ;; Check if in string in case using non-standard feature where
1638 ;; continued strings do not need "&" at start of continuations.
1639 (cond ((f90-in-string))
1640 ((setq matching-beg (f90-looking-at-program-block-start))
1633 (setq count (1- count))) 1641 (setq count (1- count)))
1634 ((f90-looking-at-program-block-end) 1642 ((f90-looking-at-program-block-end)
1635 (setq count (1+ count))))) 1643 (setq count (1+ count)))))
@@ -1654,7 +1662,8 @@ Return (TYPE NAME), or nil if not found."
1654 (re-search-forward f90-program-block-re nil 'move)) 1662 (re-search-forward f90-program-block-re nil 'move))
1655 (beginning-of-line) 1663 (beginning-of-line)
1656 (skip-chars-forward " \t0-9") 1664 (skip-chars-forward " \t0-9")
1657 (cond ((f90-looking-at-program-block-start) 1665 (cond ((f90-in-string))
1666 ((f90-looking-at-program-block-start)
1658 (setq count (1+ count))) 1667 (setq count (1+ count)))
1659 ((setq matching-end (f90-looking-at-program-block-end)) 1668 ((setq matching-end (f90-looking-at-program-block-end))
1660 (setq count (1- count)))) 1669 (setq count (1- count))))
@@ -2194,8 +2203,12 @@ Leave point at the end of line."
2194 (end-point (point)) 2203 (end-point (point))
2195 (case-fold-search t) 2204 (case-fold-search t)
2196 matching-beg beg-name end-name beg-block end-block end-struct) 2205 matching-beg beg-name end-name beg-block end-block end-struct)
2206 ;; Check if in string in case using non-standard feature where
2207 ;; continued strings do not need "&" at start of continuations.
2197 (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9") 2208 (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9")
2198 (setq end-struct (f90-looking-at-program-block-end))) 2209 (unless (f90-in-string)
2210 (setq end-struct
2211 (f90-looking-at-program-block-end))))
2199 (setq end-block (car end-struct) 2212 (setq end-block (car end-struct)
2200 end-name (cadr end-struct)) 2213 end-name (cadr end-struct))
2201 (save-excursion 2214 (save-excursion
@@ -2338,6 +2351,8 @@ CHANGE-WORD should be one of 'upcase-word, 'downcase-word, 'capitalize-word."
2338 (skip-chars-forward " \t0-9") 2351 (skip-chars-forward " \t0-9")
2339 (looking-at "#")))) 2352 (looking-at "#"))))
2340 (setq ref-point (point) 2353 (setq ref-point (point)
2354 ;; FIXME this does not work for constructs with
2355 ;; embedded space, eg "sync all".
2341 back-point (save-excursion (backward-word 1) (point)) 2356 back-point (save-excursion (backward-word 1) (point))
2342 saveword (buffer-substring back-point ref-point)) 2357 saveword (buffer-substring back-point ref-point))
2343 (funcall change-word -1) 2358 (funcall change-word -1)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 27846ede332..486d67297a9 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1629,9 +1629,19 @@ this trigger is subscribed to `gdb-buf-publisher' and called with
1629 :syntax-table nil :abbrev-table nil 1629 :syntax-table nil :abbrev-table nil
1630 (make-comint-in-buffer "gdb-inferior" (current-buffer) nil)) 1630 (make-comint-in-buffer "gdb-inferior" (current-buffer) nil))
1631 1631
1632(defcustom gdb-display-io-nopopup nil
1633 "When non-nil, and the 'gdb-inferior-io buffer is buried, don't pop it up."
1634 :type 'boolean
1635 :group 'gdb
1636 :version "25.1")
1637
1632(defun gdb-inferior-filter (proc string) 1638(defun gdb-inferior-filter (proc string)
1633 (unless (string-equal string "") 1639 (unless (string-equal string "")
1634 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io))) 1640 (let (buf)
1641 (unless (and gdb-display-io-nopopup
1642 (setq buf (gdb-get-buffer 'gdb-inferior-io))
1643 (null (get-buffer-window buf)))
1644 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))))
1635 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) 1645 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
1636 (comint-output-filter proc string))) 1646 (comint-output-filter proc string)))
1637 1647
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 42c5b20a7b8..9ab0667b5ba 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -1,4 +1,4 @@
1;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers 1;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1992-1996, 1998, 2000-2015 Free Software Foundation, 3;; Copyright (C) 1992-1996, 1998, 2000-2015 Free Software Foundation,
4;; Inc. 4;; Inc.
@@ -2813,7 +2813,7 @@ Obeying it means displaying in another window the specified file and line."
2813 (gud-find-file true-file))) 2813 (gud-find-file true-file)))
2814 (window (and buffer 2814 (window (and buffer
2815 (or (get-buffer-window buffer) 2815 (or (get-buffer-window buffer)
2816 (display-buffer buffer)))) 2816 (display-buffer buffer '(nil (inhibit-same-window . t))))))
2817 (pos)) 2817 (pos))
2818 (when buffer 2818 (when buffer
2819 (with-current-buffer buffer 2819 (with-current-buffer buffer
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index c25e52cdc6a..62f19f42df1 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -509,6 +509,48 @@ getting timeout messages."
509 :type 'integer 509 :type 'integer
510 :group 'js) 510 :group 'js)
511 511
512(defcustom js-indent-first-init nil
513 "Non-nil means specially indent the first variable declaration's initializer.
514Normally, the first declaration's initializer is unindented, and
515subsequent declarations have their identifiers aligned with it:
516
517 var o = {
518 foo: 3
519 };
520
521 var o = {
522 foo: 3
523 },
524 bar = 2;
525
526If this option has the value t, indent the first declaration's
527initializer by an additional level:
528
529 var o = {
530 foo: 3
531 };
532
533 var o = {
534 foo: 3
535 },
536 bar = 2;
537
538If this option has the value `dynamic', if there is only one declaration,
539don't indent the first one's initializer; otherwise, indent it.
540
541 var o = {
542 foo: 3
543 };
544
545 var o = {
546 foo: 3
547 },
548 bar = 2;"
549 :version "25.1"
550 :type '(choice (const nil) (const t) (const dynamic))
551 :safe 'symbolp
552 :group 'js)
553
512;;; KeyMap 554;;; KeyMap
513 555
514(defvar js-mode-map 556(defvar js-mode-map
@@ -534,6 +576,7 @@ getting timeout messages."
534 (let ((table (make-syntax-table))) 576 (let ((table (make-syntax-table)))
535 (c-populate-syntax-table table) 577 (c-populate-syntax-table table)
536 (modify-syntax-entry ?$ "_" table) 578 (modify-syntax-entry ?$ "_" table)
579 (modify-syntax-entry ?` "\"" table)
537 table) 580 table)
538 "Syntax table for `js-mode'.") 581 "Syntax table for `js-mode'.")
539 582
@@ -1857,6 +1900,36 @@ In particular, return the buffer position of the first `for' kwd."
1857 (goto-char for-kwd) 1900 (goto-char for-kwd)
1858 (current-column)))) 1901 (current-column))))
1859 1902
1903(defun js--maybe-goto-declaration-keyword-end (parse-status)
1904 "Helper function for `js--proper-indentation'.
1905Depending on the value of `js-indent-first-init', move
1906point to the end of a variable declaration keyword so that
1907indentation is aligned to that column."
1908 (cond
1909 ((eq js-indent-first-init t)
1910 (when (looking-at js--declaration-keyword-re)
1911 (goto-char (1+ (match-end 0)))))
1912 ((eq js-indent-first-init 'dynamic)
1913 (let ((bracket (nth 1 parse-status))
1914 declaration-keyword-end
1915 at-closing-bracket-p
1916 comma-p)
1917 (when (looking-at js--declaration-keyword-re)
1918 (setq declaration-keyword-end (match-end 0))
1919 (save-excursion
1920 (goto-char bracket)
1921 (setq at-closing-bracket-p
1922 (condition-case nil
1923 (progn
1924 (forward-sexp)
1925 t)
1926 (error nil)))
1927 (when at-closing-bracket-p
1928 (while (forward-comment 1))
1929 (setq comma-p (looking-at-p ","))))
1930 (when comma-p
1931 (goto-char (1+ declaration-keyword-end))))))))
1932
1860(defun js--proper-indentation (parse-status) 1933(defun js--proper-indentation (parse-status)
1861 "Return the proper indentation for the current line." 1934 "Return the proper indentation for the current line."
1862 (save-excursion 1935 (save-excursion
@@ -1890,6 +1963,7 @@ In particular, return the buffer position of the first `for' kwd."
1890 (skip-syntax-backward " ") 1963 (skip-syntax-backward " ")
1891 (when (eq (char-before) ?\)) (backward-list)) 1964 (when (eq (char-before) ?\)) (backward-list))
1892 (back-to-indentation) 1965 (back-to-indentation)
1966 (js--maybe-goto-declaration-keyword-end parse-status)
1893 (let* ((in-switch-p (unless same-indent-p 1967 (let* ((in-switch-p (unless same-indent-p
1894 (looking-at "\\_<switch\\_>"))) 1968 (looking-at "\\_<switch\\_>")))
1895 (same-indent-p (or same-indent-p 1969 (same-indent-p (or same-indent-p
@@ -1928,8 +2002,9 @@ In particular, return the buffer position of the first `for' kwd."
1928 (let* ((parse-status 2002 (let* ((parse-status
1929 (save-excursion (syntax-ppss (point-at-bol)))) 2003 (save-excursion (syntax-ppss (point-at-bol))))
1930 (offset (- (point) (save-excursion (back-to-indentation) (point))))) 2004 (offset (- (point) (save-excursion (back-to-indentation) (point)))))
1931 (indent-line-to (js--proper-indentation parse-status)) 2005 (unless (nth 3 parse-status)
1932 (when (> offset 0) (forward-char offset)))) 2006 (indent-line-to (js--proper-indentation parse-status))
2007 (when (> offset 0) (forward-char offset)))))
1933 2008
1934;;; Filling 2009;;; Filling
1935 2010
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index d340550a017..67b44aa1bbe 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Fabián E. Gallina <fabian@anue.biz> 5;; Author: Fabián E. Gallina <fabian@anue.biz>
6;; URL: https://github.com/fgallina/python.el 6;; URL: https://github.com/fgallina/python.el
7;; Version: 0.24.4 7;; Version: 0.24.5
8;; Maintainer: emacs-devel@gnu.org 8;; Maintainer: emacs-devel@gnu.org
9;; Created: Jul 2010 9;; Created: Jul 2010
10;; Keywords: languages 10;; Keywords: languages
@@ -696,6 +696,12 @@ It makes underscores and dots word constituent chars.")
696 :group 'python 696 :group 'python
697 :safe 'booleanp) 697 :safe 'booleanp)
698 698
699(defcustom python-indent-guess-indent-offset-verbose t
700 "Non-nil means to emit a warning when indentation guessing fails."
701 :type 'boolean
702 :group 'python
703 :safe' booleanp)
704
699(defcustom python-indent-trigger-commands 705(defcustom python-indent-trigger-commands
700 '(indent-for-tab-command yas-expand yas/expand) 706 '(indent-for-tab-command yas-expand yas/expand)
701 "Commands that might trigger a `python-indent-line' call." 707 "Commands that might trigger a `python-indent-line' call."
@@ -766,8 +772,9 @@ work on `python-indent-calculate-indentation' instead."
766 (current-indentation)))) 772 (current-indentation))))
767 (if (and indentation (not (zerop indentation))) 773 (if (and indentation (not (zerop indentation)))
768 (set (make-local-variable 'python-indent-offset) indentation) 774 (set (make-local-variable 'python-indent-offset) indentation)
769 (message "Can't guess python-indent-offset, using defaults: %s" 775 (when python-indent-guess-indent-offset-verbose
770 python-indent-offset))))))) 776 (message "Can't guess python-indent-offset, using defaults: %s"
777 python-indent-offset))))))))
771 778
772(defun python-indent-context () 779(defun python-indent-context ()
773 "Get information about the current indentation context. 780 "Get information about the current indentation context.
@@ -843,15 +850,6 @@ keyword
843 ;; Beginning of buffer. 850 ;; Beginning of buffer.
844 ((= (line-number-at-pos) 1) 851 ((= (line-number-at-pos) 1)
845 (cons :no-indent 0)) 852 (cons :no-indent 0))
846 ;; Comment continuation (maybe).
847 ((save-excursion
848 (when (and
849 (or
850 (python-info-current-line-comment-p)
851 (python-info-current-line-empty-p))
852 (forward-comment -1)
853 (python-info-current-line-comment-p))
854 (cons :after-comment (point)))))
855 ;; Inside a string. 853 ;; Inside a string.
856 ((let ((start (python-syntax-context 'string ppss))) 854 ((let ((start (python-syntax-context 'string ppss)))
857 (when start 855 (when start
@@ -963,28 +961,29 @@ keyword
963 ((let ((start (python-info-dedenter-statement-p))) 961 ((let ((start (python-info-dedenter-statement-p)))
964 (when start 962 (when start
965 (cons :at-dedenter-block-start start)))) 963 (cons :at-dedenter-block-start start))))
966 ;; After normal line. 964 ;; After normal line, comment or ender (default case).
967 ((let ((start (save-excursion 965 ((save-excursion
968 (back-to-indentation) 966 (back-to-indentation)
969 (skip-chars-backward " \t\n") 967 (skip-chars-backward " \t\n")
970 (python-nav-beginning-of-statement) 968 (python-nav-beginning-of-statement)
971 (point)))) 969 (cons
972 (when start 970 (cond ((python-info-current-line-comment-p)
973 (if (save-excursion 971 :after-comment)
974 (python-util-forward-comment -1) 972 ((save-excursion
975 (python-nav-beginning-of-statement) 973 (goto-char (line-end-position))
976 (looking-at (python-rx block-ender))) 974 (python-util-forward-comment -1)
977 (cons :after-block-end start) 975 (python-nav-beginning-of-statement)
978 (cons :after-line start))))) 976 (looking-at (python-rx block-ender)))
979 ;; Default case: do not indent. 977 :after-block-end)
980 (t (cons :no-indent 0)))))) 978 (t :after-line))
979 (point))))))))
981 980
982(defun python-indent--calculate-indentation () 981(defun python-indent--calculate-indentation ()
983 "Internal implementation of `python-indent-calculate-indentation'. 982 "Internal implementation of `python-indent-calculate-indentation'.
984May return an integer for the maximum possible indentation at 983May return an integer for the maximum possible indentation at
985current context or a list of integers. The latter case is only 984current context or a list of integers. The latter case is only
986happening for :at-dedenter-block-start context since the 985happening for :at-dedenter-block-start context since the
987possibilities can be narrowed to especific indentation points." 986possibilities can be narrowed to specific indentation points."
988 (save-restriction 987 (save-restriction
989 (widen) 988 (widen)
990 (save-excursion 989 (save-excursion
@@ -1068,12 +1067,14 @@ minimum."
1068 (levels (python-indent--calculate-levels indentation))) 1067 (levels (python-indent--calculate-levels indentation)))
1069 (if previous 1068 (if previous
1070 (python-indent--previous-level levels (current-indentation)) 1069 (python-indent--previous-level levels (current-indentation))
1071 (apply #'max levels)))) 1070 (if levels
1071 (apply #'max levels)
1072 0))))
1072 1073
1073(defun python-indent-line (&optional previous) 1074(defun python-indent-line (&optional previous)
1074 "Internal implementation of `python-indent-line-function'. 1075 "Internal implementation of `python-indent-line-function'.
1075Use the PREVIOUS level when argument is non-nil, otherwise indent 1076Use the PREVIOUS level when argument is non-nil, otherwise indent
1076to the maxium available level. When indentation is the minimum 1077to the maximum available level. When indentation is the minimum
1077possible and PREVIOUS is non-nil, cycle back to the maximum 1078possible and PREVIOUS is non-nil, cycle back to the maximum
1078level." 1079level."
1079 (let ((follow-indentation-p 1080 (let ((follow-indentation-p
@@ -1108,9 +1109,7 @@ indentation levels from right to left."
1108 (interactive "*") 1109 (interactive "*")
1109 (when (and (not (bolp)) 1110 (when (and (not (bolp))
1110 (not (python-syntax-comment-or-string-p)) 1111 (not (python-syntax-comment-or-string-p))
1111 (= (+ (line-beginning-position) 1112 (= (current-indentation) (current-column)))
1112 (current-indentation))
1113 (point)))
1114 (python-indent-line t) 1113 (python-indent-line t)
1115 t)) 1114 t))
1116 1115
@@ -2295,16 +2294,15 @@ Signals an error if no shell buffer is available for current buffer."
2295 (let ((process-name 2294 (let ((process-name
2296 (process-name (get-buffer-process (current-buffer))))) 2295 (process-name (get-buffer-process (current-buffer)))))
2297 (generate-new-buffer 2296 (generate-new-buffer
2298 (format "*%s-font-lock*" process-name)))))) 2297 (format " *%s-font-lock*" process-name))))))
2299 2298
2300(defun python-shell-font-lock-kill-buffer () 2299(defun python-shell-font-lock-kill-buffer ()
2301 "Kill the font-lock buffer safely." 2300 "Kill the font-lock buffer safely."
2302 (python-shell-with-shell-buffer 2301 (when (and python-shell--font-lock-buffer
2303 (when (and python-shell--font-lock-buffer 2302 (buffer-live-p python-shell--font-lock-buffer))
2304 (buffer-live-p python-shell--font-lock-buffer)) 2303 (kill-buffer python-shell--font-lock-buffer)
2305 (kill-buffer python-shell--font-lock-buffer) 2304 (when (derived-mode-p 'inferior-python-mode)
2306 (when (derived-mode-p 'inferior-python-mode) 2305 (setq python-shell--font-lock-buffer nil))))
2307 (setq python-shell--font-lock-buffer nil)))))
2308 2306
2309(defmacro python-shell-font-lock-with-font-lock-buffer (&rest body) 2307(defmacro python-shell-font-lock-with-font-lock-buffer (&rest body)
2310 "Execute the forms in BODY in the font-lock buffer. 2308 "Execute the forms in BODY in the font-lock buffer.
@@ -2318,6 +2316,8 @@ also `with-current-buffer'."
2318 (setq python-shell--font-lock-buffer 2316 (setq python-shell--font-lock-buffer
2319 (python-shell-font-lock-get-or-create-buffer))) 2317 (python-shell-font-lock-get-or-create-buffer)))
2320 (set-buffer python-shell--font-lock-buffer) 2318 (set-buffer python-shell--font-lock-buffer)
2319 (when (not font-lock-mode)
2320 (font-lock-mode 1))
2321 (set (make-local-variable 'delay-mode-hooks) t) 2321 (set (make-local-variable 'delay-mode-hooks) t)
2322 (let ((python-indent-guess-indent-offset nil)) 2322 (let ((python-indent-guess-indent-offset nil))
2323 (when (not (derived-mode-p 'python-mode)) 2323 (when (not (derived-mode-p 'python-mode))
@@ -2331,57 +2331,66 @@ goes wrong and syntax highlighting in the shell gets messed up."
2331 (interactive) 2331 (interactive)
2332 (python-shell-with-shell-buffer 2332 (python-shell-with-shell-buffer
2333 (python-shell-font-lock-with-font-lock-buffer 2333 (python-shell-font-lock-with-font-lock-buffer
2334 (delete-region (point-min) (point-max))))) 2334 (erase-buffer))))
2335 2335
2336(defun python-shell-font-lock-comint-output-filter-function (output) 2336(defun python-shell-font-lock-comint-output-filter-function (output)
2337 "Clean up the font-lock buffer after any OUTPUT." 2337 "Clean up the font-lock buffer after any OUTPUT."
2338 (when (and (not (string= "" output)) 2338 (if (and (not (string= "" output))
2339 ;; Is end of output and is not just a prompt. 2339 ;; Is end of output and is not just a prompt.
2340 (not (member 2340 (not (member
2341 (python-shell-comint-end-of-output-p 2341 (python-shell-comint-end-of-output-p
2342 (ansi-color-filter-apply output)) 2342 (ansi-color-filter-apply output))
2343 '(nil 0)))) 2343 '(nil 0))))
2344 ;; If output is other than an input prompt then "real" output has 2344 ;; If output is other than an input prompt then "real" output has
2345 ;; been received and the font-lock buffer must be cleaned up. 2345 ;; been received and the font-lock buffer must be cleaned up.
2346 (python-shell-font-lock-cleanup-buffer)) 2346 (python-shell-font-lock-cleanup-buffer)
2347 ;; Otherwise just add a newline.
2348 (python-shell-font-lock-with-font-lock-buffer
2349 (goto-char (point-max))
2350 (newline)))
2347 output) 2351 output)
2348 2352
2349(defun python-shell-font-lock-post-command-hook () 2353(defun python-shell-font-lock-post-command-hook ()
2350 "Fontifies current line in shell buffer." 2354 "Fontifies current line in shell buffer."
2351 (if (eq this-command 'comint-send-input) 2355 (let ((prompt-end (cdr (python-util-comint-last-prompt))))
2352 ;; Add a newline when user sends input as this may be a block. 2356 (when (and prompt-end (> (point) prompt-end)
2353 (python-shell-font-lock-with-font-lock-buffer 2357 (process-live-p (get-buffer-process (current-buffer))))
2354 (goto-char (line-end-position)) 2358 (let* ((input (buffer-substring-no-properties
2355 (newline)) 2359 prompt-end (point-max)))
2356 (when (and (python-util-comint-last-prompt) 2360 (deactivate-mark nil)
2357 (> (point) (cdr (python-util-comint-last-prompt)))) 2361 (start-pos prompt-end)
2358 (let ((input (buffer-substring-no-properties 2362 (buffer-undo-list t)
2359 (cdr (python-util-comint-last-prompt)) (point-max))) 2363 (font-lock-buffer-pos nil)
2360 (old-input (python-shell-font-lock-with-font-lock-buffer 2364 (replacement
2361 (buffer-substring-no-properties 2365 (python-shell-font-lock-with-font-lock-buffer
2362 (line-beginning-position) (point-max)))) 2366 (delete-region (line-beginning-position)
2363 (current-point (point)) 2367 (point-max))
2364 (buffer-undo-list t)) 2368 (setq font-lock-buffer-pos (point))
2365 ;; When input hasn't changed, do nothing. 2369 (insert input)
2366 (when (not (string= input old-input)) 2370 ;; Ensure buffer is fontified, keeping it
2367 (delete-region (cdr (python-util-comint-last-prompt)) (point-max)) 2371 ;; compatible with Emacs < 24.4.
2368 (insert 2372 (if (fboundp 'font-lock-ensure)
2369 (python-shell-font-lock-with-font-lock-buffer 2373 (funcall 'font-lock-ensure)
2370 (delete-region (line-beginning-position) 2374 (font-lock-default-fontify-buffer))
2371 (line-end-position)) 2375 (buffer-substring font-lock-buffer-pos
2372 (insert input) 2376 (point-max))))
2373 ;; Ensure buffer is fontified, keeping it 2377 (replacement-length (length replacement))
2374 ;; compatible with Emacs < 24.4. 2378 (i 0))
2375 (if (fboundp 'font-lock-ensure) 2379 ;; Inject text properties to get input fontified.
2376 (funcall 'font-lock-ensure) 2380 (while (not (= i replacement-length))
2377 (font-lock-default-fontify-buffer)) 2381 (let* ((plist (text-properties-at i replacement))
2378 ;; Replace FACE text properties with FONT-LOCK-FACE so 2382 (next-change (or (next-property-change i replacement)
2379 ;; they are not overwritten by comint buffer's font lock. 2383 replacement-length))
2380 (python-util-text-properties-replace-name 2384 (plist (let ((face (plist-get plist 'face)))
2381 'face 'font-lock-face) 2385 (if (not face)
2382 (buffer-substring (line-beginning-position) 2386 plist
2383 (line-end-position)))) 2387 ;; Replace FACE text properties with
2384 (goto-char current-point)))))) 2388 ;; FONT-LOCK-FACE so input is fontified.
2389 (plist-put plist 'face nil)
2390 (plist-put plist 'font-lock-face face)))))
2391 (set-text-properties
2392 (+ start-pos i) (+ start-pos next-change) plist)
2393 (setq i next-change)))))))
2385 2394
2386(defun python-shell-font-lock-turn-on (&optional msg) 2395(defun python-shell-font-lock-turn-on (&optional msg)
2387 "Turn on shell font-lock. 2396 "Turn on shell font-lock.
@@ -2414,7 +2423,7 @@ With argument MSG show deactivation message."
2414 '(face nil font-lock-face nil))) 2423 '(face nil font-lock-face nil)))
2415 (set (make-local-variable 'python-shell--font-lock-buffer) nil) 2424 (set (make-local-variable 'python-shell--font-lock-buffer) nil)
2416 (remove-hook 'post-command-hook 2425 (remove-hook 'post-command-hook
2417 #'python-shell-font-lock-post-command-hook'local) 2426 #'python-shell-font-lock-post-command-hook 'local)
2418 (remove-hook 'kill-buffer-hook 2427 (remove-hook 'kill-buffer-hook
2419 #'python-shell-font-lock-kill-buffer 'local) 2428 #'python-shell-font-lock-kill-buffer 'local)
2420 (remove-hook 'comint-output-filter-functions 2429 (remove-hook 'comint-output-filter-functions
@@ -3148,67 +3157,68 @@ With argument MSG show activation/deactivation message."
3148 "Get completions using native readline for PROCESS. 3157 "Get completions using native readline for PROCESS.
3149When IMPORT is non-nil takes precedence over INPUT for 3158When IMPORT is non-nil takes precedence over INPUT for
3150completion." 3159completion."
3151 (when (and python-shell-completion-native-enable 3160 (with-current-buffer (process-buffer process)
3152 (python-util-comint-last-prompt) 3161 (when (and python-shell-completion-native-enable
3153 (>= (point) (cdr (python-util-comint-last-prompt)))) 3162 (python-util-comint-last-prompt)
3154 (let* ((input (or import input)) 3163 (>= (point) (cdr (python-util-comint-last-prompt))))
3155 (original-filter-fn (process-filter process)) 3164 (let* ((input (or import input))
3156 (redirect-buffer (get-buffer-create 3165 (original-filter-fn (process-filter process))
3157 python-shell-completion-native-redirect-buffer)) 3166 (redirect-buffer (get-buffer-create
3158 (separators (python-rx 3167 python-shell-completion-native-redirect-buffer))
3159 (or whitespace open-paren close-paren))) 3168 (separators (python-rx
3160 (trigger "\t\t\t") 3169 (or whitespace open-paren close-paren)))
3161 (new-input (concat input trigger)) 3170 (trigger "\t\t\t")
3162 (input-length 3171 (new-input (concat input trigger))
3163 (save-excursion 3172 (input-length
3164 (+ (- (point-max) (comint-bol)) (length new-input)))) 3173 (save-excursion
3165 (delete-line-command (make-string input-length ?\b)) 3174 (+ (- (point-max) (comint-bol)) (length new-input))))
3166 (input-to-send (concat new-input delete-line-command))) 3175 (delete-line-command (make-string input-length ?\b))
3167 ;; Ensure restoring the process filter, even if the user quits 3176 (input-to-send (concat new-input delete-line-command)))
3168 ;; or there's some other error. 3177 ;; Ensure restoring the process filter, even if the user quits
3169 (unwind-protect 3178 ;; or there's some other error.
3170 (with-current-buffer redirect-buffer 3179 (unwind-protect
3171 ;; Cleanup the redirect buffer 3180 (with-current-buffer redirect-buffer
3172 (delete-region (point-min) (point-max)) 3181 ;; Cleanup the redirect buffer
3173 ;; Mimic `comint-redirect-send-command', unfortunately it 3182 (delete-region (point-min) (point-max))
3174 ;; can't be used here because it expects a newline in the 3183 ;; Mimic `comint-redirect-send-command', unfortunately it
3175 ;; command and that's exactly what we are trying to avoid. 3184 ;; can't be used here because it expects a newline in the
3176 (let ((comint-redirect-echo-input nil) 3185 ;; command and that's exactly what we are trying to avoid.
3177 (comint-redirect-verbose nil) 3186 (let ((comint-redirect-echo-input nil)
3178 (comint-redirect-perform-sanity-check nil) 3187 (comint-redirect-verbose nil)
3179 (comint-redirect-insert-matching-regexp nil) 3188 (comint-redirect-perform-sanity-check nil)
3180 ;; Feed it some regex that will never match. 3189 (comint-redirect-insert-matching-regexp nil)
3181 (comint-redirect-finished-regexp "^\\'$") 3190 ;; Feed it some regex that will never match.
3182 (comint-redirect-output-buffer redirect-buffer)) 3191 (comint-redirect-finished-regexp "^\\'$")
3183 ;; Compatibility with Emacs 24.x. Comint changed and 3192 (comint-redirect-output-buffer redirect-buffer))
3184 ;; now `comint-redirect-filter' gets 3 args. This 3193 ;; Compatibility with Emacs 24.x. Comint changed and
3185 ;; checks which version of `comint-redirect-filter' is 3194 ;; now `comint-redirect-filter' gets 3 args. This
3186 ;; in use based on its args and uses `apply-partially' 3195 ;; checks which version of `comint-redirect-filter' is
3187 ;; to make it up for the 3 args case. 3196 ;; in use based on its args and uses `apply-partially'
3188 (if (= (length 3197 ;; to make it up for the 3 args case.
3189 (help-function-arglist 'comint-redirect-filter)) 3) 3198 (if (= (length
3190 (set-process-filter 3199 (help-function-arglist 'comint-redirect-filter)) 3)
3191 process (apply-partially 3200 (set-process-filter
3192 #'comint-redirect-filter original-filter-fn)) 3201 process (apply-partially
3193 (set-process-filter process #'comint-redirect-filter)) 3202 #'comint-redirect-filter original-filter-fn))
3194 (process-send-string process input-to-send) 3203 (set-process-filter process #'comint-redirect-filter))
3195 (accept-process-output 3204 (process-send-string process input-to-send)
3196 process 3205 (accept-process-output
3197 python-shell-completion-native-output-timeout) 3206 process
3198 ;; XXX: can't use `python-shell-accept-process-output' 3207 python-shell-completion-native-output-timeout)
3199 ;; here because there are no guarantees on how output 3208 ;; XXX: can't use `python-shell-accept-process-output'
3200 ;; ends. The workaround here is to call 3209 ;; here because there are no guarantees on how output
3201 ;; `accept-process-output' until we don't find anything 3210 ;; ends. The workaround here is to call
3202 ;; else to accept. 3211 ;; `accept-process-output' until we don't find anything
3203 (while (accept-process-output 3212 ;; else to accept.
3204 process 3213 (while (accept-process-output
3205 python-shell-completion-native-output-timeout)) 3214 process
3206 (cl-remove-duplicates 3215 python-shell-completion-native-output-timeout))
3207 (split-string 3216 (cl-remove-duplicates
3208 (buffer-substring-no-properties 3217 (split-string
3209 (point-min) (point-max)) 3218 (buffer-substring-no-properties
3210 separators t)))) 3219 (point-min) (point-max))
3211 (set-process-filter process original-filter-fn))))) 3220 separators t))))
3221 (set-process-filter process original-filter-fn))))))
3212 3222
3213(defun python-shell-completion-get-completions (process import input) 3223(defun python-shell-completion-get-completions (process import input)
3214 "Do completion at point using PROCESS for IMPORT or INPUT. 3224 "Do completion at point using PROCESS for IMPORT or INPUT.
@@ -3251,20 +3261,23 @@ completion."
3251Optional argument PROCESS forces completions to be retrieved 3261Optional argument PROCESS forces completions to be retrieved
3252using that one instead of current buffer's process." 3262using that one instead of current buffer's process."
3253 (setq process (or process (get-buffer-process (current-buffer)))) 3263 (setq process (or process (get-buffer-process (current-buffer))))
3254 (let* ((last-prompt-end (cdr (python-util-comint-last-prompt))) 3264 (let* ((line-start (if (derived-mode-p 'inferior-python-mode)
3265 ;; Working on a shell buffer: use prompt end.
3266 (cdr (python-util-comint-last-prompt))
3267 (line-beginning-position)))
3255 (import-statement 3268 (import-statement
3256 (when (string-match-p 3269 (when (string-match-p
3257 (rx (* space) word-start (or "from" "import") word-end space) 3270 (rx (* space) word-start (or "from" "import") word-end space)
3258 (buffer-substring-no-properties last-prompt-end (point))) 3271 (buffer-substring-no-properties line-start (point)))
3259 (buffer-substring-no-properties last-prompt-end (point)))) 3272 (buffer-substring-no-properties line-start (point))))
3260 (start 3273 (start
3261 (save-excursion 3274 (save-excursion
3262 (if (not (re-search-backward 3275 (if (not (re-search-backward
3263 (python-rx 3276 (python-rx
3264 (or whitespace open-paren close-paren string-delimiter)) 3277 (or whitespace open-paren close-paren string-delimiter))
3265 last-prompt-end 3278 line-start
3266 t 1)) 3279 t 1))
3267 last-prompt-end 3280 line-start
3268 (forward-char (length (match-string-no-properties 0))) 3281 (forward-char (length (match-string-no-properties 0)))
3269 (point)))) 3282 (point))))
3270 (end (point)) 3283 (end (point))
@@ -3847,8 +3860,10 @@ The skeleton will be bound to python-skeleton-NAME."
3847 :type 'string 3860 :type 'string
3848 :group 'python) 3861 :group 'python)
3849 3862
3850(defvar-local python-check-custom-command nil 3863(defvar python-check-custom-command nil
3851 "Internal use.") 3864 "Internal use.")
3865;; XXX: Avoid `defvar-local' for compat with Emacs<24.3
3866(make-variable-buffer-local 'python-check-custom-command)
3852 3867
3853(defun python-check (command) 3868(defun python-check (command)
3854 "Check a Python file (default current buffer's file). 3869 "Check a Python file (default current buffer's file).
@@ -3917,15 +3932,29 @@ See `python-check-command' for the default."
3917 :type 'string 3932 :type 'string
3918 :group 'python) 3933 :group 'python)
3919 3934
3935(defun python-eldoc--get-symbol-at-point ()
3936 "Get the current symbol for eldoc.
3937Returns the current symbol handling point within arguments."
3938 (save-excursion
3939 (let ((start (python-syntax-context 'paren)))
3940 (when start
3941 (goto-char start))
3942 (when (or start
3943 (eobp)
3944 (memq (char-syntax (char-after)) '(?\ ?-)))
3945 ;; Try to adjust to closest symbol if not in one.
3946 (python-util-forward-comment -1)))
3947 (python-info-current-symbol t)))
3948
3920(defun python-eldoc--get-doc-at-point (&optional force-input force-process) 3949(defun python-eldoc--get-doc-at-point (&optional force-input force-process)
3921 "Internal implementation to get documentation at point. 3950 "Internal implementation to get documentation at point.
3922If not FORCE-INPUT is passed then what `python-info-current-symbol' 3951If not FORCE-INPUT is passed then what `python-eldoc--get-symbol-at-point'
3923returns will be used. If not FORCE-PROCESS is passed what 3952returns will be used. If not FORCE-PROCESS is passed what
3924`python-shell-get-process' returns is used." 3953`python-shell-get-process' returns is used."
3925 (let ((process (or force-process (python-shell-get-process)))) 3954 (let ((process (or force-process (python-shell-get-process))))
3926 (when process 3955 (when process
3927 (let ((input (or force-input 3956 (let ((input (or force-input
3928 (python-info-current-symbol t)))) 3957 (python-eldoc--get-symbol-at-point))))
3929 (and input 3958 (and input
3930 ;; Prevent resizing the echo area when iPython is 3959 ;; Prevent resizing the echo area when iPython is
3931 ;; enabled. Bug#18794. 3960 ;; enabled. Bug#18794.
@@ -3945,7 +3974,7 @@ inferior Python process is updated properly."
3945 "Get help on SYMBOL using `help'. 3974 "Get help on SYMBOL using `help'.
3946Interactively, prompt for symbol." 3975Interactively, prompt for symbol."
3947 (interactive 3976 (interactive
3948 (let ((symbol (python-info-current-symbol t)) 3977 (let ((symbol (python-eldoc--get-symbol-at-point))
3949 (enable-recursive-minibuffers t)) 3978 (enable-recursive-minibuffers t))
3950 (list (read-string (if symbol 3979 (list (read-string (if symbol
3951 (format "Describe symbol (default %s): " symbol) 3980 (format "Describe symbol (default %s): " symbol)
@@ -3954,6 +3983,17 @@ Interactively, prompt for symbol."
3954 (message (python-eldoc--get-doc-at-point symbol))) 3983 (message (python-eldoc--get-doc-at-point symbol)))
3955 3984
3956 3985
3986;;; Hideshow
3987
3988(defun python-hideshow-forward-sexp-function (arg)
3989 "Python specific `forward-sexp' function for `hs-minor-mode'.
3990Argument ARG is ignored."
3991 arg ; Shut up, byte compiler.
3992 (python-nav-end-of-defun)
3993 (unless (python-info-current-line-empty-p)
3994 (backward-char)))
3995
3996
3957;;; Imenu 3997;;; Imenu
3958 3998
3959(defvar python-imenu-format-item-label-function 3999(defvar python-imenu-format-item-label-function
@@ -4573,23 +4613,6 @@ returned as is."
4573 n (1- n))) 4613 n (1- n)))
4574 (reverse acc)))) 4614 (reverse acc))))
4575 4615
4576(defun python-util-text-properties-replace-name
4577 (from to &optional start end)
4578 "Replace properties named FROM to TO, keeping its value.
4579Arguments START and END narrow the buffer region to work on."
4580 (save-excursion
4581 (goto-char (or start (point-min)))
4582 (while (not (eobp))
4583 (let ((plist (text-properties-at (point)))
4584 (next-change (or (next-property-change (point) (current-buffer))
4585 (or end (point-max)))))
4586 (when (plist-get plist from)
4587 (let* ((face (plist-get plist from))
4588 (plist (plist-put plist from nil))
4589 (plist (plist-put plist to face)))
4590 (set-text-properties (point) next-change plist (current-buffer))))
4591 (goto-char next-change)))))
4592
4593(defun python-util-strip-string (string) 4616(defun python-util-strip-string (string)
4594 "Strip STRING whitespace and newlines from end and beginning." 4617 "Strip STRING whitespace and newlines from end and beginning."
4595 (replace-regexp-in-string 4618 (replace-regexp-in-string
@@ -4682,14 +4705,23 @@ Arguments START and END narrow the buffer region to work on."
4682 (current-column)))) 4705 (current-column))))
4683 (^ '(- (1+ (current-indentation)))))) 4706 (^ '(- (1+ (current-indentation))))))
4684 4707
4685 (add-function :before-until (local 'eldoc-documentation-function) 4708 (if (null eldoc-documentation-function)
4686 #'python-eldoc-function) 4709 ;; Emacs<25
4687 4710 (set (make-local-variable 'eldoc-documentation-function)
4688 (add-to-list 'hs-special-modes-alist 4711 #'python-eldoc-function)
4689 `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" 4712 (add-function :before-until (local 'eldoc-documentation-function)
4690 ,(lambda (_arg) 4713 #'python-eldoc-function))
4691 (python-nav-end-of-defun)) 4714
4692 nil)) 4715 (add-to-list
4716 'hs-special-modes-alist
4717 `(python-mode
4718 "\\s-*\\(?:def\\|class\\)\\>"
4719 ;; Use the empty string as end regexp so it doesn't default to
4720 ;; "\\s)". This way parens at end of defun are properly hidden.
4721 ""
4722 "#"
4723 python-hideshow-forward-sexp-function
4724 nil))
4693 4725
4694 (set (make-local-variable 'outline-regexp) 4726 (set (make-local-variable 'outline-regexp)
4695 (python-rx (* space) block-start)) 4727 (python-rx (* space) block-start))
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index d1e42ca3443..f2fb95ce59a 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1817,7 +1817,7 @@ It will be properly highlighted even when the call omits parens.")
1817 (defvar ruby-syntax-before-regexp-re 1817 (defvar ruby-syntax-before-regexp-re
1818 (concat 1818 (concat
1819 ;; Special tokens that can't be followed by a division operator. 1819 ;; Special tokens that can't be followed by a division operator.
1820 "\\(^\\|[[=(,~;<>]" 1820 "\\(^\\|[[{|=(,~;<>!]"
1821 ;; Distinguish ternary operator tokens. 1821 ;; Distinguish ternary operator tokens.
1822 ;; FIXME: They don't really have to be separated with spaces. 1822 ;; FIXME: They don't really have to be separated with spaces.
1823 "\\|[?:] " 1823 "\\|[?:] "
@@ -2053,8 +2053,9 @@ See `font-lock-syntax-table'.")
2053 "rescue" 2053 "rescue"
2054 "retry" 2054 "retry"
2055 "return" 2055 "return"
2056 "then" 2056 "self"
2057 "super" 2057 "super"
2058 "then"
2058 "unless" 2059 "unless"
2059 "undef" 2060 "undef"
2060 "until" 2061 "until"
@@ -2071,10 +2072,10 @@ See `font-lock-syntax-table'.")
2071 "at_exit" 2072 "at_exit"
2072 "autoload" 2073 "autoload"
2073 "autoload?" 2074 "autoload?"
2075 "callcc"
2074 "catch" 2076 "catch"
2075 "eval" 2077 "eval"
2076 "exec" 2078 "exec"
2077 "fork"
2078 "format" 2079 "format"
2079 "lambda" 2080 "lambda"
2080 "load" 2081 "load"
@@ -2092,7 +2093,10 @@ See `font-lock-syntax-table'.")
2092 "sprintf" 2093 "sprintf"
2093 "syscall" 2094 "syscall"
2094 "system" 2095 "system"
2096 "throw"
2097 "trace_var"
2095 "trap" 2098 "trap"
2099 "untrace_var"
2096 "warn" 2100 "warn"
2097 ;; keyword-like private methods on Module 2101 ;; keyword-like private methods on Module
2098 "alias_method" 2102 "alias_method"
@@ -2122,13 +2126,15 @@ See `font-lock-syntax-table'.")
2122 "__dir__" 2126 "__dir__"
2123 "__method__" 2127 "__method__"
2124 "abort" 2128 "abort"
2125 "at_exit"
2126 "binding" 2129 "binding"
2127 "block_given?" 2130 "block_given?"
2128 "caller" 2131 "caller"
2129 "exit" 2132 "exit"
2130 "exit!" 2133 "exit!"
2131 "fail" 2134 "fail"
2135 "fork"
2136 "global_variables"
2137 "local_variables"
2132 "private" 2138 "private"
2133 "protected" 2139 "protected"
2134 "public" 2140 "public"
@@ -2137,8 +2143,7 @@ See `font-lock-syntax-table'.")
2137 "readline" 2143 "readline"
2138 "readlines" 2144 "readlines"
2139 "sleep" 2145 "sleep"
2140 "srand" 2146 "srand")
2141 "throw")
2142 'symbols)) 2147 'symbols))
2143 (1 font-lock-builtin-face)) 2148 (1 font-lock-builtin-face))
2144 ;; Here-doc beginnings. 2149 ;; Here-doc beginnings.
@@ -2149,13 +2154,21 @@ See `font-lock-syntax-table'.")
2149 "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$" 2154 "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$"
2150 ;; Variables. 2155 ;; Variables.
2151 (,(concat ruby-font-lock-keyword-beg-re 2156 (,(concat ruby-font-lock-keyword-beg-re
2152 "\\_<\\(nil\\|self\\|true\\|false\\)\\_>") 2157 "\\_<\\(nil\\|true\\|false\\)\\_>")
2153 1 font-lock-variable-name-face) 2158 1 font-lock-constant-face)
2154 ;; Keywords that evaluate to certain values. 2159 ;; Keywords that evaluate to certain values.
2155 ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" 2160 ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>"
2156 (0 font-lock-builtin-face)) 2161 (0 font-lock-builtin-face))
2157 ;; Symbols. 2162 ;; Symbols with symbol characters.
2158 ("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" 2163 ("\\(^\\|[^:]\\)\\(:@?\\(?:\\w\\|_\\)+\\)\\([!?=]\\)?"
2164 (2 font-lock-constant-face)
2165 (3 (unless (and (eq (char-before (match-end 3)) ?=)
2166 (eq (char-after (match-end 3)) ?>))
2167 ;; bug#18466
2168 font-lock-constant-face)
2169 nil t))
2170 ;; Symbols with special characters.
2171 ("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
2159 2 font-lock-constant-face) 2172 2 font-lock-constant-face)
2160 ;; Special globals. 2173 ;; Special globals.
2161 (,(concat "\\$\\(?:[:\"!@;,/\\._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|" 2174 (,(concat "\\$\\(?:[:\"!@;,/\\._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|"
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 2ed3a745bb0..3800cfb6b15 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Alex Schroeder <alex@gnu.org> 5;; Author: Alex Schroeder <alex@gnu.org>
6;; Maintainer: Michael Mauger <michael@mauger.com> 6;; Maintainer: Michael Mauger <michael@mauger.com>
7;; Version: 3.4 7;; Version: 3.5
8;; Keywords: comm languages processes 8;; Keywords: comm languages processes
9;; URL: http://savannah.gnu.org/projects/emacs/ 9;; URL: http://savannah.gnu.org/projects/emacs/
10 10
@@ -3296,13 +3296,13 @@ Allows the suppression of continuation prompts.")
3296(defun sql-starts-with-prompt-re () 3296(defun sql-starts-with-prompt-re ()
3297 "Anchor the prompt expression at the beginning of the output line. 3297 "Anchor the prompt expression at the beginning of the output line.
3298Remove the start of line regexp." 3298Remove the start of line regexp."
3299 (replace-regexp-in-string "\\^" "\\\\`" comint-prompt-regexp)) 3299 (concat "\\`" comint-prompt-regexp))
3300 3300
3301(defun sql-ends-with-prompt-re () 3301(defun sql-ends-with-prompt-re ()
3302 "Anchor the prompt expression at the end of the output line. 3302 "Anchor the prompt expression at the end of the output line.
3303Remove the start of line regexp from the prompt expression since 3303Match a SQL prompt or a password prompt."
3304it may not follow newline characters in the output line." 3304 (concat "\\(?:\\(?:" sql-prompt-regexp "\\)\\|"
3305 (concat (replace-regexp-in-string "\\^" "" sql-prompt-regexp) "\\'")) 3305 "\\(?:" comint-password-prompt-regexp "\\)\\)\\'"))
3306 3306
3307(defun sql-interactive-remove-continuation-prompt (oline) 3307(defun sql-interactive-remove-continuation-prompt (oline)
3308 "Strip out continuation prompts out of the OLINE. 3308 "Strip out continuation prompts out of the OLINE.
@@ -3321,7 +3321,17 @@ to the next chunk to properly match the broken-up prompt.
3321If the filter gets confused, it should reset and stop filtering 3321If the filter gets confused, it should reset and stop filtering
3322to avoid deleting non-prompt output." 3322to avoid deleting non-prompt output."
3323 3323
3324 (when comint-prompt-regexp 3324 ;; continue gathering lines of text iff
3325 ;; + we know what a prompt looks like, and
3326 ;; + there is held text, or
3327 ;; + there are continuation prompt yet to come, or
3328 ;; + not just a prompt string
3329 (when (and comint-prompt-regexp
3330 (or (> (length (or sql-preoutput-hold "")) 0)
3331 (> (or sql-output-newline-count 0) 0)
3332 (not (or (string-match sql-prompt-regexp oline)
3333 (string-match sql-prompt-cont-regexp oline)))))
3334
3325 (save-match-data 3335 (save-match-data
3326 (let (prompt-found last-nl) 3336 (let (prompt-found last-nl)
3327 3337
@@ -3357,16 +3367,19 @@ to avoid deleting non-prompt output."
3357 sql-preoutput-hold "")) 3367 sql-preoutput-hold ""))
3358 3368
3359 ;; Break up output by physical lines if we haven't hit the final prompt 3369 ;; Break up output by physical lines if we haven't hit the final prompt
3360 (unless (and (not (string= oline "")) 3370 (let ((end-re (sql-ends-with-prompt-re)))
3361 (string-match (sql-ends-with-prompt-re) oline) 3371 (unless (and (not (string= oline ""))
3362 (>= (match-end 0) (length oline))) 3372 (string-match end-re oline)
3363 (setq last-nl 0) 3373 (>= (match-end 0) (length oline)))
3364 (while (string-match "\n" oline last-nl) 3374 ;; Find everything upto the last nl
3365 (setq last-nl (match-end 0))) 3375 (setq last-nl 0)
3366 (setq sql-preoutput-hold (concat (substring oline last-nl) 3376 (while (string-match "\n" oline last-nl)
3367 sql-preoutput-hold) 3377 (setq last-nl (match-end 0)))
3368 oline (substring oline 0 last-nl)))))) 3378 ;; Hold after the last nl, return upto last nl
3369 oline) 3379 (setq sql-preoutput-hold (concat (substring oline last-nl)
3380 sql-preoutput-hold)
3381 oline (substring oline 0 last-nl)))))))
3382 oline)
3370 3383
3371;;; Sending the region to the SQLi buffer. 3384;;; Sending the region to the SQLi buffer.
3372 3385
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 7b6f2d3a819..57206544b9b 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -123,7 +123,7 @@
123;;; Code: 123;;; Code:
124 124
125;; This variable will always hold the version number of the mode 125;; This variable will always hold the version number of the mode
126(defconst verilog-mode-version "2014-11-12-aa4b777-vpo" 126(defconst verilog-mode-version "2015-02-20-0d6420b-vpo"
127 "Version of this Verilog mode.") 127 "Version of this Verilog mode.")
128(defconst verilog-mode-release-emacs t 128(defconst verilog-mode-release-emacs t
129 "If non-nil, this version of Verilog mode was released with Emacs itself.") 129 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -8419,7 +8419,6 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8419 (defvar sigs-temp) 8419 (defvar sigs-temp)
8420 ;; These are known to be from other packages and may not be defined 8420 ;; These are known to be from other packages and may not be defined
8421 (defvar diff-command nil) 8421 (defvar diff-command nil)
8422 (defvar vector-skip-list)
8423 ;; There are known to be from newer versions of Emacs 8422 ;; There are known to be from newer versions of Emacs
8424 (defvar create-lockfiles)) 8423 (defvar create-lockfiles))
8425 8424
@@ -10884,7 +10883,7 @@ See the example in `verilog-auto-inout-modport'."
10884(defvar vl-bits nil "See `verilog-auto-inst'.") ; Prevent compile warning 10883(defvar vl-bits nil "See `verilog-auto-inst'.") ; Prevent compile warning
10885(defvar vl-mbits nil "See `verilog-auto-inst'.") ; Prevent compile warning 10884(defvar vl-mbits nil "See `verilog-auto-inst'.") ; Prevent compile warning
10886 10885
10887(defun verilog-auto-inst-port (port-st indent-pt tpl-list tpl-num for-star par-values) 10886(defun verilog-auto-inst-port (port-st indent-pt moddecls tpl-list tpl-num for-star par-values)
10888 "Print out an instantiation connection for this PORT-ST. 10887 "Print out an instantiation connection for this PORT-ST.
10889Insert to INDENT-PT, use template TPL-LIST. 10888Insert to INDENT-PT, use template TPL-LIST.
10890@ are instantiation numbers, replaced with TPL-NUM. 10889@ are instantiation numbers, replaced with TPL-NUM.
@@ -10901,9 +10900,10 @@ If PAR-VALUES replace final strings with these parameter values."
10901 (vl-mbits (if (verilog-sig-multidim port-st) 10900 (vl-mbits (if (verilog-sig-multidim port-st)
10902 (verilog-sig-multidim-string port-st) "")) 10901 (verilog-sig-multidim-string port-st) ""))
10903 (vl-bits (if (or verilog-auto-inst-vector 10902 (vl-bits (if (or verilog-auto-inst-vector
10904 (not (assoc port vector-skip-list)) 10903 (not (assoc port (verilog-decls-get-signals moddecls)))
10905 (not (equal (verilog-sig-bits port-st) 10904 (not (equal (verilog-sig-bits port-st)
10906 (verilog-sig-bits (assoc port vector-skip-list))))) 10905 (verilog-sig-bits
10906 (assoc port (verilog-decls-get-signals moddecls))))))
10907 (or (verilog-sig-bits port-st) "") 10907 (or (verilog-sig-bits port-st) "")
10908 "")) 10908 ""))
10909 (case-fold-search nil) 10909 (case-fold-search nil)
@@ -10932,7 +10932,12 @@ If PAR-VALUES replace final strings with these parameter values."
10932 (concat "/*" vl-mbits vl-bits "*/") 10932 (concat "/*" vl-mbits vl-bits "*/")
10933 (concat vl-bits)) 10933 (concat vl-bits))
10934 tpl-net (concat port 10934 tpl-net (concat port
10935 (if vl-modport (concat "." vl-modport) "") 10935 (if (and vl-modport
10936 ;; .modport cannot be added if attachment is
10937 ;; already declared as modport, VCS croaks
10938 (let ((sig (assoc port (verilog-decls-get-interfaces moddecls))))
10939 (not (and sig (verilog-sig-modport sig)))))
10940 (concat "." vl-modport) "")
10936 dflt-bits)) 10941 dflt-bits))
10937 ;; Find template 10942 ;; Find template
10938 (cond (tpl-ass ; Template of exact port name 10943 (cond (tpl-ass ; Template of exact port name
@@ -11002,12 +11007,12 @@ If PAR-VALUES replace final strings with these parameter values."
11002;;(x "incom[@\"(+ (* 8 @) 7)\":@\"(* 8 @)\"]") 11007;;(x "incom[@\"(+ (* 8 @) 7)\":@\"(* 8 @)\"]")
11003;;(x ".out (outgo[@\"(concat (+ (* 8 @) 7) \\\":\\\" ( * 8 @))\"]));") 11008;;(x ".out (outgo[@\"(concat (+ (* 8 @) 7) \\\":\\\" ( * 8 @))\"]));")
11004 11009
11005(defun verilog-auto-inst-port-list (sig-list indent-pt tpl-list tpl-num for-star par-values) 11010(defun verilog-auto-inst-port-list (sig-list indent-pt moddecls tpl-list tpl-num for-star par-values)
11006 "For `verilog-auto-inst' print a list of ports using `verilog-auto-inst-port'." 11011 "For `verilog-auto-inst' print a list of ports using `verilog-auto-inst-port'."
11007 (when verilog-auto-inst-sort 11012 (when verilog-auto-inst-sort
11008 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare))) 11013 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare)))
11009 (mapc (lambda (port) 11014 (mapc (lambda (port)
11010 (verilog-auto-inst-port port indent-pt 11015 (verilog-auto-inst-port port indent-pt moddecls
11011 tpl-list tpl-num for-star par-values)) 11016 tpl-list tpl-num for-star par-values))
11012 sig-list)) 11017 sig-list))
11013 11018
@@ -11366,8 +11371,6 @@ For more information see the \\[verilog-faq] and forums at URL
11366 (+ 16 (* 8 (/ (+ indent-pt 7) 8))))) 11371 (+ 16 (* 8 (/ (+ indent-pt 7) 8)))))
11367 (modi (verilog-modi-current)) 11372 (modi (verilog-modi-current))
11368 (moddecls (verilog-modi-get-decls modi)) 11373 (moddecls (verilog-modi-get-decls modi))
11369 (vector-skip-list (unless verilog-auto-inst-vector
11370 (verilog-decls-get-signals moddecls)))
11371 submod submodi submoddecls 11374 submod submodi submoddecls
11372 inst skip-pins tpl-list tpl-num did-first par-values) 11375 inst skip-pins tpl-list tpl-num did-first par-values)
11373 11376
@@ -11409,7 +11412,7 @@ For more information see the \\[verilog-faq] and forums at URL
11409 (when (not did-first) (verilog-auto-inst-first) (setq did-first t)) 11412 (when (not did-first) (verilog-auto-inst-first) (setq did-first t))
11410 ;; Note these are searched for in verilog-read-sub-decls. 11413 ;; Note these are searched for in verilog-read-sub-decls.
11411 (verilog-insert-indent "// Interfaced\n") 11414 (verilog-insert-indent "// Interfaced\n")
11412 (verilog-auto-inst-port-list sig-list indent-pt 11415 (verilog-auto-inst-port-list sig-list indent-pt moddecls
11413 tpl-list tpl-num for-star par-values))) 11416 tpl-list tpl-num for-star par-values)))
11414 (let ((sig-list (verilog-signals-not-in 11417 (let ((sig-list (verilog-signals-not-in
11415 (verilog-decls-get-interfaces submoddecls) 11418 (verilog-decls-get-interfaces submoddecls)
@@ -11419,7 +11422,7 @@ For more information see the \\[verilog-faq] and forums at URL
11419 (when (not did-first) (verilog-auto-inst-first) (setq did-first t)) 11422 (when (not did-first) (verilog-auto-inst-first) (setq did-first t))
11420 ;; Note these are searched for in verilog-read-sub-decls. 11423 ;; Note these are searched for in verilog-read-sub-decls.
11421 (verilog-insert-indent "// Interfaces\n") 11424 (verilog-insert-indent "// Interfaces\n")
11422 (verilog-auto-inst-port-list sig-list indent-pt 11425 (verilog-auto-inst-port-list sig-list indent-pt moddecls
11423 tpl-list tpl-num for-star par-values))) 11426 tpl-list tpl-num for-star par-values)))
11424 (let ((sig-list (verilog-signals-not-in 11427 (let ((sig-list (verilog-signals-not-in
11425 (verilog-decls-get-outputs submoddecls) 11428 (verilog-decls-get-outputs submoddecls)
@@ -11428,7 +11431,7 @@ For more information see the \\[verilog-faq] and forums at URL
11428 (when sig-list 11431 (when sig-list
11429 (when (not did-first) (verilog-auto-inst-first) (setq did-first t)) 11432 (when (not did-first) (verilog-auto-inst-first) (setq did-first t))
11430 (verilog-insert-indent "// Outputs\n") 11433 (verilog-insert-indent "// Outputs\n")
11431 (verilog-auto-inst-port-list sig-list indent-pt 11434 (verilog-auto-inst-port-list sig-list indent-pt moddecls
11432 tpl-list tpl-num for-star par-values))) 11435 tpl-list tpl-num for-star par-values)))
11433 (let ((sig-list (verilog-signals-not-in 11436 (let ((sig-list (verilog-signals-not-in
11434 (verilog-decls-get-inouts submoddecls) 11437 (verilog-decls-get-inouts submoddecls)
@@ -11437,7 +11440,7 @@ For more information see the \\[verilog-faq] and forums at URL
11437 (when sig-list 11440 (when sig-list
11438 (when (not did-first) (verilog-auto-inst-first) (setq did-first t)) 11441 (when (not did-first) (verilog-auto-inst-first) (setq did-first t))
11439 (verilog-insert-indent "// Inouts\n") 11442 (verilog-insert-indent "// Inouts\n")
11440 (verilog-auto-inst-port-list sig-list indent-pt 11443 (verilog-auto-inst-port-list sig-list indent-pt moddecls
11441 tpl-list tpl-num for-star par-values))) 11444 tpl-list tpl-num for-star par-values)))
11442 (let ((sig-list (verilog-signals-not-in 11445 (let ((sig-list (verilog-signals-not-in
11443 (verilog-decls-get-inputs submoddecls) 11446 (verilog-decls-get-inputs submoddecls)
@@ -11446,7 +11449,7 @@ For more information see the \\[verilog-faq] and forums at URL
11446 (when sig-list 11449 (when sig-list
11447 (when (not did-first) (verilog-auto-inst-first) (setq did-first t)) 11450 (when (not did-first) (verilog-auto-inst-first) (setq did-first t))
11448 (verilog-insert-indent "// Inputs\n") 11451 (verilog-insert-indent "// Inputs\n")
11449 (verilog-auto-inst-port-list sig-list indent-pt 11452 (verilog-auto-inst-port-list sig-list indent-pt moddecls
11450 tpl-list tpl-num for-star par-values))) 11453 tpl-list tpl-num for-star par-values)))
11451 ;; Kill extra semi 11454 ;; Kill extra semi
11452 (save-excursion 11455 (save-excursion
@@ -11509,8 +11512,6 @@ Templates:
11509 (+ 16 (* 8 (/ (+ indent-pt 7) 8))))) 11512 (+ 16 (* 8 (/ (+ indent-pt 7) 8)))))
11510 (modi (verilog-modi-current)) 11513 (modi (verilog-modi-current))
11511 (moddecls (verilog-modi-get-decls modi)) 11514 (moddecls (verilog-modi-get-decls modi))
11512 (vector-skip-list (unless verilog-auto-inst-vector
11513 (verilog-decls-get-signals moddecls)))
11514 submod submodi submoddecls 11515 submod submodi submoddecls
11515 inst skip-pins tpl-list tpl-num did-first) 11516 inst skip-pins tpl-list tpl-num did-first)
11516 ;; Find module name that is instantiated 11517 ;; Find module name that is instantiated
@@ -11550,7 +11551,7 @@ Templates:
11550 (when (not did-first) (verilog-auto-inst-first) (setq did-first t)) 11551 (when (not did-first) (verilog-auto-inst-first) (setq did-first t))
11551 ;; Note these are searched for in verilog-read-sub-decls. 11552 ;; Note these are searched for in verilog-read-sub-decls.
11552 (verilog-insert-indent "// Parameters\n") 11553 (verilog-insert-indent "// Parameters\n")
11553 (verilog-auto-inst-port-list sig-list indent-pt 11554 (verilog-auto-inst-port-list sig-list indent-pt moddecls
11554 tpl-list tpl-num nil nil))) 11555 tpl-list tpl-num nil nil)))
11555 ;; Kill extra semi 11556 ;; Kill extra semi
11556 (save-excursion 11557 (save-excursion
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 875de3b865c..8d6d2a29293 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -13,10 +13,10 @@
13;; filed in the Emacs bug reporting system against this file, a copy 13;; filed in the Emacs bug reporting system against this file, a copy
14;; of the bug report be sent to the maintainer's email address. 14;; of the bug report be sent to the maintainer's email address.
15 15
16(defconst vhdl-version "3.36.1" 16(defconst vhdl-version "3.37.1"
17 "VHDL Mode version number.") 17 "VHDL Mode version number.")
18 18
19(defconst vhdl-time-stamp "2014-11-27" 19(defconst vhdl-time-stamp "2015-01-15"
20 "VHDL Mode time stamp for last update.") 20 "VHDL Mode time stamp for last update.")
21 21
22;; This file is part of GNU Emacs. 22;; This file is part of GNU Emacs.
@@ -59,7 +59,7 @@
59;; - Block commenting 59;; - Block commenting
60;; - Code fixing/alignment/beautification 60;; - Code fixing/alignment/beautification
61;; - PostScript printing 61;; - PostScript printing
62;; - VHDL'87/'93 and VHDL-AMS supported 62;; - VHDL'87/'93/'02/'08 and VHDL-AMS supported
63;; - Comprehensive menu 63;; - Comprehensive menu
64;; - Fully customizable 64;; - Fully customizable
65;; - Works under GNU Emacs (recommended) and XEmacs 65;; - Works under GNU Emacs (recommended) and XEmacs
@@ -716,6 +716,7 @@ A project setup file can be obtained by exporting a project (see menu).
716Basic standard: 716Basic standard:
717 VHDL'87 : IEEE Std 1076-1987 717 VHDL'87 : IEEE Std 1076-1987
718 VHDL'93/02 : IEEE Std 1076-1993/2002 718 VHDL'93/02 : IEEE Std 1076-1993/2002
719 VHDL'08 : IEEE Std 1076-2008
719Additional standards: 720Additional standards:
720 VHDL-AMS : IEEE Std 1076.1 (analog-mixed-signal) 721 VHDL-AMS : IEEE Std 1076.1 (analog-mixed-signal)
721 Math packages: IEEE Std 1076.2 (`math_real', `math_complex') 722 Math packages: IEEE Std 1076.2 (`math_real', `math_complex')
@@ -724,7 +725,8 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
724 \"Activate Options\"." 725 \"Activate Options\"."
725 :type '(list (choice :tag "Basic standard" 726 :type '(list (choice :tag "Basic standard"
726 (const :tag "VHDL'87" 87) 727 (const :tag "VHDL'87" 87)
727 (const :tag "VHDL'93/02" 93)) 728 (const :tag "VHDL'93/02" 93)
729 (const :tag "VHDL'08" 08))
728 (set :tag "Additional standards" :indent 2 730 (set :tag "Additional standards" :indent 2
729 (const :tag "VHDL-AMS" ams) 731 (const :tag "VHDL-AMS" ams)
730 (const :tag "Math packages" math))) 732 (const :tag "Math packages" math)))
@@ -942,6 +944,12 @@ If nil, only a list of actual parameters is entered."
942 :type 'boolean 944 :type 'boolean
943 :group 'vhdl-template) 945 :group 'vhdl-template)
944 946
947(defcustom vhdl-sensitivity-list-all t
948 "Non-nil means use 'all' keyword in sensitivity list."
949 :version "25.1"
950 :type 'boolean
951 :group 'vhdl-template)
952
945(defcustom vhdl-zero-string "'0'" 953(defcustom vhdl-zero-string "'0'"
946 "String to use for a logic zero." 954 "String to use for a logic zero."
947 :type 'string 955 :type 'string
@@ -1728,7 +1736,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
1728 'vhdl-words-init 'vhdl-font-lock-init)) 1736 'vhdl-words-init 'vhdl-font-lock-init))
1729 :group 'vhdl-highlight) 1737 :group 'vhdl-highlight)
1730 1738
1731(defcustom vhdl-directive-keywords '("pragma" "synopsys") 1739(defcustom vhdl-directive-keywords '("psl" "pragma" "synopsys")
1732 "List of compiler directive keywords recognized for highlighting. 1740 "List of compiler directive keywords recognized for highlighting.
1733 1741
1734NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu 1742NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
@@ -2001,6 +2009,8 @@ reported and the syntactic symbol is ignored.")
2001 (package . 0) 2009 (package . 0)
2002 (architecture . 0) 2010 (architecture . 0)
2003 (package-body . 0) 2011 (package-body . 0)
2012 (context . 0)
2013 (directive . 0)
2004 ) 2014 )
2005 "Default settings for offsets of syntactic elements. 2015 "Default settings for offsets of syntactic elements.
2006Do not change this constant! See the variable `vhdl-offsets-alist' for 2016Do not change this constant! See the variable `vhdl-offsets-alist' for
@@ -2065,7 +2075,8 @@ Here is the current list of valid syntactic element symbols:
2065 configuration -- inside a configuration declaration 2075 configuration -- inside a configuration declaration
2066 package -- inside a package declaration 2076 package -- inside a package declaration
2067 architecture -- inside an architecture body 2077 architecture -- inside an architecture body
2068 package-body -- inside a package body") 2078 package-body -- inside a package body
2079 context -- inside a context declaration")
2069 2080
2070(defvar vhdl-comment-only-line-offset 0 2081(defvar vhdl-comment-only-line-offset 0
2071 "Extra offset for line which contains only the start of a comment. 2082 "Extra offset for line which contains only the start of a comment.
@@ -2684,6 +2695,7 @@ elements > `vhdl-menu-max-size'."
2684 (define-key vhdl-template-map "Cd" 'vhdl-template-configuration-decl) 2695 (define-key vhdl-template-map "Cd" 'vhdl-template-configuration-decl)
2685 (define-key vhdl-template-map "Cs" 'vhdl-template-configuration-spec) 2696 (define-key vhdl-template-map "Cs" 'vhdl-template-configuration-spec)
2686 (define-key vhdl-template-map "co" 'vhdl-template-constant) 2697 (define-key vhdl-template-map "co" 'vhdl-template-constant)
2698 (define-key vhdl-template-map "ct" 'vhdl-template-context)
2687 (define-key vhdl-template-map "di" 'vhdl-template-disconnect) 2699 (define-key vhdl-template-map "di" 'vhdl-template-disconnect)
2688 (define-key vhdl-template-map "el" 'vhdl-template-else) 2700 (define-key vhdl-template-map "el" 'vhdl-template-else)
2689 (define-key vhdl-template-map "ei" 'vhdl-template-elsif) 2701 (define-key vhdl-template-map "ei" 'vhdl-template-elsif)
@@ -2963,7 +2975,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
2963 (modify-syntax-entry ?\* "." st) 2975 (modify-syntax-entry ?\* "." st)
2964 (modify-syntax-entry ?\+ "." st) 2976 (modify-syntax-entry ?\+ "." st)
2965 (modify-syntax-entry ?\. "." st) 2977 (modify-syntax-entry ?\. "." st)
2966 (modify-syntax-entry ?\/ "." st) 2978;;; (modify-syntax-entry ?\/ "." st)
2967 (modify-syntax-entry ?\: "." st) 2979 (modify-syntax-entry ?\: "." st)
2968 (modify-syntax-entry ?\; "." st) 2980 (modify-syntax-entry ?\; "." st)
2969 (modify-syntax-entry ?\< "." st) 2981 (modify-syntax-entry ?\< "." st)
@@ -2975,11 +2987,13 @@ STRING are replaced by `-' and substrings are converted to lower case."
2975 (modify-syntax-entry ?\" "\"" st) 2987 (modify-syntax-entry ?\" "\"" st)
2976 ;; define underscore 2988 ;; define underscore
2977 (modify-syntax-entry ?\_ (if vhdl-underscore-is-part-of-word "w" "_") st) 2989 (modify-syntax-entry ?\_ (if vhdl-underscore-is-part-of-word "w" "_") st)
2978 ;; a single hyphen is punctuation, but a double hyphen starts a comment 2990 ;; single-line comments
2979 (modify-syntax-entry ?\- ". 12" st) 2991 (modify-syntax-entry ?\- ". 12b" st)
2980 ;; and \n and \^M end a comment 2992 ;; multi-line comments
2981 (modify-syntax-entry ?\n ">" st) 2993 (modify-syntax-entry ?\/ ". 14b" st)
2982 (modify-syntax-entry ?\^M ">" st) 2994 (modify-syntax-entry ?* ". 23" st)
2995 (modify-syntax-entry ?\n "> b" st)
2996 (modify-syntax-entry ?\^M "> b" st)
2983 ;; define parentheses to match 2997 ;; define parentheses to match
2984 (modify-syntax-entry ?\( "()" st) 2998 (modify-syntax-entry ?\( "()" st)
2985 (modify-syntax-entry ?\) ")(" st) 2999 (modify-syntax-entry ?\) ")(" st)
@@ -3044,6 +3058,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
3044 ("configuration" . vhdl-template-configuration-hook) 3058 ("configuration" . vhdl-template-configuration-hook)
3045 ("cons" . vhdl-template-constant-hook) 3059 ("cons" . vhdl-template-constant-hook)
3046 ("constant" . vhdl-template-constant-hook) 3060 ("constant" . vhdl-template-constant-hook)
3061 ("context" . vhdl-template-context-hook)
3047 ("disconnect" . vhdl-template-disconnect-hook) 3062 ("disconnect" . vhdl-template-disconnect-hook)
3048 ("downto" . vhdl-template-default-hook) 3063 ("downto" . vhdl-template-default-hook)
3049 ("else" . vhdl-template-else-hook) 3064 ("else" . vhdl-template-else-hook)
@@ -3191,6 +3206,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
3191 ("configuration declaration" vhdl-template-configuration-decl) 3206 ("configuration declaration" vhdl-template-configuration-decl)
3192 ("configuration specification" vhdl-template-configuration-spec) 3207 ("configuration specification" vhdl-template-configuration-spec)
3193 ("constant declaration" vhdl-template-constant) 3208 ("constant declaration" vhdl-template-constant)
3209 ("context declaration" vhdl-template-context)
3194 ("disconnection specification" vhdl-template-disconnect) 3210 ("disconnection specification" vhdl-template-disconnect)
3195 ("entity declaration" vhdl-template-entity) 3211 ("entity declaration" vhdl-template-entity)
3196 ("exit statement" vhdl-template-exit) 3212 ("exit statement" vhdl-template-exit)
@@ -3367,6 +3383,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
3367 ["Configuration (Decl)" vhdl-template-configuration-decl t] 3383 ["Configuration (Decl)" vhdl-template-configuration-decl t]
3368 ["Configuration (Spec)" vhdl-template-configuration-spec t] 3384 ["Configuration (Spec)" vhdl-template-configuration-spec t]
3369 ["Constant" vhdl-template-constant t] 3385 ["Constant" vhdl-template-constant t]
3386 ["Context" vhdl-template-context t]
3370 ["Disconnect" vhdl-template-disconnect t] 3387 ["Disconnect" vhdl-template-disconnect t]
3371 ["Else" vhdl-template-else t] 3388 ["Else" vhdl-template-else t]
3372 ["Elsif" vhdl-template-elsif t] 3389 ["Elsif" vhdl-template-elsif t]
@@ -3708,6 +3725,11 @@ STRING are replaced by `-' and substrings are converted to lower case."
3708 (list '93 (cadr vhdl-standard))) 3725 (list '93 (cadr vhdl-standard)))
3709 (vhdl-activate-customizations)) 3726 (vhdl-activate-customizations))
3710 :style radio :selected (eq '93 (car vhdl-standard))] 3727 :style radio :selected (eq '93 (car vhdl-standard))]
3728 ["VHDL'08"
3729 (progn (customize-set-variable 'vhdl-standard
3730 (list '08 (cadr vhdl-standard)))
3731 (vhdl-activate-customizations))
3732 :style radio :selected (eq '08 (car vhdl-standard))]
3711 "--" 3733 "--"
3712 ["VHDL-AMS" 3734 ["VHDL-AMS"
3713 (progn (customize-set-variable 3735 (progn (customize-set-variable
@@ -3830,6 +3852,10 @@ STRING are replaced by `-' and substrings are converted to lower case."
3830 (customize-set-variable 'vhdl-conditions-in-parenthesis 3852 (customize-set-variable 'vhdl-conditions-in-parenthesis
3831 (not vhdl-conditions-in-parenthesis)) 3853 (not vhdl-conditions-in-parenthesis))
3832 :style toggle :selected vhdl-conditions-in-parenthesis] 3854 :style toggle :selected vhdl-conditions-in-parenthesis]
3855 ["Sensitivity List uses 'all'"
3856 (customize-set-variable 'vhdl-sensitivity-list-all
3857 (not vhdl-sensitivity-list-all))
3858 :style toggle :selected vhdl-sensitivity-list-all]
3833 ["Zero String..." (customize-option 'vhdl-zero-string) t] 3859 ["Zero String..." (customize-option 'vhdl-zero-string) t]
3834 ["One String..." (customize-option 'vhdl-one-string) t] 3860 ["One String..." (customize-option 'vhdl-one-string) t]
3835 ("File Header" 3861 ("File Header"
@@ -4224,6 +4250,9 @@ STRING are replaced by `-' and substrings are converted to lower case."
4224 ("Entity" 4250 ("Entity"
4225 "^\\s-*\\(entity\\)\\s-+\\(\\(\\w\\|\\s_\\)+\\)" 4251 "^\\s-*\\(entity\\)\\s-+\\(\\(\\w\\|\\s_\\)+\\)"
4226 2) 4252 2)
4253 ("Context"
4254 "^\\s-*\\(context\\)\\s-+\\(\\(\\w\\|\\s_\\)+\\)"
4255 2)
4227 ) 4256 )
4228 "Imenu generic expression for VHDL Mode. See `imenu-generic-expression'.") 4257 "Imenu generic expression for VHDL Mode. See `imenu-generic-expression'.")
4229 4258
@@ -4677,7 +4706,7 @@ Usage:
4677 4706
4678 VHDL STANDARDS: 4707 VHDL STANDARDS:
4679 The VHDL standards to be used are specified in option `vhdl-standard'. 4708 The VHDL standards to be used are specified in option `vhdl-standard'.
4680 Available standards are: VHDL'87/'93(02), VHDL-AMS, and Math Packages. 4709 Available standards are: VHDL'87/'93(02)/'08, VHDL-AMS, and Math Packages.
4681 4710
4682 4711
4683 KEYWORD CASE: 4712 KEYWORD CASE:
@@ -4987,6 +5016,12 @@ Key bindings:
4987 ) 5016 )
4988 "List of VHDL'02 keywords.") 5017 "List of VHDL'02 keywords.")
4989 5018
5019(defconst vhdl-08-keywords
5020 '(
5021 "context" "force" "property" "release" "sequence"
5022 )
5023 "List of VHDL'08 keywords.")
5024
4990(defconst vhdl-ams-keywords 5025(defconst vhdl-ams-keywords
4991 '( 5026 '(
4992 "across" "break" "limit" "nature" "noise" "procedural" "quantity" 5027 "across" "break" "limit" "nature" "noise" "procedural" "quantity"
@@ -5028,6 +5063,12 @@ Key bindings:
5028 ) 5063 )
5029 "List of VHDL'02 standardized types.") 5064 "List of VHDL'02 standardized types.")
5030 5065
5066(defconst vhdl-08-types
5067 '(
5068 "boolean_vector" "integer_vector" "real_vector" "time_vector"
5069 )
5070 "List of VHDL'08 standardized types.")
5071
5031(defconst vhdl-ams-types 5072(defconst vhdl-ams-types
5032 ;; standards: IEEE Std 1076.1-2007, IEEE Std 1076.1.1-2004 5073 ;; standards: IEEE Std 1076.1-2007, IEEE Std 1076.1.1-2004
5033 '( 5074 '(
@@ -5103,6 +5144,12 @@ Key bindings:
5103 ) 5144 )
5104 "List of VHDL'02 standardized attributes.") 5145 "List of VHDL'02 standardized attributes.")
5105 5146
5147(defconst vhdl-08-attributes
5148 '(
5149 "instance_name" "path_name"
5150 )
5151 "List of VHDL'08 standardized attributes.")
5152
5106(defconst vhdl-ams-attributes 5153(defconst vhdl-ams-attributes
5107 '( 5154 '(
5108 "across" "through" 5155 "across" "through"
@@ -5174,6 +5221,15 @@ Key bindings:
5174 ) 5221 )
5175 "List of VHDL'02 standardized functions.") 5222 "List of VHDL'02 standardized functions.")
5176 5223
5224(defconst vhdl-08-functions
5225 '(
5226 "finish" "flush" "justify" "maximum" "minimum"
5227 "resolution_limit" "rising_edge" "stop" "swrite"
5228 "tee" "to_binarystring" "to_bstring" "to_hexstring" "to_hstring"
5229 "to_octalstring" "to_ostring" "to_string"
5230 )
5231 "List of VHDL'08 standardized functions.")
5232
5177(defconst vhdl-ams-functions 5233(defconst vhdl-ams-functions
5178 '( 5234 '(
5179 ;; package `standard' 5235 ;; package `standard'
@@ -5202,6 +5258,13 @@ Key bindings:
5202 ) 5258 )
5203 "List of VHDL'02 standardized packages and libraries.") 5259 "List of VHDL'02 standardized packages and libraries.")
5204 5260
5261(defconst vhdl-08-packages
5262 '(
5263 "env" "numeric_std_signed" "numeric_std_unsigned"
5264 "ieee_bit_context" "ieee_std_context" ;; contexts
5265 )
5266 "List of VHDL'08 standardized packages and libraries.")
5267
5205(defconst vhdl-ams-packages 5268(defconst vhdl-ams-packages
5206 '( 5269 '(
5207 "fundamental_constants" "material_constants" "energy_systems" 5270 "fundamental_constants" "material_constants" "energy_systems"
@@ -5216,6 +5279,18 @@ Key bindings:
5216 ) 5279 )
5217 "List of Math Packages standardized packages and libraries.") 5280 "List of Math Packages standardized packages and libraries.")
5218 5281
5282(defconst vhdl-08-directives
5283 '(
5284 "author" "author_info" "begin" "begin_protected" "comment"
5285 "data_block" "data_keyname" "data_keyowner" "data_method"
5286 "decrypt_license" "digest_block" "digest_key_method" "digest_keyname"
5287 "digest_keyowner" "digest_method"
5288 "encoding" "encrypt_agent" "encrypt_agent_info" "end" "end_protected"
5289 "key_block" "key_keyname" "key_keyowner" "key_method"
5290 "runtime_license" "viewport"
5291 )
5292 "List of VHDL'08 standardized tool directives.")
5293
5219(defvar vhdl-keywords nil 5294(defvar vhdl-keywords nil
5220 "List of VHDL keywords.") 5295 "List of VHDL keywords.")
5221 5296
@@ -5237,6 +5312,9 @@ Key bindings:
5237(defvar vhdl-packages nil 5312(defvar vhdl-packages nil
5238 "List of VHDL standardized packages and libraries.") 5313 "List of VHDL standardized packages and libraries.")
5239 5314
5315(defvar vhdl-directives nil
5316 "List of VHDL standardized packages and libraries.")
5317
5240(defvar vhdl-reserved-words nil 5318(defvar vhdl-reserved-words nil
5241 "List of additional reserved words.") 5319 "List of additional reserved words.")
5242 5320
@@ -5282,17 +5360,20 @@ Key bindings:
5282 (vhdl-upcase-list 5360 (vhdl-upcase-list
5283 (and vhdl-highlight-case-sensitive vhdl-upper-case-keywords) 5361 (and vhdl-highlight-case-sensitive vhdl-upper-case-keywords)
5284 (append vhdl-02-keywords 5362 (append vhdl-02-keywords
5363 (when (vhdl-standard-p '08) vhdl-08-keywords)
5285 (when (vhdl-standard-p 'ams) vhdl-ams-keywords)))) 5364 (when (vhdl-standard-p 'ams) vhdl-ams-keywords))))
5286 (setq vhdl-types 5365 (setq vhdl-types
5287 (vhdl-upcase-list 5366 (vhdl-upcase-list
5288 (and vhdl-highlight-case-sensitive vhdl-upper-case-types) 5367 (and vhdl-highlight-case-sensitive vhdl-upper-case-types)
5289 (append vhdl-02-types 5368 (append vhdl-02-types
5369 (when (vhdl-standard-p '08) vhdl-08-types)
5290 (when (vhdl-standard-p 'ams) vhdl-ams-types) 5370 (when (vhdl-standard-p 'ams) vhdl-ams-types)
5291 (when (vhdl-standard-p 'math) vhdl-math-types)))) 5371 (when (vhdl-standard-p 'math) vhdl-math-types))))
5292 (setq vhdl-attributes 5372 (setq vhdl-attributes
5293 (vhdl-upcase-list 5373 (vhdl-upcase-list
5294 (and vhdl-highlight-case-sensitive vhdl-upper-case-attributes) 5374 (and vhdl-highlight-case-sensitive vhdl-upper-case-attributes)
5295 (append vhdl-02-attributes 5375 (append vhdl-02-attributes
5376 (when (vhdl-standard-p '08) vhdl-08-attributes)
5296 (when (vhdl-standard-p 'ams) vhdl-ams-attributes)))) 5377 (when (vhdl-standard-p 'ams) vhdl-ams-attributes))))
5297 (setq vhdl-enum-values 5378 (setq vhdl-enum-values
5298 (vhdl-upcase-list 5379 (vhdl-upcase-list
@@ -5307,12 +5388,16 @@ Key bindings:
5307 '("")))) 5388 '(""))))
5308 (setq vhdl-functions 5389 (setq vhdl-functions
5309 (append vhdl-02-functions 5390 (append vhdl-02-functions
5391 (when (vhdl-standard-p '08) vhdl-08-functions)
5310 (when (vhdl-standard-p 'ams) vhdl-ams-functions) 5392 (when (vhdl-standard-p 'ams) vhdl-ams-functions)
5311 (when (vhdl-standard-p 'math) vhdl-math-functions))) 5393 (when (vhdl-standard-p 'math) vhdl-math-functions)))
5312 (setq vhdl-packages 5394 (setq vhdl-packages
5313 (append vhdl-02-packages 5395 (append vhdl-02-packages
5396 (when (vhdl-standard-p '08) vhdl-08-packages)
5314 (when (vhdl-standard-p 'ams) vhdl-ams-packages) 5397 (when (vhdl-standard-p 'ams) vhdl-ams-packages)
5315 (when (vhdl-standard-p 'math) vhdl-math-packages))) 5398 (when (vhdl-standard-p 'math) vhdl-math-packages)))
5399 (setq vhdl-directives
5400 (append (when (vhdl-standard-p '08) vhdl-08-directives)))
5316 (setq vhdl-reserved-words 5401 (setq vhdl-reserved-words
5317 (append (when vhdl-highlight-forbidden-words vhdl-forbidden-words) 5402 (append (when vhdl-highlight-forbidden-words vhdl-forbidden-words)
5318 (when vhdl-highlight-verilog-keywords vhdl-verilog-keywords) 5403 (when vhdl-highlight-verilog-keywords vhdl-verilog-keywords)
@@ -5357,7 +5442,8 @@ Key bindings:
5357 (list vhdl-upper-case-enum-values) vhdl-enum-values 5442 (list vhdl-upper-case-enum-values) vhdl-enum-values
5358 (list vhdl-upper-case-constants) vhdl-constants 5443 (list vhdl-upper-case-constants) vhdl-constants
5359 (list nil) vhdl-functions 5444 (list nil) vhdl-functions
5360 (list nil) vhdl-packages))) 5445 (list nil) vhdl-packages
5446 (list nil) vhdl-directives)))
5361 5447
5362;; initialize reserved words for VHDL Mode 5448;; initialize reserved words for VHDL Mode
5363(vhdl-words-init) 5449(vhdl-words-init)
@@ -5598,9 +5684,24 @@ the offset is simply returned."
5598 5684
5599;; Syntactic support functions: 5685;; Syntactic support functions:
5600 5686
5601(defun vhdl-in-comment-p () 5687(defun vhdl-in-comment-p (&optional pos)
5602 "Check if point is in a comment." 5688 "Check if point is in a comment (include multi-line comments)."
5603 (eq (vhdl-in-literal) 'comment)) 5689 (let ((parse (lambda (p)
5690 (let ((c (char-after p)))
5691 (or (and c (eq (char-syntax c) ?<))
5692 (nth 4 (parse-partial-sexp
5693 (save-excursion
5694 (beginning-of-defun)
5695 (point)) p)))))))
5696 (save-excursion
5697 (goto-char (or pos (point)))
5698 (or (funcall parse (point))
5699 ;; `parse-partial-sexp's notion of comments doesn't span lines
5700 (progn
5701 (back-to-indentation)
5702 (unless (eolp)
5703 (forward-char)
5704 (funcall parse (point))))))))
5604 5705
5605(defun vhdl-in-string-p () 5706(defun vhdl-in-string-p ()
5606 "Check if point is in a string." 5707 "Check if point is in a string."
@@ -5625,6 +5726,9 @@ the offset is simply returned."
5625 ((nth 3 state) 'string) 5726 ((nth 3 state) 'string)
5626 ((nth 4 state) 'comment) 5727 ((nth 4 state) 'comment)
5627 ((vhdl-beginning-of-macro) 'pound) 5728 ((vhdl-beginning-of-macro) 'pound)
5729 ((vhdl-beginning-of-directive) 'directive)
5730 ;; for multi-line comments
5731 ((and (vhdl-standard-p '08) (vhdl-in-comment-p)) 'comment)
5628 (t nil))))) 5732 (t nil)))))
5629 5733
5630(defun vhdl-in-extended-identifier-p () 5734(defun vhdl-in-extended-identifier-p ()
@@ -5675,7 +5779,7 @@ negative, skip forward otherwise."
5675 (goto-char lim ) 5779 (goto-char lim )
5676 (while (< (point) here) 5780 (while (< (point) here)
5677 (setq match 5781 (setq match
5678 (and (re-search-forward "--\\|[\"']" 5782 (and (re-search-forward "--\\|[\"']\\|`"
5679 here 'move) 5783 here 'move)
5680 (buffer-substring (match-beginning 0) (match-end 0)))) 5784 (buffer-substring (match-beginning 0) (match-end 0))))
5681 (setq state 5785 (setq state
@@ -5685,6 +5789,9 @@ negative, skip forward otherwise."
5685 ;; looking at the opening of a VHDL style comment 5789 ;; looking at the opening of a VHDL style comment
5686 ((string= "--" match) 5790 ((string= "--" match)
5687 (if (<= here (progn (end-of-line) (point))) 'comment)) 5791 (if (<= here (progn (end-of-line) (point))) 'comment))
5792 ;; looking at a directive
5793 ((string= "`" match)
5794 (if (<= here (progn (end-of-line) (point))) 'directive))
5688 ;; looking at the opening of a double quote string 5795 ;; looking at the opening of a double quote string
5689 ((string= "\"" match) 5796 ((string= "\"" match)
5690 (if (not (save-restriction 5797 (if (not (save-restriction
@@ -5729,7 +5836,7 @@ negative, skip forward otherwise."
5729 (setq here (point)) 5836 (setq here (point))
5730 (vhdl-forward-comment hugenum) 5837 (vhdl-forward-comment hugenum)
5731 ;; skip preprocessor directives 5838 ;; skip preprocessor directives
5732 (when (and (eq (char-after) ?#) 5839 (when (and (or (eq (char-after) ?#) (eq (char-after) ?`))
5733 (= (vhdl-point 'boi) (point))) 5840 (= (vhdl-point 'boi) (point)))
5734 (while (and (eq (char-before (vhdl-point 'eol)) ?\\) 5841 (while (and (eq (char-before (vhdl-point 'eol)) ?\\)
5735 (= (forward-line 1) 0))) 5842 (= (forward-line 1) 0)))
@@ -5766,6 +5873,19 @@ negative, skip forward otherwise."
5766 (goto-char here) 5873 (goto-char here)
5767 nil))) 5874 nil)))
5768 5875
5876(defun vhdl-beginning-of-directive (&optional lim)
5877 "Go to the beginning of a directive (nicked from `cc-engine')."
5878 (let ((here (point)))
5879 (beginning-of-line)
5880 (while (eq (char-before (1- (point))) ?\\)
5881 (forward-line -1))
5882 (back-to-indentation)
5883 (if (and (<= (point) here)
5884 (eq (char-after) ?`))
5885 t
5886 (goto-char here)
5887 nil)))
5888
5769(defun vhdl-backward-syntactic-ws (&optional lim) 5889(defun vhdl-backward-syntactic-ws (&optional lim)
5770 "Backward skip over syntactic whitespace." 5890 "Backward skip over syntactic whitespace."
5771 (let* ((here (point-min)) 5891 (let* ((here (point-min))
@@ -5822,7 +5942,7 @@ that point, else nil."
5822;; Core syntactic evaluation functions: 5942;; Core syntactic evaluation functions:
5823 5943
5824(defconst vhdl-libunit-re 5944(defconst vhdl-libunit-re
5825 "\\b\\(architecture\\|configuration\\|entity\\|package\\)\\b[^_]") 5945 "\\b\\(architecture\\|configuration\\|context\\|entity\\|package\\)\\b[^_]")
5826 5946
5827(defun vhdl-libunit-p () 5947(defun vhdl-libunit-p ()
5828 (and 5948 (and
@@ -5840,7 +5960,7 @@ that point, else nil."
5840 )) 5960 ))
5841 5961
5842(defconst vhdl-defun-re 5962(defconst vhdl-defun-re
5843 "\\b\\(architecture\\|block\\|configuration\\|entity\\|package\\|process\\|procedural\\|procedure\\|function\\)\\b[^_]") 5963 "\\b\\(architecture\\|block\\|configuration\\|context\\|entity\\|package\\|process\\|procedural\\|procedure\\|function\\)\\b[^_]")
5844 5964
5845(defun vhdl-defun-p () 5965(defun vhdl-defun-p ()
5846 (save-excursion 5966 (save-excursion
@@ -5849,7 +5969,7 @@ that point, else nil."
5849 (save-excursion 5969 (save-excursion
5850 (backward-sexp) 5970 (backward-sexp)
5851 (not (looking-at "end\\s-+\\w"))) 5971 (not (looking-at "end\\s-+\\w")))
5852 ;; "architecture", "configuration", "entity", 5972 ;; "architecture", "configuration", "context", "entity",
5853 ;; "package", "procedure", "function": 5973 ;; "package", "procedure", "function":
5854 t))) 5974 t)))
5855 5975
@@ -5863,7 +5983,7 @@ corresponding \"begin\" keyword, else return nil."
5863 (if (looking-at "block\\|process\\|procedural") 5983 (if (looking-at "block\\|process\\|procedural")
5864 ;; "block", "process". "procedural: 5984 ;; "block", "process". "procedural:
5865 (buffer-substring (match-beginning 0) (match-end 0)) 5985 (buffer-substring (match-beginning 0) (match-end 0))
5866 ;; "architecture", "configuration", "entity", "package", 5986 ;; "architecture", "configuration", "context", "entity", "package",
5867 ;; "procedure", "function": 5987 ;; "procedure", "function":
5868 "is")))) 5988 "is"))))
5869 5989
@@ -5884,7 +6004,7 @@ vhdl-begin-fwd-re, and are not inside a literal, and that we are not in
5884the middle of an identifier that just happens to contain a \"begin\" 6004the middle of an identifier that just happens to contain a \"begin\"
5885keyword." 6005keyword."
5886 (cond 6006 (cond
5887 ;; "[architecture|case|configuration|entity|package| 6007 ;; "[architecture|case|configuration|context|entity|package|
5888 ;; procedure|function] ... is": 6008 ;; procedure|function] ... is":
5889 ((and (looking-at "i") 6009 ((and (looking-at "i")
5890 (save-excursion 6010 (save-excursion
@@ -5897,7 +6017,7 @@ keyword."
5897 (let (foundp) 6017 (let (foundp)
5898 (while (and (not foundp) 6018 (while (and (not foundp)
5899 (re-search-backward 6019 (re-search-backward
5900 ";\\|\\b\\(architecture\\|case\\|configuration\\|entity\\|package\\|procedure\\|return\\|is\\|begin\\|process\\|procedural\\|block\\)\\b[^_]" 6020 ";\\|\\b\\(architecture\\|case\\|configuration\\|context\\|entity\\|package\\|procedure\\|return\\|is\\|begin\\|process\\|procedural\\|block\\)\\b[^_]"
5901 lim 'move)) 6021 lim 'move))
5902 (if (or (= (preceding-char) ?_) 6022 (if (or (= (preceding-char) ?_)
5903 (vhdl-in-literal)) 6023 (vhdl-in-literal))
@@ -6092,7 +6212,7 @@ of an identifier that just happens to contain an \"end\" keyword."
6092 (vector "for" (vhdl-first-word pos) nil nil)) 6212 (vector "for" (vhdl-first-word pos) nil nil))
6093 ;; "end [id]": 6213 ;; "end [id]":
6094 (t 6214 (t
6095 (vector "begin\\|architecture\\|configuration\\|entity\\|package\\|procedure\\|function" 6215 (vector "begin\\|architecture\\|configuration\\|context\\|entity\\|package\\|procedure\\|function"
6096 (vhdl-first-word pos) 6216 (vhdl-first-word pos)
6097 ;; return an alist of (statement . keyword) mappings 6217 ;; return an alist of (statement . keyword) mappings
6098 '( 6218 '(
@@ -6102,6 +6222,8 @@ of an identifier that just happens to contain an \"end\" keyword."
6102 ("architecture" . "is") 6222 ("architecture" . "is")
6103 ;; "configuration ... is ... end [id]": 6223 ;; "configuration ... is ... end [id]":
6104 ("configuration" . "is") 6224 ("configuration" . "is")
6225 ;; "context ... is ... end [id]":
6226 ("context" . "is")
6105 ;; "entity ... is ... end [id]": 6227 ;; "entity ... is ... end [id]":
6106 ("entity" . "is") 6228 ("entity" . "is")
6107 ;; "package ... is ... end [id]": 6229 ;; "package ... is ... end [id]":
@@ -6716,7 +6838,8 @@ keyword at PLACEHOLDER, then return the library unit type."
6716 (cond 6838 (cond
6717 ((looking-at "e") 'entity) 6839 ((looking-at "e") 'entity)
6718 ((looking-at "a") 'architecture) 6840 ((looking-at "a") 'architecture)
6719 ((looking-at "c") 'configuration) 6841 ((looking-at "conf") 'configuration)
6842 ((looking-at "cont") 'context)
6720 ((looking-at "p") 6843 ((looking-at "p")
6721 (save-excursion 6844 (save-excursion
6722 (goto-char bod) 6845 (goto-char bod)
@@ -6992,7 +7115,7 @@ is not moved."
6992 (goto-char (1+ containing-sexp)) 7115 (goto-char (1+ containing-sexp))
6993 (skip-chars-forward " \t") 7116 (skip-chars-forward " \t")
6994 (not (eolp)) 7117 (not (eolp))
6995 (not (looking-at "--"))) 7118 (not (looking-at "--\\|`")))
6996 (save-excursion 7119 (save-excursion
6997 (vhdl-beginning-of-statement-1 containing-sexp) 7120 (vhdl-beginning-of-statement-1 containing-sexp)
6998 (skip-chars-backward " \t(") 7121 (skip-chars-backward " \t(")
@@ -7141,8 +7264,10 @@ is not moved."
7141 ;; now we need to look at any modifiers 7264 ;; now we need to look at any modifiers
7142 (goto-char indent-point) 7265 (goto-char indent-point)
7143 (skip-chars-forward " \t") 7266 (skip-chars-forward " \t")
7144 (if (looking-at "--") 7267 (if (or (looking-at "--") (looking-at "/\\*"))
7145 (vhdl-add-syntax 'comment)) 7268 (vhdl-add-syntax 'comment))
7269 (if (looking-at "`")
7270 (vhdl-add-syntax 'directive))
7146 (if (eq literal 'pound) 7271 (if (eq literal 'pound)
7147 (vhdl-add-syntax 'cpp-macro)) 7272 (vhdl-add-syntax 'cpp-macro))
7148 ;; return the syntax 7273 ;; return the syntax
@@ -7216,8 +7341,12 @@ only-lines."
7216 (vhdl-comment-indent) 7341 (vhdl-comment-indent)
7217 ;; otherwise, indent as specified by vhdl-comment-only-line-offset 7342 ;; otherwise, indent as specified by vhdl-comment-only-line-offset
7218 (if (not (bolp)) 7343 (if (not (bolp))
7344 ;; inside multi-line comment
7345 (if (looking-at "\\*")
7346 1
7347 ;; otherwise
7219 (or (car-safe vhdl-comment-only-line-offset) 7348 (or (car-safe vhdl-comment-only-line-offset)
7220 vhdl-comment-only-line-offset) 7349 vhdl-comment-only-line-offset))
7221 (or (cdr-safe vhdl-comment-only-line-offset) 7350 (or (cdr-safe vhdl-comment-only-line-offset)
7222 (car-safe vhdl-comment-only-line-offset) 7351 (car-safe vhdl-comment-only-line-offset)
7223 -1000 ;jam it against the left side 7352 -1000 ;jam it against the left side
@@ -7457,7 +7586,7 @@ ENDPOS is encountered."
7457 (mapc 7586 (mapc
7458 (function 7587 (function
7459 (lambda (elt) 7588 (lambda (elt)
7460 (if (memq (car elt) '(entity configuration package 7589 (if (memq (car elt) '(entity configuration context package
7461 package-body architecture)) 7590 package-body architecture))
7462 nil 7591 nil
7463 (setq expurgated (append expurgated (list elt)))))) 7592 (setq expurgated (append expurgated (list elt))))))
@@ -7787,7 +7916,7 @@ the token in MATCH."
7787 (vhdl-prepare-search-2 7916 (vhdl-prepare-search-2
7788 (save-excursion 7917 (save-excursion
7789 ;; search for declarative part 7918 ;; search for declarative part
7790 (when (and (re-search-backward "^\\(architecture\\|begin\\|configuration\\|end\\|entity\\|package\\)\\>" nil t) 7919 (when (and (re-search-backward "^\\(architecture\\|begin\\|configuration\\|context\\|end\\|entity\\|package\\)\\>" nil t)
7791 (not (member (upcase (match-string 1)) '("BEGIN" "END")))) 7920 (not (member (upcase (match-string 1)) '("BEGIN" "END"))))
7792 (setq beg (point)) 7921 (setq beg (point))
7793 (re-search-forward "^\\(begin\\|end\\)\\>" nil t) 7922 (re-search-forward "^\\(begin\\|end\\)\\>" nil t)
@@ -9137,6 +9266,27 @@ a configuration declaration if not within a design unit."
9137 (insert ";") 9266 (insert ";")
9138 (vhdl-comment-insert-inline)))))) 9267 (vhdl-comment-insert-inline))))))
9139 9268
9269(defun vhdl-template-context ()
9270 "Insert a context declaration."
9271 (interactive)
9272 (let ((margin (current-indentation))
9273 (start (point))
9274 entity-exists string name position)
9275 (vhdl-insert-keyword "CONTEXT ")
9276 (when (setq name (vhdl-template-field "name" nil t start (point)))
9277 (vhdl-insert-keyword " IS\n")
9278 (when (memq vhdl-insert-empty-lines '(unit all)) (insert "\n"))
9279 (indent-to (+ margin vhdl-basic-offset))
9280 (setq position (point))
9281 (insert "\n")
9282 (when (memq vhdl-insert-empty-lines '(unit all)) (insert "\n"))
9283 (indent-to margin)
9284 (vhdl-insert-keyword "END ")
9285 (unless (vhdl-standard-p '87)
9286 (vhdl-insert-keyword "CONTEXT "))
9287 (insert name ";")
9288 (goto-char position))))
9289
9140(defun vhdl-template-default () 9290(defun vhdl-template-default ()
9141 "Insert nothing." 9291 "Insert nothing."
9142 (interactive) 9292 (interactive)
@@ -9798,8 +9948,10 @@ otherwise."
9798 (forward-char 1)) 9948 (forward-char 1))
9799 (insert "(") 9949 (insert "(")
9800 (if (not seq) 9950 (if (not seq)
9801 (unless (setq input-signals 9951 (unless (or (and (vhdl-standard-p '08) vhdl-sensitivity-list-all
9802 (vhdl-template-field "[sensitivity list]" ")" t)) 9952 (progn (insert "all)") (setq input-signals "all")))
9953 (setq input-signals
9954 (vhdl-template-field "[sensitivity list]" ")" t)))
9803 (setq input-signals "") 9955 (setq input-signals "")
9804 (delete-char -2)) 9956 (delete-char -2))
9805 (setq clock (or (and (not (equal "" vhdl-clock-name)) 9957 (setq clock (or (and (not (equal "" vhdl-clock-name))
@@ -10533,7 +10685,8 @@ specification, if not already there."
10533 (while (search-forward "<standard>" end t) 10685 (while (search-forward "<standard>" end t)
10534 (replace-match 10686 (replace-match
10535 (concat "VHDL" (cond ((vhdl-standard-p '87) "'87") 10687 (concat "VHDL" (cond ((vhdl-standard-p '87) "'87")
10536 ((vhdl-standard-p '93) "'93/02")) 10688 ((vhdl-standard-p '93) "'93/02")
10689 ((vhdl-standard-p '08) "'08"))
10537 (when (vhdl-standard-p 'ams) ", VHDL-AMS") 10690 (when (vhdl-standard-p 'ams) ", VHDL-AMS")
10538 (when (vhdl-standard-p 'math) ", Math Packages")) t t)) 10691 (when (vhdl-standard-p 'math) ", Math Packages")) t t))
10539 (goto-char beg) 10692 (goto-char beg)
@@ -11071,7 +11224,7 @@ else insert tab (used for word completion in VHDL minibuffer)."
11071 (save-excursion 11224 (save-excursion
11072 (beginning-of-line) 11225 (beginning-of-line)
11073 ;; search backward for block beginning or end 11226 ;; search backward for block beginning or end
11074 (while (or (while (and (setq pos (re-search-backward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t)) 11227 (while (or (while (and (setq pos (re-search-backward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|context\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
11075 ;; not consider subprogram declarations 11228 ;; not consider subprogram declarations
11076 (or (and (match-string 5) 11229 (or (and (match-string 5)
11077 (save-match-data 11230 (save-match-data
@@ -11102,7 +11255,7 @@ else insert tab (used for word completion in VHDL minibuffer)."
11102 (save-excursion 11255 (save-excursion
11103 (end-of-line) 11256 (end-of-line)
11104 ;; search forward for block beginning or end 11257 ;; search forward for block beginning or end
11105 (while (or (while (and (setq pos (re-search-forward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t)) 11258 (while (or (while (and (setq pos (re-search-forward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|context\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
11106 ;; not consider subprogram declarations 11259 ;; not consider subprogram declarations
11107 (or (and (match-string 5) 11260 (or (and (match-string 5)
11108 (save-match-data 11261 (save-match-data
@@ -11203,6 +11356,8 @@ but not if inside a comment or quote."
11203 (vhdl-hooked-abbrev 'vhdl-template-configuration)) 11356 (vhdl-hooked-abbrev 'vhdl-template-configuration))
11204(defun vhdl-template-constant-hook () 11357(defun vhdl-template-constant-hook ()
11205 (vhdl-hooked-abbrev 'vhdl-template-constant)) 11358 (vhdl-hooked-abbrev 'vhdl-template-constant))
11359(defun vhdl-template-context-hook ()
11360 (vhdl-hooked-abbrev 'vhdl-template-context))
11206(defun vhdl-template-disconnect-hook () 11361(defun vhdl-template-disconnect-hook ()
11207 (vhdl-hooked-abbrev 'vhdl-template-disconnect)) 11362 (vhdl-hooked-abbrev 'vhdl-template-disconnect))
11208(defun vhdl-template-display-comment-hook () 11363(defun vhdl-template-display-comment-hook ()
@@ -13190,7 +13345,8 @@ This does highlighting of keywords and standard identifiers.")
13190 (list 13345 (list
13191 (concat 13346 (concat
13192 "^\\s-*\\(" 13347 "^\\s-*\\("
13193 "architecture\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|" 13348 "architecture\\|configuration\\|context\\|entity\\|package"
13349 "\\(\\s-+body\\)?\\|"
13194 "\\(\\(impure\\|pure\\)\\s-+\\)?function\\|procedure\\|component" 13350 "\\(\\(impure\\|pure\\)\\s-+\\)?function\\|procedure\\|component"
13195 "\\)\\s-+\\(\\w+\\)") 13351 "\\)\\s-+\\(\\w+\\)")
13196 5 'font-lock-function-name-face) 13352 5 'font-lock-function-name-face)
@@ -13232,9 +13388,9 @@ This does highlighting of keywords and standard identifiers.")
13232 (list 13388 (list
13233 (concat 13389 (concat
13234 "^\\s-*end\\s-+\\(\\(" 13390 "^\\s-*end\\s-+\\(\\("
13235 "architecture\\|block\\|case\\|component\\|configuration\\|entity\\|" 13391 "architecture\\|block\\|case\\|component\\|configuration\\|context\\|"
13236 "for\\|function\\|generate\\|if\\|loop\\|package\\(\\s-+body\\)?\\|" 13392 "entity\\|for\\|function\\|generate\\|if\\|loop\\|package"
13237 "procedure\\|\\(postponed\\s-+\\)?process\\|" 13393 "\\(\\s-+body\\)?\\|procedure\\|\\(postponed\\s-+\\)?process\\|"
13238 (when (vhdl-standard-p 'ams) "procedural\\|") 13394 (when (vhdl-standard-p 'ams) "procedural\\|")
13239 "units" 13395 "units"
13240 "\\)\\s-+\\)?\\(\\w*\\)") 13396 "\\)\\s-+\\)?\\(\\w*\\)")
@@ -13266,10 +13422,10 @@ This does highlighting of keywords and standard identifiers.")
13266 ;; highlight names in use clauses 13422 ;; highlight names in use clauses
13267 (list 13423 (list
13268 (concat 13424 (concat
13269 "\\<use\\s-+\\(\\(entity\\|configuration\\)\\s-+\\)?" 13425 "\\<\\(context\\|use\\)\\s-+\\(\\(entity\\|configuration\\)\\s-+\\)?"
13270 "\\(\\w+\\)\\(\\.\\(\\w+\\)\\)?\\((\\(\\w+\\))\\)?") 13426 "\\(\\w+\\)\\(\\.\\(\\w+\\)\\)?\\((\\(\\w+\\))\\)?")
13271 '(3 font-lock-function-name-face) '(5 font-lock-function-name-face nil t) 13427 '(4 font-lock-function-name-face) '(6 font-lock-function-name-face nil t)
13272 '(7 font-lock-function-name-face nil t)) 13428 '(8 font-lock-function-name-face nil t))
13273 13429
13274 ;; highlight attribute name in attribute declarations/specifications 13430 ;; highlight attribute name in attribute declarations/specifications
13275 (list 13431 (list
@@ -13316,6 +13472,12 @@ This does highlighting of keywords and standard identifiers.")
13316 '(vhdl-font-lock-match-item 13472 '(vhdl-font-lock-match-item
13317 (progn (goto-char (match-end 1)) (match-beginning 2)) 13473 (progn (goto-char (match-end 1)) (match-beginning 2))
13318 nil (1 font-lock-variable-name-face))) 13474 nil (1 font-lock-variable-name-face)))
13475
13476 ;; highlight tool directives
13477 (list
13478 (concat
13479 "^\\s-*\\(`\\w+\\)")
13480 1 'font-lock-preprocessor-face)
13319 ) 13481 )
13320 "For consideration as a value of `vhdl-font-lock-keywords'. 13482 "For consideration as a value of `vhdl-font-lock-keywords'.
13321This does context sensitive highlighting of names and labels.") 13483This does context sensitive highlighting of names and labels.")
@@ -13661,7 +13823,7 @@ hierarchy otherwise.")
13661 "Return position of end of current unit." 13823 "Return position of end of current unit."
13662 (let ((pos (point))) 13824 (let ((pos (point)))
13663 (save-excursion 13825 (save-excursion
13664 (while (and (re-search-forward "^[ \t]*\\(architecture\\|configuration\\|entity\\|package\\)\\>" nil 1) 13826 (while (and (re-search-forward "^[ \t]*\\(architecture\\|configuration\\|context\\|entity\\|package\\)\\>" nil 1)
13665 (save-excursion 13827 (save-excursion
13666 (goto-char (match-beginning 0)) 13828 (goto-char (match-beginning 0))
13667 (vhdl-backward-syntactic-ws) 13829 (vhdl-backward-syntactic-ws)
@@ -13682,7 +13844,7 @@ hierarchy otherwise.")
13682 "Scan the context clause that precedes a design unit." 13844 "Scan the context clause that precedes a design unit."
13683 (let (lib-alist) 13845 (let (lib-alist)
13684 (save-excursion 13846 (save-excursion
13685 (when (re-search-backward "^[ \t]*\\(architecture\\|configuration\\|entity\\|package\\)\\>" nil t) 13847 (when (re-search-backward "^[ \t]*\\(architecture\\|configuration\\|context\\|entity\\|package\\)\\>" nil t)
13686 (while (and (re-search-backward "^[ \t]*\\(end\\|use\\)\\>" nil t) 13848 (while (and (re-search-backward "^[ \t]*\\(end\\|use\\)\\>" nil t)
13687 (equal "USE" (upcase (match-string 1)))) 13849 (equal "USE" (upcase (match-string 1))))
13688 (when (looking-at "^[ \t]*use[ \t\n\r\f]*\\(\\w+\\)\\.\\(\\w+\\)\\.\\w+") 13850 (when (looking-at "^[ \t]*use[ \t\n\r\f]*\\(\\w+\\)\\.\\(\\w+\\)\\.\\w+")
@@ -17502,6 +17664,7 @@ specified by a target."
17502 'vhdl-argument-list-indent 17664 'vhdl-argument-list-indent
17503 'vhdl-association-list-with-formals 17665 'vhdl-association-list-with-formals
17504 'vhdl-conditions-in-parenthesis 17666 'vhdl-conditions-in-parenthesis
17667 'vhdl-sensitivity-list-all
17505 'vhdl-zero-string 17668 'vhdl-zero-string
17506 'vhdl-one-string 17669 'vhdl-one-string
17507 'vhdl-file-header 17670 'vhdl-file-header
@@ -17606,6 +17769,17 @@ specified by a target."
17606 17769
17607(defconst vhdl-doc-release-notes nil 17770(defconst vhdl-doc-release-notes nil
17608 "\ 17771 "\
17772Release Notes for VHDL Mode 3.37
17773================================
17774
17775- Added support for VHDL'08:
17776 - New keywords, types, functions, attributes, operators, packages
17777 - Context declaration
17778 - Block comments
17779 - Directives
17780 - 'all' keyword in sensitivity list
17781
17782
17609Release Notes for VHDL Mode 3.34 17783Release Notes for VHDL Mode 3.34
17610================================ 17784================================
17611 17785
@@ -17667,6 +17841,13 @@ User Options
17667Reserved words in VHDL 17841Reserved words in VHDL
17668---------------------- 17842----------------------
17669 17843
17844VHDL'08 (IEEE Std 1076-2008):
17845 `vhdl-08-keywords' : keywords
17846 `vhdl-08-types' : standardized types
17847 `vhdl-08-attributes' : standardized attributes
17848 `vhdl-08-functions' : standardized functions
17849 `vhdl-08-packages' : standardized packages and libraries
17850
17670VHDL'93/02 (IEEE Std 1076-1993/2002): 17851VHDL'93/02 (IEEE Std 1076-1993/2002):
17671 `vhdl-02-keywords' : keywords 17852 `vhdl-02-keywords' : keywords
17672 `vhdl-02-types' : standardized types 17853 `vhdl-02-types' : standardized types
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 55405b63fe0..fe72b3f778c 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -628,6 +628,29 @@ The argument has the same meaning as in `apropos'."
628;;;###autoload (define-key ctl-x-5-map "." #'xref-find-definitions-other-frame) 628;;;###autoload (define-key ctl-x-5-map "." #'xref-find-definitions-other-frame)
629 629
630 630
631;;; Helper functions
632
633(defvar xref-etags-mode--saved nil)
634
635(define-minor-mode xref-etags-mode
636 "Minor mode to make xref use etags again.
637
638Certain major modes install their own mechanisms for listing
639identifiers and navigation. Turn this on to undo those settings
640and just use etags."
641 :lighter ""
642 (if xref-etags-mode
643 (progn
644 (setq xref-etags-mode--saved
645 (cons xref-find-function
646 xref-identifier-completion-table-function))
647 (kill-local-variable 'xref-find-function)
648 (kill-local-variable 'xref-identifier-completion-table-function))
649 (setq-local xref-find-function (car xref-etags-mode--saved))
650 (setq-local xref-identifier-completion-table-function
651 (cdr xref-etags-mode--saved))))
652
653
631(provide 'xref) 654(provide 'xref)
632 655
633;;; xref.el ends here 656;;; xref.el ends here