diff options
| author | Michael R. Mauger | 2017-08-06 20:58:08 -0400 |
|---|---|---|
| committer | Michael R. Mauger | 2017-08-06 20:58:08 -0400 |
| commit | 6e2c0929bac8d3896d0472222cd3e6b77cb24c35 (patch) | |
| tree | 62668da72d88140958ed22273a6ed6557bc61a4a /lisp/progmodes | |
| parent | df1a71272e5cdd10b511e2ffd702ca50ddd8a773 (diff) | |
| parent | c2f1830d69f5a5e20dac6fcbf3af4d51afba92bd (diff) | |
| download | emacs-6e2c0929bac8d3896d0472222cd3e6b77cb24c35.tar.gz emacs-6e2c0929bac8d3896d0472222cd3e6b77cb24c35.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 26 | ||||
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 27 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 90 | ||||
| -rw-r--r-- | lisp/progmodes/sh-script.el | 1 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 2 |
5 files changed, 82 insertions, 64 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 66f2575f49f..b35d33a5fd3 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -1182,10 +1182,15 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1182 | (goto-char match-pos) | 1182 | (goto-char match-pos) |
| 1183 | (backward-char) | 1183 | (backward-char) |
| 1184 | (c-backward-token-2) | 1184 | (c-backward-token-2) |
| 1185 | (or (looking-at c-block-stmt-2-key) | 1185 | (cond |
| 1186 | (looking-at c-block-stmt-1-2-key) | 1186 | ((looking-at c-paren-stmt-key) |
| 1187 | (looking-at c-typeof-key)))) | 1187 | ;; Allow comma separated <> arglists in for statements. |
| 1188 | (cons nil t)) | 1188 | (cons nil nil)) |
| 1189 | ((or (looking-at c-block-stmt-2-key) | ||
| 1190 | (looking-at c-block-stmt-1-2-key) | ||
| 1191 | (looking-at c-typeof-key)) | ||
| 1192 | (cons nil t)) | ||
| 1193 | (t nil))))) | ||
| 1189 | ;; Near BOB. | 1194 | ;; Near BOB. |
| 1190 | ((<= match-pos (point-min)) | 1195 | ((<= match-pos (point-min)) |
| 1191 | (cons 'arglist t)) | 1196 | (cons 'arglist t)) |
| @@ -1226,13 +1231,16 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1226 | ;; Got a cached hit in some other type of arglist. | 1231 | ;; Got a cached hit in some other type of arglist. |
| 1227 | (type | 1232 | (type |
| 1228 | (cons 'arglist t)) | 1233 | (cons 'arglist t)) |
| 1229 | (not-front-decl | 1234 | ((and not-front-decl |
| 1230 | ;; The point is within the range of a previously | 1235 | ;; The point is within the range of a previously |
| 1231 | ;; encountered type decl expression, so the arglist | 1236 | ;; encountered type decl expression, so the arglist |
| 1232 | ;; is probably one that contains declarations. | 1237 | ;; is probably one that contains declarations. |
| 1233 | ;; However, if `c-recognize-paren-inits' is set it | 1238 | ;; However, if `c-recognize-paren-inits' is set it |
| 1234 | ;; might also be an initializer arglist. | 1239 | ;; might also be an initializer arglist. |
| 1235 | ;; | 1240 | (or (not c-recognize-paren-inits) |
| 1241 | (save-excursion | ||
| 1242 | (goto-char match-pos) | ||
| 1243 | (not (c-back-over-member-initializers))))) | ||
| 1236 | ;; The result of this check is cached with a char | 1244 | ;; The result of this check is cached with a char |
| 1237 | ;; property on the match token, so that we can look | 1245 | ;; property on the match token, so that we can look |
| 1238 | ;; it up again when refontifying single lines in a | 1246 | ;; it up again when refontifying single lines in a |
| @@ -1243,17 +1251,21 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1243 | ;; Got an open paren preceded by an arith operator. | 1251 | ;; Got an open paren preceded by an arith operator. |
| 1244 | ((and (eq (char-before match-pos) ?\() | 1252 | ((and (eq (char-before match-pos) ?\() |
| 1245 | (save-excursion | 1253 | (save-excursion |
| 1254 | (goto-char match-pos) | ||
| 1246 | (and (zerop (c-backward-token-2 2)) | 1255 | (and (zerop (c-backward-token-2 2)) |
| 1247 | (looking-at c-arithmetic-op-regexp)))) | 1256 | (looking-at c-arithmetic-op-regexp)))) |
| 1248 | (cons nil nil)) | 1257 | (cons nil nil)) |
| 1249 | ;; In a C++ member initialization list. | 1258 | ;; In a C++ member initialization list. |
| 1250 | ((and (eq (char-before match-pos) ?,) | 1259 | ((and (eq (char-before match-pos) ?,) |
| 1251 | (c-major-mode-is 'c++-mode) | 1260 | (c-major-mode-is 'c++-mode) |
| 1252 | (save-excursion (c-back-over-member-initializers))) | 1261 | (save-excursion |
| 1262 | (goto-char match-pos) | ||
| 1263 | (c-back-over-member-initializers))) | ||
| 1253 | (c-put-char-property (1- match-pos) 'c-type 'c-not-decl) | 1264 | (c-put-char-property (1- match-pos) 'c-type 'c-not-decl) |
| 1254 | (cons 'not-decl nil)) | 1265 | (cons 'not-decl nil)) |
| 1255 | ;; At start of a declaration inside a declaration paren. | 1266 | ;; At start of a declaration inside a declaration paren. |
| 1256 | ((save-excursion | 1267 | ((save-excursion |
| 1268 | (goto-char match-pos) | ||
| 1257 | (and (memq (char-before match-pos) '(?\( ?\,)) | 1269 | (and (memq (char-before match-pos) '(?\( ?\,)) |
| 1258 | (c-go-up-list-backward match-pos) | 1270 | (c-go-up-list-backward match-pos) |
| 1259 | (eq (char-after) ?\() | 1271 | (eq (char-after) ?\() |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index bf0439ffe8a..0bf89b9a36a 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -1539,6 +1539,21 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") | |||
| 1539 | (setq new-pos capture-opener)) | 1539 | (setq new-pos capture-opener)) |
| 1540 | (and (/= new-pos pos) new-pos))) | 1540 | (and (/= new-pos pos) new-pos))) |
| 1541 | 1541 | ||
| 1542 | (defun c-fl-decl-end (pos) | ||
| 1543 | ;; If POS is inside a declarator, return the end of the token that follows | ||
| 1544 | ;; the declarator, otherwise return nil. | ||
| 1545 | (goto-char pos) | ||
| 1546 | (let ((lit-start (c-literal-start)) | ||
| 1547 | pos1) | ||
| 1548 | (if lit-start (goto-char lit-start)) | ||
| 1549 | (c-backward-syntactic-ws) | ||
| 1550 | (when (setq pos1 (c-on-identifier)) | ||
| 1551 | (goto-char pos1) | ||
| 1552 | (when (and (c-forward-declarator) | ||
| 1553 | (eq (c-forward-token-2) 0)) | ||
| 1554 | (c-backward-syntactic-ws) | ||
| 1555 | (point))))) | ||
| 1556 | |||
| 1542 | (defun c-change-expand-fl-region (_beg _end _old-len) | 1557 | (defun c-change-expand-fl-region (_beg _end _old-len) |
| 1543 | ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock | 1558 | ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock |
| 1544 | ;; region. This will usually be the smallest sequence of whole lines | 1559 | ;; region. This will usually be the smallest sequence of whole lines |
| @@ -1552,18 +1567,16 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") | |||
| 1552 | (setq c-new-BEG | 1567 | (setq c-new-BEG |
| 1553 | (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG)) | 1568 | (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG)) |
| 1554 | c-new-END | 1569 | c-new-END |
| 1555 | (save-excursion | 1570 | (or (c-fl-decl-end c-new-END) |
| 1556 | (goto-char c-new-END) | 1571 | (c-point 'bonl (max (1- c-new-END) (point-min))))))) |
| 1557 | (if (bolp) | ||
| 1558 | (point) | ||
| 1559 | (c-point 'bonl c-new-END)))))) | ||
| 1560 | 1572 | ||
| 1561 | (defun c-context-expand-fl-region (beg end) | 1573 | (defun c-context-expand-fl-region (beg end) |
| 1562 | ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a | 1574 | ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a |
| 1563 | ;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is | 1575 | ;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is |
| 1564 | ;; in. NEW-END is beginning of the line after the one END is in. | 1576 | ;; in. NEW-END is beginning of the line after the one END is in. |
| 1565 | (cons (or (c-fl-decl-start beg) (c-point 'bol beg)) | 1577 | (c-save-buffer-state () |
| 1566 | (c-point 'bonl end))) | 1578 | (cons (or (c-fl-decl-start beg) (c-point 'bol beg)) |
| 1579 | (or (c-fl-decl-end end) (c-point 'bonl (1- end)))))) | ||
| 1567 | 1580 | ||
| 1568 | (defun c-before-context-fl-expand-region (beg end) | 1581 | (defun c-before-context-fl-expand-region (beg end) |
| 1569 | ;; Expand the region (BEG END) as specified by | 1582 | ;; Expand the region (BEG END) as specified by |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2ddaf884bce..466b524c79d 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | 31 | ||
| 32 | (require 'compile) | 32 | (require 'compile) |
| 33 | 33 | ||
| 34 | |||
| 35 | (defgroup grep nil | 34 | (defgroup grep nil |
| 36 | "Run `grep' and display the results." | 35 | "Run `grep' and display the results." |
| 37 | :group 'tools | 36 | :group 'tools |
| @@ -366,53 +365,44 @@ A grep buffer becomes most recent when you select Grep mode in it. | |||
| 366 | Notice that using \\[next-error] or \\[compile-goto-error] modifies | 365 | Notice that using \\[next-error] or \\[compile-goto-error] modifies |
| 367 | `compilation-last-buffer' rather than `grep-last-buffer'.") | 366 | `compilation-last-buffer' rather than `grep-last-buffer'.") |
| 368 | 367 | ||
| 369 | (defconst grep--regexp-alist-column | ||
| 370 | ;; Calculate column positions (col . end-col) of first grep match on a line | ||
| 371 | (cons | ||
| 372 | (lambda () | ||
| 373 | (when grep-highlight-matches | ||
| 374 | (let* ((beg (match-end 0)) | ||
| 375 | (end (save-excursion (goto-char beg) (line-end-position))) | ||
| 376 | (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face))) | ||
| 377 | (when mbeg | ||
| 378 | (- mbeg beg))))) | ||
| 379 | (lambda () | ||
| 380 | (when grep-highlight-matches | ||
| 381 | (let* ((beg (match-end 0)) | ||
| 382 | (end (save-excursion (goto-char beg) (line-end-position))) | ||
| 383 | (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face)) | ||
| 384 | (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end)))) | ||
| 385 | (when mend | ||
| 386 | (- mend beg))))))) | ||
| 387 | (defconst grep--regexp-alist-bin-matcher | ||
| 388 | '("^Binary file \\(.+\\) matches$" 1 nil nil 0 1)) | ||
| 389 | (defconst grep-with-null-regexp-alist | ||
| 390 | `(("^\\([^\0]+\\)\\(\0\\)\\([0-9]+\\):" 1 3 ,grep--regexp-alist-column nil nil | ||
| 391 | (2 '(face unspecified display ":"))) | ||
| 392 | ,grep--regexp-alist-bin-matcher) | ||
| 393 | "Regexp used to match grep hits. | ||
| 394 | See `compilation-error-regexp-alist'.") | ||
| 395 | (defconst grep-fallback-regexp-alist | ||
| 396 | `(;; Use a tight regexp to handle weird file names (with colons | ||
| 397 | ;; in them) as well as possible. E.g., use [1-9][0-9]* rather | ||
| 398 | ;; than [0-9]+ so as to accept ":034:" in file names. | ||
| 399 | ("^\\(.*?[^/\n]\\):[ \t]*\\([1-9][0-9]*\\)[ \t]*:" | ||
| 400 | 1 2 ,grep--regexp-alist-column) | ||
| 401 | ,grep--regexp-alist-bin-matcher) | ||
| 402 | "Regexp used to match grep hits when `--null' is not supported. | ||
| 403 | See `compilation-error-regexp-alist'.") | ||
| 404 | |||
| 405 | (defvaralias 'grep-regex-alist 'grep-with-null-regexp-alist) | ||
| 406 | (make-obsolete-variable | ||
| 407 | 'grep-regex-alist "Call `grep-regexp-alist' instead." "26.1") | ||
| 408 | |||
| 409 | ;;;###autoload | 368 | ;;;###autoload |
| 410 | (defun grep-regexp-alist () | 369 | (defconst grep-regexp-alist |
| 411 | "Return a regexp alist to match grep hits. | 370 | `((,(concat "^\\(?:" |
| 412 | The regexp used depends on `grep-use-null-filename-separator'. | 371 | ;; Parse using NUL characters when `--null' is used. |
| 413 | See `compilation-error-regexp-alist' for format details." | 372 | ;; Note that we must still assume no newlines in |
| 414 | (if grep-use-null-filename-separator | 373 | ;; filenames due to "foo: Is a directory." type |
| 415 | grep-with-null-regexp-alist grep-fallback-regexp-alist)) | 374 | ;; messages. |
| 375 | "\\(?1:[^\0\n]+\\)\\(?3:\0\\)\\(?2:[0-9]+\\):" | ||
| 376 | "\\|" | ||
| 377 | ;; Fallback if `--null' is not used, use a tight regexp | ||
| 378 | ;; to handle weird file names (with colons in them) as | ||
| 379 | ;; well as possible. E.g., use [1-9][0-9]* rather than | ||
| 380 | ;; [0-9]+ so as to accept ":034:" in file names. | ||
| 381 | "\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:" | ||
| 382 | "\\)") | ||
| 383 | 1 2 | ||
| 384 | ;; Calculate column positions (col . end-col) of first grep match on a line | ||
| 385 | (,(lambda () | ||
| 386 | (when grep-highlight-matches | ||
| 387 | (let* ((beg (match-end 0)) | ||
| 388 | (end (save-excursion (goto-char beg) (line-end-position))) | ||
| 389 | (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face))) | ||
| 390 | (when mbeg | ||
| 391 | (- mbeg beg))))) | ||
| 392 | . | ||
| 393 | ,(lambda () | ||
| 394 | (when grep-highlight-matches | ||
| 395 | (let* ((beg (match-end 0)) | ||
| 396 | (end (save-excursion (goto-char beg) (line-end-position))) | ||
| 397 | (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face)) | ||
| 398 | (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end)))) | ||
| 399 | (when mend | ||
| 400 | (- mend beg)))))) | ||
| 401 | nil nil | ||
| 402 | (3 '(face nil display ":"))) | ||
| 403 | ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1)) | ||
| 404 | "Regexp used to match grep hits. | ||
| 405 | See `compilation-error-regexp-alist' for format details.") | ||
| 416 | 406 | ||
| 417 | (defvar grep-first-column 0 ; bug#10594 | 407 | (defvar grep-first-column 0 ; bug#10594 |
| 418 | "Value to use for `compilation-first-column' in grep buffers.") | 408 | "Value to use for `compilation-first-column' in grep buffers.") |
| @@ -451,7 +441,9 @@ See `compilation-error-regexp-alist' for format details." | |||
| 451 | (2 grep-error-face nil t)) | 441 | (2 grep-error-face nil t)) |
| 452 | ;; "filename-linenumber-" format is used for context lines in GNU grep, | 442 | ;; "filename-linenumber-" format is used for context lines in GNU grep, |
| 453 | ;; "filename=linenumber=" for lines with function names in "git grep -p". | 443 | ;; "filename=linenumber=" for lines with function names in "git grep -p". |
| 454 | ("^.+?[-=][0-9]+[-=].*\n" (0 grep-context-face))) | 444 | ("^.+?\\([-=\0]\\)[0-9]+\\([-=]\\).*\n" (0 grep-context-face) |
| 445 | (1 (if (eq (char-after (match-beginning 1)) ?\0) | ||
| 446 | `(face nil display ,(match-string 2)))))) | ||
| 455 | "Additional things to highlight in grep output. | 447 | "Additional things to highlight in grep output. |
| 456 | This gets tacked on the end of the generated expressions.") | 448 | This gets tacked on the end of the generated expressions.") |
| 457 | 449 | ||
| @@ -781,7 +773,7 @@ This function is called from `compilation-filter-hook'." | |||
| 781 | (set (make-local-variable 'compilation-error-face) | 773 | (set (make-local-variable 'compilation-error-face) |
| 782 | grep-hit-face) | 774 | grep-hit-face) |
| 783 | (set (make-local-variable 'compilation-error-regexp-alist) | 775 | (set (make-local-variable 'compilation-error-regexp-alist) |
| 784 | (grep-regexp-alist)) | 776 | grep-regexp-alist) |
| 785 | ;; compilation-directory-matcher can't be nil, so we set it to a regexp that | 777 | ;; compilation-directory-matcher can't be nil, so we set it to a regexp that |
| 786 | ;; can never match. | 778 | ;; can never match. |
| 787 | (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`")) | 779 | (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`")) |
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 35b555e6879..23e79f6ac59 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -1683,6 +1683,7 @@ with your script for an edit-interpret-debug cycle." | |||
| 1683 | ((string-match "[.]sh\\>" buffer-file-name) "sh") | 1683 | ((string-match "[.]sh\\>" buffer-file-name) "sh") |
| 1684 | ((string-match "[.]bash\\>" buffer-file-name) "bash") | 1684 | ((string-match "[.]bash\\>" buffer-file-name) "bash") |
| 1685 | ((string-match "[.]ksh\\>" buffer-file-name) "ksh") | 1685 | ((string-match "[.]ksh\\>" buffer-file-name) "ksh") |
| 1686 | ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh") | ||
| 1686 | ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh") | 1687 | ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh") |
| 1687 | ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh") | 1688 | ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh") |
| 1688 | ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh") | 1689 | ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh") |
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index cc9b794c5a0..35a5c8862f4 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -929,7 +929,7 @@ IGNORES is a list of glob patterns." | |||
| 929 | (expand-file-name dir) | 929 | (expand-file-name dir) |
| 930 | ignores)) | 930 | ignores)) |
| 931 | (buf (get-buffer-create " *xref-grep*")) | 931 | (buf (get-buffer-create " *xref-grep*")) |
| 932 | (`(,grep-re ,file-group ,line-group . ,_) (car (grep-regexp-alist))) | 932 | (`(,grep-re ,file-group ,line-group . ,_) (car grep-regexp-alist)) |
| 933 | (status nil) | 933 | (status nil) |
| 934 | (hits nil)) | 934 | (hits nil)) |
| 935 | (with-current-buffer buf | 935 | (with-current-buffer buf |