emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 1fa0766 1/2: ; Merge from emacs-26


From: Noam Postavsky
Subject: [Emacs-diffs] master 1fa0766 1/2: ; Merge from emacs-26
Date: Sat, 11 Nov 2017 11:15:24 -0500 (EST)

branch: master
commit 1fa0766cfa17e37be77a1566dbc775ab4ce7ff2e
Merge: 1ef6d2b 9533d76
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    ; 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
---
 doc/emacs/files.texi                 |   3 +
 doc/emacs/mini.texi                  |  24 +++++-
 lisp/desktop.el                      |   8 +-
 lisp/dired-aux.el                    |   6 +-
 lisp/files.el                        |  30 +++++++-
 lisp/help.el                         |  16 ++--
 lisp/isearch.el                      |   7 +-
 lisp/man.el                          |   3 +-
 lisp/minibuffer.el                   |  11 ++-
 lisp/progmodes/cc-engine.el          | 140 ++++++++++++++++++++---------------
 lisp/progmodes/elisp-mode.el         |   6 +-
 lisp/progmodes/flymake.el            |   9 ++-
 lisp/url/url-cookie.el               |   2 +-
 src/alloc.c                          |   2 +-
 src/dispextern.h                     |   7 ++
 src/frame.c                          |   6 +-
 src/xdisp.c                          |  20 ++++-
 src/xfns.c                           |   6 +-
 src/xterm.c                          |  12 ++-
 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 2c4a0ca..dc59e13 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -63,6 +63,9 @@ completing up to a nonexistent file name, Emacs prints
 @samp{[Confirm]} and you must type a second @key{RET} to confirm.
 @xref{Completion Exit}, for details.
 
+Minibuffer history commands offer some special features for reading
+file names, see @ref{Minibuffer History}.
+
 @cindex default directory
 @vindex default-directory
 @vindex insert-default-directory
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 83e7f3b..93f9142 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
 specifies the file @file{/u2/emacs/src/buffer.c}.  @xref{File Names},
 for information about the default directory.
 
-  You can specify the parent directory with @file{..}:
+  Alternative defaults for the file name you may want are available by
+typing @kbd{M-n}, see @ref{Minibuffer History}.
+
+  You can specify a file in the parent directory with @file{..}:
 @file{/a/b/../foo.el} is equivalent to @file{/a/foo.el}.
 Alternatively, you can use @address@hidden to kill directory names
 backwards (@pxref{Words}).
@@ -609,8 +612,6 @@ Move to a later item in the minibuffer history that matches
 
 @kindex M-p @r{(minibuffer history)}
 @kindex M-n @r{(minibuffer history)}
address@hidden UP @r{(minibuffer history)}
address@hidden DOWN @r{(minibuffer history)}
 @findex next-history-element
 @findex previous-history-element
   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
 arguments: values that you are likely to enter.  You can think of this
 as moving through the ``future history''.
 
address@hidden future history for file names
address@hidden minibuffer defaults for file names
address@hidden file-name-at-point-functions
+  The ``future history'' for file names includes several possible
+alternatives you may find useful, such as the file name or the URL at
+point in the current buffer.  The defaults put into the ``future
+history'' in this case are controlled by the functions mentioned in
+the value of the option @code{file-name-at-point-functions}.  By
+default, its value invokes the @code{ffap} package (@pxref{FFAP}),
+which tries to guess the default file or URL from the text around
+point.  To disable this guessing, customize the option to a @code{nil}
+value, then the ``future history'' of file names will include only the
+file, if any, visited by the current buffer, and the default
+directory.
+
 @findex previous-line-or-history-element
 @findex next-line-or-history-element
address@hidden UP @r{(minibuffer history)}
address@hidden DOWN @r{(minibuffer history)}
   The arrow keys @address@hidden and @address@hidden work like
 @kbd{M-p} and @kbd{M-n}, but if the current history item is longer
 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 2a5ec61..5257c60 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1240,7 +1240,13 @@ Using it may cause conflicts.  Use it anyway? " 
