commit fd6a133fdcd6bcdc240c05cfe645cd9064f9e744 (HEAD, refs/remotes/origin/master) Author: Dmitry Antipov Date: Thu Jun 30 09:30:41 2016 +0300 Minor tweaks to openp * src/lread.c (openp): Move invariant code out of the loop and thus avoid redundant calls to memcpy. Adjust comments. diff --git a/src/lread.c b/src/lread.c index 5c47f78..ecd4827 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1464,6 +1464,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, for (; CONSP (path); path = XCDR (path)) { + ptrdiff_t baselen, prefixlen; + filename = Fexpand_file_name (str, XCAR (path)); if (!complete_filename_p (filename)) /* If there are non-absolute elts in PATH (eg "."). */ @@ -1485,6 +1487,14 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, fn = SAFE_ALLOCA (fn_size); } + /* Copy FILENAME's data to FN but remove starting /: if any. */ + prefixlen = ((SCHARS (filename) > 2 + && SREF (filename, 0) == '/' + && SREF (filename, 1) == ':') + ? 2 : 0); + baselen = SBYTES (filename) - prefixlen; + memcpy (fn, SDATA (filename) + prefixlen, baselen); + /* Loop over suffixes. */ for (tail = NILP (suffixes) ? list1 (empty_unibyte_string) : suffixes; CONSP (tail); tail = XCDR (tail)) @@ -1493,16 +1503,10 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, ptrdiff_t fnlen, lsuffix = SBYTES (suffix); Lisp_Object handler; - /* Concatenate path element/specified name with the suffix. - If the directory starts with /:, remove that. */ - int prefixlen = ((SCHARS (filename) > 2 - && SREF (filename, 0) == '/' - && SREF (filename, 1) == ':') - ? 2 : 0); - fnlen = SBYTES (filename) - prefixlen; - memcpy (fn, SDATA (filename) + prefixlen, fnlen); - memcpy (fn + fnlen, SDATA (suffix), lsuffix + 1); - fnlen += lsuffix; + /* Make complete filename by appending SUFFIX. */ + memcpy (fn + baselen, SDATA (suffix), lsuffix + 1); + fnlen = baselen + lsuffix; + /* Check that the file exists and is not a directory. */ /* We used to only check for handlers on non-absolute file names: if (absolute) commit 3aeb7c35edf3ae4042717889d8bdd40e1b861be0 Author: Dmitry Antipov Date: Thu Jun 30 09:21:07 2016 +0300 Simplify handling of frame parameters * src/frame.c (x_set_frame_parameters): Avoid extra loop processing foreground color, background color and font parameters. Adjust comments. diff --git a/src/frame.c b/src/frame.c index aa06a38..540b69f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3110,70 +3110,58 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) /* Record in these vectors all the parms specified. */ Lisp_Object *parms; Lisp_Object *values; - ptrdiff_t i, p; + ptrdiff_t i, j, size; bool left_no_change = 0, top_no_change = 0; #ifdef HAVE_X_WINDOWS bool icon_left_no_change = 0, icon_top_no_change = 0; #endif - i = 0; - for (tail = alist; CONSP (tail); tail = XCDR (tail)) - i++; + for (size = 0, tail = alist; CONSP (tail); tail = XCDR (tail)) + size++; USE_SAFE_ALLOCA; - SAFE_ALLOCA_LISP (parms, 2 * i); - values = parms + i; + SAFE_ALLOCA_LISP (parms, 2 * size); + values = parms + size; /* Extract parm names and values into those vectors. */ - i = 0; + i = 0, j = size - 1; for (tail = alist; CONSP (tail); tail = XCDR (tail)) { - Lisp_Object elt; - - elt = XCAR (tail); - parms[i] = Fcar (elt); - values[i] = Fcdr (elt); - i++; - } - /* TAIL and ALIST are not used again below here. */ - alist = tail = Qnil; - - top = left = Qunbound; - icon_left = icon_top = Qunbound; + Lisp_Object elt = XCAR (tail), prop = Fcar (elt), val = Fcdr (elt); - /* Process foreground_color and background_color before anything else. - They are independent of other properties, but other properties (e.g., - cursor_color) are dependent upon them. */ - /* Process default font as well, since fringe widths depends on it. */ - for (p = 0; p < i; p++) - { - Lisp_Object prop, val; + /* Some properties are independent of other properties, but other + properties are dependent upon them. These special properties + are foreground_color, background_color (affects cursor_color) + and font (affects fringe widths); they're recorded starting + from the end of PARMS and VALUES to process them first by using + reverse iteration. */ - prop = parms[p]; - val = values[p]; if (EQ (prop, Qforeground_color) || EQ (prop, Qbackground_color) || EQ (prop, Qfont)) { - register Lisp_Object param_index, old_value; - - old_value = get_frame_param (f, prop); - if (NILP (Fequal (val, old_value))) - { - store_frame_param (f, prop, val); - - param_index = Fget (prop, Qx_frame_parameter); - if (NATNUMP (param_index) - && XFASTINT (param_index) < ARRAYELTS (frame_parms) - && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) - (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); - } + parms[j] = prop; + values[j] = val; + j--; + } + else + { + parms[i] = prop; + values[i] = val; + i++; } } - /* Now process them in reverse of specified order. */ - while (i-- != 0) + /* TAIL and ALIST are not used again below here. */ + alist = tail = Qnil; + + top = left = Qunbound; + icon_left = icon_top = Qunbound; + + /* Reverse order is used to make sure that special + properties noticed above are processed first. */ + for (i = size - 1; i >= 0; i--) { Lisp_Object prop, val; @@ -3221,11 +3209,6 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) fullscreen = val; fullscreen_change = true; } - else if (EQ (prop, Qforeground_color) - || EQ (prop, Qbackground_color) - || EQ (prop, Qfont)) - /* Processed above. */ - continue; else { register Lisp_Object param_index, old_value; commit 4bd3503991e501690b30c3415d4641efb6e1de3a Author: Dmitry Antipov Date: Thu Jun 30 08:37:46 2016 +0300 Cleanup around mature character manipulation functions * lisp/international/mule-diag.el (decode-codepage-char): Remove. * lisp/ldefs-boot.el (toplevel): Adjust accordingly. * lisp/subr.el (toplevel): Do not advertise calling conventions for 'decode-char' and 'encode-char'. * src/charset.c (Fdecode_char, Fencode_char): Remove unused 3rd arg. diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index fbb0e0c..731d688 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -204,13 +204,6 @@ Character sets for defining other charsets, or for backward compatibility "Obsolete.") (make-obsolete-variable 'non-iso-charset-alist "no longer relevant." "23.1") -(defun decode-codepage-char (codepage code) - "Decode a character that has code CODE in CODEPAGE. -Return a decoded character string. Each CODEPAGE corresponds to a -coding system cpCODEPAGE." - (declare (obsolete decode-char "23.1")) - (decode-char (intern (format "cp%d" codepage)) code)) - ;; A variable to hold charset input history. (defvar charset-history nil) diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index bc5233c..7103041 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -21527,7 +21527,7 @@ The default is 20. If LIMIT is negative, do not limit the listing. \(fn &optional LIMIT)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "mule-diag" '("print-" "list-" "sort-listed-character-sets" "non-iso-charset-alist" "decode-codepage-char" "charset-history" "describe-font-internal" "insert-section"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "mule-diag" '("print-" "list-" "sort-listed-character-sets" "non-iso-charset-alist" "charset-history" "describe-font-internal" "insert-section"))) ;;;*** diff --git a/lisp/subr.el b/lisp/subr.el index 27b1c8a..cf84d8b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1335,8 +1335,6 @@ is converted into a string by expressing it in decimal." (set-advertised-calling-convention 'unintern '(name obarray) "23.3") (set-advertised-calling-convention 'indirect-function '(object) "25.1") (set-advertised-calling-convention 'redirect-frame-focus '(frame focus-frame) "24.3") -(set-advertised-calling-convention 'decode-char '(ch charset) "21.4") -(set-advertised-calling-convention 'encode-char '(ch charset) "21.4") ;;;; Obsolescence declarations for variables, and aliases. diff --git a/src/charset.c b/src/charset.c index 6882052..95a9c57 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1839,12 +1839,12 @@ encode_char (struct charset *charset, int c) } -DEFUN ("decode-char", Fdecode_char, Sdecode_char, 2, 3, 0, +DEFUN ("decode-char", Fdecode_char, Sdecode_char, 2, 2, 0, doc: /* Decode the pair of CHARSET and CODE-POINT into a character. Return nil if CODE-POINT is not valid in CHARSET. CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). */) - (Lisp_Object charset, Lisp_Object code_point, Lisp_Object restriction) + (Lisp_Object charset, Lisp_Object code_point) { int c, id; unsigned code; @@ -1858,10 +1858,10 @@ CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). */) } -DEFUN ("encode-char", Fencode_char, Sencode_char, 2, 3, 0, +DEFUN ("encode-char", Fencode_char, Sencode_char, 2, 2, 0, doc: /* Encode the character CH into a code-point of CHARSET. Return nil if CHARSET doesn't include CH. */) - (Lisp_Object ch, Lisp_Object charset, Lisp_Object restriction) + (Lisp_Object ch, Lisp_Object charset) { int c, id; unsigned code; commit 681d3f1f582d9b549f41ef1eacff42abb98f878d Author: Alan Mackenzie Date: Wed Jun 29 20:17:39 2016 +0000 Fix C-M-a in a C function finding the start of a macro preceding it. Also amend some pertinent documentation. This fixes bug #23818. * lisp/progmodes/cc-engine.el (c-beginning-of-decl-1): Also check for a virtual semicolon at a place where we check for other types of statement ends. * lisp/progmodes/cc-vars.el (c-macro-nacmes-with-semicolon): Remove from the doc string the bit saying that the variable is a prototype and liable to change. * doc/misc/cc-mode.texi (Macros with ;): Enhance, stating that configuring macros with semicolon can prevent C-M-a missing the beginning of defun. diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index 82f8cbc..f311ec8 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -6727,9 +6727,11 @@ Macros which needn't (or mustn't) be followed by a semicolon when you invoke them, @dfn{macros with semicolons}, are very common. These can cause @ccmode{} to parse the next line wrongly as a @code{statement-cont} (@pxref{Function Symbols}) and thus mis-indent -it. +it. At the top level, a macro invocation before a defun start can +cause, for example, @code{c-beginning-of-defun} (@kbd{C-M-a}) not to +find the correct start of the current function. -You can prevent this by specifying which macros have semicolons. It +You can prevent these by specifying which macros have semicolons. It doesn't matter whether or not such a macro has a parameter list: @defopt c-macro-names-with-semicolon diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 4bc4056..75f07e3 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -9298,7 +9298,8 @@ comment at the start of cc-engine.el for more info." (/= last-stmt-start (point)) (progn (c-backward-syntactic-ws lim) - (not (memq (char-before) '(?\; ?} ?: nil)))) + (not (or (memq (char-before) '(?\; ?} ?: nil)) + (c-at-vsemi-p)))) (save-excursion (backward-char) (not (looking-at "\\s("))) diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index f03aec2..7a6f4ba 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1702,10 +1702,7 @@ the regular expression must match only valid identifiers. If you change this variable's value, call the function `c-make-macros-with-semi-re' to set the necessary internal -variables. - -Note that currently \(2008-11-04) this variable is a prototype, -and is likely to disappear or change its form soon.") +variables.") (make-variable-buffer-local 'c-macro-names-with-semicolon) (put 'c-macro-names-with-semicolon 'safe-local-variable #'c-string-or-string-list-p)