diff options
| author | Noam Postavsky | 2017-11-11 11:10:49 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2017-11-11 11:12:00 -0500 |
| commit | 1fa0766cfa17e37be77a1566dbc775ab4ce7ff2e (patch) | |
| tree | 66f1607d41b0bc490f3202c327ecb3fcdc5746bf | |
| parent | 1ef6d2b0e679c035dd2a1f2f858865eeafc5bc28 (diff) | |
| parent | 9533d76b0b5bfe2df1cccc55a92c2545b1de4e2b (diff) | |
| download | emacs-1fa0766cfa17e37be77a1566dbc775ab4ce7ff2e.tar.gz emacs-1fa0766cfa17e37be77a1566dbc775ab4ce7ff2e.zip | |
; Merge from emacs-26
9533d76b0b Keep Man sections in natural order (bug#28998)
d63c9a96f5 * lisp/minibuffer.el: Install a workaround for bug#16274
7657a86709 Fix comparisons with tip_frame in GTK builds
603a0716a8 Improve the documentation of M-n for entering file names
72f813fb56 Fix desktop auto-save timer when linum-mode is used
44340b475f Fix "C-h k" in xterm-mouse-mode
05aa6d4a68 Fix off-by-1 bug in --enable-checking=stringbytes
096f638ddc Correct the indentation of C99's compound literals.
c52a2aa8f3 Improve the doc string of 'dired-isearch-filter-filenames'
e592b92482 * lisp/isearch.el (search-invisible): Doc fix. (Bug#29222)
f3e69a80ab Fix display of line numbers in GTK builds
e6f1fd4091 Fix previous change to flymake-diag-region (bug#29174)
89382780e1 flymake-diag-region really returns nil if region is invali...
535688a418 Flymake correctly highlights whole last line if eob (bug#2...
72e62d3fdb Protect Flymake checkdoc backend against checkdoc errors (...
b28de57411 Sort entries of the Flymake diagnostics buffer (bug#29175)
fc56bea142 Correctly indent C++14 brace lists which are a second argu...
9dde8be9cd Fix redisplay of overlay-arrows on GUI frames
0da08f2f8e Protect Flymake tests against older Ruby and Perl (bug#29187)
781f276cc1 Fix URL cookie expiration bug
| -rw-r--r-- | doc/emacs/files.texi | 3 | ||||
| -rw-r--r-- | doc/emacs/mini.texi | 24 | ||||
| -rw-r--r-- | lisp/desktop.el | 8 | ||||
| -rw-r--r-- | lisp/dired-aux.el | 6 | ||||
| -rw-r--r-- | lisp/files.el | 30 | ||||
| -rw-r--r-- | lisp/help.el | 16 | ||||
| -rw-r--r-- | lisp/isearch.el | 7 | ||||
| -rw-r--r-- | lisp/man.el | 3 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 11 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 140 | ||||
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/flymake.el | 9 | ||||
| -rw-r--r-- | lisp/url/url-cookie.el | 2 | ||||
| -rw-r--r-- | src/alloc.c | 2 | ||||
| -rw-r--r-- | src/dispextern.h | 7 | ||||
| -rw-r--r-- | src/frame.c | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 20 | ||||
| -rw-r--r-- | src/xfns.c | 6 | ||||
| -rw-r--r-- | src/xterm.c | 12 | ||||
| -rw-r--r-- | test/lisp/progmodes/flymake-tests.el | 19 |
20 files changed, 237 insertions, 100 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 2c4a0ca30ce..dc59e13e081 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi | |||
| @@ -63,6 +63,9 @@ completing up to a nonexistent file name, Emacs prints | |||
| 63 | @samp{[Confirm]} and you must type a second @key{RET} to confirm. | 63 | @samp{[Confirm]} and you must type a second @key{RET} to confirm. |
| 64 | @xref{Completion Exit}, for details. | 64 | @xref{Completion Exit}, for details. |
| 65 | 65 | ||
| 66 | Minibuffer history commands offer some special features for reading | ||
| 67 | file names, see @ref{Minibuffer History}. | ||
| 68 | |||
| 66 | @cindex default directory | 69 | @cindex default directory |
| 67 | @vindex default-directory | 70 | @vindex default-directory |
| 68 | @vindex insert-default-directory | 71 | @vindex insert-default-directory |
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 83e7f3b7eb5..93f91420771 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi | |||
| @@ -89,7 +89,10 @@ the default directory. If you now type @kbd{buffer.c} as input, that | |||
| 89 | specifies the file @file{/u2/emacs/src/buffer.c}. @xref{File Names}, | 89 | specifies the file @file{/u2/emacs/src/buffer.c}. @xref{File Names}, |
| 90 | for information about the default directory. | 90 | for information about the default directory. |
| 91 | 91 | ||
| 92 | You can specify the parent directory with @file{..}: | 92 | Alternative defaults for the file name you may want are available by |
| 93 | typing @kbd{M-n}, see @ref{Minibuffer History}. | ||
| 94 | |||
| 95 | You can specify a file in the parent directory with @file{..}: | ||
| 93 | @file{/a/b/../foo.el} is equivalent to @file{/a/foo.el}. | 96 | @file{/a/b/../foo.el} is equivalent to @file{/a/foo.el}. |
| 94 | Alternatively, you can use @kbd{M-@key{DEL}} to kill directory names | 97 | Alternatively, you can use @kbd{M-@key{DEL}} to kill directory names |
| 95 | backwards (@pxref{Words}). | 98 | backwards (@pxref{Words}). |
| @@ -609,8 +612,6 @@ Move to a later item in the minibuffer history that matches | |||
| 609 | 612 | ||
| 610 | @kindex M-p @r{(minibuffer history)} | 613 | @kindex M-p @r{(minibuffer history)} |
| 611 | @kindex M-n @r{(minibuffer history)} | 614 | @kindex M-n @r{(minibuffer history)} |
| 612 | @kindex UP @r{(minibuffer history)} | ||
| 613 | @kindex DOWN @r{(minibuffer history)} | ||
| 614 | @findex next-history-element | 615 | @findex next-history-element |
| 615 | @findex previous-history-element | 616 | @findex previous-history-element |
| 616 | While in the minibuffer, @kbd{M-p} (@code{previous-history-element}) | 617 | While in the minibuffer, @kbd{M-p} (@code{previous-history-element}) |
| @@ -627,8 +628,25 @@ typed @kbd{M-p}), Emacs tries fetching from a list of default | |||
| 627 | arguments: values that you are likely to enter. You can think of this | 628 | arguments: values that you are likely to enter. You can think of this |
| 628 | as moving through the ``future history''. | 629 | as moving through the ``future history''. |
| 629 | 630 | ||
| 631 | @cindex future history for file names | ||
| 632 | @cindex minibuffer defaults for file names | ||
| 633 | @vindex file-name-at-point-functions | ||
| 634 | The ``future history'' for file names includes several possible | ||
| 635 | alternatives you may find useful, such as the file name or the URL at | ||
| 636 | point in the current buffer. The defaults put into the ``future | ||
| 637 | history'' in this case are controlled by the functions mentioned in | ||
| 638 | the value of the option @code{file-name-at-point-functions}. By | ||
| 639 | default, its value invokes the @code{ffap} package (@pxref{FFAP}), | ||
| 640 | which tries to guess the default file or URL from the text around | ||
| 641 | point. To disable this guessing, customize the option to a @code{nil} | ||
| 642 | value, then the ``future history'' of file names will include only the | ||
| 643 | file, if any, visited by the current buffer, and the default | ||
| 644 | directory. | ||
| 645 | |||
| 630 | @findex previous-line-or-history-element | 646 | @findex previous-line-or-history-element |
| 631 | @findex next-line-or-history-element | 647 | @findex next-line-or-history-element |
| 648 | @kindex UP @r{(minibuffer history)} | ||
| 649 | @kindex DOWN @r{(minibuffer history)} | ||
| 632 | The arrow keys @kbd{@key{UP}} and @kbd{@key{DOWN}} work like | 650 | The arrow keys @kbd{@key{UP}} and @kbd{@key{DOWN}} work like |
| 633 | @kbd{M-p} and @kbd{M-n}, but if the current history item is longer | 651 | @kbd{M-p} and @kbd{M-n}, but if the current history item is longer |
| 634 | than a single line, they allow you to move to the previous or next | 652 | than a single line, they allow you to move to the previous or next |
diff --git a/lisp/desktop.el b/lisp/desktop.el index 2a5ec612ddf..5257c609dde 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -1240,7 +1240,13 @@ Using it may cause conflicts. Use it anyway? " owner))))) | |||
| 1240 | ;; disabled when loading the desktop fails with errors, | 1240 | ;; disabled when loading the desktop fails with errors, |
| 1241 | ;; thus not overwriting the desktop with broken contents. | 1241 | ;; thus not overwriting the desktop with broken contents. |
| 1242 | (setq desktop-autosave-was-enabled | 1242 | (setq desktop-autosave-was-enabled |
| 1243 | (memq 'desktop-auto-save-set-timer window-configuration-change-hook)) | 1243 | (memq 'desktop-auto-save-set-timer |
| 1244 | ;; Use the toplevel value of the hook, in case some | ||
| 1245 | ;; feature makes window-configuration-change-hook | ||
| 1246 | ;; buffer-local, and puts there stuff which | ||
| 1247 | ;; doesn't include our timer. | ||
| 1248 | (default-toplevel-value | ||
| 1249 | 'window-configuration-change-hook))) | ||
| 1244 | (desktop-auto-save-disable) | 1250 | (desktop-auto-save-disable) |
| 1245 | ;; Evaluate desktop buffer and remember when it was modified. | 1251 | ;; Evaluate desktop buffer and remember when it was modified. |
| 1246 | (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) | 1252 | (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) |
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 94938cf679e..3f9912980ba 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -2768,9 +2768,9 @@ Intended to be added to `isearch-mode-hook'." | |||
| 2768 | (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t)) | 2768 | (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t)) |
| 2769 | 2769 | ||
| 2770 | (defun dired-isearch-filter-filenames (beg end) | 2770 | (defun dired-isearch-filter-filenames (beg end) |
| 2771 | "Test whether the current search hit is a file name. | 2771 | "Test whether some part of the current search match is inside a file name. |
| 2772 | Return non-nil if the text from BEG to END is part of a file | 2772 | This function returns non-nil if some part of the text between BEG and END |
| 2773 | name (has the text property `dired-filename')." | 2773 | is part of a file name (i.e., has the text property `dired-filename')." |
| 2774 | (text-property-not-all (min beg end) (max beg end) | 2774 | (text-property-not-all (min beg end) (max beg end) |
| 2775 | 'dired-filename nil)) | 2775 | 'dired-filename nil)) |
| 2776 | 2776 | ||
diff --git a/lisp/files.el b/lisp/files.el index cda2c1abd5e..e3a34af2dc3 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1560,7 +1560,15 @@ Switch to a buffer visiting file FILENAME, | |||
| 1560 | creating one if none already exists. | 1560 | creating one if none already exists. |
| 1561 | Interactively, the default if you just type RET is the current directory, | 1561 | Interactively, the default if you just type RET is the current directory, |
| 1562 | but the visited file name is available through the minibuffer history: | 1562 | but the visited file name is available through the minibuffer history: |
| 1563 | type M-n to pull it into the minibuffer. | 1563 | type \\[next-history-element] to pull it into the minibuffer. |
| 1564 | |||
| 1565 | The first time \\[next-history-element] is used after Emacs prompts for | ||
| 1566 | the file name, the result is affected by `file-name-at-point-functions', | ||
| 1567 | which by default try to guess the file name by looking at point in the | ||
| 1568 | current buffer. Customize the value of `file-name-at-point-functions' | ||
| 1569 | or set it to nil, if you want only the visited file name and the | ||
| 1570 | current directory to be available on first \\[next-history-element] | ||
| 1571 | request. | ||
| 1564 | 1572 | ||
| 1565 | You can visit files on remote machines by specifying something | 1573 | You can visit files on remote machines by specifying something |
| 1566 | like /ssh:SOME_REMOTE_MACHINE:FILE for the file name. You can | 1574 | like /ssh:SOME_REMOTE_MACHINE:FILE for the file name. You can |
| @@ -1591,7 +1599,15 @@ an existing one. See the function `display-buffer'. | |||
| 1591 | 1599 | ||
| 1592 | Interactively, the default if you just type RET is the current directory, | 1600 | Interactively, the default if you just type RET is the current directory, |
| 1593 | but the visited file name is available through the minibuffer history: | 1601 | but the visited file name is available through the minibuffer history: |
| 1594 | type M-n to pull it into the minibuffer. | 1602 | type \\[next-history-element] to pull it into the minibuffer. |
| 1603 | |||
| 1604 | The first time \\[next-history-element] is used after Emacs prompts for | ||
| 1605 | the file name, the result is affected by `file-name-at-point-functions', | ||
| 1606 | which by default try to guess the file name by looking at point in the | ||
| 1607 | current buffer. Customize the value of `file-name-at-point-functions' | ||
| 1608 | or set it to nil, if you want only the visited file name and the | ||
| 1609 | current directory to be available on first \\[next-history-element] | ||
| 1610 | request. | ||
| 1595 | 1611 | ||
| 1596 | Interactively, or if WILDCARDS is non-nil in a call from Lisp, | 1612 | Interactively, or if WILDCARDS is non-nil in a call from Lisp, |
| 1597 | expand wildcards (if any) and visit multiple files." | 1613 | expand wildcards (if any) and visit multiple files." |
| @@ -1615,7 +1631,15 @@ an existing one. See the function `display-buffer'. | |||
| 1615 | 1631 | ||
| 1616 | Interactively, the default if you just type RET is the current directory, | 1632 | Interactively, the default if you just type RET is the current directory, |
| 1617 | but the visited file name is available through the minibuffer history: | 1633 | but the visited file name is available through the minibuffer history: |
| 1618 | type M-n to pull it into the minibuffer. | 1634 | type \\[next-history-element] to pull it into the minibuffer. |
| 1635 | |||
| 1636 | The first time \\[next-history-element] is used after Emacs prompts for | ||
| 1637 | the file name, the result is affected by `file-name-at-point-functions', | ||
| 1638 | which by default try to guess the file name by looking at point in the | ||
| 1639 | current buffer. Customize the value of `file-name-at-point-functions' | ||
| 1640 | or set it to nil, if you want only the visited file name and the | ||
| 1641 | current directory to be available on first \\[next-history-element] | ||
| 1642 | request. | ||
| 1619 | 1643 | ||
| 1620 | Interactively, or if WILDCARDS is non-nil in a call from Lisp, | 1644 | Interactively, or if WILDCARDS is non-nil in a call from Lisp, |
| 1621 | expand wildcards (if any) and visit multiple files." | 1645 | expand wildcards (if any) and visit multiple files." |
diff --git a/lisp/help.el b/lisp/help.el index bc8035db0ea..fbb9fc8cbe6 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -717,7 +717,7 @@ with `mouse-movement' events." | |||
| 717 | (cursor-in-echo-area t) | 717 | (cursor-in-echo-area t) |
| 718 | saved-yank-menu) | 718 | saved-yank-menu) |
| 719 | (unwind-protect | 719 | (unwind-protect |
| 720 | (let (key) | 720 | (let (key down-ev) |
| 721 | ;; If yank-menu is empty, populate it temporarily, so that | 721 | ;; If yank-menu is empty, populate it temporarily, so that |
| 722 | ;; "Select and Paste" menu can generate a complete event. | 722 | ;; "Select and Paste" menu can generate a complete event. |
| 723 | (when (null (cdr yank-menu)) | 723 | (when (null (cdr yank-menu)) |
| @@ -743,17 +743,21 @@ Describe the following key, mouse click, or menu item: ")) | |||
| 743 | (let ((last-idx (1- (length key)))) | 743 | (let ((last-idx (1- (length key)))) |
| 744 | (and (eventp (aref key last-idx)) | 744 | (and (eventp (aref key last-idx)) |
| 745 | (memq 'down (event-modifiers (aref key last-idx))))) | 745 | (memq 'down (event-modifiers (aref key last-idx))))) |
| 746 | (or (and (eventp (aref key 0)) | 746 | (or (and (eventp (setq down-ev (aref key 0))) |
| 747 | (memq 'down (event-modifiers (aref key 0))) | 747 | (memq 'down (event-modifiers down-ev)) |
| 748 | ;; However, for the C-down-mouse-2 popup | 748 | ;; However, for the C-down-mouse-2 popup |
| 749 | ;; menu, there is no subsequent up-event. In | 749 | ;; menu, there is no subsequent up-event. In |
| 750 | ;; this case, the up-event is the next | 750 | ;; this case, the up-event is the next |
| 751 | ;; element in the supplied vector. | 751 | ;; element in the supplied vector. |
| 752 | (= (length key) 1)) | 752 | (= (length key) 1)) |
| 753 | (and (> (length key) 1) | 753 | (and (> (length key) 1) |
| 754 | (eventp (aref key 1)) | 754 | (eventp (setq down-ev (aref key 1))) |
| 755 | (memq 'down (event-modifiers (aref key 1))))) | 755 | (memq 'down (event-modifiers down-ev)))) |
| 756 | (read-event)))) | 756 | (if (and (terminal-parameter nil 'xterm-mouse-mode) |
| 757 | (equal (terminal-parameter nil 'xterm-mouse-last-down) | ||
| 758 | down-ev)) | ||
| 759 | (aref (read-key-sequence-vector nil) 0) | ||
| 760 | (read-event))))) | ||
| 757 | ;; Put yank-menu back as it was, if we changed it. | 761 | ;; Put yank-menu back as it was, if we changed it. |
| 758 | (when saved-yank-menu | 762 | (when saved-yank-menu |
| 759 | (setq yank-menu (copy-sequence saved-yank-menu)) | 763 | (setq yank-menu (copy-sequence saved-yank-menu)) |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 7c576a67d43..13fa97ea71f 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -128,9 +128,10 @@ a tab, a carriage return (control-M), a newline, and `]+'." | |||
| 128 | "If t incremental search/query-replace can match hidden text. | 128 | "If t incremental search/query-replace can match hidden text. |
| 129 | A nil value means don't match invisible text. | 129 | A nil value means don't match invisible text. |
| 130 | When the value is `open', if the text matched is made invisible by | 130 | When the value is `open', if the text matched is made invisible by |
| 131 | an overlay having an `invisible' property and that overlay has a property | 131 | an overlay having a non-nil `invisible' property, and that overlay |
| 132 | `isearch-open-invisible', then incremental search will show the contents. | 132 | has a non-nil property `isearch-open-invisible', then incremental |
| 133 | \(This applies when using `outline.el' and `hideshow.el'.) | 133 | search will show the hidden text. (This applies when using `outline.el' |
| 134 | and `hideshow.el'.) | ||
| 134 | 135 | ||
| 135 | To temporarily change the value for an active incremental search, | 136 | To temporarily change the value for an active incremental search, |
| 136 | use \\<isearch-mode-map>\\[isearch-toggle-invisible]. | 137 | use \\<isearch-mode-map>\\[isearch-toggle-invisible]. |
diff --git a/lisp/man.el b/lisp/man.el index 7a892c6e88a..f7b1609c929 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -1522,7 +1522,8 @@ The following key bindings are currently in effect in the buffer: | |||
| 1522 | (let ((section (match-string 1))) | 1522 | (let ((section (match-string 1))) |
| 1523 | (unless (member section Man--sections) | 1523 | (unless (member section Man--sections) |
| 1524 | (push section Man--sections))) | 1524 | (push section Man--sections))) |
| 1525 | (forward-line 1)))) | 1525 | (forward-line 1))) |
| 1526 | (setq Man--sections (nreverse Man--sections))) | ||
| 1526 | 1527 | ||
| 1527 | (defsubst Man-build-references-alist () | 1528 | (defsubst Man-build-references-alist () |
| 1528 | "Build the list of references (in the SEE ALSO section)." | 1529 | "Build the list of references (in the SEE ALSO section)." |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 77fddc3436d..3b1d6f447a5 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -896,8 +896,15 @@ This overrides the defaults specified in `completion-category-defaults'." | |||
| 896 | ;; than from completion-extra-properties) because it may apply only to some | 896 | ;; than from completion-extra-properties) because it may apply only to some |
| 897 | ;; part of the string (e.g. substitute-in-file-name). | 897 | ;; part of the string (e.g. substitute-in-file-name). |
| 898 | (let ((requote | 898 | (let ((requote |
| 899 | (when (completion-metadata-get metadata 'completion--unquote-requote) | 899 | (when (and |
| 900 | (cl-assert (functionp table)) | 900 | (completion-metadata-get metadata 'completion--unquote-requote) |
| 901 | ;; Sometimes a table's metadata is used on another | ||
| 902 | ;; table (typically that other table is just a list taken | ||
| 903 | ;; from the output of `all-completions' or something equivalent, | ||
| 904 | ;; for progressive refinement). See bug#28898 and bug#16274. | ||
| 905 | ;; FIXME: Rather than do nothing, we should somehow call | ||
| 906 | ;; the original table, in that case! | ||
| 907 | (functionp table)) | ||
| 901 | (let ((new (funcall table string point 'completion--unquote))) | 908 | (let ((new (funcall table string point 'completion--unquote))) |
| 902 | (setq string (pop new)) | 909 | (setq string (pop new)) |
| 903 | (setq table (pop new)) | 910 | (setq table (pop new)) |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 6f39cc64338..8ec01e1810b 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -10407,16 +10407,20 @@ comment at the start of cc-engine.el for more info." | |||
| 10407 | (defun c-looking-at-or-maybe-in-bracelist (&optional containing-sexp lim) | 10407 | (defun c-looking-at-or-maybe-in-bracelist (&optional containing-sexp lim) |
| 10408 | ;; Point is at an open brace. If this starts a brace list, return a list | 10408 | ;; Point is at an open brace. If this starts a brace list, return a list |
| 10409 | ;; whose car is the buffer position of the start of the construct which | 10409 | ;; whose car is the buffer position of the start of the construct which |
| 10410 | ;; introduces the list, and whose cdr is t if we have parsed a keyword | 10410 | ;; introduces the list, and whose cdr is the symbol `in-paren' if the brace |
| 10411 | ;; matching `c-opt-inexpr-brace-list-key' (e.g. Java's "new"), nil | 10411 | ;; is directly enclosed in a parenthesis form (i.e. an arglist), t if we |
| 10412 | ;; otherwise. Otherwise, if point might be inside an enclosing brace list, | 10412 | ;; have parsed a keyword matching `c-opt-inexpr-brace-list-key' (e.g. Java's |
| 10413 | ;; return t. If point is definitely neither at nor in a brace list, return | 10413 | ;; "new"), nil otherwise. Otherwise, if point might be inside an enclosing |
| 10414 | ;; nil. | 10414 | ;; brace list, return t. If point is definitely neither at nor in a brace |
| 10415 | ;; list, return nil. | ||
| 10415 | ;; | 10416 | ;; |
| 10416 | ;; CONTAINING-SEXP is the position of the brace/paren/bracket enclosing | 10417 | ;; CONTAINING-SEXP is the position of the brace/paren/bracket enclosing |
| 10417 | ;; POINT, or nil if there is no such position, or we do not know it. LIM is | 10418 | ;; POINT, or nil if there is no such position, or we do not know it. LIM is |
| 10418 | ;; a backward search limit. | 10419 | ;; a backward search limit. |
| 10419 | ;; | 10420 | ;; |
| 10421 | ;; The determination of whether the brace starts a brace list is solely by | ||
| 10422 | ;; the context of the brace, not by its contents. | ||
| 10423 | ;; | ||
| 10420 | ;; Here, "brace list" does not include the body of an enum. | 10424 | ;; Here, "brace list" does not include the body of an enum. |
| 10421 | (save-excursion | 10425 | (save-excursion |
| 10422 | (let ((start (point)) | 10426 | (let ((start (point)) |
| @@ -10426,17 +10430,20 @@ comment at the start of cc-engine.el for more info." | |||
| 10426 | (and (c-major-mode-is 'pike-mode) | 10430 | (and (c-major-mode-is 'pike-mode) |
| 10427 | c-decl-block-key)) | 10431 | c-decl-block-key)) |
| 10428 | (braceassignp 'dontknow) | 10432 | (braceassignp 'dontknow) |
| 10429 | inexpr-brace-list bufpos macro-start res pos after-type-id-pos) | 10433 | inexpr-brace-list bufpos macro-start res pos after-type-id-pos |
| 10434 | in-paren) | ||
| 10430 | 10435 | ||
| 10431 | (setq res (c-backward-token-2 1 t lim)) | 10436 | (setq res (c-backward-token-2 1 t lim)) |
| 10432 | ;; Checks to do only on the first sexp before the brace. | 10437 | ;; Checks to do only on the first sexp before the brace. |
| 10433 | ;; Have we a C++ initialization, without an "="? | 10438 | ;; Have we a C++ initialization, without an "="? |
| 10434 | (if (and (c-major-mode-is 'c++-mode) | 10439 | (if (and (c-major-mode-is 'c++-mode) |
| 10435 | (cond | 10440 | (cond |
| 10436 | ((and (not (eq res 0)) | 10441 | ((and (or (not (eq res 0)) |
| 10442 | (eq (char-after) ?,)) | ||
| 10437 | (c-go-up-list-backward nil lim) ; FIXME!!! Check ; `lim' 2016-07-12. | 10443 | (c-go-up-list-backward nil lim) ; FIXME!!! Check ; `lim' 2016-07-12. |
| 10438 | (eq (char-after) ?\()) | 10444 | (eq (char-after) ?\()) |
| 10439 | (setq braceassignp 'c++-noassign)) | 10445 | (setq braceassignp 'c++-noassign |
| 10446 | in-paren 'in-paren)) | ||
| 10440 | ((looking-at c-pre-id-bracelist-key)) | 10447 | ((looking-at c-pre-id-bracelist-key)) |
| 10441 | ((looking-at c-return-key)) | 10448 | ((looking-at c-return-key)) |
| 10442 | ((and (looking-at c-symbol-start) | 10449 | ((and (looking-at c-symbol-start) |
| @@ -10445,9 +10452,11 @@ comment at the start of cc-engine.el for more info." | |||
| 10445 | (t nil)) | 10452 | (t nil)) |
| 10446 | (save-excursion | 10453 | (save-excursion |
| 10447 | (cond | 10454 | (cond |
| 10448 | ((not (eq res 0)) | 10455 | ((or (not (eq res 0)) |
| 10456 | (eq (char-after) ?,)) | ||
| 10449 | (and (c-go-up-list-backward nil lim) ; FIXME!!! Check `lim' 2016-07-12. | 10457 | (and (c-go-up-list-backward nil lim) ; FIXME!!! Check `lim' 2016-07-12. |
| 10450 | (eq (char-after) ?\())) | 10458 | (eq (char-after) ?\() |
| 10459 | (setq in-paren 'in-paren))) | ||
| 10451 | ((looking-at c-pre-id-bracelist-key)) | 10460 | ((looking-at c-pre-id-bracelist-key)) |
| 10452 | ((looking-at c-return-key)) | 10461 | ((looking-at c-return-key)) |
| 10453 | (t (setq after-type-id-pos (point)) | 10462 | (t (setq after-type-id-pos (point)) |
| @@ -10486,7 +10495,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10486 | (c-backward-syntactic-ws) | 10495 | (c-backward-syntactic-ws) |
| 10487 | (eq (char-before) ?\())) | 10496 | (eq (char-before) ?\())) |
| 10488 | ;; Single identifier between '(' and '{'. We have a bracelist. | 10497 | ;; Single identifier between '(' and '{'. We have a bracelist. |
| 10489 | (cons after-type-id-pos nil)) | 10498 | (cons after-type-id-pos 'in-paren)) |
| 10490 | 10499 | ||
| 10491 | (t | 10500 | (t |
| 10492 | (goto-char pos) | 10501 | (goto-char pos) |
| @@ -10544,7 +10553,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10544 | (braceassignp | 10553 | (braceassignp |
| 10545 | ;; We've hit the beginning of the aggregate list. | 10554 | ;; We've hit the beginning of the aggregate list. |
| 10546 | (c-beginning-of-statement-1 containing-sexp) | 10555 | (c-beginning-of-statement-1 containing-sexp) |
| 10547 | (cons (point) inexpr-brace-list)) | 10556 | (cons (point) (or in-paren inexpr-brace-list))) |
| 10548 | ((and after-type-id-pos | 10557 | ((and after-type-id-pos |
| 10549 | (save-excursion | 10558 | (save-excursion |
| 10550 | (when (eq (char-after) ?\;) | 10559 | (when (eq (char-after) ?\;) |
| @@ -10569,7 +10578,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10569 | nil nil)) | 10578 | nil nil)) |
| 10570 | (and (consp res) | 10579 | (and (consp res) |
| 10571 | (eq (car res) after-type-id-pos)))))) | 10580 | (eq (car res) after-type-id-pos)))))) |
| 10572 | (cons bufpos inexpr-brace-list)) | 10581 | (cons bufpos (or in-paren inexpr-brace-list))) |
| 10573 | ((eq (char-after) ?\;) | 10582 | ((eq (char-after) ?\;) |
| 10574 | ;; Brace lists can't contain a semicolon, so we're done. | 10583 | ;; Brace lists can't contain a semicolon, so we're done. |
| 10575 | ;; (setq containing-sexp nil) | 10584 | ;; (setq containing-sexp nil) |
| @@ -10593,12 +10602,16 @@ comment at the start of cc-engine.el for more info." | |||
| 10593 | (t t)))) ;; The caller can go up one level. | 10602 | (t t)))) ;; The caller can go up one level. |
| 10594 | ))) | 10603 | ))) |
| 10595 | 10604 | ||
| 10596 | (defun c-inside-bracelist-p (containing-sexp paren-state) | 10605 | (defun c-inside-bracelist-p (containing-sexp paren-state accept-in-paren) |
| 10597 | ;; return the buffer position of the beginning of the brace list | 10606 | ;; return the buffer position of the beginning of the brace list |
| 10598 | ;; statement if we're inside a brace list, otherwise return nil. | 10607 | ;; statement if we're inside a brace list, otherwise return nil. |
| 10599 | ;; CONTAINING-SEXP is the buffer pos of the innermost containing | 10608 | ;; CONTAINING-SEXP is the buffer pos of the innermost containing |
| 10600 | ;; paren. PAREN-STATE is the remainder of the state of enclosing | 10609 | ;; paren. PAREN-STATE is the remainder of the state of enclosing |
| 10601 | ;; braces | 10610 | ;; braces. ACCEPT-IN-PAREN is non-nil iff we will accept as a brace |
| 10611 | ;; list a brace directly enclosed in a parenthesis. | ||
| 10612 | ;; | ||
| 10613 | ;; The "brace list" here is recognized solely by its context, not by | ||
| 10614 | ;; its contents. | ||
| 10602 | ;; | 10615 | ;; |
| 10603 | ;; N.B.: This algorithm can potentially get confused by cpp macros | 10616 | ;; N.B.: This algorithm can potentially get confused by cpp macros |
| 10604 | ;; placed in inconvenient locations. It's a trade-off we make for | 10617 | ;; placed in inconvenient locations. It's a trade-off we make for |
| @@ -10613,17 +10626,11 @@ comment at the start of cc-engine.el for more info." | |||
| 10613 | ;; this will pick up array/aggregate init lists, even if they are nested. | 10626 | ;; this will pick up array/aggregate init lists, even if they are nested. |
| 10614 | (save-excursion | 10627 | (save-excursion |
| 10615 | (let ((bufpos t) | 10628 | (let ((bufpos t) |
| 10616 | lim next-containing) | 10629 | next-containing) |
| 10617 | (while (and (eq bufpos t) | 10630 | (while (and (eq bufpos t) |
| 10618 | containing-sexp) | 10631 | containing-sexp) |
| 10619 | (when paren-state | 10632 | (when paren-state |
| 10620 | (if (consp (car paren-state)) | 10633 | (setq next-containing (c-pull-open-brace paren-state))) |
| 10621 | (setq lim (cdr (car paren-state)) | ||
| 10622 | paren-state (cdr paren-state)) | ||
| 10623 | (setq lim (car paren-state))) | ||
| 10624 | (when paren-state | ||
| 10625 | (setq next-containing (car paren-state) | ||
| 10626 | paren-state (cdr paren-state)))) | ||
| 10627 | 10634 | ||
| 10628 | (goto-char containing-sexp) | 10635 | (goto-char containing-sexp) |
| 10629 | (if (c-looking-at-inexpr-block next-containing next-containing) | 10636 | (if (c-looking-at-inexpr-block next-containing next-containing) |
| @@ -10632,14 +10639,16 @@ comment at the start of cc-engine.el for more info." | |||
| 10632 | ;; containing sexp, so that c-looking-at-inexpr-block | 10639 | ;; containing sexp, so that c-looking-at-inexpr-block |
| 10633 | ;; doesn't check for an identifier before it. | 10640 | ;; doesn't check for an identifier before it. |
| 10634 | (setq bufpos nil) | 10641 | (setq bufpos nil) |
| 10635 | (when (or (not (eq (char-after) ?{)) | 10642 | (if (not (eq (char-after) ?{)) |
| 10636 | (eq (setq bufpos (c-looking-at-or-maybe-in-bracelist | 10643 | (setq bufpos nil) |
| 10637 | next-containing lim)) | 10644 | (when (eq (setq bufpos (c-looking-at-or-maybe-in-bracelist |
| 10638 | t)) | 10645 | next-containing next-containing)) |
| 10639 | (setq containing-sexp next-containing | 10646 | t) |
| 10640 | lim nil | 10647 | (setq containing-sexp next-containing |
| 10641 | next-containing nil)))) | 10648 | next-containing nil))))) |
| 10642 | (and (consp bufpos) (car bufpos)))))) | 10649 | (and (consp bufpos) |
| 10650 | (or accept-in-paren (not (eq (cdr bufpos) 'in-paren))) | ||
| 10651 | (car bufpos)))))) | ||
| 10643 | 10652 | ||
| 10644 | (defun c-looking-at-special-brace-list (&optional _lim) | 10653 | (defun c-looking-at-special-brace-list (&optional _lim) |
| 10645 | ;; If we're looking at the start of a pike-style list, i.e., `({Â })', | 10654 | ;; If we're looking at the start of a pike-style list, i.e., `({Â })', |
| @@ -10717,26 +10726,35 @@ comment at the start of cc-engine.el for more info." | |||
| 10717 | 10726 | ||
| 10718 | (defun c-looking-at-statement-block () | 10727 | (defun c-looking-at-statement-block () |
| 10719 | ;; Point is at an opening brace. If this is a statement block (i.e. the | 10728 | ;; Point is at an opening brace. If this is a statement block (i.e. the |
| 10720 | ;; elements in it are terminated by semicolons) return t. Otherwise, return | 10729 | ;; elements in the block are terminated by semicolons, or the block is |
| 10721 | ;; nil. | 10730 | ;; empty, or the block contains a keyword) return t. Otherwise, return nil. |
| 10722 | (let ((here (point))) | 10731 | (let ((here (point))) |
| 10723 | (prog1 | 10732 | (prog1 |
| 10724 | (if (c-go-list-forward) | 10733 | (if (c-go-list-forward) |
| 10725 | (let ((there (point))) | 10734 | (let ((there (point))) |
| 10726 | (backward-char) | 10735 | (backward-char) |
| 10727 | (c-syntactic-skip-backward | 10736 | (c-syntactic-skip-backward "^;," here t) |
| 10728 | "^;," here t) | ||
| 10729 | (cond | 10737 | (cond |
| 10730 | ((eq (char-before) ?\;) t) | 10738 | ((eq (char-before) ?\;) t) |
| 10731 | ((eq (char-before) ?,) nil) | 10739 | ((eq (char-before) ?,) nil) |
| 10732 | (t (goto-char here) | 10740 | (t ; We're at (1+ here). |
| 10733 | (forward-char) | 10741 | (cond |
| 10734 | (and (c-syntactic-re-search-forward "{" there t t) | 10742 | ((progn (c-forward-syntactic-ws) |
| 10735 | (progn (backward-char) | 10743 | (eq (point) (1- there))) |
| 10736 | (c-looking-at-statement-block)))))) | 10744 | t) |
| 10745 | ((c-syntactic-re-search-forward c-keywords-regexp there t) | ||
| 10746 | t) | ||
| 10747 | ((c-syntactic-re-search-forward "{" there t t) | ||
| 10748 | (backward-char) | ||
| 10749 | (c-looking-at-statement-block)) | ||
| 10750 | (t nil))))) | ||
| 10737 | (forward-char) | 10751 | (forward-char) |
| 10738 | (and (c-syntactic-re-search-forward "[;,]" nil t t) | 10752 | (cond |
| 10739 | (eq (char-before) ?\;))) | 10753 | ((c-syntactic-re-search-forward "[;,]" nil t t) |
| 10754 | (eq (char-before) ?\;)) | ||
| 10755 | ((c-syntactic-re-search-forward c-keywords-regexp nil t t) | ||
| 10756 | t) | ||
| 10757 | (t nil))) | ||
| 10740 | (goto-char here)))) | 10758 | (goto-char here)))) |
| 10741 | 10759 | ||
| 10742 | (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) | 10760 | (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) |
| @@ -11506,6 +11524,7 @@ comment at the start of cc-engine.el for more info." | |||
| 11506 | ;; The paren state outside `containing-sexp', or at | 11524 | ;; The paren state outside `containing-sexp', or at |
| 11507 | ;; `indent-point' if `containing-sexp' is nil. | 11525 | ;; `indent-point' if `containing-sexp' is nil. |
| 11508 | (paren-state (c-parse-state)) | 11526 | (paren-state (c-parse-state)) |
| 11527 | (state-cache (copy-tree paren-state)) | ||
| 11509 | ;; There's always at most one syntactic element which got | 11528 | ;; There's always at most one syntactic element which got |
| 11510 | ;; an anchor pos. It's stored in syntactic-relpos. | 11529 | ;; an anchor pos. It's stored in syntactic-relpos. |
| 11511 | syntactic-relpos | 11530 | syntactic-relpos |
| @@ -11668,7 +11687,7 @@ comment at the start of cc-engine.el for more info." | |||
| 11668 | (not (c-at-vsemi-p before-ws-ip)) | 11687 | (not (c-at-vsemi-p before-ws-ip)) |
| 11669 | (not (memq char-after-ip '(?\) ?\] ?,))) | 11688 | (not (memq char-after-ip '(?\) ?\] ?,))) |
| 11670 | (or (not (eq char-before-ip ?})) | 11689 | (or (not (eq char-before-ip ?})) |
| 11671 | (c-looking-at-inexpr-block-backward c-state-cache)) | 11690 | (c-looking-at-inexpr-block-backward state-cache)) |
| 11672 | (> (point) | 11691 | (> (point) |
| 11673 | (progn | 11692 | (progn |
| 11674 | ;; Ought to cache the result from the | 11693 | ;; Ought to cache the result from the |
| @@ -11746,7 +11765,7 @@ comment at the start of cc-engine.el for more info." | |||
| 11746 | (if containing-sexp | 11765 | (if containing-sexp |
| 11747 | (progn | 11766 | (progn |
| 11748 | (goto-char containing-sexp) | 11767 | (goto-char containing-sexp) |
| 11749 | (setq lim (c-most-enclosing-brace c-state-cache | 11768 | (setq lim (c-most-enclosing-brace state-cache |
| 11750 | containing-sexp)) | 11769 | containing-sexp)) |
| 11751 | (c-backward-to-block-anchor lim) | 11770 | (c-backward-to-block-anchor lim) |
| 11752 | (c-add-stmt-syntax 'case-label nil t lim paren-state)) | 11771 | (c-add-stmt-syntax 'case-label nil t lim paren-state)) |
| @@ -11772,7 +11791,7 @@ comment at the start of cc-engine.el for more info." | |||
| 11772 | 11791 | ||
| 11773 | (containing-sexp | 11792 | (containing-sexp |
| 11774 | (goto-char containing-sexp) | 11793 | (goto-char containing-sexp) |
| 11775 | (setq lim (c-most-enclosing-brace c-state-cache | 11794 | (setq lim (c-most-enclosing-brace state-cache |
| 11776 | containing-sexp)) | 11795 | containing-sexp)) |
| 11777 | (save-excursion | 11796 | (save-excursion |
| 11778 | (setq tmpsymbol | 11797 | (setq tmpsymbol |
| @@ -11816,7 +11835,7 @@ comment at the start of cc-engine.el for more info." | |||
| 11816 | (goto-char (cdr placeholder)) | 11835 | (goto-char (cdr placeholder)) |
| 11817 | (back-to-indentation) | 11836 | (back-to-indentation) |
| 11818 | (c-add-stmt-syntax tmpsymbol nil t | 11837 | (c-add-stmt-syntax tmpsymbol nil t |
| 11819 | (c-most-enclosing-brace c-state-cache (point)) | 11838 | (c-most-enclosing-brace state-cache (point)) |
| 11820 | paren-state) | 11839 | paren-state) |
| 11821 | (unless (eq (point) (cdr placeholder)) | 11840 | (unless (eq (point) (cdr placeholder)) |
| 11822 | (c-add-syntax (car placeholder)))) | 11841 | (c-add-syntax (car placeholder)))) |
| @@ -12239,11 +12258,11 @@ comment at the start of cc-engine.el for more info." | |||
| 12239 | (and (eq (char-before) ?}) | 12258 | (and (eq (char-before) ?}) |
| 12240 | (save-excursion | 12259 | (save-excursion |
| 12241 | (let ((start (point))) | 12260 | (let ((start (point))) |
| 12242 | (if (and c-state-cache | 12261 | (if (and state-cache |
| 12243 | (consp (car c-state-cache)) | 12262 | (consp (car state-cache)) |
| 12244 | (eq (cdar c-state-cache) (point))) | 12263 | (eq (cdar state-cache) (point))) |
| 12245 | ;; Speed up the backward search a bit. | 12264 | ;; Speed up the backward search a bit. |
| 12246 | (goto-char (caar c-state-cache))) | 12265 | (goto-char (caar state-cache))) |
| 12247 | (c-beginning-of-decl-1 containing-sexp) ; Can't use `lim' here. | 12266 | (c-beginning-of-decl-1 containing-sexp) ; Can't use `lim' here. |
| 12248 | (setq placeholder (point)) | 12267 | (setq placeholder (point)) |
| 12249 | (if (= start (point)) | 12268 | (if (= start (point)) |
| @@ -12400,7 +12419,8 @@ comment at the start of cc-engine.el for more info." | |||
| 12400 | ((and (eq char-after-ip ?{) | 12419 | ((and (eq char-after-ip ?{) |
| 12401 | (progn | 12420 | (progn |
| 12402 | (setq placeholder (c-inside-bracelist-p (point) | 12421 | (setq placeholder (c-inside-bracelist-p (point) |
| 12403 | paren-state)) | 12422 | paren-state |
| 12423 | nil)) | ||
| 12404 | (if placeholder | 12424 | (if placeholder |
| 12405 | (setq tmpsymbol '(brace-list-open . inexpr-class)) | 12425 | (setq tmpsymbol '(brace-list-open . inexpr-class)) |
| 12406 | (setq tmpsymbol '(block-open . inexpr-statement) | 12426 | (setq tmpsymbol '(block-open . inexpr-statement) |
| @@ -12482,7 +12502,7 @@ comment at the start of cc-engine.el for more info." | |||
| 12482 | (skip-chars-forward " \t")) | 12502 | (skip-chars-forward " \t")) |
| 12483 | (goto-char placeholder)) | 12503 | (goto-char placeholder)) |
| 12484 | (c-add-stmt-syntax 'arglist-cont-nonempty (list containing-sexp) t | 12504 | (c-add-stmt-syntax 'arglist-cont-nonempty (list containing-sexp) t |
| 12485 | (c-most-enclosing-brace c-state-cache (point)) | 12505 | (c-most-enclosing-brace state-cache (point)) |
| 12486 | paren-state)) | 12506 | paren-state)) |
| 12487 | 12507 | ||
| 12488 | ;; CASE 7G: we are looking at just a normal arglist | 12508 | ;; CASE 7G: we are looking at just a normal arglist |
| @@ -12523,7 +12543,11 @@ comment at the start of cc-engine.el for more info." | |||
| 12523 | (save-excursion | 12543 | (save-excursion |
| 12524 | (goto-char containing-sexp) | 12544 | (goto-char containing-sexp) |
| 12525 | (c-looking-at-special-brace-list))) | 12545 | (c-looking-at-special-brace-list))) |
| 12526 | (c-inside-bracelist-p containing-sexp paren-state)))) | 12546 | (c-inside-bracelist-p containing-sexp paren-state t) |
| 12547 | (save-excursion | ||
| 12548 | (goto-char containing-sexp) | ||
| 12549 | (and (eq (char-after) ?{) | ||
| 12550 | (not (c-looking-at-statement-block))))))) | ||
| 12527 | (cond | 12551 | (cond |
| 12528 | 12552 | ||
| 12529 | ;; CASE 9A: In the middle of a special brace list opener. | 12553 | ;; CASE 9A: In the middle of a special brace list opener. |
| @@ -12571,7 +12595,7 @@ comment at the start of cc-engine.el for more info." | |||
| 12571 | (= (point) containing-sexp))) | 12595 | (= (point) containing-sexp))) |
| 12572 | (if (eq (point) (c-point 'boi)) | 12596 | (if (eq (point) (c-point 'boi)) |
| 12573 | (c-add-syntax 'brace-list-close (point)) | 12597 | (c-add-syntax 'brace-list-close (point)) |
| 12574 | (setq lim (c-most-enclosing-brace c-state-cache (point))) | 12598 | (setq lim (c-most-enclosing-brace state-cache (point))) |
| 12575 | (c-beginning-of-statement-1 lim nil nil t) | 12599 | (c-beginning-of-statement-1 lim nil nil t) |
| 12576 | (c-add-stmt-syntax 'brace-list-close nil t lim paren-state))) | 12600 | (c-add-stmt-syntax 'brace-list-close nil t lim paren-state))) |
| 12577 | 12601 | ||
| @@ -12597,7 +12621,7 @@ comment at the start of cc-engine.el for more info." | |||
| 12597 | (goto-char containing-sexp)) | 12621 | (goto-char containing-sexp)) |
| 12598 | (if (eq (point) (c-point 'boi)) | 12622 | (if (eq (point) (c-point 'boi)) |
| 12599 | (c-add-syntax 'brace-list-intro (point)) | 12623 | (c-add-syntax 'brace-list-intro (point)) |
| 12600 | (setq lim (c-most-enclosing-brace c-state-cache (point))) | 12624 | (setq lim (c-most-enclosing-brace state-cache (point))) |
| 12601 | (c-beginning-of-statement-1 lim) | 12625 | (c-beginning-of-statement-1 lim) |
| 12602 | (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state))) | 12626 | (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state))) |
| 12603 | 12627 | ||
| @@ -12619,7 +12643,7 @@ comment at the start of cc-engine.el for more info." | |||
| 12619 | ((and (not (memq char-before-ip '(?\; ?:))) | 12643 | ((and (not (memq char-before-ip '(?\; ?:))) |
| 12620 | (not (c-at-vsemi-p before-ws-ip)) | 12644 | (not (c-at-vsemi-p before-ws-ip)) |
| 12621 | (or (not (eq char-before-ip ?})) | 12645 | (or (not (eq char-before-ip ?})) |
| 12622 | (c-looking-at-inexpr-block-backward c-state-cache)) | 12646 | (c-looking-at-inexpr-block-backward state-cache)) |
| 12623 | (> (point) | 12647 | (> (point) |
| 12624 | (save-excursion | 12648 | (save-excursion |
| 12625 | (c-beginning-of-statement-1 containing-sexp) | 12649 | (c-beginning-of-statement-1 containing-sexp) |
| @@ -12753,7 +12777,7 @@ comment at the start of cc-engine.el for more info." | |||
| 12753 | (skip-chars-forward " \t")) | 12777 | (skip-chars-forward " \t")) |
| 12754 | (goto-char placeholder)) | 12778 | (goto-char placeholder)) |
| 12755 | (c-add-stmt-syntax 'template-args-cont (list containing-<) t | 12779 | (c-add-stmt-syntax 'template-args-cont (list containing-<) t |
| 12756 | (c-most-enclosing-brace c-state-cache (point)) | 12780 | (c-most-enclosing-brace state-cache (point)) |
| 12757 | paren-state)) | 12781 | paren-state)) |
| 12758 | 12782 | ||
| 12759 | ;; CASE 17: Statement or defun catchall. | 12783 | ;; CASE 17: Statement or defun catchall. |
| @@ -12827,7 +12851,7 @@ comment at the start of cc-engine.el for more info." | |||
| 12827 | (goto-char (cdr placeholder)) | 12851 | (goto-char (cdr placeholder)) |
| 12828 | (back-to-indentation) | 12852 | (back-to-indentation) |
| 12829 | (c-add-stmt-syntax tmpsymbol nil t | 12853 | (c-add-stmt-syntax tmpsymbol nil t |
| 12830 | (c-most-enclosing-brace c-state-cache (point)) | 12854 | (c-most-enclosing-brace state-cache (point)) |
| 12831 | paren-state) | 12855 | paren-state) |
| 12832 | (if (/= (point) (cdr placeholder)) | 12856 | (if (/= (point) (cdr placeholder)) |
| 12833 | (c-add-syntax (car placeholder)))) | 12857 | (c-add-syntax (car placeholder)))) |
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 41415943a58..5ba09789097 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -1615,7 +1615,11 @@ Calls REPORT-FN directly." | |||
| 1615 | (generate-new-buffer " *checkdoc-temp*"))) | 1615 | (generate-new-buffer " *checkdoc-temp*"))) |
| 1616 | (unwind-protect | 1616 | (unwind-protect |
| 1617 | (save-excursion | 1617 | (save-excursion |
| 1618 | (checkdoc-current-buffer t)) | 1618 | ;; checkdoc-current-buffer can error if there are |
| 1619 | ;; unbalanced parens, for example, but this shouldn't | ||
| 1620 | ;; disable the backend (bug#29176). | ||
| 1621 | (ignore-errors | ||
| 1622 | (checkdoc-current-buffer t))) | ||
| 1619 | (kill-buffer checkdoc-diagnostic-buffer))) | 1623 | (kill-buffer checkdoc-diagnostic-buffer))) |
| 1620 | (funcall report-fn | 1624 | (funcall report-fn |
| 1621 | (cl-loop for (text start end _unfixable) in | 1625 | (cl-loop for (text start end _unfixable) in |
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 0d200f01b34..1930f4fc832 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -334,7 +334,8 @@ region is invalid." | |||
| 334 | (end (or (and sexp-end | 334 | (end (or (and sexp-end |
| 335 | (not (= sexp-end beg)) | 335 | (not (= sexp-end beg)) |
| 336 | sexp-end) | 336 | sexp-end) |
| 337 | (ignore-errors (goto-char (1+ beg))))) | 337 | (and (< (goto-char (1+ beg)) (point-max)) |
| 338 | (point)))) | ||
| 338 | (safe-end (or end | 339 | (safe-end (or end |
| 339 | (fallback-eol beg)))) | 340 | (fallback-eol beg)))) |
| 340 | (cons (if end beg (fallback-bol)) | 341 | (cons (if end beg (fallback-bol)) |
| @@ -342,7 +343,8 @@ region is invalid." | |||
| 342 | (let* ((beg (fallback-bol)) | 343 | (let* ((beg (fallback-bol)) |
| 343 | (end (fallback-eol beg))) | 344 | (end (fallback-eol beg))) |
| 344 | (cons beg end))))))) | 345 | (cons beg end))))))) |
| 345 | (error (flymake-log :warning "Invalid region line=%s col=%s" line col)))) | 346 | (error (flymake-log :warning "Invalid region line=%s col=%s" line col) |
| 347 | nil))) | ||
| 346 | 348 | ||
| 347 | (defvar flymake-diagnostic-functions nil | 349 | (defvar flymake-diagnostic-functions nil |
| 348 | "Special hook of Flymake backends that check a buffer. | 350 | "Special hook of Flymake backends that check a buffer. |
| @@ -1139,7 +1141,8 @@ POS can be a buffer position or a button" | |||
| 1139 | 1141 | ||
| 1140 | (defun flymake--diagnostics-buffer-entries () | 1142 | (defun flymake--diagnostics-buffer-entries () |
| 1141 | (with-current-buffer flymake--diagnostics-buffer-source | 1143 | (with-current-buffer flymake--diagnostics-buffer-source |
| 1142 | (cl-loop for diag in (flymake-diagnostics) | 1144 | (cl-loop for diag in |
| 1145 | (cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg) | ||
| 1143 | for (line . col) = | 1146 | for (line . col) = |
| 1144 | (save-excursion | 1147 | (save-excursion |
| 1145 | (goto-char (flymake--diag-beg diag)) | 1148 | (goto-char (flymake--diag-beg diag)) |
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index fbd905b8bc7..109d55ad39d 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el | |||
| @@ -210,7 +210,7 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." | |||
| 210 | (let ((exp (url-cookie-expires cookie))) | 210 | (let ((exp (url-cookie-expires cookie))) |
| 211 | (and (> (length exp) 0) | 211 | (and (> (length exp) 0) |
| 212 | (condition-case () | 212 | (condition-case () |
| 213 | (time-less-p nil (date-to-time exp)) | 213 | (time-less-p (date-to-time exp) nil) |
| 214 | (error nil))))) | 214 | (error nil))))) |
| 215 | 215 | ||
| 216 | (defun url-cookie-retrieve (host &optional localpart secure) | 216 | (defun url-cookie-retrieve (host &optional localpart secure) |
diff --git a/src/alloc.c b/src/alloc.c index f479226845a..ae892e49d7d 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1760,7 +1760,7 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = | |||
| 1760 | 1760 | ||
| 1761 | #ifdef GC_CHECK_STRING_BYTES | 1761 | #ifdef GC_CHECK_STRING_BYTES |
| 1762 | 1762 | ||
| 1763 | #define SDATA_SIZE(NBYTES) FLEXSIZEOF (struct sdata, data, NBYTES) | 1763 | #define SDATA_SIZE(NBYTES) FLEXSIZEOF (struct sdata, data, (NBYTES) + 1) |
| 1764 | 1764 | ||
| 1765 | #else /* not GC_CHECK_STRING_BYTES */ | 1765 | #else /* not GC_CHECK_STRING_BYTES */ |
| 1766 | 1766 | ||
diff --git a/src/dispextern.h b/src/dispextern.h index 2f55d8cbc87..430afbf09a3 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3452,7 +3452,14 @@ void gamma_correct (struct frame *, COLORREF *); | |||
| 3452 | void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); | 3452 | void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); |
| 3453 | void x_change_tool_bar_height (struct frame *f, int); | 3453 | void x_change_tool_bar_height (struct frame *f, int); |
| 3454 | 3454 | ||
| 3455 | /* The frame used to display a tooltip. | ||
| 3456 | |||
| 3457 | Note: In a GTK build with non-zero x_gtk_use_system_tooltips, this | ||
| 3458 | variable holds the frame that shows the tooltip, not the frame of | ||
| 3459 | the tooltip itself, so checking whether a frame is a tooltip frame | ||
| 3460 | cannot just compare the frame to what this variable holds. */ | ||
| 3455 | extern Lisp_Object tip_frame; | 3461 | extern Lisp_Object tip_frame; |
| 3462 | |||
| 3456 | extern Window tip_window; | 3463 | extern Window tip_window; |
| 3457 | extern frame_parm_handler x_frame_parm_handlers[]; | 3464 | extern frame_parm_handler x_frame_parm_handlers[]; |
| 3458 | 3465 | ||
diff --git a/src/frame.c b/src/frame.c index fe1709e6ede..2b32751c0d3 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1472,7 +1472,11 @@ DEFUN ("frame-list", Fframe_list, Sframe_list, | |||
| 1472 | Lisp_Object frames; | 1472 | Lisp_Object frames; |
| 1473 | frames = Fcopy_sequence (Vframe_list); | 1473 | frames = Fcopy_sequence (Vframe_list); |
| 1474 | #ifdef HAVE_WINDOW_SYSTEM | 1474 | #ifdef HAVE_WINDOW_SYSTEM |
| 1475 | if (FRAMEP (tip_frame)) | 1475 | if (FRAMEP (tip_frame) |
| 1476 | #ifdef USE_GTK | ||
| 1477 | && !NILP (Fframe_parameter (tip_frame, Qtooltip)) | ||
| 1478 | #endif | ||
| 1479 | ) | ||
| 1476 | frames = Fdelq (tip_frame, frames); | 1480 | frames = Fdelq (tip_frame, frames); |
| 1477 | #endif | 1481 | #endif |
| 1478 | return frames; | 1482 | return frames; |
diff --git a/src/xdisp.c b/src/xdisp.c index f1a6c622d09..f1c6b9ff699 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -16066,8 +16066,10 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, | |||
| 16066 | since the handling of this_line_start_pos, etc., in redisplay | 16066 | since the handling of this_line_start_pos, etc., in redisplay |
| 16067 | handles the same cases. */ | 16067 | handles the same cases. */ |
| 16068 | && !EQ (window, minibuf_window) | 16068 | && !EQ (window, minibuf_window) |
| 16069 | && (FRAME_WINDOW_P (f) | 16069 | /* When overlay arrow is shown in current buffer, point movement |
| 16070 | || !overlay_arrow_in_current_buffer_p ())) | 16070 | is no longer "simple", as it typically causes the overlay |
| 16071 | arrow to move as well. */ | ||
| 16072 | && !overlay_arrow_in_current_buffer_p ()) | ||
| 16071 | { | 16073 | { |
| 16072 | int this_scroll_margin, top_scroll_margin; | 16074 | int this_scroll_margin, top_scroll_margin; |
| 16073 | struct glyph_row *row = NULL; | 16075 | struct glyph_row *row = NULL; |
| @@ -17698,7 +17700,11 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 17698 | /* Don't try to reuse the display if windows have been split | 17700 | /* Don't try to reuse the display if windows have been split |
| 17699 | or such. */ | 17701 | or such. */ |
| 17700 | || windows_or_buffers_changed | 17702 | || windows_or_buffers_changed |
| 17701 | || f->cursor_type_changed) | 17703 | || f->cursor_type_changed |
| 17704 | /* This function cannot handle buffers where the overlay arrow | ||
| 17705 | is shown on the fringes, because if the arrow position | ||
| 17706 | changes, we cannot just reuse the current matrix. */ | ||
| 17707 | || overlay_arrow_in_current_buffer_p ()) | ||
| 17702 | return false; | 17708 | return false; |
| 17703 | 17709 | ||
| 17704 | /* Can't do this if showing trailing whitespace. */ | 17710 | /* Can't do this if showing trailing whitespace. */ |
| @@ -21126,7 +21132,13 @@ should_produce_line_number (struct it *it) | |||
| 21126 | 21132 | ||
| 21127 | #ifdef HAVE_WINDOW_SYSTEM | 21133 | #ifdef HAVE_WINDOW_SYSTEM |
| 21128 | /* Don't display line number in tooltip frames. */ | 21134 | /* Don't display line number in tooltip frames. */ |
| 21129 | if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame)) | 21135 | if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame) |
| 21136 | #ifdef USE_GTK | ||
| 21137 | /* GTK builds store in tip_frame the frame that shows the tip, | ||
| 21138 | so we need an additional test. */ | ||
| 21139 | && !NILP (Fframe_parameter (tip_frame, Qtooltip)) | ||
| 21140 | #endif | ||
| 21141 | ) | ||
| 21130 | return false; | 21142 | return false; |
| 21131 | #endif | 21143 | #endif |
| 21132 | 21144 | ||
diff --git a/src/xfns.c b/src/xfns.c index 9022e4a9674..83fc07dc6cb 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -4915,7 +4915,11 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4915 | struct frame *f = XFRAME (frame); | 4915 | struct frame *f = XFRAME (frame); |
| 4916 | 4916 | ||
| 4917 | if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo | 4917 | if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo |
| 4918 | && !EQ (frame, tip_frame)) | 4918 | && !(EQ (frame, tip_frame) |
| 4919 | #ifdef USE_GTK | ||
| 4920 | && !NILP (Fframe_parameter (tip_frame, Qtooltip)) | ||
| 4921 | #endif | ||
| 4922 | )) | ||
| 4919 | { | 4923 | { |
| 4920 | GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); | 4924 | GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); |
| 4921 | 4925 | ||
diff --git a/src/xterm.c b/src/xterm.c index dbb8349452d..e11cde771ab 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -997,7 +997,11 @@ x_update_begin (struct frame *f) | |||
| 997 | { | 997 | { |
| 998 | #ifdef USE_CAIRO | 998 | #ifdef USE_CAIRO |
| 999 | if (! NILP (tip_frame) && XFRAME (tip_frame) == f | 999 | if (! NILP (tip_frame) && XFRAME (tip_frame) == f |
| 1000 | && ! FRAME_VISIBLE_P (f)) | 1000 | && ! FRAME_VISIBLE_P (f) |
| 1001 | #ifdef USE_GTK | ||
| 1002 | && !NILP (Fframe_parameter (tip_frame, Qtooltip)) | ||
| 1003 | #endif | ||
| 1004 | ) | ||
| 1001 | return; | 1005 | return; |
| 1002 | 1006 | ||
| 1003 | if (! FRAME_CR_SURFACE (f)) | 1007 | if (! FRAME_CR_SURFACE (f)) |
| @@ -9960,7 +9964,11 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 9960 | /* Don't change the size of a tip frame; there's no point in | 9964 | /* Don't change the size of a tip frame; there's no point in |
| 9961 | doing it because it's done in Fx_show_tip, and it leads to | 9965 | doing it because it's done in Fx_show_tip, and it leads to |
| 9962 | problems because the tip frame has no widget. */ | 9966 | problems because the tip frame has no widget. */ |
| 9963 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) | 9967 | if (NILP (tip_frame) || XFRAME (tip_frame) != f |
| 9968 | #ifdef USE_GTK | ||
| 9969 | || NILP (Fframe_parameter (tip_frame, Qtooltip)) | ||
| 9970 | #endif | ||
| 9971 | ) | ||
| 9964 | { | 9972 | { |
| 9965 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 9973 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 9966 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, | 9974 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, |
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index c60f9100345..05214e7a927 100644 --- a/test/lisp/progmodes/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el | |||
| @@ -114,17 +114,24 @@ SEVERITY-PREDICATE is used to setup | |||
| 114 | (flymake-tests--with-flymake ("test.pl") | 114 | (flymake-tests--with-flymake ("test.pl") |
| 115 | (flymake-goto-next-error) | 115 | (flymake-goto-next-error) |
| 116 | (should (eq 'flymake-warning (face-at-point))) | 116 | (should (eq 'flymake-warning (face-at-point))) |
| 117 | (flymake-goto-next-error) | 117 | (goto-char (point-max)) |
| 118 | (flymake-goto-prev-error) | ||
| 118 | (should (eq 'flymake-error (face-at-point))))) | 119 | (should (eq 'flymake-error (face-at-point))))) |
| 119 | 120 | ||
| 120 | (ert-deftest ruby-backend () | 121 | (ert-deftest ruby-backend () |
| 121 | "Test the ruby backend" | 122 | "Test the ruby backend" |
| 122 | (skip-unless (executable-find "ruby")) | 123 | (skip-unless (executable-find "ruby")) |
| 123 | (flymake-tests--with-flymake ("test.rb") | 124 | ;; Some versions of ruby fail if HOME doesn't exist (bug#29187). |
| 124 | (flymake-goto-next-error) | 125 | (let* ((tempdir (make-temp-file "flymake-tests-ruby" t)) |
| 125 | (should (eq 'flymake-warning (face-at-point))) | 126 | (process-environment (cons (format "HOME=%s" tempdir) |
| 126 | (flymake-goto-next-error) | 127 | process-environment))) |
| 127 | (should (eq 'flymake-error (face-at-point))))) | 128 | (unwind-protect |
| 129 | (flymake-tests--with-flymake ("test.rb") | ||
| 130 | (flymake-goto-next-error) | ||
| 131 | (should (eq 'flymake-warning (face-at-point))) | ||
| 132 | (flymake-goto-next-error) | ||
| 133 | (should (eq 'flymake-error (face-at-point)))) | ||
| 134 | (delete-directory tempdir t)))) | ||
| 128 | 135 | ||
| 129 | (ert-deftest different-diagnostic-types () | 136 | (ert-deftest different-diagnostic-types () |
| 130 | "Test GCC warning via function predicate." | 137 | "Test GCC warning via function predicate." |