aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2020-07-07 20:44:39 +0100
committerAndrea Corallo2020-07-07 20:44:39 +0100
commit3d43d45755b2c38d5378496ff6b0fc40538ee924 (patch)
treeee43ee3f19bc6ef5cb37c2462c6876584e01364b
parent2593bbee51f4d15d3a4fc1d4e2e3b215222f783a (diff)
parentdf3ece9d2ed61c9526dbf718e3c96d72bd53dccb (diff)
downloademacs-3d43d45755b2c38d5378496ff6b0fc40538ee924.tar.gz
emacs-3d43d45755b2c38d5378496ff6b0fc40538ee924.zip
Merge remote-tracking branch 'savannah/master' into HEAD
-rw-r--r--doc/lispref/display.texi12
-rw-r--r--doc/lispref/frames.texi13
-rw-r--r--doc/misc/tramp.texi9
-rw-r--r--lisp/emacs-lisp/byte-opt.el156
-rw-r--r--lisp/emacs-lisp/cl-macs.el26
-rw-r--r--lisp/man.el6
-rw-r--r--lisp/progmodes/cc-engine.el30
-rw-r--r--lisp/progmodes/cc-langs.el2
-rw-r--r--lisp/progmodes/gud.el6
-rw-r--r--lisp/progmodes/js.el4
-rw-r--r--lisp/progmodes/project.el31
-rw-r--r--lisp/progmodes/verilog-mode.el112
-rw-r--r--lisp/simple.el7
-rw-r--r--lisp/textmodes/mhtml-mode.el35
-rw-r--r--src/json.c2
-rw-r--r--src/keyboard.c2
-rw-r--r--src/xdisp.c27
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el20
-rw-r--r--test/src/json-tests.el12
19 files changed, 310 insertions, 202 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 6fff199485e..d7aab4ae62f 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -4274,9 +4274,10 @@ a display specification has the form
4274@noindent 4274@noindent
4275@var{fringe} is either the symbol @code{left-fringe} or 4275@var{fringe} is either the symbol @code{left-fringe} or
4276@code{right-fringe}. @var{bitmap} is a symbol identifying the bitmap 4276@code{right-fringe}. @var{bitmap} is a symbol identifying the bitmap
4277to display. The optional @var{face} names a face whose foreground 4277to display. The optional @var{face} names a face whose foreground and
4278color is used to display the bitmap; this face is automatically merged 4278background colors are to be used to display the bitmap; this face is
4279with the @code{fringe} face. 4279automatically merged with the @code{fringe} face. If @var{face} is
4280omitted, that means to use the @code{default} face.
4280 4281
4281 For instance, to display an arrow in the left fringe, using the 4282 For instance, to display an arrow in the left fringe, using the
4282@code{warning} face, you could say something like: 4283@code{warning} face, you could say something like:
@@ -4980,8 +4981,9 @@ Margins}).
4980This display specification on any character of a line of text causes 4981This display specification on any character of a line of text causes
4981the specified @var{bitmap} be displayed in the left or right fringes 4982the specified @var{bitmap} be displayed in the left or right fringes
4982for that line, instead of the characters that have the display 4983for that line, instead of the characters that have the display
4983specification. The optional @var{face} specifies the colors to be 4984specification. The optional @var{face} specifies the face whose
4984used for the bitmap. @xref{Fringe Bitmaps}, for the details. 4985colors are to be used for the bitmap display. @xref{Fringe Bitmaps},
4986for the details.
4985 4987
4986@item (space-width @var{factor}) 4988@item (space-width @var{factor})
4987This display specification affects all the space characters within the 4989This display specification affects all the space characters within the
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index a82b585d93d..22d32c00d9b 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1599,12 +1599,13 @@ parameters represent the user's stated preference; otherwise, use
1599This parameter specifies a relative position of the frame's 1599This parameter specifies a relative position of the frame's
1600window-system window in the stacking (Z-) order of the frame's display. 1600window-system window in the stacking (Z-) order of the frame's display.
1601 1601
1602If this is @code{above}, the frame's window-system window is displayed 1602If this is @code{above}, the window-system will display the window
1603above all other window-system windows that do not have the @code{above} 1603that corresponds to the frame above all other window-system windows
1604property set. If this is @code{nil}, the frame's window is displayed below all 1604that do not have the @code{above} property set. If this is
1605windows that have the @code{above} property set and above all windows 1605@code{nil}, the frame's window is displayed below all windows that
1606that have the @code{below} property set. If this is @code{below}, the 1606have the @code{above} property set and above all windows that have the
1607frame's window is displayed below all windows that do not have the 1607@code{below} property set. If this is @code{below}, the frame's
1608window is displayed below all windows that do not have the
1608@code{below} property set. 1609@code{below} property set.
1609 1610
1610To position the frame above or below a specific other frame use the 1611To position the frame above or below a specific other frame use the
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index feead3d0a76..c018033cdab 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -1709,10 +1709,11 @@ Integration for LXD containers. A container is accessed via
1709@item magit-tramp 1709@item magit-tramp
1710@cindex method @option{git} 1710@cindex method @option{git}
1711@cindex @option{git} method 1711@cindex @option{git} method
1712Browing git repositories with @code{magit}. A versioned file is accessed via 1712Browsing git repositories with @code{magit}. A versioned file is
1713@file{@trampfn{git,rev@@root-dir,/path/to/file}}. @samp{rev} is a git 1713accessed via @file{@trampfn{git,rev@@root-dir,/path/to/file}}.
1714revision, and @samp{root-dir} is a virtual host name for the root 1714@samp{rev} is a git revision, and @samp{root-dir} is a virtual host
1715directory, specified in @code{magit-tramp-hosts-alist}. 1715name for the root directory, specified in
1716@code{magit-tramp-hosts-alist}.
1716 1717
1717@item tramp-hdfs 1718@item tramp-hdfs
1718@cindex method @option{hdfs} 1719@cindex method @option{hdfs}
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 12bde8faf39..194ceee176f 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -557,7 +557,10 @@
557 (let ((args (mapcar #'byte-optimize-form (cdr form)))) 557 (let ((args (mapcar #'byte-optimize-form (cdr form))))
558 (if (and (get fn 'pure) 558 (if (and (get fn 'pure)
559 (byte-optimize-all-constp args)) 559 (byte-optimize-all-constp args))
560 (list 'quote (apply fn (mapcar #'eval args))) 560 (let ((arg-values (mapcar #'eval args)))
561 (condition-case nil
562 (list 'quote (apply fn arg-values))
563 (error (cons fn args))))
561 (cons fn args))))))) 564 (cons fn args)))))))
562 565
563(defun byte-optimize-all-constp (list) 566(defun byte-optimize-all-constp (list)
@@ -672,36 +675,18 @@
672 (apply (car form) constants)) 675 (apply (car form) constants))
673 form))) 676 form)))
674 677
675;; Portable Emacs integers fall in this range. 678;; Use OP to reduce any leading prefix of constant numbers in the list
676(defconst byte-opt--portable-max #x1fffffff) 679;; (cons ACCUM ARGS) down to a single number, and return the
677(defconst byte-opt--portable-min (- -1 byte-opt--portable-max))
678
679;; True if N is a number that works the same on all Emacs platforms.
680;; Portable Emacs fixnums are exactly representable as floats on all
681;; Emacs platforms, and (except for -0.0) any floating-point number
682;; that equals one of these integers must be the same on all
683;; platforms. Although other floating-point numbers such as 0.5 are
684;; also portable, it can be tricky to characterize them portably so
685;; they are not optimized.
686(defun byte-opt--portable-numberp (n)
687 (and (numberp n)
688 (<= byte-opt--portable-min n byte-opt--portable-max)
689 (= n (floor n))
690 (not (and (floatp n) (zerop n)
691 (condition-case () (< (/ n) 0) (error))))))
692
693;; Use OP to reduce any leading prefix of portable numbers in the list
694;; (cons ACCUM ARGS) down to a single portable number, and return the
695;; resulting list A of arguments. The idea is that applying OP to A 680;; resulting list A of arguments. The idea is that applying OP to A
696;; is equivalent to (but likely more efficient than) applying OP to 681;; is equivalent to (but likely more efficient than) applying OP to
697;; (cons ACCUM ARGS), on any Emacs platform. Do not make any special 682;; (cons ACCUM ARGS), on any Emacs platform. Do not make any special
698;; provision for (- X) or (/ X); for example, it is the caller’s 683;; provision for (- X) or (/ X); for example, it is the caller’s
699;; responsibility that (- 1 0) should not be "optimized" to (- 1). 684;; responsibility that (- 1 0) should not be "optimized" to (- 1).
700(defun byte-opt--arith-reduce (op accum args) 685(defun byte-opt--arith-reduce (op accum args)
701 (when (byte-opt--portable-numberp accum) 686 (when (numberp accum)
702 (let (accum1) 687 (let (accum1)
703 (while (and (byte-opt--portable-numberp (car args)) 688 (while (and (numberp (car args))
704 (byte-opt--portable-numberp 689 (numberp
705 (setq accum1 (condition-case () 690 (setq accum1 (condition-case ()
706 (funcall op accum (car args)) 691 (funcall op accum (car args))
707 (error)))) 692 (error))))
@@ -746,12 +731,11 @@
746 ;; (- x -1) --> (1+ x) 731 ;; (- x -1) --> (1+ x)
747 ((equal (cdr args) '(-1)) 732 ((equal (cdr args) '(-1))
748 (list '1+ (car args))) 733 (list '1+ (car args)))
749 ;; (- n) -> -n, where n and -n are portable numbers. 734 ;; (- n) -> -n, where n and -n are constant numbers.
750 ;; This must be done separately since byte-opt--arith-reduce 735 ;; This must be done separately since byte-opt--arith-reduce
751 ;; is not applied to (- n). 736 ;; is not applied to (- n).
752 ((and (null (cdr args)) 737 ((and (null (cdr args))
753 (byte-opt--portable-numberp (car args)) 738 (numberp (car args)))
754 (byte-opt--portable-numberp (- (car args))))
755 (- (car args))) 739 (- (car args)))
756 ;; not further optimized 740 ;; not further optimized
757 ((equal args (cdr form)) form) 741 ((equal args (cdr form)) form)
@@ -761,8 +745,7 @@
761 (let ((args (cdr form))) 745 (let ((args (cdr form)))
762 (when (null (cdr args)) 746 (when (null (cdr args))
763 (let ((n (car args))) 747 (let ((n (car args)))
764 (when (and (byte-opt--portable-numberp n) 748 (when (numberp n)
765 (byte-opt--portable-numberp (1+ n)))
766 (setq form (1+ n)))))) 749 (setq form (1+ n))))))
767 form) 750 form)
768 751
@@ -770,8 +753,7 @@
770 (let ((args (cdr form))) 753 (let ((args (cdr form)))
771 (when (null (cdr args)) 754 (when (null (cdr args))
772 (let ((n (car args))) 755 (let ((n (car args)))
773 (when (and (byte-opt--portable-numberp n) 756 (when (numberp n)
774 (byte-opt--portable-numberp (1- n)))
775 (setq form (1- n)))))) 757 (setq form (1- n))))))
776 form) 758 form)
777 759
@@ -813,7 +795,7 @@
813 (t ;; This can enable some lapcode optimizations. 795 (t ;; This can enable some lapcode optimizations.
814 (list (car form) (nth 2 form) (nth 1 form))))) 796 (list (car form) (nth 2 form) (nth 1 form)))))
815 797
816(defun byte-optimize-predicate (form) 798(defun byte-optimize-constant-args (form)
817 (let ((ok t) 799 (let ((ok t)
818 (rest (cdr form))) 800 (rest (cdr form)))
819 (while (and rest ok) 801 (while (and rest ok)
@@ -828,9 +810,6 @@
828(defun byte-optimize-identity (form) 810(defun byte-optimize-identity (form)
829 (if (and (cdr form) (null (cdr (cdr form)))) 811 (if (and (cdr form) (null (cdr (cdr form))))
830 (nth 1 form) 812 (nth 1 form)
831 (byte-compile-warn "identity called with %d arg%s, but requires 1"
832 (length (cdr form))
833 (if (= 1 (length (cdr form))) "" "s"))
834 form)) 813 form))
835 814
836(defun byte-optimize--constant-symbol-p (expr) 815(defun byte-optimize--constant-symbol-p (expr)
@@ -863,21 +842,27 @@
863 ;; Arity errors reported elsewhere. 842 ;; Arity errors reported elsewhere.
864 form)) 843 form))
865 844
845(defun byte-optimize-assoc (form)
846 ;; Replace 2-argument `assoc' with `assq', `rassoc' with `rassq',
847 ;; if the first arg is a symbol.
848 (if (and (= (length form) 3)
849 (byte-optimize--constant-symbol-p (nth 1 form)))
850 (cons (if (eq (car form) 'assoc) 'assq 'rassq)
851 (cdr form))
852 form))
853
866(defun byte-optimize-memq (form) 854(defun byte-optimize-memq (form)
867 ;; (memq foo '(bar)) => (and (eq foo 'bar) '(bar)) 855 ;; (memq foo '(bar)) => (and (eq foo 'bar) '(bar))
868 (if (/= (length (cdr form)) 2) 856 (if (= (length (cdr form)) 2)
869 (byte-compile-warn "memq called with %d arg%s, but requires 2" 857 (let ((list (nth 2 form)))
870 (length (cdr form)) 858 (if (and (eq (car-safe list) 'quote)
871 (if (= 1 (length (cdr form))) "" "s"))
872 (let ((list (nth 2 form)))
873 (when (and (eq (car-safe list) 'quote)
874 (listp (setq list (cadr list))) 859 (listp (setq list (cadr list)))
875 (= (length list) 1)) 860 (= (length list) 1))
876 (setq form (byte-optimize-and 861 `(and (eq ,(nth 1 form) ',(nth 0 list))
877 `(and ,(byte-optimize-predicate 862 ',list)
878 `(eq ,(nth 1 form) ',(nth 0 list))) 863 form))
879 ',list))))) 864 ;; Arity errors reported elsewhere.
880 (byte-optimize-predicate form))) 865 form))
881 866
882(defun byte-optimize-concat (form) 867(defun byte-optimize-concat (form)
883 "Merge adjacent constant arguments to `concat'." 868 "Merge adjacent constant arguments to `concat'."
@@ -910,6 +895,8 @@
910(put 'memq 'byte-optimizer 'byte-optimize-memq) 895(put 'memq 'byte-optimizer 'byte-optimize-memq)
911(put 'memql 'byte-optimizer 'byte-optimize-member) 896(put 'memql 'byte-optimizer 'byte-optimize-member)
912(put 'member 'byte-optimizer 'byte-optimize-member) 897(put 'member 'byte-optimizer 'byte-optimize-member)
898(put 'assoc 'byte-optimizer 'byte-optimize-assoc)
899(put 'rassoc 'byte-optimizer 'byte-optimize-assoc)
913 900
914(put '+ 'byte-optimizer 'byte-optimize-plus) 901(put '+ 'byte-optimizer 'byte-optimize-plus)
915(put '* 'byte-optimizer 'byte-optimize-multiply) 902(put '* 'byte-optimizer 'byte-optimize-multiply)
@@ -925,31 +912,8 @@
925(put 'string= 'byte-optimizer 'byte-optimize-binary-predicate) 912(put 'string= 'byte-optimizer 'byte-optimize-binary-predicate)
926(put 'string-equal 'byte-optimizer 'byte-optimize-binary-predicate) 913(put 'string-equal 'byte-optimizer 'byte-optimize-binary-predicate)
927 914
928(put '< 'byte-optimizer 'byte-optimize-predicate)
929(put '> 'byte-optimizer 'byte-optimize-predicate)
930(put '<= 'byte-optimizer 'byte-optimize-predicate)
931(put '>= 'byte-optimizer 'byte-optimize-predicate)
932(put '1+ 'byte-optimizer 'byte-optimize-1+) 915(put '1+ 'byte-optimizer 'byte-optimize-1+)
933(put '1- 'byte-optimizer 'byte-optimize-1-) 916(put '1- 'byte-optimizer 'byte-optimize-1-)
934(put 'not 'byte-optimizer 'byte-optimize-predicate)
935(put 'null 'byte-optimizer 'byte-optimize-predicate)
936(put 'consp 'byte-optimizer 'byte-optimize-predicate)
937(put 'listp 'byte-optimizer 'byte-optimize-predicate)
938(put 'symbolp 'byte-optimizer 'byte-optimize-predicate)
939(put 'stringp 'byte-optimizer 'byte-optimize-predicate)
940(put 'string< 'byte-optimizer 'byte-optimize-predicate)
941(put 'string-lessp 'byte-optimizer 'byte-optimize-predicate)
942(put 'proper-list-p 'byte-optimizer 'byte-optimize-predicate)
943
944(put 'logand 'byte-optimizer 'byte-optimize-predicate)
945(put 'logior 'byte-optimizer 'byte-optimize-predicate)
946(put 'logxor 'byte-optimizer 'byte-optimize-predicate)
947(put 'lognot 'byte-optimizer 'byte-optimize-predicate)
948
949(put 'car 'byte-optimizer 'byte-optimize-predicate)
950(put 'cdr 'byte-optimizer 'byte-optimize-predicate)
951(put 'car-safe 'byte-optimizer 'byte-optimize-predicate)
952(put 'cdr-safe 'byte-optimizer 'byte-optimize-predicate)
953 917
954(put 'concat 'byte-optimizer 'byte-optimize-concat) 918(put 'concat 'byte-optimizer 'byte-optimize-concat)
955 919
@@ -980,7 +944,7 @@
980 nil)) 944 nil))
981 ((null (cdr (cdr form))) 945 ((null (cdr (cdr form)))
982 (nth 1 form)) 946 (nth 1 form))
983 ((byte-optimize-predicate form)))) 947 ((byte-optimize-constant-args form))))
984 948
985(defun byte-optimize-or (form) 949(defun byte-optimize-or (form)
986 ;; Throw away nil's, and simplify if less than 2 args. 950 ;; Throw away nil's, and simplify if less than 2 args.
@@ -993,7 +957,7 @@
993 (setq form (copy-sequence form) 957 (setq form (copy-sequence form)
994 rest (setcdr (memq (car rest) form) nil)))) 958 rest (setcdr (memq (car rest) form) nil))))
995 (if (cdr (cdr form)) 959 (if (cdr (cdr form))
996 (byte-optimize-predicate form) 960 (byte-optimize-constant-args form)
997 (nth 1 form)))) 961 (nth 1 form))))
998 962
999(defun byte-optimize-cond (form) 963(defun byte-optimize-cond (form)
@@ -1140,7 +1104,7 @@
1140 (list 'car (if (zerop (nth 1 form)) 1104 (list 'car (if (zerop (nth 1 form))
1141 (nth 2 form) 1105 (nth 2 form)
1142 (list 'cdr (nth 2 form)))) 1106 (list 'cdr (nth 2 form))))
1143 (byte-optimize-predicate form)) 1107 form)
1144 form)) 1108 form))
1145 1109
1146(put 'nthcdr 'byte-optimizer 'byte-optimize-nthcdr) 1110(put 'nthcdr 'byte-optimizer 'byte-optimize-nthcdr)
@@ -1152,7 +1116,7 @@
1152 (while (>= (setq count (1- count)) 0) 1116 (while (>= (setq count (1- count)) 0)
1153 (setq form (list 'cdr form))) 1117 (setq form (list 'cdr form)))
1154 form) 1118 form)
1155 (byte-optimize-predicate form)) 1119 form)
1156 form)) 1120 form))
1157 1121
1158;; Fixme: delete-char -> delete-region (byte-coded) 1122;; Fixme: delete-char -> delete-region (byte-coded)
@@ -1295,9 +1259,9 @@
1295;; Pure functions are side-effect free functions whose values depend 1259;; Pure functions are side-effect free functions whose values depend
1296;; only on their arguments, not on the platform. For these functions, 1260;; only on their arguments, not on the platform. For these functions,
1297;; calls with constant arguments can be evaluated at compile time. 1261;; calls with constant arguments can be evaluated at compile time.
1298;; This may shift runtime errors to compile time. For example, logand 1262;; For example, ash is pure since its results are machine-independent,
1299;; is pure since its results are machine-independent, whereas ash is 1263;; whereas lsh is not pure because (lsh -1 -1)'s value depends on the
1300;; not pure because (ash 1 29)'s value depends on machine word size. 1264;; fixnum range.
1301;; 1265;;
1302;; When deciding whether a function is pure, do not worry about 1266;; When deciding whether a function is pure, do not worry about
1303;; mutable strings or markers, as they are so unlikely in real code 1267;; mutable strings or markers, as they are so unlikely in real code
@@ -1307,9 +1271,41 @@
1307;; values if a marker is moved. 1271;; values if a marker is moved.
1308 1272
1309(let ((pure-fns 1273(let ((pure-fns
1310 '(% concat logand logcount logior lognot logxor 1274 '(concat regexp-opt regexp-quote
1311 regexp-opt regexp-quote 1275 string-to-char string-to-syntax symbol-name
1312 string-to-char string-to-syntax symbol-name))) 1276 eq eql
1277 = /= < <= => > min max
1278 + - * / % mod abs ash 1+ 1- sqrt
1279 logand logior lognot logxor logcount
1280 copysign isnan ldexp float logb
1281 floor ceiling round truncate
1282 ffloor fceiling fround ftruncate
1283 string= string-equal string< string-lessp
1284 consp atom listp nlistp propert-list-p
1285 sequencep arrayp vectorp stringp bool-vector-p hash-table-p
1286 null not
1287 numberp integerp floatp natnump characterp
1288 integer-or-marker-p number-or-marker-p char-or-string-p
1289 symbolp keywordp
1290 type-of
1291 identity ignore
1292
1293 ;; The following functions are pure up to mutation of their
1294 ;; arguments. This is pure enough for the purposes of
1295 ;; constant folding, but not necessarily for all kinds of
1296 ;; code motion.
1297 car cdr car-safe cdr-safe nth nthcdr last
1298 equal
1299 length safe-length
1300 memq memql member
1301 ;; `assoc' and `assoc-default' are excluded since they are
1302 ;; impure if the test function is (consider `string-match').
1303 assq rassq rassoc
1304 plist-get lax-plist-get plist-member
1305 aref elt
1306 bool-vector-subsetp
1307 bool-vector-count-population bool-vector-count-consecutive
1308 )))
1313 (while pure-fns 1309 (while pure-fns
1314 (put (car pure-fns) 'pure t) 1310 (put (car pure-fns) 'pure t)
1315 (setq pure-fns (cdr pure-fns))) 1311 (setq pure-fns (cdr pure-fns)))
@@ -2194,7 +2190,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
2194 (or noninteractive (message "compiling %s...done" x))) 2190 (or noninteractive (message "compiling %s...done" x)))
2195 '(byte-optimize-form 2191 '(byte-optimize-form
2196 byte-optimize-body 2192 byte-optimize-body
2197 byte-optimize-predicate 2193 byte-optimize-constant-args
2198 byte-optimize-binary-predicate 2194 byte-optimize-binary-predicate
2199 ;; Inserted some more than necessary, to speed it up. 2195 ;; Inserted some more than necessary, to speed it up.
2200 byte-optimize-form-code-walker 2196 byte-optimize-form-code-walker
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index a3e72c4b00d..6c1426ce5cb 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3138,23 +3138,29 @@ Of course, we really can't know that for sure, so it's just a heuristic."
3138 (cdr (assq sym byte-compile-macro-environment)))))) 3138 (cdr (assq sym byte-compile-macro-environment))))))
3139 3139
3140(pcase-dolist (`(,type . ,pred) 3140(pcase-dolist (`(,type . ,pred)
3141 '((null . null) 3141 ;; Mostly kept in alphabetical order.
3142 '((array . arrayp)
3142 (atom . atom) 3143 (atom . atom)
3143 (real . numberp)
3144 (fixnum . integerp)
3145 (base-char . characterp) 3144 (base-char . characterp)
3145 (boolean . booleanp)
3146 (bool-vector . bool-vector-p)
3147 (buffer . bufferp)
3146 (character . natnump) 3148 (character . natnump)
3147 ;; "Obvious" mappings. 3149 (char-table . char-table-p)
3148 (string . stringp)
3149 (list . listp)
3150 (cons . consp) 3150 (cons . consp)
3151 (symbol . symbolp) 3151 (fixnum . integerp)
3152 (float . floatp)
3152 (function . functionp) 3153 (function . functionp)
3153 (integer . integerp) 3154 (integer . integerp)
3154 (float . floatp) 3155 (keyword . keywordp)
3155 (boolean . booleanp) 3156 (list . listp)
3157 (number . numberp)
3158 (null . null)
3159 (real . numberp)
3160 (sequence . sequencep)
3161 (string . stringp)
3162 (symbol . symbolp)
3156 (vector . vectorp) 3163 (vector . vectorp)
3157 (array . arrayp)
3158 ;; FIXME: Do we really want to consider this a type? 3164 ;; FIXME: Do we really want to consider this a type?
3159 (integer-or-marker . integer-or-marker-p) 3165 (integer-or-marker . integer-or-marker-p)
3160 )) 3166 ))
diff --git a/lisp/man.el b/lisp/man.el
index 5278a1a84dd..8a36f3ac25d 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -996,7 +996,11 @@ An \"apropos\" query with -k gives a buffer of matching page
996names or descriptions. The pattern argument is usually an 996names or descriptions. The pattern argument is usually an
997\"grep -E\" style regexp. 997\"grep -E\" style regexp.
998 998
999 -k pattern" 999 -k pattern
1000
1001Note that in some cases you will need to use \\[quoted-insert] to quote the
1002SPC character in the above examples, because this command attempts
1003to auto-complete your input based on the installed manual pages."
1000 1004
1001 (interactive 1005 (interactive
1002 (list (let* ((default-entry (Man-default-man-entry)) 1006 (list (let* ((default-entry (Man-default-man-entry))
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 1977eadb5c6..784a6c7d679 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1582,6 +1582,7 @@ comment at the start of cc-engine.el for more info."
1582 (save-excursion (backward-char) 1582 (save-excursion (backward-char)
1583 (looking-at "\\s(")) 1583 (looking-at "\\s("))
1584 (c-crosses-statement-barrier-p (point) end))))) 1584 (c-crosses-statement-barrier-p (point) end)))))
1585(make-obsolete 'c-at-expression-start-p nil "5.35")
1585 1586
1586 1587
1587;; A set of functions that covers various idiosyncrasies in 1588;; A set of functions that covers various idiosyncrasies in
@@ -3186,6 +3187,24 @@ comment at the start of cc-engine.el for more info."
3186 c-semi-near-cache-limit (min c-semi-near-cache-limit pos) 3187 c-semi-near-cache-limit (min c-semi-near-cache-limit pos)
3187 c-full-near-cache-limit (min c-full-near-cache-limit pos))) 3188 c-full-near-cache-limit (min c-full-near-cache-limit pos)))
3188 3189
3190(defun c-foreign-truncate-lit-pos-cache (beg _end)
3191 "Truncate CC Mode's literal cache.
3192
3193This function should be added to the `before-change-functions'
3194hook by major modes that use CC Mode's filling functionality
3195without initializing CC Mode. Currently (2020-06) these are
3196js-mode and mhtml-mode."
3197 (c-truncate-lit-pos-cache beg))
3198
3199(defun c-foreign-init-lit-pos-cache ()
3200 "Initialize CC Mode's literal cache.
3201
3202This function should be called from the mode functions of major
3203modes which use CC Mode's filling functionality without
3204initializing CC Mode. Currently (2020-06) these are js-mode and
3205mhtml-mode."
3206 (c-truncate-lit-pos-cache 1))
3207
3189 3208
3190;; A system for finding noteworthy parens before the point. 3209;; A system for finding noteworthy parens before the point.
3191 3210
@@ -11877,17 +11896,6 @@ comment at the start of cc-engine.el for more info."
11877 (cons (list beg) type))))) 11896 (cons (list beg) type)))))
11878 (error nil)))) 11897 (error nil))))
11879 11898
11880(defun c-looking-at-bos (&optional _lim)
11881 ;; Return non-nil if between two statements or declarations, assuming
11882 ;; point is not inside a literal or comment.
11883 ;;
11884 ;; Obsolete - `c-at-statement-start-p' or `c-at-expression-start-p'
11885 ;; are recommended instead.
11886 ;;
11887 ;; This function might do hidden buffer changes.
11888 (c-at-statement-start-p))
11889(make-obsolete 'c-looking-at-bos 'c-at-statement-start-p "22.1")
11890
11891(defun c-looking-at-statement-block () 11899(defun c-looking-at-statement-block ()
11892 ;; Point is at an opening brace. If this is a statement block (i.e. the 11900 ;; Point is at an opening brace. If this is a statement block (i.e. the
11893 ;; elements in the block are terminated by semicolons, or the block is 11901 ;; elements in the block are terminated by semicolons, or the block is
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 00babf95332..13e3ecc684d 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1770,7 +1770,7 @@ ender."
1770`comment-start-skip' is initialized from this." 1770`comment-start-skip' is initialized from this."
1771 ;; Default: Allow the last char of the comment starter(s) to be 1771 ;; Default: Allow the last char of the comment starter(s) to be
1772 ;; repeated, then allow any amount of horizontal whitespace. 1772 ;; repeated, then allow any amount of horizontal whitespace.
1773 t (concat "\\(" 1773 t (concat "\\(?:"
1774 (c-concat-separated 1774 (c-concat-separated
1775 (mapcar (lambda (cs) 1775 (mapcar (lambda (cs)
1776 (when cs 1776 (when cs
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index eb43e8b7e44..092d15983e5 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -2620,9 +2620,9 @@ comint mode, which see."
2620 (select-window 2620 (select-window
2621 (display-buffer 2621 (display-buffer
2622 (get-buffer-create (concat "*gud" filepart "*")) 2622 (get-buffer-create (concat "*gud" filepart "*"))
2623 '(display-buffer-reuse-window 2623 '((display-buffer-reuse-window
2624 display-buffer-in-previous-window 2624 display-buffer-in-previous-window
2625 display-buffer-same-window display-buffer-pop-up-window))) 2625 display-buffer-same-window display-buffer-pop-up-window))))
2626 (when (and existing-buffer (get-buffer-process existing-buffer)) 2626 (when (and existing-buffer (get-buffer-process existing-buffer))
2627 (error "This program is already being debugged")) 2627 (error "This program is already being debugged"))
2628 ;; Set the dir, in case the buffer already existed with a different dir. 2628 ;; Set the dir, in case the buffer already existed with a different dir.
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 04b449ecd2c..5c50e2accdf 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -4570,7 +4570,7 @@ This function is intended for use in `after-change-functions'."
4570 4570
4571 ;; Comments 4571 ;; Comments
4572 (setq-local comment-start "// ") 4572 (setq-local comment-start "// ")
4573 (setq-local comment-start-skip "\\(//+\\|/\\*+\\)\\s *") 4573 (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
4574 (setq-local comment-end "") 4574 (setq-local comment-end "")
4575 (setq-local fill-paragraph-function #'js-fill-paragraph) 4575 (setq-local fill-paragraph-function #'js-fill-paragraph)
4576 (setq-local normal-auto-fill-function #'js-do-auto-fill) 4576 (setq-local normal-auto-fill-function #'js-do-auto-fill)
@@ -4591,6 +4591,8 @@ This function is intended for use in `after-change-functions'."
4591 (setq imenu-create-index-function #'js--imenu-create-index) 4591 (setq imenu-create-index-function #'js--imenu-create-index)
4592 4592
4593 ;; for filling, pretend we're cc-mode 4593 ;; for filling, pretend we're cc-mode
4594 (c-foreign-init-lit-pos-cache)
4595 (add-hook 'before-change-functions #'c-foreign-truncate-lit-pos-cache nil t)
4594 (setq-local comment-line-break-function #'c-indent-new-comment-line) 4596 (setq-local comment-line-break-function #'c-indent-new-comment-line)
4595 (setq-local comment-multi-line t) 4597 (setq-local comment-multi-line t)
4596 (setq-local electric-indent-chars 4598 (setq-local electric-indent-chars
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 0a15939d243..08798d86f8e 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1,7 +1,7 @@
1;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- 1;;; project.el --- Operations on the current project -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2015-2020 Free Software Foundation, Inc. 3;; Copyright (C) 2015-2020 Free Software Foundation, Inc.
4;; Version: 0.4.0 4;; Version: 0.5.0
5;; Package-Requires: ((emacs "26.3")) 5;; Package-Requires: ((emacs "26.3"))
6 6
7;; This is a GNU ELPA :core package. Avoid using functionality that 7;; This is a GNU ELPA :core package. Avoid using functionality that
@@ -294,11 +294,14 @@ The directory names should be absolute. Used in the VC project
294backend implementation of `project-external-roots'.") 294backend implementation of `project-external-roots'.")
295 295
296(defun project-try-vc (dir) 296(defun project-try-vc (dir)
297 (let* ((backend (ignore-errors (vc-responsible-backend dir))) 297 (let* ((backend
298 ;; FIXME: This is slow. Cache it.
299 (ignore-errors (vc-responsible-backend dir)))
298 (root 300 (root
299 (pcase backend 301 (pcase backend
300 ('Git 302 ('Git
301 ;; Don't stop at submodule boundary. 303 ;; Don't stop at submodule boundary.
304 ;; FIXME: Cache for a shorter time.
302 (or (vc-file-getprop dir 'project-git-root) 305 (or (vc-file-getprop dir 'project-git-root)
303 (let ((root (vc-call-backend backend 'root dir))) 306 (let ((root (vc-call-backend backend 'root dir)))
304 (vc-file-setprop 307 (vc-file-setprop
@@ -800,10 +803,10 @@ Arguments the same as in `compile'."
800;;;###autoload 803;;;###autoload
801(defun project-switch-to-buffer () 804(defun project-switch-to-buffer ()
802 "Switch to another buffer that is related to the current project. 805 "Switch to another buffer that is related to the current project.
803A buffer is related to a project if its `default-directory' 806A buffer is related to a project if `project-current' returns the
804is inside the directory hierarchy of the project's root." 807same (equal) value when called in that buffer."
805 (interactive) 808 (interactive)
806 (let* ((root (project-root (project-current t))) 809 (let* ((pr (project-current t))
807 (current-buffer (current-buffer)) 810 (current-buffer (current-buffer))
808 (other-buffer (other-buffer current-buffer)) 811 (other-buffer (other-buffer current-buffer))
809 (other-name (buffer-name other-buffer)) 812 (other-name (buffer-name other-buffer))
@@ -811,10 +814,9 @@ is inside the directory hierarchy of the project's root."
811 (lambda (buffer) 814 (lambda (buffer)
812 ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist. 815 ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
813 (and (cdr buffer) 816 (and (cdr buffer)
814 (not (eq (cdr buffer) current-buffer)) 817 (equal pr
815 (when-let ((file (buffer-local-value 'default-directory 818 (with-current-buffer (cdr buffer)
816 (cdr buffer)))) 819 (project-current)))))))
817 (file-in-directory-p file root))))))
818 (switch-to-buffer 820 (switch-to-buffer
819 (read-buffer 821 (read-buffer
820 "Switch to buffer: " 822 "Switch to buffer: "
@@ -836,13 +838,12 @@ any of the conditions will not be killed."
836 838
837(defun project--buffer-list (pr) 839(defun project--buffer-list (pr)
838 "Return the list of all buffers in project PR." 840 "Return the list of all buffers in project PR."
839 (let ((root (project-root pr)) 841 (let (bufs)
840 bufs)
841 (dolist (buf (buffer-list)) 842 (dolist (buf (buffer-list))
842 (let ((filename (or (buffer-file-name buf) 843 (when (equal pr
843 (buffer-local-value 'default-directory buf)))) 844 (with-current-buffer buf
844 (when (and filename (file-in-directory-p filename root)) 845 (project-current)))
845 (push buf bufs)))) 846 (push buf bufs)))
846 (nreverse bufs))) 847 (nreverse bufs)))
847 848
848;;;###autoload 849;;;###autoload
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 6400e1e6cd9..5a469bb9677 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -9,7 +9,7 @@
9;; Keywords: languages 9;; Keywords: languages
10;; The "Version" is the date followed by the decimal rendition of the Git 10;; The "Version" is the date followed by the decimal rendition of the Git
11;; commit hex. 11;; commit hex.
12;; Version: 2020.02.23.232634261 12;; Version: 2020.06.27.014326051
13 13
14;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this 14;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
15;; file on 19/3/2008, and the maintainer agreed that when a bug is 15;; file on 19/3/2008, and the maintainer agreed that when a bug is
@@ -124,7 +124,7 @@
124;; 124;;
125 125
126;; This variable will always hold the version number of the mode 126;; This variable will always hold the version number of the mode
127(defconst verilog-mode-version "2020-02-23-dddb795-vpo-GNU" 127(defconst verilog-mode-version "2020-06-27-0da9923-vpo-GNU"
128 "Version of this Verilog mode.") 128 "Version of this Verilog mode.")
129(defconst verilog-mode-release-emacs t 129(defconst verilog-mode-release-emacs t
130 "If non-nil, this version of Verilog mode was released with Emacs itself.") 130 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -1430,7 +1430,7 @@ See also `verilog-case-fold'."
1430 :type 'hook) 1430 :type 'hook)
1431 1431
1432(defvar verilog-imenu-generic-expression 1432(defvar verilog-imenu-generic-expression
1433 '((nil "^\\s-*\\(?:m\\(?:odule\\|acromodule\\)\\|p\\(?:rimitive\\|rogram\\|ackage\\)\\)\\s-+\\([a-zA-Z0-9_.:]+\\)" 1) 1433 '((nil "^\\s-*\\(?:connectmodule\\|m\\(?:odule\\|acromodule\\)\\|p\\(?:rimitive\\|rogram\\|ackage\\)\\)\\s-+\\([a-zA-Z0-9_.:]+\\)" 1)
1434 ("*Variables*" "^\\s-*\\(reg\\|wire\\|logic\\)\\s-+\\(\\|\\[[^]]+\\]\\s-+\\)\\([A-Za-z0-9_]+\\)" 3) 1434 ("*Variables*" "^\\s-*\\(reg\\|wire\\|logic\\)\\s-+\\(\\|\\[[^]]+\\]\\s-+\\)\\([A-Za-z0-9_]+\\)" 3)
1435 ("*Classes*" "^\\s-*\\(?:\\(?:virtual\\|interface\\)\\s-+\\)?class\\s-+\\([A-Za-z_][A-Za-z0-9_]+\\)" 1) 1435 ("*Classes*" "^\\s-*\\(?:\\(?:virtual\\|interface\\)\\s-+\\)?class\\s-+\\([A-Za-z_][A-Za-z0-9_]+\\)" 1)
1436 ("*Tasks*" "^\\s-*\\(?:\\(?:static\\|pure\\|virtual\\|local\\|protected\\)\\s-+\\)*task\\s-+\\(?:\\(?:static\\|automatic\\)\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_:]+\\)" 1) 1436 ("*Tasks*" "^\\s-*\\(?:\\(?:static\\|pure\\|virtual\\|local\\|protected\\)\\s-+\\)*task\\s-+\\(?:\\(?:static\\|automatic\\)\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_:]+\\)" 1)
@@ -2515,11 +2515,13 @@ find the errors."
2515 (eval-when-compile 2515 (eval-when-compile
2516 (verilog-regexp-words 2516 (verilog-regexp-words
2517 '( "begin" 2517 '( "begin"
2518 "connectmodule"
2518 "else" 2519 "else"
2519 "end" 2520 "end"
2520 "endcase" 2521 "endcase"
2521 "endclass" 2522 "endclass"
2522 "endclocking" 2523 "endclocking"
2524 "endconnectmodule"
2523 "endgroup" 2525 "endgroup"
2524 "endfunction" 2526 "endfunction"
2525 "endmodule" 2527 "endmodule"
@@ -2562,6 +2564,7 @@ find the errors."
2562 "\\(sequence\\)\\|" ; 14 2564 "\\(sequence\\)\\|" ; 14
2563 "\\(clocking\\)\\|" ; 15 2565 "\\(clocking\\)\\|" ; 15
2564 "\\(property\\)\\|" ; 16 2566 "\\(property\\)\\|" ; 16
2567 "\\(connectmodule\\)\\|" ; 17
2565 "\\)\\>\\)")) 2568 "\\)\\>\\)"))
2566(defconst verilog-end-block-re 2569(defconst verilog-end-block-re
2567 (eval-when-compile 2570 (eval-when-compile
@@ -2722,6 +2725,7 @@ find the errors."
2722 "endclass" 2725 "endclass"
2723 "endclocking" 2726 "endclocking"
2724 "endconfig" 2727 "endconfig"
2728 "endconnectmodule"
2725 "endfunction" 2729 "endfunction"
2726 "endgenerate" 2730 "endgenerate"
2727 "endgroup" 2731 "endgroup"
@@ -2740,7 +2744,7 @@ find the errors."
2740(defconst verilog-declaration-opener 2744(defconst verilog-declaration-opener
2741 (eval-when-compile 2745 (eval-when-compile
2742 (verilog-regexp-words 2746 (verilog-regexp-words
2743 '("module" "begin" "task" "function")))) 2747 '("connectmodule" "module" "begin" "task" "function"))))
2744 2748
2745(defconst verilog-declaration-prefix-re 2749(defconst verilog-declaration-prefix-re
2746 (eval-when-compile 2750 (eval-when-compile
@@ -2802,9 +2806,9 @@ find the errors."
2802(defconst verilog-declaration-re-1-no-macro (concat "^" verilog-declaration-re-2-no-macro)) 2806(defconst verilog-declaration-re-1-no-macro (concat "^" verilog-declaration-re-2-no-macro))
2803 2807
2804(defconst verilog-defun-re 2808(defconst verilog-defun-re
2805 (eval-when-compile (verilog-regexp-words '("macromodule" "module" "class" "program" "interface" "package" "primitive" "config")))) 2809 (eval-when-compile (verilog-regexp-words '("macromodule" "connectmodule" "module" "class" "program" "interface" "package" "primitive" "config"))))
2806(defconst verilog-end-defun-re 2810(defconst verilog-end-defun-re
2807 (eval-when-compile (verilog-regexp-words '("endmodule" "endclass" "endprogram" "endinterface" "endpackage" "endprimitive" "endconfig")))) 2811 (eval-when-compile (verilog-regexp-words '("endconnectmodule" "endmodule" "endclass" "endprogram" "endinterface" "endpackage" "endprimitive" "endconfig"))))
2808(defconst verilog-zero-indent-re 2812(defconst verilog-zero-indent-re
2809 (concat verilog-defun-re "\\|" verilog-end-defun-re)) 2813 (concat verilog-defun-re "\\|" verilog-end-defun-re))
2810(defconst verilog-inst-comment-re 2814(defconst verilog-inst-comment-re
@@ -2836,7 +2840,7 @@ find the errors."
2836 "generate" "endgenerate" 2840 "generate" "endgenerate"
2837 "initial" 2841 "initial"
2838 "interface" "endinterface" 2842 "interface" "endinterface"
2839 "module" "macromodule" "endmodule" 2843 "connectmodule" "module" "macromodule" "endconnectmodule" "endmodule"
2840 "package" "endpackage" 2844 "package" "endpackage"
2841 "primitive" "endprimitive" 2845 "primitive" "endprimitive"
2842 "program" "endprogram" 2846 "program" "endprogram"
@@ -2904,14 +2908,14 @@ find the errors."
2904(defconst verilog-defun-level-not-generate-re 2908(defconst verilog-defun-level-not-generate-re
2905 (eval-when-compile 2909 (eval-when-compile
2906 (verilog-regexp-words 2910 (verilog-regexp-words
2907 '( "module" "macromodule" "primitive" "class" "program" 2911 '( "connectmodule" "module" "macromodule" "primitive" "class" "program"
2908 "interface" "package" "config")))) 2912 "interface" "package" "config"))))
2909 2913
2910(defconst verilog-defun-level-re 2914(defconst verilog-defun-level-re
2911 (eval-when-compile 2915 (eval-when-compile
2912 (verilog-regexp-words 2916 (verilog-regexp-words
2913 (append 2917 (append
2914 '( "module" "macromodule" "primitive" "class" "program" 2918 '( "connectmodule" "module" "macromodule" "primitive" "class" "program"
2915 "interface" "package" "config") 2919 "interface" "package" "config")
2916 '( "initial" "final" "always" "always_comb" "always_ff" 2920 '( "initial" "final" "always" "always_comb" "always_ff"
2917 "always_latch" "endtask" "endfunction" ))))) 2921 "always_latch" "endtask" "endfunction" )))))
@@ -2926,7 +2930,7 @@ find the errors."
2926 (eval-when-compile 2930 (eval-when-compile
2927 (verilog-regexp-words 2931 (verilog-regexp-words
2928 '( 2932 '(
2929 "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass" 2933 "endconnectmodule" "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass"
2930 )))) 2934 ))))
2931 2935
2932(defconst verilog-dpi-import-export-re 2936(defconst verilog-dpi-import-export-re
@@ -2947,7 +2951,7 @@ find the errors."
2947 (eval-when-compile 2951 (eval-when-compile
2948 (verilog-regexp-words 2952 (verilog-regexp-words
2949 '( 2953 '(
2950 "always" "assign" "always_latch" "always_ff" "always_comb" "constraint" 2954 "always" "assign" "always_latch" "always_ff" "always_comb" "connectmodule" "constraint"
2951 "import" "initial" "final" "module" "macromodule" "repeat" "randcase" "while" 2955 "import" "initial" "final" "module" "macromodule" "repeat" "randcase" "while"
2952 "if" "for" "forever" "foreach" "else" "parameter" "do" "localparam" "assert" 2956 "if" "for" "forever" "foreach" "else" "parameter" "do" "localparam" "assert"
2953 )))) 2957 ))))
@@ -3065,6 +3069,8 @@ find the errors."
3065 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak" 3069 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
3066 ;; 1800-2012 3070 ;; 1800-2012
3067 "implements" "interconnect" "nettype" "soft" 3071 "implements" "interconnect" "nettype" "soft"
3072 ;; AMS
3073 "connectmodule" "endconnectmodule"
3068 )) 3074 ))
3069 "List of Verilog keywords.") 3075 "List of Verilog keywords.")
3070 3076
@@ -3211,7 +3217,7 @@ See also `verilog-font-lock-extra-types'.")
3211 "atan2" "atanh" "branch" "ceil" "connect" "connectmodule" 3217 "atan2" "atanh" "branch" "ceil" "connect" "connectmodule"
3212 "connectrules" "continuous" "cos" "cosh" "ddt" "ddt_nature" 3218 "connectrules" "continuous" "cos" "cosh" "ddt" "ddt_nature"
3213 "ddx" "discipline" "discrete" "domain" "driver_update" 3219 "ddx" "discipline" "discrete" "domain" "driver_update"
3214 "endconnectrules" "enddiscipline" "endnature" "endparamset" 3220 "endconnectmodule" "endconnectrules" "enddiscipline" "endnature" "endparamset"
3215 "exclude" "exp" "final_step" "flicker_noise" "floor" "flow" 3221 "exclude" "exp" "final_step" "flicker_noise" "floor" "flow"
3216 "from" "ground" "hypot" "idt" "idt_nature" "idtmod" "inf" 3222 "from" "ground" "hypot" "idt" "idt_nature" "idtmod" "inf"
3217 "initial_step" "laplace_nd" "laplace_np" "laplace_zd" 3223 "initial_step" "laplace_nd" "laplace_np" "laplace_zd"
@@ -3290,9 +3296,9 @@ See also `verilog-font-lock-extra-types'.")
3290 (list 3296 (list
3291 ;; Fontify module definitions 3297 ;; Fontify module definitions
3292 (list 3298 (list
3293 "\\<\\(\\(macro\\)?module\\|primitive\\|class\\|program\\|interface\\|package\\|task\\)\\>\\s-*\\(\\sw+\\)" 3299 "\\<\\(\\(macro\\|connect\\)?module\\|primitive\\|class\\|program\\|interface\\|package\\|task\\)\\>\\s-*\\(\\sw+\\)"
3294 '(1 font-lock-keyword-face) 3300 '(1 font-lock-keyword-face)
3295 '(3 font-lock-function-name-face 'prepend)) 3301 '(3 font-lock-function-name-face prepend))
3296 ;; Fontify function definitions 3302 ;; Fontify function definitions
3297 (list 3303 (list
3298 (concat "\\<function\\>\\s-+\\(integer\\|real\\(time\\)?\\|time\\)\\s-+\\(\\sw+\\)" ) 3304 (concat "\\<function\\>\\s-+\\(integer\\|real\\(time\\)?\\|time\\)\\s-+\\(\\sw+\\)" )
@@ -3302,7 +3308,16 @@ See also `verilog-font-lock-extra-types'.")
3302 (1 font-lock-keyword-face) 3308 (1 font-lock-keyword-face)
3303 (2 font-lock-constant-face append)) 3309 (2 font-lock-constant-face append))
3304 '("\\<function\\>\\s-+\\(\\sw+\\)" 3310 '("\\<function\\>\\s-+\\(\\sw+\\)"
3305 1 'font-lock-constant-face append)))) 3311 1 'font-lock-constant-face append)
3312 ;; Fontify variable names in declarations
3313 (list ;; Implemented as an anchored-matcher
3314 (concat verilog-declaration-re
3315 " *\\(" verilog-range-re "\\)?")
3316 (list ;; anchored-highlighter
3317 (concat "\\_<\\(" verilog-symbol-re "\\)"
3318 " *\\(" verilog-range-re "\\)?*")
3319 nil nil '(1 font-lock-variable-name-face))))))
3320
3306 3321
3307 (setq verilog-font-lock-keywords-2 3322 (setq verilog-font-lock-keywords-2
3308 (append verilog-font-lock-keywords-1 3323 (append verilog-font-lock-keywords-1
@@ -3608,7 +3623,7 @@ Use filename, if current buffer being edited shorten to just buffer name."
3608 (setq found 't)))))) 3623 (setq found 't))))))
3609 ((looking-at verilog-end-block-re) 3624 ((looking-at verilog-end-block-re)
3610 (verilog-leap-to-head)) 3625 (verilog-leap-to-head))
3611 ((looking-at "\\(endmodule\\>\\)\\|\\(\\<endprimitive\\>\\)\\|\\(\\<endclass\\>\\)\\|\\(\\<endprogram\\>\\)\\|\\(\\<endinterface\\>\\)\\|\\(\\<endpackage\\>\\)") 3626 ((looking-at "\\(endmodule\\>\\)\\|\\(\\<endprimitive\\>\\)\\|\\(\\<endclass\\>\\)\\|\\(\\<endprogram\\>\\)\\|\\(\\<endinterface\\>\\)\\|\\(\\<endpackage\\>\\)\\|\\(\\<endconnectmodule\\>\\)")
3612 (cond 3627 (cond
3613 ((match-end 1) 3628 ((match-end 1)
3614 (verilog-re-search-backward "\\<\\(macro\\)?module\\>" nil 'move)) 3629 (verilog-re-search-backward "\\<\\(macro\\)?module\\>" nil 'move))
@@ -3622,6 +3637,8 @@ Use filename, if current buffer being edited shorten to just buffer name."
3622 (verilog-re-search-backward "\\<interface\\>" nil 'move)) 3637 (verilog-re-search-backward "\\<interface\\>" nil 'move))
3623 ((match-end 6) 3638 ((match-end 6)
3624 (verilog-re-search-backward "\\<package\\>" nil 'move)) 3639 (verilog-re-search-backward "\\<package\\>" nil 'move))
3640 ((match-end 7)
3641 (verilog-re-search-backward "\\<connectmodule\\>" nil 'move))
3625 (t 3642 (t
3626 (goto-char st) 3643 (goto-char st)
3627 (backward-sexp 1)))) 3644 (backward-sexp 1))))
@@ -3747,7 +3764,8 @@ Use filename, if current buffer being edited shorten to just buffer name."
3747 "\\(\\<class\\>\\)\\|" 3764 "\\(\\<class\\>\\)\\|"
3748 "\\(\\<program\\>\\)\\|" 3765 "\\(\\<program\\>\\)\\|"
3749 "\\(\\<interface\\>\\)\\|" 3766 "\\(\\<interface\\>\\)\\|"
3750 "\\(\\<package\\>\\)")) 3767 "\\(\\<package\\>\\)\\|"
3768 "\\(\\<connectmodule\\>\\)"))
3751 (cond 3769 (cond
3752 ((match-end 1) 3770 ((match-end 1)
3753 (verilog-re-search-forward "\\<endmodule\\>" nil 'move)) 3771 (verilog-re-search-forward "\\<endmodule\\>" nil 'move))
@@ -3761,6 +3779,8 @@ Use filename, if current buffer being edited shorten to just buffer name."
3761 (verilog-re-search-forward "\\<endinterface\\>" nil 'move)) 3779 (verilog-re-search-forward "\\<endinterface\\>" nil 'move))
3762 ((match-end 6) 3780 ((match-end 6)
3763 (verilog-re-search-forward "\\<endpackage\\>" nil 'move)) 3781 (verilog-re-search-forward "\\<endpackage\\>" nil 'move))
3782 ((match-end 7)
3783 (verilog-re-search-forward "\\<endconnectmodule\\>" nil 'move))
3764 (t 3784 (t
3765 (goto-char st) 3785 (goto-char st)
3766 (if (= (following-char) ?\) ) 3786 (if (= (following-char) ?\) )
@@ -4568,13 +4588,13 @@ More specifically, point @ in the line foo : @ begin"
4568 (let ((nest 1)) 4588 (let ((nest 1))
4569 (while t 4589 (while t
4570 (verilog-re-search-backward 4590 (verilog-re-search-backward
4571 (concat "\\(\\<module\\>\\)\\|\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|" 4591 (concat "\\(\\<module\\>\\)\\|\\(\\<connectmodule\\>\\)\\|\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|"
4572 "\\(\\<endcase\\>\\)\\>") 4592 "\\(\\<endcase\\>\\)\\>")
4573 nil 'move) 4593 nil 'move)
4574 (cond 4594 (cond
4575 ((match-end 3) 4595 ((match-end 4)
4576 (setq nest (1+ nest))) 4596 (setq nest (1+ nest)))
4577 ((match-end 2) 4597 ((match-end 3)
4578 (if (= nest 1) 4598 (if (= nest 1)
4579 (throw 'found 1)) 4599 (throw 'found 1))
4580 (setq nest (1- nest))) 4600 (setq nest (1- nest)))
@@ -4609,13 +4629,15 @@ More specifically, after a generate and before an endgenerate."
4609 (while (and 4629 (while (and
4610 (/= nest 0) 4630 (/= nest 0)
4611 (verilog-re-search-backward 4631 (verilog-re-search-backward
4612 "\\<\\(module\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\>" nil 'move) 4632 "\\<\\(module\\)\\|\\(connectmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\>" nil 'move)
4613 (cond 4633 (cond
4614 ((match-end 1) ; module - we have crawled out 4634 ((match-end 1) ; module - we have crawled out
4615 (throw 'done 1)) 4635 (throw 'done 1))
4616 ((match-end 2) ; generate 4636 ((match-end 2) ; connectmodule - we have crawled out
4637 (throw 'done 1))
4638 ((match-end 3) ; generate
4617 (setq nest (1- nest))) 4639 (setq nest (1- nest)))
4618 ((match-end 3) ; endgenerate 4640 ((match-end 4) ; endgenerate
4619 (setq nest (1+ nest)))))))) 4641 (setq nest (1+ nest))))))))
4620 (= nest 0) )) ; return nest 4642 (= nest 0) )) ; return nest
4621 4643
@@ -5078,6 +5100,8 @@ primitive or interface named NAME."
5078 (setq reg "\\(\\<clocking\\>\\)\\|\\<endclocking\\>")) 5100 (setq reg "\\(\\<clocking\\>\\)\\|\\<endclocking\\>"))
5079 ((match-end 16) ; of verilog-end-block-ordered-re 5101 ((match-end 16) ; of verilog-end-block-ordered-re
5080 (setq reg "\\(\\<property\\>\\)\\|\\<endproperty\\>")) 5102 (setq reg "\\(\\<property\\>\\)\\|\\<endproperty\\>"))
5103 ((match-end 17) ; of verilog-end-block-ordered-re
5104 (setq reg "\\(\\<connectmodule\\>\\)\\|\\<endconnectmodule\\>"))
5081 5105
5082 (t (error "Problem in verilog-set-auto-endcomments"))) 5106 (t (error "Problem in verilog-set-auto-endcomments")))
5083 (let (b e) 5107 (let (b e)
@@ -5103,7 +5127,7 @@ primitive or interface named NAME."
5103 (setq string (buffer-substring b e))) 5127 (setq string (buffer-substring b e)))
5104 (t 5128 (t
5105 (ding 't) 5129 (ding 't)
5106 (setq string "unmatched end(function|task|module|primitive|interface|package|class|clocking)"))))) 5130 (setq string "unmatched end(function|task|module|connectmodule|primitive|interface|package|class|clocking)")))))
5107 (end-of-line) 5131 (end-of-line)
5108 (insert (concat " // " string ))) 5132 (insert (concat " // " string )))
5109 )))))))))) 5133 ))))))))))
@@ -5574,7 +5598,7 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5574 (case-fold-search nil) 5598 (case-fold-search nil)
5575 (par 0) 5599 (par 0)
5576 (begin (looking-at "[ \t]*begin\\>")) 5600 (begin (looking-at "[ \t]*begin\\>"))
5577 (lim (save-excursion (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<module\\>\\)" nil t))) 5601 (lim (save-excursion (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<\\(connect\\)?module\\>\\)" nil t)))
5578 (structres nil) 5602 (structres nil)
5579 (type (catch 'nesting 5603 (type (catch 'nesting
5580 ;; Keep working backwards until we can figure out 5604 ;; Keep working backwards until we can figure out
@@ -7127,7 +7151,7 @@ BASEIND is the base indent to offset everything."
7127 (let ((pos (point-marker)) 7151 (let ((pos (point-marker))
7128 (lim (save-excursion 7152 (lim (save-excursion
7129 ;; (verilog-re-search-backward verilog-declaration-opener nil 'move) 7153 ;; (verilog-re-search-backward verilog-declaration-opener nil 'move)
7130 (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<module\\>\\)\\|\\(\\<task\\>\\)" nil 'move) 7154 (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<\\(connect\\)?module\\>\\)\\|\\(\\<task\\>\\)" nil 'move)
7131 (point))) 7155 (point)))
7132 (ind) 7156 (ind)
7133 (val) 7157 (val)
@@ -7286,7 +7310,7 @@ it displays a list of all possible completions.")
7286\(integer, real, reg...)") 7310\(integer, real, reg...)")
7287 7311
7288(defvar verilog-cpp-keywords 7312(defvar verilog-cpp-keywords
7289 '("module" "macromodule" "primitive" "timescale" "define" "ifdef" "ifndef" "else" 7313 '("connectmodule" "module" "macromodule" "primitive" "timescale" "define" "ifdef" "ifndef" "else"
7290 "endif") 7314 "endif")
7291 "Keywords to complete when at first word of a line in declarative scope. 7315 "Keywords to complete when at first word of a line in declarative scope.
7292\(initial, always, begin, assign...) 7316\(initial, always, begin, assign...)
@@ -7297,7 +7321,7 @@ will be completed at runtime and should not be added to this list.")
7297 (append 7321 (append
7298 '( 7322 '(
7299 "always" "always_comb" "always_ff" "always_latch" "assign" 7323 "always" "always_comb" "always_ff" "always_latch" "assign"
7300 "begin" "end" "generate" "endgenerate" "module" "endmodule" 7324 "begin" "end" "connectmodule" "endconnectmodule" "generate" "endgenerate" "module" "endmodule"
7301 "specify" "endspecify" "function" "endfunction" "initial" "final" 7325 "specify" "endspecify" "function" "endfunction" "initial" "final"
7302 "task" "endtask" "primitive" "endprimitive" 7326 "task" "endtask" "primitive" "endprimitive"
7303 ) 7327 )
@@ -7394,9 +7418,9 @@ TYPE is `module', `tf' for task or function, or t if unknown."
7394 (if (string= verilog-str "") 7418 (if (string= verilog-str "")
7395 (setq verilog-str "[a-zA-Z_]")) 7419 (setq verilog-str "[a-zA-Z_]"))
7396 (let ((verilog-str (concat (cond 7420 (let ((verilog-str (concat (cond
7397 ((eq type 'module) "\\<\\(module\\)\\s +") 7421 ((eq type 'module) "\\<\\(module\\|connectmodule\\)\\s +")
7398 ((eq type 'tf) "\\<\\(task\\|function\\)\\s +") 7422 ((eq type 'tf) "\\<\\(task\\|function\\)\\s +")
7399 (t "\\<\\(task\\|function\\|module\\)\\s +")) 7423 (t "\\<\\(task\\|function\\|module\\|connectmodule\\)\\s +"))
7400 "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>")) 7424 "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>"))
7401 match) 7425 match)
7402 7426
@@ -7738,7 +7762,7 @@ If search fails, other files are checked based on
7738 (first 1) 7762 (first 1)
7739 (prevpos (point-min)) 7763 (prevpos (point-min))
7740 (final-context-start (make-marker)) 7764 (final-context-start (make-marker))
7741 (regexp "\\(module\\s-+\\w+\\s-*(\\)\\|\\(\\w+\\s-+\\w+\\s-*(\\)")) 7765 (regexp "\\(\\(connect\\)?module\\s-+\\w+\\s-*(\\)\\|\\(\\w+\\s-+\\w+\\s-*(\\)"))
7742 (with-output-to-temp-buffer "*Occur*" 7766 (with-output-to-temp-buffer "*Occur*"
7743 (save-excursion 7767 (save-excursion
7744 (message "Searching for %s ..." regexp) 7768 (message "Searching for %s ..." regexp)
@@ -8459,7 +8483,8 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
8459 (let ((olist)) 8483 (let ((olist))
8460 (save-excursion 8484 (save-excursion
8461 ;; /*AUTOPUNT("parameter", "parameter")*/ 8485 ;; /*AUTOPUNT("parameter", "parameter")*/
8462 (backward-sexp 1) 8486 (when (not (eq (char-before) ?\*)) ; Not .*
8487 (backward-sexp 1))
8463 (while (looking-at "(?\\s *\"\\([^\"]*\\)\"\\s *,?") 8488 (while (looking-at "(?\\s *\"\\([^\"]*\\)\"\\s *,?")
8464 (setq olist (cons (match-string-no-properties 1) olist)) 8489 (setq olist (cons (match-string-no-properties 1) olist))
8465 (goto-char (match-end 0)))) 8490 (goto-char (match-end 0))))
@@ -9909,7 +9934,7 @@ Allows version control to check out the file if need be."
9909 (while (and 9934 (while (and
9910 ;; It may be tempting to look for verilog-defun-re, 9935 ;; It may be tempting to look for verilog-defun-re,
9911 ;; don't, it slows things down a lot! 9936 ;; don't, it slows things down a lot!
9912 (verilog-re-search-forward-quick "\\<\\(module\\|interface\\|program\\)\\>" nil t) 9937 (verilog-re-search-forward-quick "\\<\\(connectmodule\\|module\\|interface\\|program\\)\\>" nil t)
9913 (setq type (match-string-no-properties 0)) 9938 (setq type (match-string-no-properties 0))
9914 (verilog-re-search-forward-quick "[(;]" nil t)) 9939 (verilog-re-search-forward-quick "[(;]" nil t))
9915 (if (equal module (verilog-read-module-name)) 9940 (if (equal module (verilog-read-module-name))
@@ -10937,9 +10962,9 @@ shown) will make this into:
10937 ;; Presume one module per file. 10962 ;; Presume one module per file.
10938 (save-excursion 10963 (save-excursion
10939 (goto-char (point-min)) 10964 (goto-char (point-min))
10940 (while (verilog-re-search-forward-quick "\\<module\\>" nil t) 10965 (while (verilog-re-search-forward-quick "\\<\\(connect\\)?module\\>" nil t)
10941 (let ((endmodp (save-excursion 10966 (let ((endmodp (save-excursion
10942 (verilog-re-search-forward-quick "\\<endmodule\\>" nil t) 10967 (verilog-re-search-forward-quick "\\<end\\(connect\\)?module\\>" nil t)
10943 (point)))) 10968 (point))))
10944 ;; See if there's already a comment .. inside a comment so not verilog-re-search 10969 ;; See if there's already a comment .. inside a comment so not verilog-re-search
10945 (when (not (re-search-forward "/\\*AUTOARG\\*/" endmodp t)) 10970 (when (not (re-search-forward "/\\*AUTOARG\\*/" endmodp t))
@@ -11583,6 +11608,9 @@ Replace the pin connections to an instantiation or interface
11583declaration with ones automatically derived from the module or 11608declaration with ones automatically derived from the module or
11584interface header of the instantiated item. 11609interface header of the instantiated item.
11585 11610
11611You may also provide an optional regular expression, in which
11612case only I/O matching the regular expression will be included.
11613
11586If `verilog-auto-star-expand' is set, also expand SystemVerilog .* ports, 11614If `verilog-auto-star-expand' is set, also expand SystemVerilog .* ports,
11587and delete them before saving unless `verilog-auto-star-save' is set. 11615and delete them before saving unless `verilog-auto-star-save' is set.
11588See `verilog-auto-star' for more information. 11616See `verilog-auto-star' for more information.
@@ -11901,7 +11929,9 @@ For more information see the \\[verilog-faq] and forums at URL
11901`https://www.veripool.org'." 11929`https://www.veripool.org'."
11902 (save-excursion 11930 (save-excursion
11903 ;; Find beginning 11931 ;; Find beginning
11904 (let* ((pt (point)) 11932 (let* ((params (verilog-read-auto-params 0 1))
11933 (regexp (nth 0 params))
11934 (pt (point))
11905 (for-star (save-excursion (backward-char 2) (looking-at "\\.\\*"))) 11935 (for-star (save-excursion (backward-char 2) (looking-at "\\.\\*")))
11906 (indent-pt (save-excursion (verilog-backward-open-paren) 11936 (indent-pt (save-excursion (verilog-backward-open-paren)
11907 (1+ (current-column)))) 11937 (1+ (current-column))))
@@ -11946,6 +11976,8 @@ For more information see the \\[verilog-faq] and forums at URL
11946 (verilog-decls-get-vars submoddecls) 11976 (verilog-decls-get-vars submoddecls)
11947 skip-pins))) 11977 skip-pins)))
11948 (vl-dir "interfaced")) 11978 (vl-dir "interfaced"))
11979 (when regexp
11980 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11949 (when (and sig-list 11981 (when (and sig-list
11950 verilog-auto-inst-interfaced-ports) 11982 verilog-auto-inst-interfaced-ports)
11951 ;; Note these are searched for in verilog-read-sub-decls. 11983 ;; Note these are searched for in verilog-read-sub-decls.
@@ -11956,6 +11988,8 @@ For more information see the \\[verilog-faq] and forums at URL
11956 (verilog-decls-get-interfaces submoddecls) 11988 (verilog-decls-get-interfaces submoddecls)
11957 skip-pins)) 11989 skip-pins))
11958 (vl-dir "interface")) 11990 (vl-dir "interface"))
11991 (when regexp
11992 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11959 (when sig-list 11993 (when sig-list
11960 ;; Note these are searched for in verilog-read-sub-decls. 11994 ;; Note these are searched for in verilog-read-sub-decls.
11961 (verilog-auto-inst-port-list "// Interfaces\n" 11995 (verilog-auto-inst-port-list "// Interfaces\n"
@@ -11965,6 +11999,8 @@ For more information see the \\[verilog-faq] and forums at URL
11965 (verilog-decls-get-outputs submoddecls) 11999 (verilog-decls-get-outputs submoddecls)
11966 skip-pins)) 12000 skip-pins))
11967 (vl-dir "output")) 12001 (vl-dir "output"))
12002 (when regexp
12003 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11968 (when sig-list 12004 (when sig-list
11969 (verilog-auto-inst-port-list "// Outputs\n" 12005 (verilog-auto-inst-port-list "// Outputs\n"
11970 sig-list indent-pt moddecls 12006 sig-list indent-pt moddecls
@@ -11973,6 +12009,8 @@ For more information see the \\[verilog-faq] and forums at URL
11973 (verilog-decls-get-inouts submoddecls) 12009 (verilog-decls-get-inouts submoddecls)
11974 skip-pins)) 12010 skip-pins))
11975 (vl-dir "inout")) 12011 (vl-dir "inout"))
12012 (when regexp
12013 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11976 (when sig-list 12014 (when sig-list
11977 (verilog-auto-inst-port-list "// Inouts\n" 12015 (verilog-auto-inst-port-list "// Inouts\n"
11978 sig-list indent-pt moddecls 12016 sig-list indent-pt moddecls
@@ -11981,6 +12019,8 @@ For more information see the \\[verilog-faq] and forums at URL
11981 (verilog-decls-get-inputs submoddecls) 12019 (verilog-decls-get-inputs submoddecls)
11982 skip-pins)) 12020 skip-pins))
11983 (vl-dir "input")) 12021 (vl-dir "input"))
12022 (when regexp
12023 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11984 (when sig-list 12024 (when sig-list
11985 (verilog-auto-inst-port-list "// Inputs\n" 12025 (verilog-auto-inst-port-list "// Inputs\n"
11986 sig-list indent-pt moddecls 12026 sig-list indent-pt moddecls
diff --git a/lisp/simple.el b/lisp/simple.el
index a28d10fd4a5..2f92238e640 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1622,8 +1622,11 @@ display the result of expression evaluation."
1622 (let ((minibuffer-completing-symbol t)) 1622 (let ((minibuffer-completing-symbol t))
1623 (minibuffer-with-setup-hook 1623 (minibuffer-with-setup-hook
1624 (lambda () 1624 (lambda ()
1625 ;; FIXME: call emacs-lisp-mode (see also 1625 ;; FIXME: instead of just applying the syntax table, maybe
1626 ;; `eldoc--eval-expression-setup')? 1626 ;; use a special major mode tailored to reading Lisp
1627 ;; expressions from the minibuffer? (`emacs-lisp-mode'
1628 ;; doesn't preserve the necessary keybindings.)
1629 (set-syntax-table emacs-lisp-mode-syntax-table)
1627 (add-hook 'completion-at-point-functions 1630 (add-hook 'completion-at-point-functions
1628 #'elisp-completion-at-point nil t) 1631 #'elisp-completion-at-point nil t)
1629 (run-hooks 'eval-expression-minibuffer-setup-hook)) 1632 (run-hooks 'eval-expression-minibuffer-setup-hook))
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 1ae07c0a304..54e20779bdc 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -73,7 +73,9 @@ code();
73 73
74(defconst mhtml--crucial-variable-prefix 74(defconst mhtml--crucial-variable-prefix
75 (regexp-opt '("comment-" "uncomment-" "electric-indent-" 75 (regexp-opt '("comment-" "uncomment-" "electric-indent-"
76 "smie-" "forward-sexp-function" "completion-" "major-mode")) 76 "smie-" "forward-sexp-function" "completion-" "major-mode"
77 "adaptive-fill-" "fill-" "normal-auto-fill-function"
78 "paragraph-"))
77 "Regexp matching the prefix of \"crucial\" buffer-locals we want to capture.") 79 "Regexp matching the prefix of \"crucial\" buffer-locals we want to capture.")
78 80
79(defconst mhtml--variable-prefix 81(defconst mhtml--variable-prefix
@@ -255,17 +257,14 @@ This is used by `mhtml--pre-command'.")
255 sgml-syntax-propertize-rules)) 257 sgml-syntax-propertize-rules))
256 258
257(defun mhtml-syntax-propertize (start end) 259(defun mhtml-syntax-propertize (start end)
258 ;; First remove our special settings from the affected text. They 260 (let ((submode (get-text-property start 'mhtml-submode)))
259 ;; will be re-applied as needed. 261 ;; First remove our special settings from the affected text. They
260 (remove-list-of-text-properties start end 262 ;; will be re-applied as needed.
261 '(syntax-table local-map mhtml-submode)) 263 (remove-list-of-text-properties start end
262 (goto-char start) 264 '(syntax-table local-map mhtml-submode))
263 ;; Be sure to look back one character, because START won't yet have 265 (goto-char start)
264 ;; been propertized. 266 (if submode
265 (unless (bobp) 267 (mhtml--syntax-propertize-submode submode end)))
266 (let ((submode (get-text-property (1- (point)) 'mhtml-submode)))
267 (if submode
268 (mhtml--syntax-propertize-submode submode end))))
269 (sgml-syntax-propertize (point) end mhtml--syntax-propertize)) 268 (sgml-syntax-propertize (point) end mhtml--syntax-propertize))
270 269
271(defun mhtml-indent-line () 270(defun mhtml-indent-line ()
@@ -333,6 +332,18 @@ the rules from `css-mode'."
333 ;: Hack 332 ;: Hack
334 (js--update-quick-match-re) 333 (js--update-quick-match-re)
335 334
335 ;; Setup the appropriate js-mode value of auto-fill-function.
336 (setf (mhtml--submode-crucial-captured-locals mhtml--js-submode)
337 (push (cons 'auto-fill-function
338 (if (and (boundp 'auto-fill-function) auto-fill-function)
339 #'js-do-auto-fill
340 nil))
341 (mhtml--submode-crucial-captured-locals mhtml--js-submode)))
342
343 ;; This mode might be using CC Mode's filling functionality.
344 (c-foreign-init-lit-pos-cache)
345 (add-hook 'before-change-functions #'c-foreign-truncate-lit-pos-cache nil t)
346
336 ;; This is sort of a prog-mode as well as a text mode. 347 ;; This is sort of a prog-mode as well as a text mode.
337 (run-hooks 'prog-mode-hook)) 348 (run-hooks 'prog-mode-hook))
338 349
diff --git a/src/json.c b/src/json.c
index 30027675580..814afc6d741 100644
--- a/src/json.c
+++ b/src/json.c
@@ -365,6 +365,7 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp,
365 Lisp_Object key = HASH_KEY (h, i); 365 Lisp_Object key = HASH_KEY (h, i);
366 if (!EQ (key, Qunbound)) 366 if (!EQ (key, Qunbound))
367 { 367 {
368 CHECK_STRING (key);
368 Lisp_Object ekey = json_encode (key); 369 Lisp_Object ekey = json_encode (key);
369 /* We can't specify the length, so the string must be 370 /* We can't specify the length, so the string must be
370 NUL-terminated. */ 371 NUL-terminated. */
@@ -975,6 +976,7 @@ usage: (json-parse-string STRING &rest ARGS) */)
975#endif 976#endif
976 977
977 Lisp_Object string = args[0]; 978 Lisp_Object string = args[0];
979 CHECK_STRING (string);
978 Lisp_Object encoded = json_encode (string); 980 Lisp_Object encoded = json_encode (string);
979 check_string_without_embedded_nuls (encoded); 981 check_string_without_embedded_nuls (encoded);
980 struct json_configuration conf = 982 struct json_configuration conf =
diff --git a/src/keyboard.c b/src/keyboard.c
index f9b9399d502..5fa58abce1d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10531,7 +10531,7 @@ The value is always a vector. */)
10531DEFUN ("clear-this-command-keys", Fclear_this_command_keys, 10531DEFUN ("clear-this-command-keys", Fclear_this_command_keys,
10532 Sclear_this_command_keys, 0, 1, 0, 10532 Sclear_this_command_keys, 0, 1, 0,
10533 doc: /* Clear out the vector that `this-command-keys' returns. 10533 doc: /* Clear out the vector that `this-command-keys' returns.
10534Also clear the record of the last 100 events, unless optional arg 10534Also clear the record of the last 300 input events, unless optional arg
10535KEEP-RECORD is non-nil. */) 10535KEEP-RECORD is non-nil. */)
10536 (Lisp_Object keep_record) 10536 (Lisp_Object keep_record)
10537{ 10537{
diff --git a/src/xdisp.c b/src/xdisp.c
index e454fd7b83f..97c55cdf5b8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1872,10 +1872,13 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1872 /* Account for line-number display, if IT3 still 1872 /* Account for line-number display, if IT3 still
1873 didn't. This can happen if START - 1 is the 1873 didn't. This can happen if START - 1 is the
1874 first or the last character on its display line. */ 1874 first or the last character on its display line. */
1875 if (it3.lnum_pixel_width > 0) 1875 if (!it3.line_number_produced_p)
1876 top_x += it3.lnum_pixel_width; 1876 {
1877 else if (it.line_number_produced_p) 1877 if (it3.lnum_pixel_width > 0)
1878 top_x += it.lnum_pixel_width; 1878 top_x += it3.lnum_pixel_width;
1879 else if (it.line_number_produced_p)
1880 top_x += it.lnum_pixel_width;
1881 }
1879 /* Normally, we would exit the above loop because we 1882 /* Normally, we would exit the above loop because we
1880 found the display element whose character 1883 found the display element whose character
1881 position is CHARPOS. For the contingency that we 1884 position is CHARPOS. For the contingency that we
@@ -26382,6 +26385,22 @@ decode_mode_spec (struct window *w, register int c, int field_width,
26382 startpos = marker_position (w->start); 26385 startpos = marker_position (w->start);
26383 startpos_byte = marker_byte_position (w->start); 26386 startpos_byte = marker_byte_position (w->start);
26384 height = WINDOW_TOTAL_LINES (w); 26387 height = WINDOW_TOTAL_LINES (w);
26388 /* We cannot cope with w->start being outside of the
26389 accessible portion of the buffer; in particular,
26390 display_count_lines call below will infloop if called with
26391 startpos_byte outside of the [BEGV_BYTE..ZV_BYTE] region.
26392 Such w->start means we were called in some "creative" way
26393 when the buffer's restriction was changed, but the window
26394 wasn't yet redisplayed after that. If that happens, we
26395 need to determine a new base line. */
26396 if (!(BUF_BEGV_BYTE (b) <= startpos_byte
26397 && startpos_byte <= BUF_ZV_BYTE (b)))
26398 {
26399 startpos = BUF_BEGV (b);
26400 startpos_byte = BUF_BEGV_BYTE (b);
26401 w->base_line_pos = 0;
26402 w->base_line_number = 0;
26403 }
26385 26404
26386 /* If we decided that this buffer isn't suitable for line numbers, 26405 /* If we decided that this buffer isn't suitable for line numbers,
26387 don't forget that too fast. */ 26406 don't forget that too fast. */
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index bfe2d06a61b..c235dd43fcc 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -363,10 +363,10 @@ bytecompiled code, and their results compared.")
363 (byte-compile-warnings nil) 363 (byte-compile-warnings nil)
364 (v0 (condition-case nil 364 (v0 (condition-case nil
365 (eval pat) 365 (eval pat)
366 (error nil))) 366 (error 'bytecomp-check-error)))
367 (v1 (condition-case nil 367 (v1 (condition-case nil
368 (funcall (byte-compile (list 'lambda nil pat))) 368 (funcall (byte-compile (list 'lambda nil pat)))
369 (error nil)))) 369 (error 'bytecomp-check-error))))
370 (equal v0 v1))) 370 (equal v0 v1)))
371 371
372(put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1) 372(put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1)
@@ -374,10 +374,10 @@ bytecompiled code, and their results compared.")
374(defun bytecomp-explain-1 (pat) 374(defun bytecomp-explain-1 (pat)
375 (let ((v0 (condition-case nil 375 (let ((v0 (condition-case nil
376 (eval pat) 376 (eval pat)
377 (error nil))) 377 (error 'bytecomp-check-error)))
378 (v1 (condition-case nil 378 (v1 (condition-case nil
379 (funcall (byte-compile (list 'lambda nil pat))) 379 (funcall (byte-compile (list 'lambda nil pat)))
380 (error nil)))) 380 (error 'bytecomp-check-error))))
381 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." 381 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled."
382 pat v0 v1))) 382 pat v0 v1)))
383 383
@@ -402,10 +402,10 @@ Subtests signal errors if something goes wrong."
402 (dolist (pat byte-opt-testsuite-arith-data) 402 (dolist (pat byte-opt-testsuite-arith-data)
403 (condition-case nil 403 (condition-case nil
404 (setq v0 (eval pat)) 404 (setq v0 (eval pat))
405 (error (setq v0 nil))) 405 (error (setq v0 'bytecomp-check-error)))
406 (condition-case nil 406 (condition-case nil
407 (setq v1 (funcall (byte-compile (list 'lambda nil pat)))) 407 (setq v1 (funcall (byte-compile (list 'lambda nil pat))))
408 (error (setq v1 nil))) 408 (error (setq v1 'bytecomp-check-error)))
409 (insert (format "%s" pat)) 409 (insert (format "%s" pat))
410 (indent-to-column 65) 410 (indent-to-column 65)
411 (if (equal v0 v1) 411 (if (equal v0 v1)
@@ -561,11 +561,11 @@ bytecompiled code, and their results compared.")
561 (byte-compile-warnings nil) 561 (byte-compile-warnings nil)
562 (v0 (condition-case nil 562 (v0 (condition-case nil
563 (eval pat t) 563 (eval pat t)
564 (error nil))) 564 (error 'bytecomp-check-error)))
565 (v1 (condition-case nil 565 (v1 (condition-case nil
566 (funcall (let ((lexical-binding t)) 566 (funcall (let ((lexical-binding t))
567 (byte-compile `(lambda nil ,pat)))) 567 (byte-compile `(lambda nil ,pat))))
568 (error nil)))) 568 (error 'bytecomp-check-error))))
569 (equal v0 v1))) 569 (equal v0 v1)))
570 570
571(put 'bytecomp-lexbind-check-1 'ert-explainer 'bytecomp-lexbind-explain-1) 571(put 'bytecomp-lexbind-check-1 'ert-explainer 'bytecomp-lexbind-explain-1)
@@ -573,11 +573,11 @@ bytecompiled code, and their results compared.")
573(defun bytecomp-lexbind-explain-1 (pat) 573(defun bytecomp-lexbind-explain-1 (pat)
574 (let ((v0 (condition-case nil 574 (let ((v0 (condition-case nil
575 (eval pat t) 575 (eval pat t)
576 (error nil))) 576 (error 'bytecomp-check-error)))
577 (v1 (condition-case nil 577 (v1 (condition-case nil
578 (funcall (let ((lexical-binding t)) 578 (funcall (let ((lexical-binding t))
579 (byte-compile (list 'lambda nil pat)))) 579 (byte-compile (list 'lambda nil pat))))
580 (error nil)))) 580 (error 'bytecomp-check-error))))
581 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." 581 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled."
582 pat v0 v1))) 582 pat v0 v1)))
583 583
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index 7eeef885198..028f92f29d3 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -296,5 +296,17 @@ Test with both unibyte and multibyte strings."
296 (1+ most-positive-fixnum) 296 (1+ most-positive-fixnum)
297 (1- most-negative-fixnum))))) 297 (1- most-negative-fixnum)))))
298 298
299(ert-deftest json-parse-string/wrong-type ()
300 "Check that Bug#42113 is fixed."
301 (skip-unless (fboundp 'json-parse-string))
302 (should-error (json-parse-string 1) :type 'wrong-type-argument))
303
304(ert-deftest json-serialize/wrong-hash-key-type ()
305 "Check that Bug#42113 is fixed."
306 (skip-unless (fboundp 'json-serialize))
307 (let ((table (make-hash-table :test #'eq)))
308 (puthash 1 2 table)
309 (should-error (json-serialize table) :type 'wrong-type-argument)))
310
299(provide 'json-tests) 311(provide 'json-tests)
300;;; json-tests.el ends here 312;;; json-tests.el ends here