commit aed22ca32344c21c5868a451d1afe969642a3ba5 (HEAD, refs/remotes/origin/master) Merge: dc491c3 7a6b3d0 Author: Martin Rudalics Date: Mon Aug 22 08:41:31 2016 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit dc491c3df305a73908fe8de20b7c428a5b38c846 Author: Martin Rudalics Date: Mon Aug 22 08:33:48 2016 +0200 Fix (next-frame nil t) crash (Bug#24281) * src/frame.c (candidate_frame): Check minibuf argument before comparing it to zero (Bug#24281). diff --git a/src/frame.c b/src/frame.c index e17c8ac..2dbbb37 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1310,7 +1310,7 @@ candidate_frame (Lisp_Object candidate, Lisp_Object frame, Lisp_Object minibuf) FRAME_FOCUS_FRAME (c))) return candidate; } - else if (XFASTINT (minibuf) == 0) + else if (INTEGERP (minibuf) && XINT (minibuf) == 0) { if (FRAME_VISIBLE_P (c) || FRAME_ICONIFIED_P (c)) return candidate; commit 7a6b3d0fb793864a1f5deb5a22de78a4dced652d Author: Noah Friedman Date: Sun Aug 21 14:03:46 2016 -0700 Fix interpretation of signed vs unsigned values when retrieving X Window properties, and make sure the full value is returned when not parsed. New subr to export type and format information about X Window properties to lisp. * src/xselect.c (selection_data_to_lisp_data): Treat any data as unsigned unless its actual type is INTEGER. CARDINALs, in particular, are unsigned. * src/xfns.c (Fx_change_window_property): If value is a string, ignore any provided format and force to 8. (x_window_property_intern): If returning value as a string, the length is actual_size times the actual format of each element, which is not necessarily bytes. (Fx_window_property_attributes): New subr. (syms_of_xfns): Declare it. diff --git a/src/xfns.c b/src/xfns.c index ccea20e..8860a21 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5113,6 +5113,7 @@ FRAME. Default is to change on the edit X window. */) if (INT_MAX < SBYTES (value)) error ("VALUE too long"); nelements = SBYTES (value); + element_format = 8; /* ignore any provided format */ } block_input (); @@ -5223,7 +5224,7 @@ x_window_property_intern (struct frame *f, } if (NILP (vector_ret_p)) - prop_value = make_string ((char *) tmp_data, actual_size); + prop_value = make_string ((char *) tmp_data, (actual_format / 8) * actual_size); else prop_value = x_property_data_to_lisp (f, tmp_data, @@ -5310,6 +5311,62 @@ no value of TYPE (always string in the MS Windows case). */) return prop_value; } +DEFUN ("x-window-property-attributes", Fx_window_property_attributes, Sx_window_property_attributes, + 1, 3, 0, + doc: /* Retrieve metadata about window property PROP on FRAME. +If FRAME is nil or omitted, use the selected frame. +If SOURCE is non-nil, get the property on that window instead of from +FRAME. The number 0 denotes the root window. + +Return value is nil if FRAME hasn't a property with name PROP. +Otherwise, the return value is a vector with the following fields: + +0. The property type, as an integer. The symbolic name of + the type can be obtained with `x-get-atom-name'. +1. The format of each element; one of 8, 16, or 32. +2. The length of the property, in number of elements. */) + (Lisp_Object prop, Lisp_Object frame, Lisp_Object source) +{ + struct frame *f = decode_window_system_frame (frame); + Window target_window = FRAME_X_WINDOW (f); + Atom prop_atom; + Lisp_Object prop_attr = Qnil; + Atom actual_type; + int actual_format; + unsigned long actual_size, bytes_remaining; + unsigned char *tmp_data = NULL; + int rc; + + CHECK_STRING (prop); + + if (! NILP (source)) + { + CONS_TO_INTEGER (source, Window, target_window); + if (! target_window) + target_window = FRAME_DISPLAY_INFO (f)->root_window; + } + + block_input (); + + prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); + rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window, + prop_atom, 0, 0, False, AnyPropertyType, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, &tmp_data); + if (rc == Success && actual_format != 0) + { + XFree (tmp_data); + + prop_attr = Fmake_vector (make_number (3), Qnil); + ASET (prop_attr, 0, make_number (actual_type)); + ASET (prop_attr, 1, make_number (actual_format)); + ASET (prop_attr, 2, make_number (bytes_remaining / (actual_format / 8))); + } + + unblock_input (); + return prop_attr; +} + /*********************************************************************** Tool tips ***********************************************************************/ @@ -6966,6 +7023,7 @@ When using Gtk+ tooltips, the tooltip face is not used. */); defsubr (&Sx_change_window_property); defsubr (&Sx_delete_window_property); defsubr (&Sx_window_property); + defsubr (&Sx_window_property_attributes); defsubr (&Sxw_display_color_p); defsubr (&Sx_display_grayscale_p); diff --git a/src/xselect.c b/src/xselect.c index 616d12c..156888a 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -1612,11 +1612,24 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo, /* Convert a single 16-bit number or a small 32-bit number to a Lisp_Int. If the number is 32 bits and won't fit in a Lisp_Int, convert it to a cons of integers, 16 bits in each half. + + INTEGER is a signed type, CARDINAL is unsigned. + Assume any other types are unsigned as well. */ else if (format == 32 && size == sizeof (int)) - return INTEGER_TO_CONS (((int *) data) [0]); + { + if (type == XA_INTEGER) + return INTEGER_TO_CONS (((int *) data) [0]); + else + return INTEGER_TO_CONS (((unsigned int *) data) [0]); + } else if (format == 16 && size == sizeof (short)) - return make_number (((short *) data) [0]); + { + if (type == XA_INTEGER) + return make_number (((short *) data) [0]); + else + return make_number (((unsigned short *) data) [0]); + } /* Convert any other kind of data to a vector of numbers, represented as above (as an integer, or a cons of two 16 bit integers.) @@ -1626,11 +1639,22 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo, ptrdiff_t i; Lisp_Object v = make_uninit_vector (size / 2); - for (i = 0; i < size / 2; i++) - { - short j = ((short *) data) [i]; - ASET (v, i, make_number (j)); - } + if (type == XA_INTEGER) + { + for (i = 0; i < size / 2; i++) + { + short j = ((short *) data) [i]; + ASET (v, i, make_number (j)); + } + } + else + { + for (i = 0; i < size / 2; i++) + { + unsigned short j = ((unsigned short *) data) [i]; + ASET (v, i, make_number (j)); + } + } return v; } else @@ -1638,11 +1662,22 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo, ptrdiff_t i; Lisp_Object v = make_uninit_vector (size / X_LONG_SIZE); - for (i = 0; i < size / X_LONG_SIZE; i++) - { - int j = ((int *) data) [i]; - ASET (v, i, INTEGER_TO_CONS (j)); - } + if (type == XA_INTEGER) + { + for (i = 0; i < size / X_LONG_SIZE; i++) + { + int j = ((int *) data) [i]; + ASET (v, i, INTEGER_TO_CONS (j)); + } + } + else + { + for (i = 0; i < size / X_LONG_SIZE; i++) + { + unsigned int j = ((unsigned int *) data) [i]; + ASET (v, i, INTEGER_TO_CONS (j)); + } + } return v; } } commit 14a86f837762af8d16eef57c315da93b56699901 Author: Noam Postavsky Date: Sat Jun 25 15:57:39 2016 -0400 Improve error when installing non-package dirs * lisp/emacs-lisp/package.el (package-dir-info): Throw meaningful error when no file with package info is found (Bug #19851). diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index e721b55..f669c31 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1081,6 +1081,8 @@ The return result is a `package-desc'." (setq files nil) ;; set the 'dir kind, (setf (package-desc-kind info) 'dir)))) + (unless info + (error "No .el files with package headers in `%s'" default-directory)) ;; and return the info. info)))) commit 578d9aaf82b386c1a0316dde491d297e18e10636 Author: Alan Mackenzie Date: Sun Aug 21 16:00:15 2016 +0000 Adapt CC Mode for C++11 uniform initialization. For fontification, introduce a new "context", 'non-decl, to be used for brace lists; also a new value for the property 'c-type, called 'c-not-decl. * lisp/progmodes/cc-engine.el (c-back-over-compound-identifier): Check that an ostensible symbol we're going to move over isn't a keyword. (c-forward-decl-or-cast-1): CASE 1: Where we have two consecutive identifiers (hence a declaration), and an unmatched open paren, perform c-fdoc-shift-type-backwards to recognize the partial construct correctly. Whilst checking a type decl expression, check for and handle C++11's "copy initialization", where we have (). Recognize (... (where the paren is unclosed) as a declaration. (c-looking-at-or-maybe-in-bracelist): New function, extracted from c-inside-bracelist-p. Recognize as bracelists "{"s which are preceded by valid tokens other than "=". Recognize a bracelist when preceded by a template declaration. (c-inside-bracelist-p): Call c-looking-at-or-maybe-in-bracelist in place of much inline code. (c-looking-at-inexpr-block): Amend so that it won't wrongly recognise an initialization starting "({" as an in-expression block, by checking for semicolons, as opposed to commas, separating elements inside it. (c-guess-continued-construct): (CASE B-2): Recognize a brace-list-open by calling c-looking-at-or-maybe-in-bracelist rather than checking for a preceding "=". (CASE B-5): New code to recognize new construct "return { ...}". (c-guess-basic-syntax): (CASE 5A.3): Additionally recognize a "{" preceded by "return", or "{" preceded by as a bracelist. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Recognize brace lists, giving them `context' 'non-decl. Pass over elements of one by regexp search for "," rather than calling c-forward-decl-or-cast-1. * lisp/progmodes/cc-langs.el (c-return-kwds, c-return-key): New lang constants/variables to recognize "return". (c-pre-id-bracelist-key): New lang constant/variable to recognize tokens which, when preceding an identifier followed by a brace, signify the brace as a bracelist. * lisp/progmodes/cc-mode.el (c-fl-decl-start): When searching outwards for the start of a "local" declaration, move out from an enclosing brace when that is the start of a brace list. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 8e8e4e4..ccdc1b1 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -130,6 +130,10 @@ ;; 'c-decl-type-start is used when the declarators are types, ;; 'c-decl-id-start otherwise. ;; +;; 'c-not-decl +;; Put on the brace which introduces a brace list and on the commas +;; which separate the element within it. +;; ;; 'c-awk-NL-prop ;; Used in AWK mode to mark the various kinds of newlines. See ;; cc-awk.el. @@ -7354,10 +7358,10 @@ comment at the start of cc-engine.el for more info." ;; this construct and return t. If the parsing fails, return nil, leaving ;; point unchanged. (let ((here (point)) - end - ) - (if (not (c-simple-skip-symbol-backward)) + end) + (if (not (c-on-identifier)) nil + (c-simple-skip-symbol-backward) (while (progn (setq end (point)) @@ -7712,6 +7716,8 @@ comment at the start of cc-engine.el for more info." ;; 'arglist Some other type of arglist. ;; nil Some other context or unknown context. Includes ;; within the parens of an if, for, ... construct. + ;; 'not-decl This value is never supplied to this function. It + ;; would mean we're definitely not in a declaration. ;; ;; LAST-CAST-END is the first token after the closing paren of a ;; preceding cast, or nil if none is known. If @@ -8019,7 +8025,10 @@ comment at the start of cc-engine.el for more info." ;; arglist paren that gets entered. c-parse-and-markup-<>-arglists ;; Start of the identifier for which `got-identifier' was set. - name-start) + name-start + ;; Position after (innermost) open parenthesis encountered in the + ;; prefix operators. + after-paren-pos) (goto-char id-start) @@ -8030,7 +8039,8 @@ comment at the start of cc-engine.el for more info." (when (eq (char-after) ?\() (progn (setq paren-depth (1+ paren-depth)) - (forward-char))) + (forward-char) + (setq after-paren-pos (point)))) (while (and (looking-at c-type-decl-prefix-key) (if (and (c-major-mode-is 'c++-mode) (match-beginning 3)) @@ -8053,7 +8063,8 @@ comment at the start of cc-engine.el for more info." (if (eq (char-after) ?\() (progn (setq paren-depth (1+ paren-depth)) - (forward-char)) + (forward-char) + (setq after-paren-pos (point))) (unless got-prefix-before-parens (setq got-prefix-before-parens (= paren-depth 0))) (setq got-prefix t) @@ -8062,7 +8073,7 @@ comment at the start of cc-engine.el for more info." (setq got-parens (> paren-depth 0)) - ;; Skip over an identifier. + ;; Try to skip over an identifier. (or got-identifier (and (looking-at c-identifier-start) (setq pos (point)) @@ -8111,7 +8122,15 @@ comment at the start of cc-engine.el for more info." maybe-typeless backup-maybe-typeless (when c-recognize-typeless-decls - (not context))) + (and (not context) + ;; Deal with C++11's "copy-initialization" + ;; where we have (), by + ;; contraasting with a typeless + ;; (, ...). + (save-excursion + (goto-char after-paren-pos) + (c-forward-syntactic-ws) + (c-forward-type))))) (setq pos (c-up-list-forward (point))) (eq (char-before pos) ?\))) (c-fdoc-shift-type-backward) @@ -8149,11 +8168,15 @@ comment at the start of cc-engine.el for more info." ;; Encountered something inside parens that isn't matched by ;; the `c-type-decl-*' regexps, so it's not a type decl ;; expression. Try to skip out to the same paren depth to - ;; not confuse the cast check below. - (c-safe (goto-char (scan-lists (point) 1 paren-depth))) + ;; not confuse the cast check below. If we don't manage this and + ;; `at-decl-or-cast' is 'ids we might have an expression like + ;; "foo bar ({ ..." which is a valid C++11 initialization. + (if (and (not (c-safe (goto-char (scan-lists (point) 1 paren-depth)))) + (eq at-decl-or-cast 'ids)) + (c-fdoc-shift-type-backward)) ;; If we've found a specifier keyword then it's a ;; declaration regardless. - (throw 'at-decl-or-cast (eq at-decl-or-cast t))) + (throw 'at-decl-or-cast (memq at-decl-or-cast '(t ids)))) (setq at-decl-end (looking-at (cond ((eq context '<>) "[,>]") @@ -9788,6 +9811,169 @@ comment at the start of cc-engine.el for more info." (or (looking-at c-brace-list-key) (progn (goto-char here) nil)))) +(defun c-looking-at-or-maybe-in-bracelist (containing-sexp &optional lim) + ;; Point is at an open brace. If this starts a brace list, return the + ;; buffer position of the start of the construct which introduces the list. + ;; 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/braacket enclosing + ;; POINT, or nil if there is no such position. LIM is a backward search + ;; limit. + ;; + ;; Here, "brace list" does not include the body of an enum. + (save-excursion + (let ((start (point)) + (class-key + ;; Pike can have class definitions anywhere, so we must + ;; check for the class key here. + (and (c-major-mode-is 'pike-mode) + c-decl-block-key)) + (braceassignp 'dontknow) + bufpos macro-start res after-type-id-pos) + + (setq res (c-backward-token-2 1 t lim)) + ;; Checks to do only on the first sexp before the brace. + ;; Have we a C++ initialisation, without an "="? + (if (and (c-major-mode-is 'c++-mode) + (cond + ((and (not (eq res 0)) + (c-go-up-list-backward nil lim) ; FIXME!!! Check ; `lim' 2016-07-12. + (eq (char-after) ?\()) + (setq braceassignp 'c++-noassign)) + ((looking-at c-pre-id-bracelist-key)) + ((looking-at c-return-key)) + ((and (looking-at c-symbol-start) + (not (looking-at c-keywords-regexp))) + (setq after-type-id-pos (point))) + (t nil)) + (save-excursion + (cond + ((not (eq res 0)) + (and (c-go-up-list-backward nil lim) ; FIXME!!! Check `lim' 2016-07-12. + (eq (char-after) ?\())) + ((looking-at c-pre-id-bracelist-key)) + ((looking-at c-return-key)) + (t (setq after-type-id-pos (point)) + nil)))) + (setq braceassignp 'c++-noassign)) + + (when (and c-opt-inexpr-brace-list-key + (eq (char-after) ?\[)) + ;; In Java, an initialization brace list may follow + ;; directly after "new Foo[]", so check for a "new" + ;; earlier. + (while (eq braceassignp 'dontknow) + (setq braceassignp + (cond ((/= (c-backward-token-2 1 t lim) 0) nil) + ((looking-at c-opt-inexpr-brace-list-key) t) + ((looking-at "\\sw\\|\\s_\\|[.[]") + ;; Carry on looking if this is an + ;; identifier (may contain "." in Java) + ;; or another "[]" sexp. + 'dontknow) + (t nil))))) + + ;; Checks to do on all sexps before the brace, up to the + ;; beginning of the statement. + (while (eq braceassignp 'dontknow) + (cond ((eq (char-after) ?\;) + (setq braceassignp nil)) + ((and class-key + (looking-at class-key)) + (setq braceassignp nil)) + ((eq (char-after) ?=) + ;; We've seen a =, but must check earlier tokens so + ;; that it isn't something that should be ignored. + (setq braceassignp 'maybe) + (while (and (eq braceassignp 'maybe) + (zerop (c-backward-token-2 1 t lim))) + (setq braceassignp + (cond + ;; Check for operator = + ((and c-opt-op-identifier-prefix + (looking-at c-opt-op-identifier-prefix)) + nil) + ;; Check for `= in Pike. + ((and (c-major-mode-is 'pike-mode) + (or (eq (char-after) ?`) + ;; Special case for Pikes + ;; `[]=, since '[' is not in + ;; the punctuation class. + (and (eq (char-after) ?\[) + (eq (char-before) ?`)))) + nil) + ((looking-at "\\s.") 'maybe) + ;; make sure we're not in a C++ template + ;; argument assignment + ((and + (c-major-mode-is 'c++-mode) + (save-excursion + (let ((here (point)) + (pos< (progn + (skip-chars-backward "^<>") + (point)))) + (and (eq (char-before) ?<) + (not (c-crosses-statement-barrier-p + pos< here)) + (not (c-in-literal)) + )))) + nil) + (t t)))))) + (if (and (eq braceassignp 'dontknow) + (/= (c-backward-token-2 1 t lim) 0)) + (setq braceassignp nil))) + + (cond + (braceassignp + ;; We've hit the beginning of the aggregate list. + (c-beginning-of-statement-1 containing-sexp) + (point)) + ((and after-type-id-pos + (save-excursion + (when (eq (char-after) ?\;) + (c-forward-token-2 1 t)) + (setq bufpos (point)) + (when (looking-at c-opt-<>-sexp-key) + (c-forward-token-2) + (when (and (eq (char-after) ?<) + (c-get-char-property (point) 'syntax-table)) + (c-go-list-forward nil after-type-id-pos) + (c-forward-syntactic-ws))) + (and + (or (not (looking-at c-class-key)) + (save-excursion + (goto-char (match-end 1)) + (c-forward-syntactic-ws) + (not (eq (point) after-type-id-pos)))) + (progn + (setq res + (c-forward-decl-or-cast-1 + (save-excursion (c-backward-syntactic-ws) (point)) + nil nil)) + (and (consp res) + (eq (car res) after-type-id-pos)))))) + bufpos) + ((eq (char-after) ?\;) + ;; Brace lists can't contain a semicolon, so we're done. + ;; (setq containing-sexp nil) + nil) + ((and (setq macro-start (point)) + (c-forward-to-cpp-define-body) + (eq (point) start)) + ;; We've a macro whose expansion starts with the '{'. + ;; Heuristically, if we have a ';' in it we've not got a + ;; brace list, otherwise we have. + (let ((macro-end (progn (c-end-of-macro) (point)))) + (goto-char start) + (forward-char) + (if (and (c-syntactic-re-search-forward "[;,]" macro-end t t) + (eq (char-before) ?\;)) + nil + macro-start))) + (t t)) ;; The caller can go up one level. + ))) + (defun c-inside-bracelist-p (containing-sexp paren-state) ;; return the buffer position of the beginning of the brace list ;; statement if we're inside a brace list, otherwise return nil. @@ -9807,13 +9993,9 @@ comment at the start of cc-engine.el for more info." (c-backward-over-enum-header)) ;; this will pick up array/aggregate init lists, even if they are nested. (save-excursion - (let ((class-key - ;; Pike can have class definitions anywhere, so we must - ;; check for the class key here. - (and (c-major-mode-is 'pike-mode) - c-decl-block-key)) - bufpos braceassignp lim next-containing macro-start) - (while (and (not bufpos) + (let ((bufpos t) + lim next-containing) + (while (and (eq bufpos t) containing-sexp) (when paren-state (if (consp (car paren-state)) @@ -9823,113 +10005,22 @@ comment at the start of cc-engine.el for more info." (when paren-state (setq next-containing (car paren-state) paren-state (cdr paren-state)))) + (goto-char containing-sexp) (if (c-looking-at-inexpr-block next-containing next-containing) ;; We're in an in-expression block of some kind. Do not ;; check nesting. We deliberately set the limit to the ;; containing sexp, so that c-looking-at-inexpr-block ;; doesn't check for an identifier before it. - (setq containing-sexp nil) - ;; see if the open brace is preceded by = or [...] in - ;; this statement, but watch out for operator= - (setq braceassignp 'dontknow) - (c-backward-token-2 1 t lim) - ;; Checks to do only on the first sexp before the brace. - (when (and c-opt-inexpr-brace-list-key - (eq (char-after) ?\[)) - ;; In Java, an initialization brace list may follow - ;; directly after "new Foo[]", so check for a "new" - ;; earlier. - (while (eq braceassignp 'dontknow) - (setq braceassignp - (cond ((/= (c-backward-token-2 1 t lim) 0) nil) - ((looking-at c-opt-inexpr-brace-list-key) t) - ((looking-at "\\sw\\|\\s_\\|[.[]") - ;; Carry on looking if this is an - ;; identifier (may contain "." in Java) - ;; or another "[]" sexp. - 'dontknow) - (t nil))))) - ;; Checks to do on all sexps before the brace, up to the - ;; beginning of the statement. - (while (eq braceassignp 'dontknow) - (cond ((eq (char-after) ?\;) - (setq braceassignp nil)) - ((and class-key - (looking-at class-key)) - (setq braceassignp nil)) - ((eq (char-after) ?=) - ;; We've seen a =, but must check earlier tokens so - ;; that it isn't something that should be ignored. - (setq braceassignp 'maybe) - (while (and (eq braceassignp 'maybe) - (zerop (c-backward-token-2 1 t lim))) - (setq braceassignp - (cond - ;; Check for operator = - ((and c-opt-op-identifier-prefix - (looking-at c-opt-op-identifier-prefix)) - nil) - ;; Check for `= in Pike. - ((and (c-major-mode-is 'pike-mode) - (or (eq (char-after) ?`) - ;; Special case for Pikes - ;; `[]=, since '[' is not in - ;; the punctuation class. - (and (eq (char-after) ?\[) - (eq (char-before) ?`)))) - nil) - ((looking-at "\\s.") 'maybe) - ;; make sure we're not in a C++ template - ;; argument assignment - ((and - (c-major-mode-is 'c++-mode) - (save-excursion - (let ((here (point)) - (pos< (progn - (skip-chars-backward "^<>") - (point)))) - (and (eq (char-before) ?<) - (not (c-crosses-statement-barrier-p - pos< here)) - (not (c-in-literal)) - )))) - nil) - (t t)))))) - (if (and (eq braceassignp 'dontknow) - (/= (c-backward-token-2 1 t lim) 0)) - (setq braceassignp nil))) - (cond - (braceassignp - ;; We've hit the beginning of the aggregate list. - (c-beginning-of-statement-1 - (c-most-enclosing-brace paren-state)) - (setq bufpos (point))) - ((eq (char-after) ?\;) - ;; Brace lists can't contain a semicolon, so we're done. - (setq containing-sexp nil)) - ((and (setq macro-start (point)) - (c-forward-to-cpp-define-body) - (eq (point) containing-sexp)) - ;; We've a macro whose expansion starts with the '{'. - ;; Heuristically, if we have a ';' in it we've not got a - ;; brace list, otherwise we have. - (let ((macro-end (progn (c-end-of-macro) (point)))) - (goto-char containing-sexp) - (forward-char) - (if (and (c-syntactic-re-search-forward "[;,]" macro-end t t) - (eq (char-before) ?\;)) - (setq bufpos nil - containing-sexp nil) - (setq bufpos macro-start)))) - (t - ;; Go up one level + (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))))) - - bufpos)) - )) + next-containing nil)))) + (and (numberp bufpos) bufpos))))) (defun c-looking-at-special-brace-list (&optional lim) ;; If we're looking at the start of a pike-style list, i.e., `({ })', @@ -10156,7 +10247,19 @@ comment at the start of cc-engine.el for more info." (and (> (point) (or lim (point-min))) (c-on-identifier))) (and c-special-brace-lists - (c-looking-at-special-brace-list))) + (c-looking-at-special-brace-list)) + (and (c-major-mode-is 'c++-mode) + (save-excursion + (goto-char block-follows) + (if (c-go-list-forward) + (progn + (backward-char) + (c-syntactic-skip-backward + "^;," block-follows t) + (not (eq (char-before) ?\;))) + (or (not (c-syntactic-re-search-forward + "[;,]" nil t t)) + (not (eq (char-before) ?\;))))))) nil (cons 'inexpr-statement (point))))) @@ -10565,10 +10668,10 @@ comment at the start of cc-engine.el for more info." ;; CASE B.2: brace-list-open ((or (consp special-brace-list) - (save-excursion - (goto-char beg-of-same-or-containing-stmt) - (c-syntactic-re-search-forward "=\\([^=]\\|$\\)" - indent-point t t t))) + (numberp + (c-looking-at-or-maybe-in-bracelist + containing-sexp beg-of-same-or-containing-stmt)) + ) ;; The most semantically accurate symbol here is ;; brace-list-open, but we normally report it simply as a ;; statement-cont. The reason is that one normally adjusts @@ -10601,6 +10704,14 @@ comment at the start of cc-engine.el for more info." (c-add-stmt-syntax 'defun-open nil t containing-sexp paren-state)) + ;; CASE B.5: We have a C++11 "return \n { ..... }" Note that we're + ;; not at the "{", currently. + ((progn (goto-char indent-point) + (backward-sexp) + (looking-at c-return-key)) + (c-add-stmt-syntax 'statement-cont nil t + containing-sexp paren-state)) + ;; CASE B.4: Continued statement with block open. The most ;; accurate analysis is perhaps `statement-cont' together with ;; `block-open' but we play DWIM and use `substatement-open' @@ -11120,7 +11231,14 @@ comment at the start of cc-engine.el for more info." (looking-at c-opt-inexpr-brace-list-key) (setq tmpsymbol 'topmost-intro-cont))) (looking-at "=\\([^=]\\|$\\)")) - (looking-at c-brace-list-key)) + (looking-at c-brace-list-key) + (looking-at c-return-key) + (save-excursion + (and (c-forward-type) + (looking-at c-identifier-start) + (not (looking-at c-keywords-regexp)) + (c-forward-token-2) + (eq (point) (c-point 'boi indent-point))))) (save-excursion (while (and (< (point) indent-point) (zerop (c-forward-token-2 1 t)) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index ae18d0a..60b8b6d 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1166,7 +1166,8 @@ casts and declarations are fontified. Used on level 2 and higher." ;; `parse-sexp-lookup-properties' (when it exists). (parse-sexp-lookup-properties (cc-eval-when-compile - (boundp 'parse-sexp-lookup-properties)))) + (boundp 'parse-sexp-lookup-properties)) + )) ;; Below we fontify a whole declaration even when it crosses the limit, ;; to avoid gaps when jit/lazy-lock fontifies the file a block at a @@ -1204,7 +1205,8 @@ casts and declarations are fontified. Used on level 2 and higher." (setq start-pos (point)) (when ;; The result of the form below is true when we don't recognize a - ;; declaration or cast. + ;; declaration or cast, and we don't recognise a "non-decl", + ;; typically a brace list. (if (or (and (eq (get-text-property (point) 'face) 'font-lock-keyword-face) (looking-at c-not-decl-init-keywords)) @@ -1220,7 +1222,7 @@ casts and declarations are fontified. Used on level 2 and higher." ;; (e.g. "for ("). (let ((type (and (> match-pos (point-min)) (c-get-char-property (1- match-pos) 'c-type)))) - (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?<))) + (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?< ?{))) (setq context nil c-restricted-<>-arglists nil)) ;; A control flow expression or a decltype @@ -1242,6 +1244,10 @@ casts and declarations are fontified. Used on level 2 and higher." ((eq type 'c-decl-arg-start) (setq context 'decl c-restricted-<>-arglists nil)) + ;; We're inside (probably) a brace list. + ((eq type 'c-not-decl) + (setq context 'not-decl + c-restricted-<>-arglists nil)) ;; Inside a C++11 lambda function arglist. ((and (c-major-mode-is 'c++-mode) (eq (char-before match-pos) ?\() @@ -1255,7 +1261,20 @@ casts and declarations are fontified. Used on level 2 and higher." c-restricted-<>-arglists nil) (c-put-char-property (1- match-pos) 'c-type 'c-decl-arg-start)) - + ;; We're inside an brace list. + ((and (eq (char-before match-pos) ?{) + (save-excursion + (goto-char (1- match-pos)) + (numberp + (c-looking-at-or-maybe-in-bracelist nil)))) + (setq context 'not-decl + c-restricted-<>-arglists nil) + (c-put-char-property (1- match-pos) 'c-type + 'c-not-decl)) + ;; We're inside an "ordinary" open brace. + ((eq (char-before match-pos) ?{) + (setq context nil + c-restricted-<>-arglists nil)) ;; Inside an angle bracket arglist. ((or (eq type 'c-<>-arg-sep) (eq (char-before match-pos) ?<)) @@ -1301,123 +1320,131 @@ casts and declarations are fontified. Used on level 2 and higher." (c-forward-syntactic-ws)) ;; Now analyze the construct. - (setq decl-or-cast (c-forward-decl-or-cast-1 - match-pos context last-cast-end)) - - ;; Ensure that c-<>-arg-sep c-type properties are in place on the - ;; commas separating the arguments inside template/generic <..>s. - (when (and (eq (char-before match-pos) ?<) - (> match-pos max-<>-end)) - (save-excursion - (goto-char match-pos) - (c-backward-token-2) - (if (and - (eq (char-after) ?<) - (let ((c-restricted-<>-arglists - (save-excursion - (c-backward-token-2) - (and - (not (looking-at c-opt-<>-sexp-key)) - (progn (c-backward-syntactic-ws) - (memq (char-before) '(?\( ?,))) - (not (eq (c-get-char-property (1- (point)) - 'c-type) - 'c-decl-arg-start)))))) - (c-forward-<>-arglist nil))) - (setq max-<>-end (point))))) - - (cond - ((eq decl-or-cast 'cast) - ;; Save the position after the previous cast so we can feed - ;; it to `c-forward-decl-or-cast-1' in the next round. That - ;; helps it discover cast chains like "(a) (b) c". - (setq last-cast-end (point)) - (c-fontify-recorded-types-and-refs) - nil) + (if (eq context 'not-decl) + (progn + (setq decl-or-cast nil) + (if (c-syntactic-re-search-forward + "," (min limit (point-max)) 'at-limit t) + (c-put-char-property (1- (point)) 'c-type 'c-not-decl)) + nil) + (setq decl-or-cast + (c-forward-decl-or-cast-1 + match-pos context last-cast-end)) + + ;; Ensure that c-<>-arg-sep c-type properties are in place on the + ;; commas separating the arguments inside template/generic <..>s. + (when (and (eq (char-before match-pos) ?<) + (> match-pos max-<>-end)) + (save-excursion + (goto-char match-pos) + (c-backward-token-2) + (if (and + (eq (char-after) ?<) + (let ((c-restricted-<>-arglists + (save-excursion + (c-backward-token-2) + (and + (not (looking-at c-opt-<>-sexp-key)) + (progn (c-backward-syntactic-ws) + (memq (char-before) '(?\( ?,))) + (not (eq (c-get-char-property (1- (point)) + 'c-type) + 'c-decl-arg-start)))))) + (c-forward-<>-arglist nil))) + (setq max-<>-end (point))))) + + (cond + ((eq decl-or-cast 'cast) + ;; Save the position after the previous cast so we can feed + ;; it to `c-forward-decl-or-cast-1' in the next round. That + ;; helps it discover cast chains like "(a) (b) c". + (setq last-cast-end (point)) + (c-fontify-recorded-types-and-refs) + nil) + + (decl-or-cast + ;; We've found a declaration. + + ;; Set `max-type-decl-end' or `max-type-decl-end-before-token' + ;; under the assumption that we're after the first type decl + ;; expression in the declaration now. That's not really true; + ;; we could also be after a parenthesized initializer + ;; expression in C++, but this is only used as a last resort + ;; to slant ambiguous expression/declarations, and overall + ;; it's worth the risk to occasionally fontify an expression + ;; as a declaration in an initializer expression compared to + ;; getting ambiguous things in normal function prototypes + ;; fontified as expressions. + (if inside-macro + (when (> (point) max-type-decl-end-before-token) + (setq max-type-decl-end-before-token (point))) + (when (> (point) max-type-decl-end) + (setq max-type-decl-end (point)))) + + ;; Do we have an expression as the second or third clause of + ;; a "for" paren expression? + (if (save-excursion + (and + (car (cddr decl-or-cast)) ; maybe-expression flag. + (goto-char start-pos) + (c-go-up-list-backward) + (eq (char-after) ?\() + (progn (c-backward-syntactic-ws) + (c-simple-skip-symbol-backward)) + (looking-at c-paren-stmt-key) + (progn (goto-char match-pos) + (while (and (eq (char-before) ?\)) + (c-go-list-backward)) + (c-backward-syntactic-ws)) + (eq (char-before) ?\;)))) + ;; We've got an expression in "for" parens. Remove the + ;; "type" that would spuriously get fontified. + (let ((elt (and (consp c-record-type-identifiers) + (assq (cadr (cddr decl-or-cast)) + c-record-type-identifiers)))) + (when elt + (setq c-record-type-identifiers + (c-delq-from-dotted-list + elt c-record-type-identifiers))) + t) + ;; Back up to the type to fontify the declarator(s). + (goto-char (car decl-or-cast)) + + (let ((decl-list + (if context + ;; Should normally not fontify a list of + ;; declarators inside an arglist, but the first + ;; argument in the ';' separated list of a "for" + ;; statement is an exception. + (when (eq (char-before match-pos) ?\() + (save-excursion + (goto-char (1- match-pos)) + (c-backward-syntactic-ws) + (and (c-simple-skip-symbol-backward) + (looking-at c-paren-stmt-key)))) + t))) + + ;; Fix the `c-decl-id-start' or `c-decl-type-start' property + ;; before the first declarator if it's a list. + ;; `c-font-lock-declarators' handles the rest. + (when decl-list + (save-excursion + (c-backward-syntactic-ws) + (unless (bobp) + (c-put-char-property (1- (point)) 'c-type + (if (cadr decl-or-cast) + 'c-decl-type-start + 'c-decl-id-start))))) + + (c-font-lock-declarators + (min limit (point-max)) decl-list (cadr decl-or-cast))) + + ;; A declaration has been successfully identified, so do all the + ;; fontification of types and refs that've been recorded. + (c-fontify-recorded-types-and-refs) + nil)) - (decl-or-cast - ;; We've found a declaration. - - ;; Set `max-type-decl-end' or `max-type-decl-end-before-token' - ;; under the assumption that we're after the first type decl - ;; expression in the declaration now. That's not really true; - ;; we could also be after a parenthesized initializer - ;; expression in C++, but this is only used as a last resort - ;; to slant ambiguous expression/declarations, and overall - ;; it's worth the risk to occasionally fontify an expression - ;; as a declaration in an initializer expression compared to - ;; getting ambiguous things in normal function prototypes - ;; fontified as expressions. - (if inside-macro - (when (> (point) max-type-decl-end-before-token) - (setq max-type-decl-end-before-token (point))) - (when (> (point) max-type-decl-end) - (setq max-type-decl-end (point)))) - - ;; Do we have an expression as the second or third clause of - ;; a "for" paren expression? - (if (save-excursion - (and - (car (cddr decl-or-cast)) ; maybe-expression flag. - (goto-char start-pos) - (c-go-up-list-backward) - (eq (char-after) ?\() - (progn (c-backward-syntactic-ws) - (c-simple-skip-symbol-backward)) - (looking-at c-paren-stmt-key) - (progn (goto-char match-pos) - (while (and (eq (char-before) ?\)) - (c-go-list-backward)) - (c-backward-syntactic-ws)) - (eq (char-before) ?\;)))) - ;; We've got an expression in "for" parens. Remove the - ;; "type" that would spuriously get fontified. - (let ((elt (and (consp c-record-type-identifiers) - (assq (cadr (cddr decl-or-cast)) - c-record-type-identifiers)))) - (when elt - (setq c-record-type-identifiers - (c-delq-from-dotted-list - elt c-record-type-identifiers))) - t) - ;; Back up to the type to fontify the declarator(s). - (goto-char (car decl-or-cast)) - - (let ((decl-list - (if context - ;; Should normally not fontify a list of - ;; declarators inside an arglist, but the first - ;; argument in the ';' separated list of a "for" - ;; statement is an exception. - (when (eq (char-before match-pos) ?\() - (save-excursion - (goto-char (1- match-pos)) - (c-backward-syntactic-ws) - (and (c-simple-skip-symbol-backward) - (looking-at c-paren-stmt-key)))) - t))) - - ;; Fix the `c-decl-id-start' or `c-decl-type-start' property - ;; before the first declarator if it's a list. - ;; `c-font-lock-declarators' handles the rest. - (when decl-list - (save-excursion - (c-backward-syntactic-ws) - (unless (bobp) - (c-put-char-property (1- (point)) 'c-type - (if (cadr decl-or-cast) - 'c-decl-type-start - 'c-decl-id-start))))) - - (c-font-lock-declarators - (min limit (point-max)) decl-list (cadr decl-or-cast))) - - ;; A declaration has been successfully identified, so do all the - ;; fontification of types and refs that've been recorded. - (c-fontify-recorded-types-and-refs) - nil)) - - (t t))) + (t t)))) ;; It was a false alarm. Check if we're in a label (or other ;; construct with `:' except bitfield) instead. diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 1d9b8d3..e1ccc79 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1772,6 +1772,16 @@ the appropriate place for that." "array" "float" "function" "int" "mapping" "mixed" "multiset" "object" "program" "string" "this_program" "void")) +(c-lang-defconst c-return-kwds + "Keywords which return a value to the calling function." + t '("return") + idl nil) + +(c-lang-defconst c-return-key + ;; Adorned regexp matching `c-return-kwds'. + t (c-make-keywords-re t (c-lang-const c-return-kwds))) +(c-lang-defvar c-return-key (c-lang-const c-return-key)) + (c-lang-defconst c-primitive-type-key ;; An adorned regexp that matches `c-primitive-type-kwds'. t (c-make-keywords-re t (c-lang-const c-primitive-type-kwds))) @@ -3150,6 +3160,13 @@ list." c t) (c-lang-defvar c-recognize-knr-p (c-lang-const c-recognize-knr-p)) +(c-lang-defconst c-pre-id-bracelist-key + "A regexp matching tokens which, preceding an identifier, signify a bracelist. +" + t "\\<\\>" + c++ "new\\([^[:alnum:]_$]\\|$\\)\\|&&?\\(\\S.\\|$\\)") +(c-lang-defvar c-pre-id-bracelist-key (c-lang-const c-pre-id-bracelist-key)) + (c-lang-defconst c-recognize-typeless-decls "Non-nil means function declarations without return type should be recognized. That can introduce an ambiguity with parenthesized macro diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 694a510..5b324d6 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1351,10 +1351,10 @@ Note that the style variables are always made local to the buffer." (defun c-fl-decl-start (pos) ;; If the beginning of the line containing POS is in the middle of a "local" - ;; declaration (i.e. one which does not start outside of braces enclosing - ;; POS, such as a struct), return the beginning of that declaration. - ;; Otherwise return nil. Note that declarations, in this sense, can be - ;; nested. + ;; declaration, return the beginning of that declaration. Otherwise return + ;; nil. Note that declarations, in this sense, can be nested. (A local + ;; declaration is one which does not start outside of struct braces (and + ;; similar) enclosing POS. Brace list braces here are not "similar". ;; ;; This function is called indirectly from font locking stuff - either from ;; c-after-change (to prepare for after-change font-locking) or from font @@ -1402,7 +1402,12 @@ Note that the style variables are always made local to the buffer." (and (eq (char-before) ?\<) (eq (c-get-char-property (1- (point)) 'syntax-table) - c-<-as-paren-syntax))))) + c-<-as-paren-syntax)) + (and (eq (char-before) ?{) + (save-excursion + (backward-char) + (numberp (c-looking-at-or-maybe-in-bracelist nil)))) + ))) (not (bobp))) (backward-char)) ; back over (, [, <. (when (and capture-opener (< capture-opener new-pos)) commit 1f7302563ae03e20e0a2f90a950c164f8bc17941 Author: Paul Eggert Date: Sun Aug 21 04:25:24 2016 -0700 Update from gnulib This incorporates: 2016-08-17 maint: preprocessor changes to support z/OS 2016-08-17 string: rename to avoid '__string' * doc/misc/texinfo.tex, lib/alloca.in.h, lib/string.in.h: Copy from gnulib. diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 5a1f728..5e260ed 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2016-08-03.13} +\def\texinfoversion{2016-08-16.20} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -1108,9 +1108,14 @@ % For LuaTeX % +\newif\iftxiuseunicodedestname +\txiuseunicodedestnamefalse % For pdfTeX etc. + \ifx\luatexversion\thisisundefined \else - % Escape PDF strings UTF-8 to UTF-16 + % Use Unicode destination names + \txiuseunicodedestnametrue + % Escape PDF strings with converting UTF-16 from UTF-8 \begingroup \catcode`\%=12 \directlua{ @@ -1138,7 +1143,24 @@ end } \endgroup - \def\pdfescapestring#1{\directlua{UTF16oct('\luaescapestring{#1}')}} + \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}} + % Escape PDF strings without converting + \begingroup + \directlua{ + function PDFescstr(str) + for c in string.bytes(str) do + if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then + tex.sprint( + string.format(string.char(0x5c) .. string.char(0x25) .. '03o', + c)) + else + tex.sprint(string.char(c)) + end + end + end + } + \endgroup + \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} \ifnum\luatexversion>84 % For LuaTeX >= 0.85 \def\pdfdest{\pdfextension dest} @@ -1199,6 +1221,14 @@ \xdef#1{\pdfescapestring{#1}}% \fi } +\def\txiescapepdfutfsixteen#1{% + \ifx\pdfescapestrutfsixteen\thisisundefined + % No UTF-16 converting macro available. + \txiescapepdf{#1}% + \else + \xdef#1{\pdfescapestrutfsixteen{#1}}% + \fi +} \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot @@ -1308,19 +1338,77 @@ \pdfrefximage \pdflastximage \fi} % - \def\pdfmkdest#1{{% + \def\setpdfdestname#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts \makevalueexpandable \turnoffactive - % Use ASCII approximations in destination names. - \passthroughcharsfalse + \iftxiuseunicodedestname + \ifx \declaredencoding \latone + % Pass through Latin-1 characters. + % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode. + \else + \ifx \declaredencoding \utfeight + % Pass through Unicode characters. + \else + % Use ASCII approximations in destination names. + \passthroughcharsfalse + \fi + \fi + \else + % Use ASCII approximations in destination names. + \passthroughcharsfalse + \fi \def\pdfdestname{#1}% \txiescapepdf\pdfdestname - \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % + \def\setpdfoutlinetext#1{{% + \indexnofonts + \makevalueexpandable + \turnoffactive + \ifx \declaredencoding \latone + % The PDF format can use an extended form of Latin-1 in bookmark + % strings. See Appendix D of the PDF Reference, Sixth Edition, for + % the "PDFDocEncoding". + \passthroughcharstrue + % Pass through Latin-1 characters. + % LuaTeX: Convert to Unicode + % pdfTeX: Use Latin-1 as PDFDocEncoding + \def\pdfoutlinetext{#1}% + \else + \ifx \declaredencoding \utfeight + \ifx\luatexversion\thisisundefined + % For pdfTeX with UTF-8. + % TODO: the PDF format can use UTF-16 in bookmark strings, + % but the code for this isn't done yet. + % Use ASCII approximations. + \passthroughcharsfalse + \def\pdfoutlinetext{#1}% + \else + % For LuaTeX with UTF-8. + % Pass through Unicode characters for title texts. + \passthroughcharstrue + \def\pdfoutlinetext{#1}% + \fi + \else + % For non-Latin-1 or non-UTF-8 encodings. + % Use ASCII approximations. + \passthroughcharsfalse + \def\pdfoutlinetext{#1}% + \fi + \fi + % LuaTeX: Convert to UTF-16 + % pdfTeX: Use Latin-1 as PDFDocEncoding + \txiescapepdfutfsixteen\pdfoutlinetext + }} + % + \def\pdfmkdest#1{% + \setpdfdestname{#1}% + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + } + % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % @@ -1348,36 +1436,13 @@ % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. - { - \ifx\luatexversion\thisisundefined \else - \turnoffactive % LuaTeX can use Unicode strings for PDF - \fi - \edef\pdfoutlinedest{#3}% - \ifx\pdfoutlinedest\empty - \def\pdfoutlinedest{#4}% - \else - \txiescapepdf\pdfoutlinedest - \fi - % - % Also escape PDF chars in the display string. - \bgroup - \ifx \declaredencoding \latone - % The PDF format can use an extended form of Latin-1 in bookmark - % strings. See Appendix D of the PDF Reference, Sixth Edition, for - % the "PDFDocEncoding". - \passthroughcharstrue - \fi - \ifx \declaredencoding \utfeight - % TODO: the PDF format can use UTF-16 in bookmark strings, but the - % code for this isn't done yet. - \fi - \globaldefs=1 - \edef\pdfoutlinetext{#1}% - \txiescapepdf\pdfoutlinetext - \egroup - % - \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% - } + \setpdfoutlinetext{#1} + \setpdfdestname{#3} + \ifx\pdfdestname\empty + \def\pdfdestname{#4}% + \fi + % + \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% @@ -1535,7 +1600,6 @@ % % For XeTeX % -\newif\iftxiuseunicodedestname \ifx\XeTeXrevision\thisisundefined \else % @@ -1608,44 +1672,51 @@ \def\pdfdest name#1 xyz{% \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}% } - \def\pdfmkdest#1{{% + % + \def\setpdfdestname#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts + \makevalueexpandable + \turnoffactive \iftxiuseunicodedestname - \def\pdfdestname{#1}% Pass through Unicode characters. + % Pass through Unicode characters. \else - \edef\pdfdestname{#1}% Replace Unicode characters with ASCII. + % Use ASCII approximations in destination names. + \passthroughcharsfalse \fi - \turnoffactive - \makevalueexpandable + \def\pdfdestname{#1}% \txiescapepdf\pdfdestname - \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % + \def\setpdfoutlinetext#1{{% + \turnoffactive + % Always use Unicode characters in title texts. + \def\pdfoutlinetext{#1}% + % For XeTeX, xdvipdfmx converts to UTF-16. + % So we do not convert. + \txiescapepdf\pdfoutlinetext + }} + % + \def\pdfmkdest#1{% + \setpdfdestname{#1}% + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + } + % % by default, use black for everything. \def\urlcolor{\rgbBlack} \def\linkcolor{\rgbBlack} \def\endlink{\setcolor{\maincolor}\pdfendlink} % \def\dopdfoutline#1#2#3#4{% - \iftxiuseunicodedestname - \def\pdfoutlinedest{#3}% Pass through Unicode characters. - \else - \edef\pdfoutlinedest{#3}% Replace Unicode characters with ASCII. + \setpdfoutlinetext{#1} + \setpdfdestname{#3} + \ifx\pdfdestname\empty + \def\pdfdestname{#4}% \fi - \ifx\pdfoutlinedest\empty - \def\pdfoutlinedest{#4}% - \fi - { - \turnoffactive - \txiescapepdf\pdfoutlinedest - \edef\pdfoutlinetext{#1}% - \txiescapepdf\pdfoutlinetext - % - \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A - << /S /GoTo /D (\pdfoutlinedest) >> >> }% - } + % + \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A + << /S /GoTo /D (\pdfdestname) >> >> }% } % \def\pdfmakeoutlines{% @@ -4842,8 +4913,8 @@ \definedummyletter\ % % % For texindex which always views { and } as separators. - \def\{{\lbracechar}% - \def\}{\rbracechar}% + \def\{{\lbracechar{}}% + \def\}{\rbracechar{}}% % % Do the redefinitions. \definedummies @@ -4927,6 +4998,7 @@ \definedummyword\TeX % % Assorted special characters. + \definedummyword\atchar \definedummyword\arrow \definedummyword\bullet \definedummyword\comma @@ -5143,37 +5215,40 @@ \def\LaTeX{LaTeX}% \def\TeX{TeX}% % - % Assorted special characters. - % (The following {} will end up in the sort string, but that's ok.) - \def\arrow{->}% - \def\bullet{bullet}% - \def\comma{,}% - \def\copyright{copyright}% - \def\dots{...}% - \def\enddots{...}% - \def\equiv{==}% - \def\error{error}% - \def\euro{euro}% - \def\expansion{==>}% - \def\geq{>=}% - \def\guillemetleft{<<}% - \def\guillemetright{>>}% - \def\guilsinglleft{<}% - \def\guilsinglright{>}% - \def\leq{<=}% - \def\minus{-}% - \def\point{.}% - \def\pounds{pounds}% - \def\print{-|}% - \def\quotedblbase{"}% - \def\quotedblleft{"}% - \def\quotedblright{"}% - \def\quoteleft{`}% - \def\quoteright{'}% - \def\quotesinglbase{,}% - \def\registeredsymbol{R}% - \def\result{=>}% - \def\textdegree{o}% + % Assorted special characters. \defglyph gives the control sequence a + % definition that removes the {} that follows its use. + \defglyph\atchar{@}% + \defglyph\arrow{->}% + \defglyph\bullet{bullet}% + \defglyph\comma{,}% + \defglyph\copyright{copyright}% + \defglyph\dots{...}% + \defglyph\enddots{...}% + \defglyph\equiv{==}% + \defglyph\error{error}% + \defglyph\euro{euro}% + \defglyph\expansion{==>}% + \defglyph\geq{>=}% + \defglyph\guillemetleft{<<}% + \defglyph\guillemetright{>>}% + \defglyph\guilsinglleft{<}% + \defglyph\guilsinglright{>}% + \defglyph\leq{<=}% + \defglyph\lbracechar{\{}% + \defglyph\minus{-}% + \defglyph\point{.}% + \defglyph\pounds{pounds}% + \defglyph\print{-|}% + \defglyph\quotedblbase{"}% + \defglyph\quotedblleft{"}% + \defglyph\quotedblright{"}% + \defglyph\quoteleft{`}% + \defglyph\quoteright{'}% + \defglyph\quotesinglbase{,}% + \defglyph\rbracechar{\}}% + \defglyph\registeredsymbol{R}% + \defglyph\result{=>}% + \defglyph\textdegree{o}% % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. @@ -5188,6 +5263,7 @@ \macrolist \let\value\indexnofontsvalue } +\def\defglyph#1#2{\def#1##1{#2}} % see above @@ -5465,7 +5541,7 @@ \let\indexlbrace\{ % Likewise, set these sequences for braces \let\indexrbrace\} % used in the sort key. \begindoublecolumns - \let\entryorphanpenalty=\indexorphanpenalty + \let\entrywidowpenalty=\indexwidowpenalty % % Read input from the index file line by line. \loopdo @@ -5566,6 +5642,12 @@ \def\entry{% \begingroup % + % For pdfTeX and XeTeX. + % The redefinition of \domark stops marks being added in \pdflink to + % preserve coloured links across page boundaries. Otherwise the marks + % would get in the way of \lastbox in \insertindexentrybox. + \let\domark\relax + % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par @@ -5579,10 +5661,6 @@ \def\*{\unskip\space\ignorespaces}% \def\entrybreak{\hfil\break}% An undocumented command % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus0.5pt - % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = @@ -5616,20 +5694,13 @@ % \ifpdf \pdfgettoks#1.% - \bgroup\let\domark\relax - \hskip\skip\thinshrinkable\the\toksA - \egroup - % The redefinion of \domark stops marks being added in \pdflink to - % preserve coloured links across page boundaries. Otherwise the marks - % would get in the way of \lastbox in \insertindexentrybox. + \hskip\skip\thinshrinkable\the\toksA \else \ifx\XeTeXrevision\thisisundefined \hskip\skip\thinshrinkable #1% \else \pdfgettoks#1.% - \bgroup\let\domark\relax - \hskip\skip\thinshrinkable\the\toksA - \egroup + \hskip\skip\thinshrinkable\the\toksA \fi \fi \fi @@ -5638,11 +5709,10 @@ \global\setbox\entryindexbox=\vbox{\unhbox\boxA}% \else \global\setbox\entryindexbox=\vbox\bgroup - \prevdepth=\entrylinedepth - \noindent % We want the text of the entries to be aligned to the left, and the % page numbers to be aligned to the right. % + \parindent = 0pt \advance\leftskip by 0pt plus 1fil \advance\leftskip by 0pt plus -1fill \rightskip = 0pt plus -1fil @@ -5651,8 +5721,6 @@ % if the list of page numbers is long, to be aligned to the right. \parfillskip=0pt plus -1fill % - \hangindent=1em - % \advance\rightskip by \entryrightmargin % Determine how far we can stretch into the margin. % This allows, e.g., "Appendix H GNU Free Documentation License" to @@ -5672,17 +5740,21 @@ \ifdim\dimen@ > 0.8\dimen@ii % due to long index text \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly \dimen@ii = \hsize - \advance \dimen@ii by -1em \ifnum\dimen@>\dimen@ii % If the entry is too long, use the whole line \dimen@ = \dimen@ii \fi \advance\leftskip by 0pt plus 1fill % ragged right \advance \dimen@ by 1\rightskip - \parshape = 2 0pt \dimen@ 1em \dimen@ii - % Ideally we'd add a finite glue at the end of the first line only, but - % TeX doesn't seem to provide a way to do such a thing. + \parshape = 2 0pt \dimen@ 0em \dimen@ii + % Ideally we'd add a finite glue at the end of the first line only, + % instead of using \parshape with explicit line lengths, but TeX + % doesn't seem to provide a way to do such a thing. + % + \leftskip = 1em + \parindent = -1em \fi\fi + \indent % start paragraph \unhbox\boxA % % Do not prefer a separate line ending with a hyphen to fewer lines. @@ -5700,7 +5772,7 @@ \endgroup % delay text of entry until after penalty \bgroup\aftergroup\insertindexentrybox - \entryorphanpenalty + \entrywidowpenalty }} \newskip\thinshrinkable @@ -5708,40 +5780,43 @@ \newbox\entryindexbox \def\insertindexentrybox{% - \copy\entryindexbox - % The following gets the depth of the last box. This is for even - % line spacing when entries span several lines. - \setbox\dummybox\vbox{% - \unvbox\entryindexbox - \nointerlineskip - \lastbox - \global\entrylinedepth=\prevdepth + \ourunvbox\entryindexbox +} + +% Use \lastbox to take apart vbox box by box, and add each sub-box +% to the current vertical list. +\def\ourunvbox#1{% +\bgroup % for local binding of \delayedbox + % Remove the last box from box #1 + \global\setbox#1=\vbox{% + \unvbox#1% + \unskip % remove any glue + \unpenalty + \global\setbox\interbox=\lastbox }% - % Note that we couldn't simply \unvbox\entryindexbox followed by - % \nointerlineskip\lastbox to remove the last box and then reinstate it, - % because this resets how far the box has been \moveleft'ed to 0. \unvbox - % doesn't affect \prevdepth either. + \setbox\delayedbox=\box\interbox + \ifdim\ht#1=0pt\else + \ourunvbox#1 % Repeat on what's left of the box + \nobreak + \fi + \box\delayedbox +\egroup } -\newdimen\entrylinedepth +\newbox\delayedbox +\newbox\interbox % Default is no penalty -\let\entryorphanpenalty\egroup +\let\entrywidowpenalty\egroup % Used from \printindex. \firsttoken should be the first token % after the \entry. If it's not another \entry, we are at the last % line of a group of index entries, so insert a penalty to discourage -% orphaned index entries. -\long\def\indexorphanpenalty{% +% widowed index entries. +\long\def\indexwidowpenalty{% \def\isentry{\entry}% \ifx\firsttoken\isentry \else - \unskip\penalty 9000 - % The \unskip here stops breaking before the glue. It relies on the - % \vskip above being there, otherwise there is an error - % "You can't use `\unskip' in vertical mode". There has to be glue - % in the current vertical list that hasn't been added to the - % "current page". See Chapter 24 of the TeXbook. This contradicts - % Section 8.3.7 in "TeX by Topic," though. + \penalty 9000 \fi \egroup % now comes the box added with \aftergroup } @@ -5781,8 +5856,6 @@ \newbox\partialpage \newdimen\doublecolumnhsize -\newdimen\doublecolumntopgap -\doublecolumntopgap = 0pt % Use inside an output routine to save \topmark and \firstmark \def\savemarks{% @@ -5865,12 +5938,10 @@ % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) - \global\doublecolumntopgap = \topskip - \global\advance\doublecolumntopgap by -1\baselineskip - \advance\vsize by -1\doublecolumntopgap \vsize = 2\vsize - \topskip=0pt - \global\entrylinedepth=0pt\relax + % + % For the benefit of balancing columns + \advance\baselineskip by 0pt plus 0.5pt } % The double-column output routine for all double-column pages except @@ -5900,9 +5971,7 @@ % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize - \vbox{% - \vskip\doublecolumntopgap - \hbox to\txipagewidth{\box0\hfil\box2}}% + \hbox to\txipagewidth{\box0\hfil\box2}% } @@ -5982,10 +6051,6 @@ \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ - % Remove glue from bottom of columns to compare - % apparent heights. - \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}% - \global\setbox3 = \vbox{\unvbox3\unpenalty\unskip}% \ifdim\ht1<\ht3 \global\advance\dimen@ by 1pt \repeat @@ -5998,8 +6063,8 @@ % Just split the last of the double column material roughly in half. \setbox2=\box0 \setbox0 = \vsplit2 to \dimen@ii - \setbox0=\vbox to\dimen@ii{\unvbox0}% - \setbox2=\vbox to\dimen@ii{\unvbox2}% + \setbox0=\vbox to \dimen@ii {\unvbox0\vfill}% + \setbox2=\vbox to \dimen@ii {\unvbox2\vfill}% \else % Compare the heights of the two columns. \ifdim4\ht1>5\ht3 @@ -6009,8 +6074,8 @@ \setbox0=\vbox to \ht1 {\unvbox1\vfill}% \else % Make column bottoms flush with each other. - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% + \setbox2=\vbox to\ht1{\unvbox3\unskip}% + \setbox0=\vbox to\ht1{\unvbox1\unskip}% \fi \fi \fi @@ -8846,32 +8911,26 @@ % For pdfTeX and LuaTeX {\indexnofonts \makevalueexpandable - % - % This (wrongly) does not take account of leading or trailing - % spaces in #1, which should be ignored. - \ifx\luatexversion\thisisundefined - \edef\pdfxrefdest{#1}% pdfTeX: Replace Unicode characters with ASCII. - \else - \def\pdfxrefdest{#1}% LuaTeX: Pass through Unicode characters. - \fi \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. \getfilename{#4}% % - \ifx\pdfxrefdest\empty - \def\pdfxrefdest{Top}% no empty targets - \else - \txiescapepdf\pdfxrefdest % escape PDF special chars + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \setpdfdestname{#1}% + % + \ifx\pdfdestname\empty + \def\pdfdestname{Top}% no empty targets \fi % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 - goto file{\the\filename.pdf} name{\pdfxrefdest}% + goto file{\the\filename.pdf} name{\pdfdestname}% \else - goto name{\pdfmkpgn{\pdfxrefdest}}% + goto name{\pdfmkpgn{\pdfdestname}}% \fi }% \setcolor{\linkcolor}% @@ -8881,24 +8940,18 @@ % For XeTeX {\indexnofonts \makevalueexpandable - % - % This (wrongly) does not take account of leading or trailing - % spaces in #1, which should be ignored. - \iftxiuseunicodedestname - \def\pdfxrefdest{#1}% Pass through Unicode characters. - \else - \edef\pdfxrefdest{#1}% Replace Unicode characters with ASCII. - \fi \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. \getfilename{#4}% % - \ifx\pdfxrefdest\empty - \def\pdfxrefdest{Top}% no empty targets - \else - \txiescapepdf\pdfxrefdest % escape PDF special chars + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \setpdfdestname{#1}% + % + \ifx\pdfdestname\empty + \def\pdfdestname{Top}% no empty targets \fi % \leavevmode @@ -8912,10 +8965,10 @@ % this command line option is no longer necessary % because we can use the `dvipdfmx:config' special. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A - << /S /GoToR /F (\the\filename.pdf) /D (\pdfxrefdest) >> >>}% + << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}% \else \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A - << /S /GoTo /D (\pdfxrefdest) >> >>}% + << /S /GoTo /D (\pdfdestname) >> >>}% \fi }% \setcolor{\linkcolor}% @@ -9975,7 +10028,7 @@ \ifx \declaredencoding \ascii \else \message{Warning: XeTeX with non-UTF-8 encodings cannot handle % - non-ASCII characters in auxiallity files.}% + non-ASCII characters in auxiliary files.}% \fi \fi \fi diff --git a/lib/alloca.in.h b/lib/alloca.in.h index d457ebb..6a25ecd 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h @@ -51,6 +51,8 @@ extern "C" void *_alloca (unsigned short); # pragma intrinsic (_alloca) # define alloca _alloca +# elif defined __MVS__ +# include # else # include # ifdef __cplusplus diff --git a/lib/string.in.h b/lib/string.in.h index 7fb00c1..b3213c4 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -416,15 +416,15 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - " # undef strndup # define strndup rpl_strndup # endif -_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) +_GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); +_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); # else # if ! @HAVE_DECL_STRNDUP@ -_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) +_GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); +_GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); # endif _GL_CXXALIASWARN (strndup); #elif defined GNULIB_POSIXCHECK @@ -444,17 +444,17 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - " # undef strnlen # define strnlen rpl_strnlen # endif -_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) +_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); +_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); # else # if ! @HAVE_DECL_STRNLEN@ -_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) +_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); +_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); # endif _GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK commit 886b9ed80c88b8f729ea9760f904b8c0ef63664f Author: Paul Eggert Date: Sun Aug 21 04:17:30 2016 -0700 ; Spelling fixes diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi index 1f951de..ba10be9 100644 --- a/doc/misc/ses.texi +++ b/doc/misc/ses.texi @@ -1173,7 +1173,7 @@ yank. Using this method, the concerned cells won't be relocated whatever formula they appear in. Please note however that when a formula contains some range @code{(ses-range @var{cell1} @var{cell2})} then in the yanked formula each range bound @var{cell1} and -@var{cell2} are relocated, or not, indepently, depending on whether +@var{cell2} are relocated, or not, independently, depending on whether they are A1-like or renamed. An alternative method is to use @@ -1203,7 +1203,7 @@ kind of dependency is also not recorded. Begins with an 014 character, followed by sets of cell-definition macros for each row, followed by the set of local printer -defintitions, followed by column-widths, column-printers, +definitions, followed by column-widths, column-printers, default-printer, and header-row. Then there's the global parameters (file-format ID, row count, column count, local printer count) and the local variables (specifying @acronym{SES} mode for the buffer, etc.). diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el index 3285fc9..ecf1436 100644 --- a/lisp/net/tramp-gw.el +++ b/lisp/net/tramp-gw.el @@ -125,7 +125,7 @@ (tramp-gw-process-filter tramp-gw-gw-proc s)))))) (defun tramp-gw-process-filter (proc string) - "Resend the string to the other pocess." + "Resend the string to the other process." (let ((tramp-verbose 0)) ;; The other process might have been stopped already. We don't ;; want to be interrupted then. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ee59529..bbc74fc 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5158,7 +5158,7 @@ Return ATTR." (defun tramp-get-remote-path (vec) "Compile list of remote directories for $PATH. -Nonexisting directories are removed from spec." +Nonexistent directories are removed from spec." (with-tramp-connection-property ;; When `tramp-own-remote-path' is in `tramp-remote-path', we ;; cache the result for the session only. Otherwise, the result diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 934186d..1d9b8d3 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -518,7 +518,7 @@ parameters \(point-min) and \(point-max).") c-change-expand-fl-region) c++ '(c-depropertize-new-text c-extend-font-lock-region-for-macros -; c-before-after-change-extend-region-for-lambda-capture ; doens't seem needed. +; c-before-after-change-extend-region-for-lambda-capture ; doesn't seem needed. c-before-after-change-digit-quote c-after-change-re-mark-raw-strings c-neutralize-syntax-in-and-mark-CPP diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index f630b05..694a510 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -497,7 +497,7 @@ preferably use the `c-mode-menu' language constant directly." ;; correct one. This happens in some Emacsen, for example when ;; `basic-save-buffer' does (insert ?\n) when `require-final-newline' is ;; non-nil; (ii) to detect when Emacs fails to invoke -;; `before-change-functions'. This can happend when reverting a buffer - see +;; `before-change-functions'. This can happen when reverting a buffer - see ;; bug #24094. It seems these failures happen only in GNU Emacs; XEmacs ;; seems to maintain the strict alternation of calls to ;; `before-change-functions' and `after-change-functions'. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 1735693..5d9d3a0 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -1943,7 +1943,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (let ((default-directory tramp-test-temporary-file-directory) tmp-file) - ;; The remote host shall know a tempory file directory. + ;; The remote host shall know a temporary file directory. (should (stringp (temporary-file-directory))) (should (string-equal commit b1601a95ea6337abef04544c92552caa0a5bcbca Author: Paul Eggert Date: Sun Aug 21 04:02:06 2016 -0700 Minor text-quoting-style fixes * src/charset.c (check_iso_charset_parameter): * src/frame.c (store_frame_param): * src/xselect.c (x_fill_property_data): Use grave accent for left single quote in ‘error’ format strings. diff --git a/src/charset.c b/src/charset.c index 05469aa..0c831f1 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1401,7 +1401,7 @@ check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars, int final_ch = XFASTINT (final_char); if (! ('0' <= final_ch && final_ch <= '~')) - error ("Invalid FINAL-CHAR '%c', it should be '0'..'~'", final_ch); + error ("Invalid FINAL-CHAR `%c', it should be `0'..`~'", final_ch); return chars_flag; } diff --git a/src/frame.c b/src/frame.c index e17c8ac..dd9ad77 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2412,7 +2412,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) if (WINDOWP (val)) { if (!MINI_WINDOW_P (XWINDOW (val))) - error ("The 'minibuffer' parameter does not specify a valid minibuffer window"); + error ("The `minibuffer' parameter does not specify a valid minibuffer window"); else if (FRAME_MINIBUF_ONLY_P (f)) { if (EQ (val, FRAME_MINIBUF_WINDOW (f))) @@ -2442,7 +2442,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) only nil was specified as new value. */ val = old_val; else if (!EQ (old_val, val)) - error ("Can't change the 'minibuffer' parameter of this frame"); + error ("Can't change the `minibuffer' parameter of this frame"); } } } diff --git a/src/xselect.c b/src/xselect.c index 8de436f..616d12c 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2296,13 +2296,13 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format) if (format == 8) { if ((1 << 8) < val && val <= X_ULONG_MAX - (1 << 7)) - error ("Out of 'char' range"); + error ("Out of `char' range"); *d08++ = val; } else if (format == 16) { if ((1 << 16) < val && val <= X_ULONG_MAX - (1 << 15)) - error ("Out of 'short' range"); + error ("Out of `short' range"); *d16++ = val; } else commit 1a1062d6e16f97effa7030cc5f297c9c57b232ad Author: Martin Rudalics Date: Sun Aug 21 11:36:11 2016 +0200 Fix semantics of 'minibuffer' frame parameter The 'minibuffer' frame parameter is now t for a normal frame (a frame with a root window plus a minibuffer window) and the frame's minibuffer window for a minibuffer-less frame (a frame whose minibuffer window is on another frame). See also: https://lists.gnu.org/archive/html/emacs-devel/2016-07/msg01259.html * src/frame.c (make_frame, make_frame_without_minibuffer) (make_minibuffer_frame): When assigning the frame's minibuffer window also store corresponding 'minibuffer' frame parameter. (store_frame_param): Move the 'minibuffer' parameter checks to the beginning so we can silently override the value before it gets stored in the parameter alist. Fix error handling. (Fframe_parameters): Return value of 'minibuffer' parameter unmodified. * lisp/frameset.el (frameset-filter-minibuffer): When the cdr of the parameter is a minibuffer window, save (minibuffer . nil) instead of (minibuffer . t). (frameset--reuse-frame): To find a non-minibuffer-only frame look out for a frame whose 'minibuffer' parameter is t instead of that frame's minibuffer window. (frameset-minibufferless-first-p): To find a minibuffer-less frame look out for a frame whose 'minibuffer' parameter is a window instead of nil. diff --git a/lisp/frameset.el b/lisp/frameset.el index 2453f57..9a7a8bc 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el @@ -572,7 +572,7 @@ see `frameset-filter-alist'." (defun frameset-filter-minibuffer (current filtered _parameters saving) "Force the minibuffer parameter to have a sensible value. -When saving, convert (minibuffer . #) to (minibuffer . t). +When saving, convert (minibuffer . #) to (minibuffer . nil). When restoring, if there are two copies, keep the one pointing to a live window. @@ -580,7 +580,12 @@ For the meaning of CURRENT, FILTERED, PARAMETERS and SAVING, see `frameset-filter-alist'." (let ((value (cdr current)) mini) (cond (saving - (if (windowp value) '(minibuffer . t) t)) + ;; "Fix semantics of 'minibuffer' frame parameter" change: + ;; When the cdr of the parameter is a minibuffer window, save + ;; (minibuffer . nil) instead of (minibuffer . t). + (if (windowp value) + '(minibuffer . nil) + t)) ((setq mini (assq 'minibuffer filtered)) (when (windowp value) (setcdr mini value)) nil) @@ -906,12 +911,12 @@ is the parameter alist of the frame being restored. Internal use only." ;; If it has not been loaded, and it is not a minibuffer-only frame, ;; let's look for an existing non-minibuffer-only frame to reuse. (unless (or frame (eq (cdr (assq 'minibuffer parameters)) 'only)) + ;; "Fix semantics of 'minibuffer' frame parameter" change: + ;; The 'minibuffer' frame parameter of a non-minibuffer-only + ;; frame is t instead of that frame's minibuffer window. (setq frame (frameset--find-frame-if (lambda (f) - (let ((w (frame-parameter f 'minibuffer))) - (and (window-live-p w) - (window-minibuffer-p w) - (eq (window-frame w) f)))) + (eq (frame-parameter f 'minibuffer) t)) display)))) (mini ;; For minibufferless frames, check whether they already exist, @@ -1027,8 +1032,11 @@ For the meaning of FORCE-DISPLAY, see `frameset-restore'." (t (not force-display)))) (defun frameset-minibufferless-first-p (frame1 _frame2) - "Predicate to sort minibufferless frames before other frames." - (not (frame-parameter frame1 'minibuffer))) + "Predicate to sort minibuffer-less frames before other frames." + ;; "Fix semantics of 'minibuffer' frame parameter" change: The + ;; 'minibuffer' frame parameter of a minibuffer-less frame is that + ;; frame's minibuffer window instead of nil. + (windowp (frame-parameter frame1 'minibuffer))) ;;;###autoload (cl-defun frameset-restore (frameset diff --git a/src/frame.c b/src/frame.c index 899c315..e17c8ac 100644 --- a/src/frame.c +++ b/src/frame.c @@ -658,6 +658,7 @@ make_frame (bool mini_p) mw->mini = 1; wset_frame (mw, frame); fset_minibuffer_window (f, mini_window); + store_frame_param (f, Qminibuffer, Qt); } else { @@ -770,6 +771,7 @@ make_frame_without_minibuffer (Lisp_Object mini_window, KBOARD *kb, } fset_minibuffer_window (f, mini_window); + store_frame_param (f, Qminibuffer, mini_window); /* Make the chosen minibuffer window display the proper minibuffer, unless it is already showing a minibuffer. */ @@ -807,6 +809,7 @@ make_minibuffer_frame (void) mini_window = f->root_window; fset_minibuffer_window (f, mini_window); + store_frame_param (f, Qminibuffer, Qonly); XWINDOW (mini_window)->mini = 1; wset_next (XWINDOW (mini_window), Qnil); wset_prev (XWINDOW (mini_window), Qnil); @@ -2404,6 +2407,46 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) { register Lisp_Object old_alist_elt; + if (EQ (prop, Qminibuffer)) + { + if (WINDOWP (val)) + { + if (!MINI_WINDOW_P (XWINDOW (val))) + error ("The 'minibuffer' parameter does not specify a valid minibuffer window"); + else if (FRAME_MINIBUF_ONLY_P (f)) + { + if (EQ (val, FRAME_MINIBUF_WINDOW (f))) + val = Qonly; + else + error ("Can't change the minibuffer window of a minibuffer-only frame"); + } + else if (FRAME_HAS_MINIBUF_P (f)) + { + if (EQ (val, FRAME_MINIBUF_WINDOW (f))) + val = Qt; + else + error ("Can't change the minibuffer window of a frame with its own minibuffer"); + } + else + /* Store the chosen minibuffer window. */ + fset_minibuffer_window (f, val); + } + else + { + Lisp_Object old_val = Fcdr (Fassq (Qminibuffer, f->param_alist)); + + if (!NILP (old_val)) + { + if (WINDOWP (old_val) && NILP (val)) + /* Don't change the value for a minibuffer-less frame if + only nil was specified as new value. */ + val = old_val; + else if (!EQ (old_val, val)) + error ("Can't change the 'minibuffer' parameter of this frame"); + } + } + } + /* The buffer-list parameters are stored in a special place and not in the alist. All buffers must be live. */ if (EQ (prop, Qbuffer_list)) @@ -2475,19 +2518,6 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) else if (EQ (prop, Qname)) set_term_frame_name (f, val); } - - if (EQ (prop, Qminibuffer) && WINDOWP (val)) - { - if (! MINI_WINDOW_P (XWINDOW (val))) - error ("Surrogate minibuffer windows must be minibuffer windows"); - - if ((FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f)) - && !EQ (val, f->minibuffer_window)) - error ("Can't change the surrogate minibuffer of a frame with its own minibuffer"); - - /* Install the chosen minibuffer window, with proper buffer. */ - fset_minibuffer_window (f, val); - } } /* Return color matches UNSPEC on frame F or nil if UNSPEC @@ -2565,10 +2595,6 @@ If FRAME is omitted or nil, return information on the currently selected frame. : FRAME_COLS (f)); store_in_alist (&alist, Qwidth, make_number (width)); store_in_alist (&alist, Qmodeline, (FRAME_WANTS_MODELINE_P (f) ? Qt : Qnil)); - store_in_alist (&alist, Qminibuffer, - (! FRAME_HAS_MINIBUF_P (f) ? Qnil - : FRAME_MINIBUF_ONLY_P (f) ? Qonly - : FRAME_MINIBUF_WINDOW (f))); store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil)); store_in_alist (&alist, Qbuffer_list, f->buffer_list); store_in_alist (&alist, Qburied_buffer_list, f->buried_buffer_list);