diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el index f1061a8621b..b1027ce34f9 100644 --- a/lisp/cus-dep.el +++ b/lisp/cus-dep.el @@ -99,7 +99,7 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" (setq name (intern name))) (condition-case nil (while (re-search-forward - "^(def\\(custom\\|face\\|group\\)" nil t) + "^(def\\(custom\\|face\\|group\\|ine\\(?:-globalized\\)?-minor-mode\\)" nil t) (beginning-of-line) (let ((type (match-string 1)) (expr (read (current-buffer)))) diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 3f947bdc1c9..3391aa371b7 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -73,7 +73,9 @@ See Info node `Displaying Boundaries' for details." ;;;###autoload (define-globalized-minor-mode global-display-fill-column-indicator-mode - display-fill-column-indicator-mode display-fill-column-indicator--turn-on) + display-fill-column-indicator-mode display-fill-column-indicator--turn-on + ;; See bug#41145 + :group 'display-fill-column-indicator) (provide 'display-fill-column-indicator) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 7b8b174c430..7ff424c6a7e 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -9102,7 +9102,7 @@ This function might do hidden buffer changes." (let ((cdd-pos (point)) cdd-next-pos cdd-id-start cdd-id-end cdd-decl-res cdd-got-func cdd-got-type cdd-got-init - c-last-identifier-range cdd-exhausted) + c-last-identifier-range cdd-exhausted cdd-after-block) ;; The following `while' applies `cdd-function' to a single declarator id ;; each time round. It loops only when CDD-LIST is non-nil. @@ -9155,23 +9155,25 @@ This function might do hidden buffer changes." (c-forward-syntactic-ws cdd-limit) (setq cdd-exhausted t))) ; unbalanced parens - (cdd-got-init ; "=" sign OR opening "(", "[", or "{" - ;; Skip an initializer expression. If we're at a '=' - ;; then accept a brace list directly after it to cope - ;; with array initializers. Otherwise stop at braces - ;; to avoid going past full function and class blocks. - (if (and (if (and (eq cdd-got-init ?=) - (= (c-forward-token-2 1 nil cdd-limit) 0) - (looking-at "{")) - (c-go-list-forward (point) cdd-limit) - t) - ;; FIXME: Should look for c-decl-end markers here; - ;; we might go far into the following declarations - ;; in e.g. ObjC mode (see e.g. methods-4.m). - (c-syntactic-re-search-forward "[;,{]" cdd-limit 'move t)) + (cdd-got-init ; "=" sign OR opening "(", "[", or "(" + ;; Skip an initializer expression in braces, whether or not (in + ;; C++ Mode) preceded by an "=". Be careful that the brace list + ;; isn't a code block or a struct (etc.) block. + (cond + ((and (eq cdd-got-init ?=) + (zerop (c-forward-token-2 1 nil cdd-limit)) + (eq (char-after) ?{) + (c-go-list-forward (point) cdd-limit))) + ((and (eq cdd-got-init ?{) + c-recognize-bare-brace-inits + (setq cdd-after-block + (save-excursion + (c-go-list-forward (point) cdd-limit))) + (not (c-looking-at-statement-block))) + (goto-char cdd-after-block))) + (if (c-syntactic-re-search-forward "[;,{]" cdd-limit 'move t) (backward-char) - (setq cdd-exhausted t) - )) + (setq cdd-exhausted t))) (t (c-forward-syntactic-ws cdd-limit))) @@ -11749,7 +11751,22 @@ comment at the start of cc-engine.el for more info." (save-excursion (c-backward-syntactic-ws) (point)) nil nil)) (and (consp res) - (eq (car res) after-type-id-pos)))))) + (cond + ((eq (car res) after-type-id-pos)) + ((> (car res) after-type-id-pos) nil) + (t + (catch 'find-decl + (save-excursion + (goto-char (car res)) + (c-do-declarators + (point-max) t nil nil + (lambda (id-start id-end tok not-top func init) + (cond + ((> id-start after-type-id-pos) + (throw 'find-decl nil)) + ((eq id-start after-type-id-pos) + (throw 'find-decl t))))) + nil))))))))) (cons bufpos (or in-paren inexpr-brace-list))) ((or (eq (char-after) ?\;) ;; Brace lists can't contain a semicolon, so we're done. diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index b77bf3303b6..bf035c9a9e3 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -3701,6 +3701,20 @@ Foo bar = gnu;" c++ t) (c-lang-defvar c-recognize-paren-inits (c-lang-const c-recognize-paren-inits)) +(c-lang-defconst c-recognize-bare-brace-inits + "Non-nil means that brace initializers without \"=\" exist, +i.e. constructs like + +int foo[] {1, 2, 3}; + +in addition to the more classic + +int foo[] = {1, 2, 3};" + t nil + c++ t) +(c-lang-defvar c-recognize-bare-brace-inits + (c-lang-const c-recognize-bare-brace-inits)) + (c-lang-defconst c-recognize-paren-inexpr-blocks "Non-nil to recognize gcc style in-expression blocks, i.e. compound statements surrounded by parentheses inside expressions." diff --git a/src/image.c b/src/image.c index d8c34669cc4..6ecf6a70fe2 100644 --- a/src/image.c +++ b/src/image.c @@ -8276,11 +8276,13 @@ gif_load (struct frame *f, struct image *img) if (gif == NULL) { #if HAVE_GIFERRORSTRING - image_error ("Cannot open `%s': %s", - file, build_string (GifErrorString (gif_err))); -#else - image_error ("Cannot open `%s'", file); + const char *errstr = GifErrorString (gif_err); + if (errstr) + image_error ("Cannot open `%s': %s", file, build_string (errstr)); + else #endif + image_error ("Cannot open `%s'", file); + return 0; } } @@ -8306,11 +8308,13 @@ gif_load (struct frame *f, struct image *img) if (!gif) { #if HAVE_GIFERRORSTRING - image_error ("Cannot open memory source `%s': %s", - img->spec, build_string (GifErrorString (gif_err))); -#else - image_error ("Cannot open memory source `%s'", img->spec); + const char *errstr = GifErrorString (gif_err); + if (errstr) + image_error ("Cannot open memory source `%s': %s", + img->spec, build_string (errstr)); + else #endif + image_error ("Cannot open memory source `%s'", img->spec); return 0; } } @@ -8593,9 +8597,9 @@ gif_load (struct frame *f, struct image *img) if (error_text) image_error ("Error closing `%s': %s", img->spec, build_string (error_text)); -#else - image_error ("Error closing `%s'", img->spec); + else #endif + image_error ("Error closing `%s'", img->spec); } /* Maybe fill in the background field while we have ximg handy. */