owner)))))
            ;; disabled when loading the desktop fails with errors,
            ;; thus not overwriting the desktop with broken contents.
            (setq desktop-autosave-was-enabled
-                 (memq 'desktop-auto-save-set-timer 
window-configuration-change-hook))
+                 (memq 'desktop-auto-save-set-timer
+                        ;; Use the toplevel value of the hook, in case some
+                        ;; feature makes window-configuration-change-hook
+                        ;; buffer-local, and puts there stuff which
+                        ;; doesn't include our timer.
+                        (default-toplevel-value
+                          'window-configuration-change-hook)))
            (desktop-auto-save-disable)
            ;; Evaluate desktop buffer and remember when it was modified.
            (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 94938cf..3f99129 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2768,9 +2768,9 @@ Intended to be added to `isearch-mode-hook'."
   (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t))
 
 (defun dired-isearch-filter-filenames (beg end)
-  "Test whether the current search hit is a file name.
-Return non-nil if the text from BEG to END is part of a file
-name (has the text property `dired-filename')."
+  "Test whether some part of the current search match is inside a file name.
+This function returns non-nil if some part of the text between BEG and END
+is part of a file name (i.e., has the text property `dired-filename')."
   (text-property-not-all (min beg end) (max beg end)
                         'dired-filename nil))
 
diff --git a/lisp/files.el b/lisp/files.el
index cda2c1a..e3a34af 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1560,7 +1560,15 @@ Switch to a buffer visiting file FILENAME,
 creating one if none already exists.
 Interactively, the default if you just type RET is the current directory,
 but the visited file name is available through the minibuffer history:
-type M-n to pull it into the minibuffer.
+type \\[next-history-element] to pull it into the minibuffer.
+
+The first time \\[next-history-element] is used after Emacs prompts for
+the file name, the result is affected by `file-name-at-point-functions',
+which by default try to guess the file name by looking at point in the
+current buffer.  Customize the value of `file-name-at-point-functions'
+or set it to nil, if you want only the visited file name and the
+current directory to be available on first \\[next-history-element]
+request.
 
 You can visit files on remote machines by specifying something
 like /ssh:SOME_REMOTE_MACHINE:FILE for the file name.  You can
@@ -1591,7 +1599,15 @@ an existing one.  See the function `display-buffer'.
 
 Interactively, the default if you just type RET is the current directory,
 but the visited file name is available through the minibuffer history:
-type M-n to pull it into the minibuffer.
+type \\[next-history-element] to pull it into the minibuffer.
+
+The first time \\[next-history-element] is used after Emacs prompts for
+the file name, the result is affected by `file-name-at-point-functions',
+which by default try to guess the file name by looking at point in the
+current buffer.  Customize the value of `file-name-at-point-functions'
+or set it to nil, if you want only the visited file name and the
+current directory to be available on first \\[next-history-element]
+request.
 
 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
 expand wildcards (if any) and visit multiple files."
@@ -1615,7 +1631,15 @@ an existing one.  See the function `display-buffer'.
 
 Interactively, the default if you just type RET is the current directory,
 but the visited file name is available through the minibuffer history:
-type M-n to pull it into the minibuffer.
+type \\[next-history-element] to pull it into the minibuffer.
+
+The first time \\[next-history-element] is used after Emacs prompts for
+the file name, the result is affected by `file-name-at-point-functions',
+which by default try to guess the file name by looking at point in the
+current buffer.  Customize the value of `file-name-at-point-functions'
+or set it to nil, if you want only the visited file name and the
+current directory to be available on first \\[next-history-element]
+request.
 
 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
 expand wildcards (if any) and visit multiple files."
diff --git a/lisp/help.el b/lisp/help.el
index bc8035d..fbb9fc8 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -717,7 +717,7 @@ with `mouse-movement' events."
         (cursor-in-echo-area t)
         saved-yank-menu)
     (unwind-protect
-        (let (key)
+        (let (key down-ev)
           ;; If yank-menu is empty, populate it temporarily, so that
           ;; "Select and Paste" menu can generate a complete event.
           (when (null (cdr yank-menu))
@@ -743,17 +743,21 @@ Describe the following key, mouse click, or menu item: "))
                 (let ((last-idx (1- (length key))))
                   (and (eventp (aref key last-idx))
                        (memq 'down (event-modifiers (aref key last-idx)))))
-                (or (and (eventp (aref key 0))
-                         (memq 'down (event-modifiers (aref key 0)))
+                (or (and (eventp (setq down-ev (aref key 0)))
+                         (memq 'down (event-modifiers down-ev))
                          ;; However, for the C-down-mouse-2 popup
                          ;; menu, there is no subsequent up-event.  In
                          ;; this case, the up-event is the next
                          ;; element in the supplied vector.
                          (= (length key) 1))
                     (and (> (length key) 1)
-                         (eventp (aref key 1))
-                         (memq 'down (event-modifiers (aref key 1)))))
-                (read-event))))
+                         (eventp (setq down-ev (aref key 1)))
+                         (memq 'down (event-modifiers down-ev))))
+                (if (and (terminal-parameter nil 'xterm-mouse-mode)
+                         (equal (terminal-parameter nil 'xterm-mouse-last-down)
+                                down-ev))
+                    (aref (read-key-sequence-vector nil) 0)
+                  (read-event)))))
       ;; Put yank-menu back as it was, if we changed it.
       (when saved-yank-menu
         (setq yank-menu (copy-sequence saved-yank-menu))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 7c576a6..13fa97e 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -128,9 +128,10 @@ a tab, a carriage return (control-M), a newline, and `]+'."
   "If t incremental search/query-replace can match hidden text.
 A nil value means don't match invisible text.
 When the value is `open', if the text matched is made invisible by
-an overlay having an `invisible' property and that overlay has a property
-`isearch-open-invisible', then incremental search will show the contents.
-\(This applies when using `outline.el' and `hideshow.el'.)
+an overlay having a non-nil `invisible' property, and that overlay
+has a non-nil property `isearch-open-invisible', then incremental
+search will show the hidden text.  (This applies when using `outline.el'
+and `hideshow.el'.)
 
 To temporarily change the value for an active incremental search,
 use \\<isearch-mode-map>\\[isearch-toggle-invisible].
diff --git a/lisp/man.el b/lisp/man.el
index 7a892c6..f7b1609 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1522,7 +1522,8 @@ The following key bindings are currently in effect in the 
buffer:
       (let ((section (match-string 1)))
         (unless (member section Man--sections)
           (push section Man--sections)))
-      (forward-line 1))))
+      (forward-line 1)))
+  (setq Man--sections (nreverse Man--sections)))
 
 (defsubst Man-build-references-alist ()
   "Build the list of references (in the SEE ALSO section)."
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 77fddc3..3b1d6f4 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -896,8 +896,15 @@ This overrides the defaults specified in 
`completion-category-defaults'."
   ;; than from completion-extra-properties) because it may apply only to some
   ;; part of the string (e.g. substitute-in-file-name).
   (let ((requote
-         (when (completion-metadata-get metadata 'completion--unquote-requote)
-           (cl-assert (functionp table))
+         (when (and
+                (completion-metadata-get metadata 'completion--unquote-requote)
+                ;; Sometimes a table's metadata is used on another
+                ;; table (typically that other table is just a list taken
+                ;; from the output of `all-completions' or something 
equivalent,
+                ;; for progressive refinement).  See bug#28898 and bug#16274.
+                ;; FIXME: Rather than do nothing, we should somehow call
+                ;; the original table, in that case!
+                (functionp table))
            (let ((new (funcall table string point 'completion--unquote)))
              (setq string (pop new))
              (setq table (pop new))
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 6f39cc6..8ec01e1 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."
 (defun c-looking-at-or-maybe-in-bracelist (&optional containing-sexp lim)
   ;; Point is at an open brace.  If this starts a brace list, return a list
   ;; whose car is the buffer position of the start of the construct which
-  ;; introduces the list, and whose cdr is t if we have parsed a keyword
-  ;; matching `c-opt-inexpr-brace-list-key' (e.g. Java's "new"), nil
-  ;; otherwise.  Otherwise, if point might be inside an enclosing brace list,
-  ;; return t.  If point is definitely neither at nor in a brace list, return
-  ;; nil.
+  ;; introduces the list, and whose cdr is the symbol `in-paren' if the brace
+  ;; is directly enclosed in a parenthesis form (i.e. an arglist), t if we
+  ;; have parsed a keyword matching `c-opt-inexpr-brace-list-key' (e.g. Java's
+  ;; "new"), nil otherwise.  Otherwise, if point might be inside an enclosing
+  ;; brace list, return t.  If point is definitely neither at nor in a brace
+  ;; list, return nil.
   ;;
   ;; CONTAINING-SEXP is the position of the brace/paren/bracket enclosing
   ;; POINT, or nil if there is no such position, or we do not know it.  LIM is
   ;; a backward search limit.
   ;;
+  ;; The determination of whether the brace starts a brace list is solely by
+  ;; the context of the brace, not by its contents.
+  ;;
   ;; Here, "brace list" does not include the body of an enum.
   (save-excursion
     (let ((start (point))
@@ -10426,17 +10430,20 @@ comment at the start of cc-engine.el for more info."
           (and (c-major-mode-is 'pike-mode)
                c-decl-block-key))
          (braceassignp 'dontknow)
-         inexpr-brace-list bufpos macro-start res pos after-type-id-pos)
+         inexpr-brace-list bufpos macro-start res pos after-type-id-pos
+         in-paren)
 
       (setq res (c-backward-token-2 1 t lim))
       ;; Checks to do only on the first sexp before the brace.
       ;; Have we a C++ initialization, without an "="?
       (if (and (c-major-mode-is 'c++-mode)
               (cond
-               ((and (not (eq res 0))
+               ((and (or (not (eq res 0))
+                         (eq (char-after) ?,))
                      (c-go-up-list-backward nil lim) ; FIXME!!! Check ; `lim' 
2016-07-12.
                      (eq (char-after) ?\())
-                (setq braceassignp 'c++-noassign))
+                (setq braceassignp 'c++-noassign
+                      in-paren 'in-paren))
                ((looking-at c-pre-id-bracelist-key))
                ((looking-at c-return-key))
                ((and (looking-at c-symbol-start)
@@ -10445,9 +10452,11 @@ comment at the start of cc-engine.el for more info."
                (t nil))
               (save-excursion
                 (cond
-                 ((not (eq res 0))
+                 ((or (not (eq res 0))
+                      (eq (char-after) ?,))
                   (and (c-go-up-list-backward nil lim) ; FIXME!!! Check `lim' 
2016-07-12.
-                       (eq (char-after) ?\()))
+                       (eq (char-after) ?\()
+                       (setq in-paren 'in-paren)))
                  ((looking-at c-pre-id-bracelist-key))
                  ((looking-at c-return-key))
                  (t (setq after-type-id-pos (point))
@@ -10486,7 +10495,7 @@ comment at the start of cc-engine.el for more info."
               (c-backward-syntactic-ws)
               (eq (char-before) ?\()))
        ;; Single identifier between '(' and '{'.  We have a bracelist.
-       (cons after-type-id-pos nil))
+       (cons after-type-id-pos 'in-paren))
 
        (t
        (goto-char pos)
@@ -10544,7 +10553,7 @@ comment at the start of cc-engine.el for more info."
         (braceassignp
          ;; We've hit the beginning of the aggregate list.
          (c-beginning-of-statement-1 containing-sexp)
-         (cons (point) inexpr-brace-list))
+         (cons (point) (or in-paren inexpr-brace-list)))
         ((and after-type-id-pos
               (save-excursion
                 (when (eq (char-after) ?\;)
@@ -10569,7 +10578,7 @@ comment at the start of cc-engine.el for more info."
                           nil nil))
                    (and (consp res)
                         (eq (car res) after-type-id-pos))))))
-         (cons bufpos inexpr-brace-list))
+         (cons bufpos (or in-paren inexpr-brace-list)))
         ((eq (char-after) ?\;)
          ;; Brace lists can't contain a semicolon, so we're done.
          ;; (setq containing-sexp nil)
@@ -10593,12 +10602,16 @@ comment at the start of cc-engine.el for more info."
         (t t))))                       ;; The caller can go up one level.
       )))
 
-(defun c-inside-bracelist-p (containing-sexp paren-state)
+(defun c-inside-bracelist-p (containing-sexp paren-state accept-in-paren)
   ;; return the buffer position of the beginning of the brace list
   ;; statement if we're inside a brace list, otherwise return nil.
   ;; CONTAINING-SEXP is the buffer pos of the innermost containing
   ;; paren.  PAREN-STATE is the remainder of the state of enclosing
-  ;; braces
+  ;; braces.  ACCEPT-IN-PAREN is non-nil iff we will accept as a brace
+  ;; list a brace directly enclosed in a parenthesis.
+  ;;
+  ;; The "brace list" here is recognized solely by its context, not by
+  ;; its contents.
   ;;
   ;; N.B.: This algorithm can potentially get confused by cpp macros
   ;; 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."
    ;; this will pick up array/aggregate init lists, even if they are nested.
    (save-excursion
      (let ((bufpos t)
-          lim next-containing)
+           next-containing)
        (while (and (eq bufpos t)
                   containing-sexp)
         (when paren-state
-          (if (consp (car paren-state))
-              (setq lim (cdr (car paren-state))
-                    paren-state (cdr paren-state))
-            (setq lim (car paren-state)))
-          (when paren-state
-            (setq next-containing (car paren-state)
-                  paren-state (cdr paren-state))))
+          (setq next-containing (c-pull-open-brace paren-state)))
 
         (goto-char containing-sexp)
         (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."
             ;; containing sexp, so that c-looking-at-inexpr-block
             ;; doesn't check for an identifier before it.
             (setq bufpos nil)
-          (when (or (not (eq (char-after) ?{))
-                    (eq (setq bufpos (c-looking-at-or-maybe-in-bracelist
-                                      next-containing lim))
-                        t))
-            (setq containing-sexp next-containing
-                  lim nil
-                  next-containing nil))))
-       (and (consp bufpos) (car bufpos))))))
+          (if (not (eq (char-after) ?{))
+              (setq bufpos nil)
+            (when (eq (setq bufpos (c-looking-at-or-maybe-in-bracelist
+                                         next-containing next-containing))
+                      t)
+              (setq containing-sexp next-containing
+                    next-containing nil)))))
+       (and (consp bufpos)
+           (or accept-in-paren (not (eq (cdr bufpos) 'in-paren)))
+           (car bufpos))))))
 
 (defun c-looking-at-special-brace-list (&optional _lim)
   ;; 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."
 
 (defun c-looking-at-statement-block ()
   ;; Point is at an opening brace.  If this is a statement block (i.e. the
-  ;; elements in it are terminated by semicolons) return t.  Otherwise, return
-  ;; nil.
+  ;; elements in the block are terminated by semicolons, or the block is
+  ;; empty, or the block contains a keyword) return t.  Otherwise, return nil.
   (let ((here (point)))
     (prog1
        (if (c-go-list-forward)
            (let ((there (point)))
              (backward-char)
-             (c-syntactic-skip-backward
-              "^;," here t)
+             (c-syntactic-skip-backward "^;," here t)
              (cond
               ((eq (char-before) ?\;) t)
               ((eq (char-before) ?,) nil)
-              (t (goto-char here)
-                 (forward-char)
-                 (and (c-syntactic-re-search-forward "{" there t t)
-                      (progn (backward-char)
-                             (c-looking-at-statement-block))))))
+              (t                       ; We're at (1+ here).
+               (cond
+                ((progn (c-forward-syntactic-ws)
+                        (eq (point) (1- there)))
+                 t)
+                ((c-syntactic-re-search-forward c-keywords-regexp there t)
+                 t)
+                ((c-syntactic-re-search-forward "{" there t t)
+                 (backward-char)
+                 (c-looking-at-statement-block))
+                (t nil)))))
          (forward-char)
-         (and (c-syntactic-re-search-forward "[;,]" nil t t)
-              (eq (char-before) ?\;)))
+         (cond
+          ((c-syntactic-re-search-forward "[;,]" nil t t)
+           (eq (char-before) ?\;))
+          ((c-syntactic-re-search-forward c-keywords-regexp nil t t)
+           t)
+          (t nil)))
       (goto-char here))))
 
 (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."
         ;; The paren state outside `containing-sexp', or at
         ;; `indent-point' if `containing-sexp' is nil.
         (paren-state (c-parse-state))
+        (state-cache (copy-tree paren-state))
         ;; There's always at most one syntactic element which got
         ;; an anchor pos.  It's stored in syntactic-relpos.
         syntactic-relpos
@@ -11668,7 +11687,7 @@ comment at the start of cc-engine.el for more info."
               (not (c-at-vsemi-p before-ws-ip))
               (not (memq char-after-ip '(?\) ?\] ?,)))
               (or (not (eq char-before-ip ?}))
-                  (c-looking-at-inexpr-block-backward c-state-cache))
+                  (c-looking-at-inexpr-block-backward state-cache))
               (> (point)
                  (progn
                    ;; Ought to cache the result from the
@@ -11746,7 +11765,7 @@ comment at the start of cc-engine.el for more info."
        (if containing-sexp
            (progn
              (goto-char containing-sexp)
-             (setq lim (c-most-enclosing-brace c-state-cache
+             (setq lim (c-most-enclosing-brace state-cache
                                                containing-sexp))
              (c-backward-to-block-anchor lim)
              (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."
 
              (containing-sexp
               (goto-char containing-sexp)
-              (setq lim (c-most-enclosing-brace c-state-cache
+              (setq lim (c-most-enclosing-brace state-cache
                                                 containing-sexp))
               (save-excursion
                 (setq tmpsymbol
@@ -11816,7 +11835,7 @@ comment at the start of cc-engine.el for more info."
        (goto-char (cdr placeholder))
        (back-to-indentation)
        (c-add-stmt-syntax tmpsymbol nil t
-                          (c-most-enclosing-brace c-state-cache (point))
+                          (c-most-enclosing-brace state-cache (point))
                           paren-state)
        (unless (eq (point) (cdr placeholder))
          (c-add-syntax (car placeholder))))
@@ -12239,11 +12258,11 @@ comment at the start of cc-engine.el for more info."
            (and (eq (char-before) ?})
                 (save-excursion
                   (let ((start (point)))
-                    (if (and c-state-cache
-                             (consp (car c-state-cache))
-                             (eq (cdar c-state-cache) (point)))
+                    (if (and state-cache
+                             (consp (car state-cache))
+                             (eq (cdar state-cache) (point)))
                         ;; Speed up the backward search a bit.
-                        (goto-char (caar c-state-cache)))
+                        (goto-char (caar state-cache)))
                     (c-beginning-of-decl-1 containing-sexp) ; Can't use `lim' 
here.
                     (setq placeholder (point))
                     (if (= start (point))
@@ -12400,7 +12419,8 @@ comment at the start of cc-engine.el for more info."
         ((and (eq char-after-ip ?{)
               (progn
                 (setq placeholder (c-inside-bracelist-p (point)
-                                                        paren-state))
+                                                        paren-state
+                                                        nil))
                 (if placeholder
                     (setq tmpsymbol '(brace-list-open . inexpr-class))
                   (setq tmpsymbol '(block-open . inexpr-statement)
@@ -12482,7 +12502,7 @@ comment at the start of cc-engine.el for more info."
                (skip-chars-forward " \t"))
            (goto-char placeholder))
          (c-add-stmt-syntax 'arglist-cont-nonempty (list containing-sexp) t
-                            (c-most-enclosing-brace c-state-cache (point))
+                            (c-most-enclosing-brace state-cache (point))
                             paren-state))
 
         ;; 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."
                            (save-excursion
                              (goto-char containing-sexp)
                              (c-looking-at-special-brace-list)))
-                      (c-inside-bracelist-p containing-sexp paren-state))))
+                      (c-inside-bracelist-p containing-sexp paren-state t)
+                      (save-excursion
+                        (goto-char containing-sexp)
+                        (and (eq (char-after) ?{)
+                             (not (c-looking-at-statement-block)))))))
        (cond
 
         ;; 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."
                 (= (point) containing-sexp)))
          (if (eq (point) (c-point 'boi))
              (c-add-syntax 'brace-list-close (point))
-           (setq lim (c-most-enclosing-brace c-state-cache (point)))
+           (setq lim (c-most-enclosing-brace state-cache (point)))
            (c-beginning-of-statement-1 lim nil nil t)
            (c-add-stmt-syntax 'brace-list-close nil t lim paren-state)))
 
@@ -12597,7 +12621,7 @@ comment at the start of cc-engine.el for more info."
              (goto-char containing-sexp))
            (if (eq (point) (c-point 'boi))
                (c-add-syntax 'brace-list-intro (point))
-             (setq lim (c-most-enclosing-brace c-state-cache (point)))
+             (setq lim (c-most-enclosing-brace state-cache (point)))
              (c-beginning-of-statement-1 lim)
              (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state)))
 
@@ -12619,7 +12643,7 @@ comment at the start of cc-engine.el for more info."
        ((and (not (memq char-before-ip '(?\; ?:)))
             (not (c-at-vsemi-p before-ws-ip))
             (or (not (eq char-before-ip ?}))
-                (c-looking-at-inexpr-block-backward c-state-cache))
+                (c-looking-at-inexpr-block-backward state-cache))
             (> (point)
                (save-excursion
                  (c-beginning-of-statement-1 containing-sexp)
@@ -12753,7 +12777,7 @@ comment at the start of cc-engine.el for more info."
              (skip-chars-forward " \t"))
          (goto-char placeholder))
        (c-add-stmt-syntax 'template-args-cont (list containing-<) t
-                          (c-most-enclosing-brace c-state-cache (point))
+                          (c-most-enclosing-brace state-cache (point))
                           paren-state))
 
        ;; CASE 17: Statement or defun catchall.
@@ -12827,7 +12851,7 @@ comment at the start of cc-engine.el for more info."
            (goto-char (cdr placeholder))
            (back-to-indentation)
            (c-add-stmt-syntax tmpsymbol nil t
-                              (c-most-enclosing-brace c-state-cache (point))
+                              (c-most-enclosing-brace state-cache (point))
                               paren-state)
            (if (/= (point) (cdr placeholder))
                (c-add-syntax (car placeholder))))
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 4141594..5ba0978 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1615,7 +1615,11 @@ Calls REPORT-FN directly."
             (generate-new-buffer " *checkdoc-temp*")))
       (unwind-protect
           (save-excursion
-            (checkdoc-current-buffer t))
+            ;; checkdoc-current-buffer can error if there are
+            ;; unbalanced parens, for example, but this shouldn't
+            ;; disable the backend (bug#29176).
+            (ignore-errors
+              (checkdoc-current-buffer t)))
         (kill-buffer checkdoc-diagnostic-buffer)))
     (funcall report-fn
              (cl-loop for (text start end _unfixable) in
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 0d200f0..1930f4f 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -334,7 +334,8 @@ region is invalid."
                          (end (or (and sexp-end
                                        (not (= sexp-end beg))
                                        sexp-end)
-                                  (ignore-errors (goto-char (1+ beg)))))
+                                  (and (< (goto-char (1+ beg)) (point-max))
+                                       (point))))
                          (safe-end (or end
                                        (fallback-eol beg))))
                     (cons (if end beg (fallback-bol))
@@ -342,7 +343,8 @@ region is invalid."
                 (let* ((beg (fallback-bol))
                        (end (fallback-eol beg)))
                   (cons beg end)))))))
-    (error (flymake-log :warning "Invalid region line=%s col=%s" line col))))
+    (error (flymake-log :warning "Invalid region line=%s col=%s" line col)
+           nil)))
 
 (defvar flymake-diagnostic-functions nil
   "Special hook of Flymake backends that check a buffer.
@@ -1139,7 +1141,8 @@ POS can be a buffer position or a button"
 
 (defun flymake--diagnostics-buffer-entries ()
   (with-current-buffer flymake--diagnostics-buffer-source
-    (cl-loop for diag in (flymake-diagnostics)
+    (cl-loop for diag in
+             (cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg)
              for (line . col) =
              (save-excursion
                (goto-char (flymake--diag-beg diag))
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index fbd905b..109d55a 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."
   (let ((exp (url-cookie-expires cookie)))
     (and (> (length exp) 0)
         (condition-case ()
-            (time-less-p nil (date-to-time exp))
+            (time-less-p (date-to-time exp) nil)
           (error nil)))))
 
 (defun url-cookie-retrieve (host &optional localpart secure)
diff --git a/src/alloc.c b/src/alloc.c
index f479226..ae892e4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1760,7 +1760,7 @@ static char const 
string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
 
 #ifdef GC_CHECK_STRING_BYTES
 
-#define SDATA_SIZE(NBYTES) FLEXSIZEOF (struct sdata, data, NBYTES)
+#define SDATA_SIZE(NBYTES) FLEXSIZEOF (struct sdata, data, (NBYTES) + 1)
 
 #else /* not GC_CHECK_STRING_BYTES */
 
diff --git a/src/dispextern.h b/src/dispextern.h
index 2f55d8c..430afbf 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3452,7 +3452,14 @@ void gamma_correct (struct frame *, COLORREF *);
 void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
 void x_change_tool_bar_height (struct frame *f, int);
 
+/* The frame used to display a tooltip.
+
+   Note: In a GTK build with non-zero x_gtk_use_system_tooltips, this
+   variable holds the frame that shows the tooltip, not the frame of
+   the tooltip itself, so checking whether a frame is a tooltip frame
+   cannot just compare the frame to what this variable holds.  */
 extern Lisp_Object tip_frame;
+
 extern Window tip_window;
 extern frame_parm_handler x_frame_parm_handlers[];
 
diff --git a/src/frame.c b/src/frame.c
index fe1709e..2b32751 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1472,7 +1472,11 @@ DEFUN ("frame-list", Fframe_list, Sframe_list,
   Lisp_Object frames;
   frames = Fcopy_sequence (Vframe_list);
 #ifdef HAVE_WINDOW_SYSTEM
-  if (FRAMEP (tip_frame))
+  if (FRAMEP (tip_frame)
+#ifdef USE_GTK
+      && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+      )
     frames = Fdelq (tip_frame, frames);
 #endif
   return frames;
diff --git a/src/xdisp.c b/src/xdisp.c
index f1a6c62..f1c6b9f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16066,8 +16066,10 @@ try_cursor_movement (Lisp_Object window, struct 
text_pos startp,
         since the handling of this_line_start_pos, etc., in redisplay
         handles the same cases.  */
       && !EQ (window, minibuf_window)
-      && (FRAME_WINDOW_P (f)
-         || !overlay_arrow_in_current_buffer_p ()))
+      /* When overlay arrow is shown in current buffer, point movement
+        is no longer "simple", as it typically causes the overlay
+        arrow to move as well.  */
+      && !overlay_arrow_in_current_buffer_p ())
     {
       int this_scroll_margin, top_scroll_margin;
       struct glyph_row *row = NULL;
@@ -17698,7 +17700,11 @@ try_window_reusing_current_matrix (struct window *w)
       /* Don't try to reuse the display if windows have been split
         or such.  */
       || windows_or_buffers_changed
-      || f->cursor_type_changed)
+      || f->cursor_type_changed
+      /* This function cannot handle buffers where the overlay arrow
+        is shown on the fringes, because if the arrow position
+        changes, we cannot just reuse the current matrix.  */
+      || overlay_arrow_in_current_buffer_p ())
     return false;
 
   /* Can't do this if showing trailing whitespace.  */
@@ -21126,7 +21132,13 @@ should_produce_line_number (struct it *it)
 
 #ifdef HAVE_WINDOW_SYSTEM
   /* Don't display line number in tooltip frames.  */
-  if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame))
+  if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame)
+#ifdef USE_GTK
+      /* GTK builds store in tip_frame the frame that shows the tip,
+        so we need an additional test.  */
+      && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+      )
     return false;
 #endif
 
diff --git a/src/xfns.c b/src/xfns.c
index 9022e4a..83fc07d 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4915,7 +4915,11 @@ Internal use only, use `display-monitor-attributes-list' 
instead.  */)
       struct frame *f = XFRAME (frame);
 
       if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo
-         && !EQ (frame, tip_frame))
+         && !(EQ (frame, tip_frame)
+#ifdef USE_GTK
+              && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+              ))
        {
          GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
 
diff --git a/src/xterm.c b/src/xterm.c
index dbb8349..e11cde7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -997,7 +997,11 @@ x_update_begin (struct frame *f)
 {
 #ifdef USE_CAIRO
   if (! NILP (tip_frame) && XFRAME (tip_frame) == f
-      && ! FRAME_VISIBLE_P (f))
+      && ! FRAME_VISIBLE_P (f)
+#ifdef USE_GTK
+      && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+      )
     return;
 
   if (! FRAME_CR_SURFACE (f))
@@ -9960,7 +9964,11 @@ x_new_font (struct frame *f, Lisp_Object font_object, 
int fontset)
       /* Don't change the size of a tip frame; there's no point in
         doing it because it's done in Fx_show_tip, and it leads to
         problems because the tip frame has no widget.  */
-      if (NILP (tip_frame) || XFRAME (tip_frame) != f)
+      if (NILP (tip_frame) || XFRAME (tip_frame) != f
+#ifdef USE_GTK
+         || NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+         )
        {
          adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
                             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 c60f910..05214e7 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
   (flymake-tests--with-flymake ("test.pl")
     (flymake-goto-next-error)
     (should (eq 'flymake-warning (face-at-point)))
-    (flymake-goto-next-error)
+    (goto-char (point-max))
+    (flymake-goto-prev-error)
     (should (eq 'flymake-error (face-at-point)))))
 
 (ert-deftest ruby-backend ()
   "Test the ruby backend"
   (skip-unless (executable-find "ruby"))
-  (flymake-tests--with-flymake ("test.rb")
-    (flymake-goto-next-error)
-    (should (eq 'flymake-warning (face-at-point)))
-    (flymake-goto-next-error)
-    (should (eq 'flymake-error (face-at-point)))))
+  ;; Some versions of ruby fail if HOME doesn't exist (bug#29187).
+  (let* ((tempdir (make-temp-file "flymake-tests-ruby" t))
+         (process-environment (cons (format "HOME=%s" tempdir)
+                                    process-environment)))
+    (unwind-protect
+        (flymake-tests--with-flymake ("test.rb")
+          (flymake-goto-next-error)
+          (should (eq 'flymake-warning (face-at-point)))
+          (flymake-goto-next-error)
+          (should (eq 'flymake-error (face-at-point))))
+      (delete-directory tempdir t))))
 
 (ert-deftest different-diagnostic-types ()
   "Test GCC warning via function predicate."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]