------------------------------------------------------------ revno: 117549 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2014-07-18 15:04:37 +0400 message: Prefer 'x_display_info *' to 'Display *' in X selection code. This helps to avoid unneeded calls to x_display_info_for_display. * xterm.h (struct selection_input_event): Record 'x_display_info *' instead of 'Display *'. (SELECTION_EVENT_DPYINFO): New macro. (SELECTION_EVENT_DISPLAY): Now inline function to prohibit using it as an lvalue. Mention this in comment. * xterm.c (handle_one_xevent): Use SELECTION_EVENT_DPYINFO. * xselect.c (x_get_window_property_as_lisp_data, x_atom_to_symbol) (selection_data_to_lisp_data, receive_incremental_selection): Convert to use 'x_display_info *'. Adjust users where appropriate. (lisp_data_to_selection_data): Likewise. Also pass 'struct selection data *' as last arg to not return values in args. (unexpect_property_change): Use common removal technique. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-18 06:02:19 +0000 +++ src/ChangeLog 2014-07-18 11:04:37 +0000 @@ -12,6 +12,21 @@ * xterm.h (x_display_pixel_width, x_display_pixel_height): ... inlined from here. + Prefer 'x_display_info *' to 'Display *' in X selection code. + This helps to avoid unneeded calls to x_display_info_for_display. + * xterm.h (struct selection_input_event): Record 'x_display_info *' + instead of 'Display *'. + (SELECTION_EVENT_DPYINFO): New macro. + (SELECTION_EVENT_DISPLAY): Now inline function to prohibit using + it as an lvalue. Mention this in comment. + * xterm.c (handle_one_xevent): Use SELECTION_EVENT_DPYINFO. + * xselect.c (x_get_window_property_as_lisp_data, x_atom_to_symbol) + (selection_data_to_lisp_data, receive_incremental_selection): + Convert to use 'x_display_info *'. Adjust users where appropriate. + (lisp_data_to_selection_data): Likewise. Also pass 'struct + selection data *' as last arg to not return values in args. + (unexpect_property_change): Use common removal technique. + 2014-07-17 Dmitry Antipov * print.c (print_preprocess): Adjust to match changed === modified file 'src/xselect.c' --- src/xselect.c 2014-07-07 23:33:05 +0000 +++ src/xselect.c 2014-07-18 11:04:37 +0000 @@ -53,15 +53,14 @@ Atom, int); static void unexpect_property_change (struct prop_location *); static void wait_for_property_change (struct prop_location *); -static Lisp_Object x_get_window_property_as_lisp_data (Display *, +static Lisp_Object x_get_window_property_as_lisp_data (struct x_display_info *, Window, Atom, Lisp_Object, Atom); -static Lisp_Object selection_data_to_lisp_data (Display *, +static Lisp_Object selection_data_to_lisp_data (struct x_display_info *, const unsigned char *, ptrdiff_t, Atom, int); -static void lisp_data_to_selection_data (Display *, Lisp_Object, - unsigned char **, Atom *, - ptrdiff_t *, int *, int *); +static void lisp_data_to_selection_data (struct x_display_info *, Lisp_Object, + struct selection_data *); /* Printing traces to stderr. */ @@ -245,9 +244,8 @@ and calls to intern whenever possible. */ static Lisp_Object -x_atom_to_symbol (Display *dpy, Atom atom) +x_atom_to_symbol (struct x_display_info *dpyinfo, Atom atom) { - struct x_display_info *dpyinfo; char *str; Lisp_Object val; @@ -268,7 +266,6 @@ return QATOM; } - dpyinfo = x_display_info_for_display (dpy); if (dpyinfo == NULL) return Qnil; if (atom == dpyinfo->Xatom_CLIPBOARD) @@ -295,7 +292,7 @@ return QNULL; block_input (); - str = XGetAtomName (dpy, atom); + str = XGetAtomName (dpyinfo->display, atom); unblock_input (); TRACE1 ("XGetAtomName --> %s", str); if (! str) return Qnil; @@ -750,12 +747,11 @@ struct gcpro gcpro1, gcpro2; Time local_selection_time; - Display *display = SELECTION_EVENT_DISPLAY (event); - struct x_display_info *dpyinfo = x_display_info_for_display (display); + struct x_display_info *dpyinfo = SELECTION_EVENT_DPYINFO (event); Atom selection = SELECTION_EVENT_SELECTION (event); - Lisp_Object selection_symbol = x_atom_to_symbol (display, selection); + Lisp_Object selection_symbol = x_atom_to_symbol (dpyinfo, selection); Atom target = SELECTION_EVENT_TARGET (event); - Lisp_Object target_symbol = x_atom_to_symbol (display, target); + Lisp_Object target_symbol = x_atom_to_symbol (dpyinfo, target); Atom property = SELECTION_EVENT_PROPERTY (event); Lisp_Object local_selection_data; int success = 0; @@ -800,7 +796,7 @@ if (property == None) goto DONE; multprop - = x_get_window_property_as_lisp_data (display, requestor, property, + = x_get_window_property_as_lisp_data (dpyinfo, requestor, property, QMULTIPLE, selection); if (!VECTORP (multprop) || ASIZE (multprop) % 2) @@ -904,11 +900,7 @@ cs->wait_object = NULL; cs->next = converted_selections; converted_selections = cs; - lisp_data_to_selection_data (SELECTION_EVENT_DISPLAY (event), - lisp_selection, - &(cs->data), &(cs->type), - &(cs->size), &(cs->format), - &(cs->nofree)); + lisp_data_to_selection_data (dpyinfo, lisp_selection, cs); UNGCPRO; return 1; } @@ -920,20 +912,19 @@ static void x_handle_selection_clear (struct input_event *event) { - Display *display = SELECTION_EVENT_DISPLAY (event); Atom selection = SELECTION_EVENT_SELECTION (event); Time changed_owner_time = SELECTION_EVENT_TIME (event); Lisp_Object selection_symbol, local_selection_data; Time local_selection_time; - struct x_display_info *dpyinfo = x_display_info_for_display (display); + struct x_display_info *dpyinfo = SELECTION_EVENT_DPYINFO (event); Lisp_Object Vselection_alist; TRACE0 ("x_handle_selection_clear"); if (!dpyinfo) return; - selection_symbol = x_atom_to_symbol (display, selection); + selection_symbol = x_atom_to_symbol (dpyinfo, selection); local_selection_data = LOCAL_SELECTION (selection_symbol, dpyinfo); /* Well, we already believe that we don't own it, so that's just fine. */ @@ -1070,20 +1061,18 @@ static void unexpect_property_change (struct prop_location *location) { - struct prop_location *prev = 0, *rest = property_change_wait_list; - while (rest) + struct prop_location *prop, **pprev = &property_change_wait_list; + + for (prop = property_change_wait_list; prop; prop = *pprev) { - if (rest == location) + if (prop == location) { - if (prev) - prev->next = rest->next; - else - property_change_wait_list = rest->next; - xfree (rest); - return; + *pprev = prop->next; + xfree (prop); + break; } - prev = rest; - rest = rest->next; + else + pprev = &prop->next; } } @@ -1245,7 +1234,7 @@ /* Otherwise, the selection is waiting for us on the requested property. */ return - x_get_window_property_as_lisp_data (display, requestor_window, + x_get_window_property_as_lisp_data (dpyinfo, requestor_window, target_property, target_type, selection_atom); } @@ -1391,7 +1380,8 @@ /* Use xfree, not XFree, to free the data obtained with this function. */ static void -receive_incremental_selection (Display *display, Window window, Atom property, +receive_incremental_selection (struct x_display_info *dpyinfo, + Window window, Atom property, Lisp_Object target_type, unsigned int min_size_bytes, unsigned char **data_ret, @@ -1401,6 +1391,8 @@ { ptrdiff_t offset = 0; struct prop_location *wait_object; + Display *display = dpyinfo->display; + if (min (PTRDIFF_MAX, SIZE_MAX) < min_size_bytes) memory_full (SIZE_MAX); *data_ret = xmalloc (min_size_bytes); @@ -1419,10 +1411,10 @@ block_input (); XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask); TRACE1 (" Delete property %s", - SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property)))); + SDATA (SYMBOL_NAME (x_atom_to_symbol (dpyinfo, property)))); XDeleteProperty (display, window, property); TRACE1 (" Expect new value of property %s", - SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property)))); + SDATA (SYMBOL_NAME (x_atom_to_symbol (dpyinfo, property)))); wait_object = expect_property_change (display, window, property, PropertyNewValue); XFlush (display); @@ -1487,8 +1479,8 @@ if this fails. */ static Lisp_Object -x_get_window_property_as_lisp_data (Display *display, Window window, - Atom property, +x_get_window_property_as_lisp_data (struct x_display_info *dpyinfo, + Window window, Atom property, Lisp_Object target_type, Atom selection_atom) { @@ -1498,7 +1490,7 @@ unsigned char *data = 0; ptrdiff_t bytes = 0; Lisp_Object val; - struct x_display_info *dpyinfo = x_display_info_for_display (display); + Display *display = dpyinfo->display; TRACE0 ("Reading selection data"); @@ -1515,11 +1507,11 @@ signal_error ("Selection owner couldn't convert", actual_type ? list2 (target_type, - x_atom_to_symbol (display, actual_type)) + x_atom_to_symbol (dpyinfo, actual_type)) : target_type); else signal_error ("No selection", - x_atom_to_symbol (display, selection_atom)); + x_atom_to_symbol (dpyinfo, selection_atom)); } if (actual_type == dpyinfo->Xatom_INCR) @@ -1532,7 +1524,7 @@ calls xmalloc itself. */ xfree (data); unblock_input (); - receive_incremental_selection (display, window, property, target_type, + receive_incremental_selection (dpyinfo, window, property, target_type, min_size_bytes, &data, &bytes, &actual_type, &actual_format, &actual_size); @@ -1546,7 +1538,7 @@ /* It's been read. Now convert it to a lisp object in some semi-rational manner. */ - val = selection_data_to_lisp_data (display, data, bytes, + val = selection_data_to_lisp_data (dpyinfo, data, bytes, actual_type, actual_format); /* Use xfree, not XFree, because x_get_window_property @@ -1587,11 +1579,10 @@ static Lisp_Object -selection_data_to_lisp_data (Display *display, const unsigned char *data, +selection_data_to_lisp_data (struct x_display_info *dpyinfo, + const unsigned char *data, ptrdiff_t size, Atom type, int format) { - struct x_display_info *dpyinfo = x_display_info_for_display (display); - if (type == dpyinfo->Xatom_NULL) return QNULL; @@ -1629,13 +1620,13 @@ int *idata = (int *) data; if (size == sizeof (int)) - return x_atom_to_symbol (display, (Atom) idata[0]); + return x_atom_to_symbol (dpyinfo, (Atom) idata[0]); else { Lisp_Object v = make_uninit_vector (size / sizeof (int)); for (i = 0; i < size / sizeof (int); i++) - ASET (v, i, x_atom_to_symbol (display, (Atom) idata[i])); + ASET (v, i, x_atom_to_symbol (dpyinfo, (Atom) idata[i])); return v; } } @@ -1697,15 +1688,13 @@ /* Use xfree, not XFree, to free the data obtained with this function. */ static void -lisp_data_to_selection_data (Display *display, Lisp_Object obj, - unsigned char **data_ret, Atom *type_ret, - ptrdiff_t *size_ret, - int *format_ret, int *nofree_ret) +lisp_data_to_selection_data (struct x_display_info *dpyinfo, + Lisp_Object obj, struct selection_data *cs) { Lisp_Object type = Qnil; - struct x_display_info *dpyinfo = x_display_info_for_display (display); - *nofree_ret = 0; + eassert (cs != NULL); + cs->nofree = 0; if (CONSP (obj) && SYMBOLP (XCAR (obj))) { @@ -1717,9 +1706,9 @@ if (EQ (obj, QNULL) || (EQ (type, QNULL))) { /* This is not the same as declining */ - *format_ret = 32; - *size_ret = 0; - *data_ret = 0; + cs->format = 32; + cs->size = 0; + cs->data = NULL; type = QNULL; } else if (STRINGP (obj)) @@ -1729,19 +1718,19 @@ signal_error ("Non-ASCII string must be encoded in advance", obj); if (NILP (type)) type = QSTRING; - *format_ret = 8; - *size_ret = SBYTES (obj); - *data_ret = SDATA (obj); - *nofree_ret = 1; + cs->format = 8; + cs->size = SBYTES (obj); + cs->data = SDATA (obj); + cs->nofree = 1; } else if (SYMBOLP (obj)) { void *data = xmalloc (sizeof (Atom) + 1); Atom *x_atom_ptr = data; - *data_ret = data; - *format_ret = 32; - *size_ret = 1; - (*data_ret) [sizeof (Atom)] = 0; + cs->data = data; + cs->format = 32; + cs->size = 1; + cs->data[sizeof (Atom)] = 0; *x_atom_ptr = symbol_to_x_atom (dpyinfo, obj); if (NILP (type)) type = QATOM; } @@ -1749,10 +1738,10 @@ { void *data = xmalloc (sizeof (short) + 1); short *short_ptr = data; - *data_ret = data; - *format_ret = 16; - *size_ret = 1; - (*data_ret) [sizeof (short)] = 0; + cs->data = data; + cs->format = 16; + cs->size = 1; + cs->data[sizeof (short)] = 0; *short_ptr = XINT (obj); if (NILP (type)) type = QINTEGER; } @@ -1764,10 +1753,10 @@ { void *data = xmalloc (sizeof (unsigned long) + 1); unsigned long *x_long_ptr = data; - *data_ret = data; - *format_ret = 32; - *size_ret = 1; - (*data_ret) [sizeof (unsigned long)] = 0; + cs->data = data; + cs->format = 32; + cs->size = 1; + cs->data[sizeof (unsigned long)] = 0; *x_long_ptr = cons_to_x_long (obj); if (NILP (type)) type = QINTEGER; } @@ -1790,10 +1779,10 @@ if (!SYMBOLP (AREF (obj, i))) signal_error ("All elements of selection vector must have same type", obj); - *data_ret = data = xnmalloc (size, sizeof *x_atoms); + cs->data = data = xnmalloc (size, sizeof *x_atoms); x_atoms = data; - *format_ret = 32; - *size_ret = size; + cs->format = 32; + cs->size = size; for (i = 0; i < size; i++) x_atoms[i] = symbol_to_x_atom (dpyinfo, AREF (obj, i)); } @@ -1819,11 +1808,11 @@ break; } } - *data_ret = data = xnmalloc (size, data_size); + cs->data = data = xnmalloc (size, data_size); x_atoms = data; shorts = data; - *format_ret = format; - *size_ret = size; + cs->format = format; + cs->size = size; for (i = 0; i < size; i++) { if (format == 32) @@ -1836,7 +1825,7 @@ else signal_error (/* Qselection_error */ "Unrecognized selection data", obj); - *type_ret = symbol_to_x_atom (dpyinfo, type); + cs->type = symbol_to_x_atom (dpyinfo, type); } static Lisp_Object @@ -2069,7 +2058,7 @@ the selection owner to None. The NCD server does, the MIT Sun4 server doesn't. So we synthesize one; this means we might get two, but that's ok, because the second one won't have any effect. */ - SELECTION_EVENT_DISPLAY (&event.sie) = dpyinfo->display; + SELECTION_EVENT_DPYINFO (&event.sie) = dpyinfo; SELECTION_EVENT_SELECTION (&event.sie) = selection_atom; SELECTION_EVENT_TIME (&event.sie) = timestamp; x_handle_selection_clear (&event.ie); @@ -2361,8 +2350,8 @@ ptrdiff_t format_bytes = format >> 3; if (PTRDIFF_MAX / format_bytes < size) memory_full (SIZE_MAX); - return selection_data_to_lisp_data (FRAME_X_DISPLAY (f), - data, size * format_bytes, type, format); + return selection_data_to_lisp_data (FRAME_DISPLAY_INFO (f), data, + size * format_bytes, type, format); } DEFUN ("x-get-atom-name", Fx_get_atom_name, @@ -2474,7 +2463,7 @@ } vec = Fmake_vector (make_number (4), Qnil); - ASET (vec, 0, SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f), + ASET (vec, 0, SYMBOL_NAME (x_atom_to_symbol (FRAME_DISPLAY_INFO (f), event->message_type))); ASET (vec, 1, frame); ASET (vec, 2, make_number (event->format)); === modified file 'src/xterm.c' --- src/xterm.c 2014-07-18 06:02:19 +0000 +++ src/xterm.c 2014-07-18 11:04:37 +0000 @@ -5966,7 +5966,7 @@ const XSelectionClearEvent *eventp = &event->xselectionclear; inev.ie.kind = SELECTION_CLEAR_EVENT; - SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; + SELECTION_EVENT_DPYINFO (&inev.sie) = dpyinfo; SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; SELECTION_EVENT_TIME (&inev.sie) = eventp->time; } @@ -5982,7 +5982,7 @@ const XSelectionRequestEvent *eventp = &event->xselectionrequest; inev.ie.kind = SELECTION_REQUEST_EVENT; - SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; + SELECTION_EVENT_DPYINFO (&inev.sie) = dpyinfo; SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor; SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; SELECTION_EVENT_TARGET (&inev.sie) = eventp->target; === modified file 'src/xterm.h' --- src/xterm.h 2014-07-18 06:02:19 +0000 +++ src/xterm.h 2014-07-18 11:04:37 +0000 @@ -892,15 +892,21 @@ struct selection_input_event { int kind; - Display *display; + struct x_display_info *dpyinfo; /* We spell it with an "o" here because X does. */ Window requestor; Atom selection, target, property; Time time; }; -#define SELECTION_EVENT_DISPLAY(eventp) \ - (((struct selection_input_event *) (eventp))->display) +/* Unlike macros below, this can't be used as an lvalue. */ +INLINE Display * +SELECTION_EVENT_DISPLAY (struct input_event *ev) +{ + return ((struct selection_input_event *) ev)->dpyinfo->display; +} +#define SELECTION_EVENT_DPYINFO(eventp) \ + (((struct selection_input_event *) (eventp))->dpyinfo) /* We spell it with an "o" here because X does. */ #define SELECTION_EVENT_REQUESTOR(eventp) \ (((struct selection_input_event *) (eventp))->requestor) ------------------------------------------------------------ revno: 117548 author: Albert Krewinkel committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2014-07-18 08:23:49 +0000 message: * lisp/gnus/gnus-msg.el (gnus-configure-posting-style): Allow string replacements in values when matching against a header. * doc/misc/gnus.texi (Posting Styles): Document the possibility to perform string replacements when matching against headers. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-07-09 02:04:12 +0000 +++ doc/misc/ChangeLog 2014-07-18 08:23:49 +0000 @@ -1,3 +1,8 @@ +2014-07-18 Albert Krewinkel + + * gnus.texi (Posting Styles): Document the possibility to perform + string replacements when matching against headers. + 2014-07-09 Stephen Berman * todo-mode.texi (Levels of Organization): Comment out statement === modified file 'doc/misc/gnus.texi' --- doc/misc/gnus.texi 2014-06-10 02:20:31 +0000 +++ doc/misc/gnus.texi 2014-07-18 08:23:49 +0000 @@ -12813,10 +12813,12 @@ from date id references chars lines xref extra. In the case of a string value, if the @code{match} is a regular -expression, a @samp{gnus-match-substitute-replacement} is proceed on -the value to replace the positional parameters @samp{\@var{n}} by the -corresponding parenthetical matches (see @xref{Replacing Match,, -Replacing the Text that Matched, elisp, The Emacs Lisp Reference Manual}.) +expression, or if it takes the form @code{(header @var{match} +@var{regexp})}, a @samp{gnus-match-substitute-replacement} is proceed +on the value to replace the positional parameters @samp{\@var{n}} by +the corresponding parenthetical matches (see @xref{Replacing Match,, +Replacing the Text that Matched, elisp, The Emacs Lisp Reference +Manual}.) @vindex message-reply-headers @@ -12848,6 +12850,10 @@ ;; @r{If I'm replying to Larsi, set the Organization header.} ((header "from" "larsi.*org") (Organization "Somewhere, Inc.")) + ;; @r{Reply to a message from the same subaddress the message} + ;; @r{was sent to.} + ((header "x-original-to" "me\\(\\+.+\\)@@example.org") + (address "me\\1@@example.org")) ((posting-from-work-p) ;; @r{A user defined function} (signature-file "~/.work-signature") (address "user@@bar.foo") === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2014-07-07 05:47:59 +0000 +++ lisp/gnus/ChangeLog 2014-07-18 08:23:49 +0000 @@ -1,3 +1,8 @@ +2013-07-17 Albert Krewinkel + + * gnus-msg.el (gnus-configure-posting-style): + Allow string replacements in values when matching against a header. + 2014-07-07 Katsumi Yamaoka * gnus-start.el (gnus-dribble-read-file): Don't stop the auto-saving of === modified file 'lisp/gnus/gnus-msg.el' --- lisp/gnus/gnus-msg.el 2014-02-06 05:43:50 +0000 +++ lisp/gnus/gnus-msg.el 2014-07-18 08:23:49 +0000 @@ -1826,7 +1826,7 @@ (with-current-buffer gnus-summary-buffer gnus-posting-styles) gnus-posting-styles)) - style match attribute value v results + style match attribute value v results matched-string filep name address element) ;; If the group has a posting-style parameter, add it at the end with a ;; regexp matching everything, to be sure it takes precedence over all @@ -1846,7 +1846,9 @@ (when (cond ((stringp match) ;; Regexp string match on the group name. - (string-match match group)) + (when (string-match match group) + (setq matched-string group) + t)) ((eq match 'header) ;; Obsolete format of header match. (and (gnus-buffer-live-p gnus-article-copy) @@ -1875,7 +1877,8 @@ (nnheader-narrow-to-headers) (let ((header (message-fetch-field (nth 1 match)))) (and header - (string-match (nth 2 match) header))))))) + (string-match (nth 2 match) header) + (setq matched-string header))))))) (t ;; This is a form to be evalled. (eval match))))) @@ -1896,10 +1899,11 @@ (setq v (cond ((stringp value) - (if (and (stringp match) + (if (and matched-string (gnus-string-match-p "\\\\[&[:digit:]]" value) (match-beginning 1)) - (gnus-match-substitute-replacement value nil nil group) + (gnus-match-substitute-replacement value nil nil + matched-string) value)) ((or (symbolp value) (functionp value)) ------------------------------------------------------------ revno: 117547 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2014-07-18 10:02:19 +0400 message: * frame.c (frame_unspecified_color): New function refactored out from ... (Fframe_parameters, Fframe_parameter): ... adjusted users. (x_fullscreen_adjust, set_frame_param): Move Windows-specific function to ... * w32term.c (x_fullscreen_adjust, set_frame_param): ... static here. * frame.h (x_fullscreen_adjust) [HAVE_NTGUI]: * lisp.h (set_frame_param): Remove prototype. * xterm.c (x_display_pixel_width, x_display_pixel_height): Now ... * xterm.h (x_display_pixel_width, x_display_pixel_height): ... inlined from here. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-17 10:18:19 +0000 +++ src/ChangeLog 2014-07-18 06:02:19 +0000 @@ -1,3 +1,17 @@ +2014-07-18 Dmitry Antipov + + * frame.c (frame_unspecified_color): New function + refactored out from ... + (Fframe_parameters, Fframe_parameter): ... adjusted users. + (x_fullscreen_adjust, set_frame_param): Move Windows-specific + function to ... + * w32term.c (x_fullscreen_adjust, set_frame_param): ... static here. + * frame.h (x_fullscreen_adjust) [HAVE_NTGUI]: + * lisp.h (set_frame_param): Remove prototype. + * xterm.c (x_display_pixel_width, x_display_pixel_height): Now ... + * xterm.h (x_display_pixel_width, x_display_pixel_height): ... + inlined from here. + 2014-07-17 Dmitry Antipov * print.c (print_preprocess): Adjust to match changed === modified file 'src/frame.c' --- src/frame.c 2014-07-17 10:18:19 +0000 +++ src/frame.c 2014-07-18 06:02:19 +0000 @@ -2081,20 +2081,6 @@ update_mode_lines = 16; } -#ifdef HAVE_NTGUI -void -set_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) -{ - register Lisp_Object old_alist_elt; - - old_alist_elt = Fassq (prop, f->param_alist); - if (EQ (old_alist_elt, Qnil)) - fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist)); - else - Fsetcdr (old_alist_elt, val); -} -#endif - void store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) { @@ -2186,6 +2172,18 @@ } } +/* Return color matches UNSPEC on frame F or nil if UNSPEC + is not an unspecified foreground or background color. */ + +static Lisp_Object +frame_unspecified_color (struct frame *f, Lisp_Object unspec) +{ + return (!strncmp (SSDATA (unspec), unspecified_bg, SBYTES (unspec)) + ? tty_color_name (f, FRAME_BACKGROUND_PIXEL (f)) + : (!strncmp (SSDATA (unspec), unspecified_fg, SBYTES (unspec)) + ? tty_color_name (f, FRAME_FOREGROUND_PIXEL (f)) : Qnil)); +} + DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0, doc: /* Return the parameters-alist of frame FRAME. It is a list of elements of the form (PARM . VALUE), where PARM is a symbol. @@ -2206,8 +2204,6 @@ if (!FRAME_WINDOW_P (f)) { - int fg = FRAME_FOREGROUND_PIXEL (f); - int bg = FRAME_BACKGROUND_PIXEL (f); Lisp_Object elt; /* If the frame's parameter alist says the colors are @@ -2216,31 +2212,23 @@ elt = Fassq (Qforeground_color, alist); if (CONSP (elt) && STRINGP (XCDR (elt))) { - if (strncmp (SSDATA (XCDR (elt)), - unspecified_bg, - SCHARS (XCDR (elt))) == 0) - store_in_alist (&alist, Qforeground_color, tty_color_name (f, bg)); - else if (strncmp (SSDATA (XCDR (elt)), - unspecified_fg, - SCHARS (XCDR (elt))) == 0) - store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg)); + elt = frame_unspecified_color (f, XCDR (elt)); + if (!NILP (elt)) + store_in_alist (&alist, Qforeground_color, elt); } else - store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg)); + store_in_alist (&alist, Qforeground_color, + tty_color_name (f, FRAME_FOREGROUND_PIXEL (f))); elt = Fassq (Qbackground_color, alist); if (CONSP (elt) && STRINGP (XCDR (elt))) { - if (strncmp (SSDATA (XCDR (elt)), - unspecified_fg, - SCHARS (XCDR (elt))) == 0) - store_in_alist (&alist, Qbackground_color, tty_color_name (f, fg)); - else if (strncmp (SSDATA (XCDR (elt)), - unspecified_bg, - SCHARS (XCDR (elt))) == 0) - store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg)); + elt = frame_unspecified_color (f, XCDR (elt)); + if (!NILP (elt)) + store_in_alist (&alist, Qbackground_color, elt); } else - store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg)); + store_in_alist (&alist, Qbackground_color, + tty_color_name (f, FRAME_BACKGROUND_PIXEL (f))); store_in_alist (&alist, intern ("font"), build_string (FRAME_MSDOS_P (f) ? "ms-dos" @@ -2320,29 +2308,7 @@ important when param_alist's notion of colors is "unspecified". We need to do the same here. */ if (STRINGP (value) && !FRAME_WINDOW_P (f)) - { - const char *color_name; - ptrdiff_t csz; - - if (EQ (parameter, Qbackground_color)) - { - color_name = SSDATA (value); - csz = SCHARS (value); - if (strncmp (color_name, unspecified_bg, csz) == 0) - value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f)); - else if (strncmp (color_name, unspecified_fg, csz) == 0) - value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f)); - } - else if (EQ (parameter, Qforeground_color)) - { - color_name = SSDATA (value); - csz = SCHARS (value); - if (strncmp (color_name, unspecified_fg, csz) == 0) - value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f)); - else if (strncmp (color_name, unspecified_bg, csz) == 0) - value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f)); - } - } + value = frame_unspecified_color (f, value); } else value = Fcdr (Fassq (parameter, Fframe_parameters (frame))); @@ -2786,52 +2752,6 @@ {"tool-bar-position", &Qtool_bar_position}, }; -#ifdef HAVE_NTGUI - -/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the - wanted positions of the WM window (not Emacs window). - Return in *WIDTH and *HEIGHT the wanted width and height of Emacs - window (FRAME_X_WINDOW). - */ - -void -x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int *left_pos) -{ - int newwidth = FRAME_COLS (f); - int newheight = FRAME_LINES (f); - Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); - - *top_pos = f->top_pos; - *left_pos = f->left_pos; - - if (f->want_fullscreen & FULLSCREEN_HEIGHT) - { - int ph; - - ph = x_display_pixel_height (dpyinfo); - newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph); - ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, newheight) - f->y_pixels_diff; - newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph); - *top_pos = 0; - } - - if (f->want_fullscreen & FULLSCREEN_WIDTH) - { - int pw; - - pw = x_display_pixel_width (dpyinfo); - newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw); - pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, newwidth) - f->x_pixels_diff; - newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw); - *left_pos = 0; - } - - *width = newwidth; - *height = newheight; -} - -#endif /* HAVE_NTGUI */ - #ifdef HAVE_WINDOW_SYSTEM /* Change the parameters of frame F as specified by ALIST. === modified file 'src/frame.h' --- src/frame.h 2014-07-17 10:18:19 +0000 +++ src/frame.h 2014-07-18 06:02:19 +0000 @@ -1317,11 +1317,6 @@ extern Lisp_Object Qface_set_after_frame_default; -#ifdef HAVE_NTGUI -extern void x_fullscreen_adjust (struct frame *f, int *, int *, - int *, int *); -#endif - extern void x_set_frame_parameters (struct frame *, Lisp_Object); extern void x_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object); === modified file 'src/lisp.h' --- src/lisp.h 2014-07-17 10:18:19 +0000 +++ src/lisp.h 2014-07-18 06:02:19 +0000 @@ -4122,7 +4122,6 @@ /* Defined in frame.c. */ extern Lisp_Object Qonly, Qnone; -extern void set_frame_param (struct frame *, Lisp_Object, Lisp_Object); extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object); === modified file 'src/w32term.c' --- src/w32term.c 2014-06-10 04:55:03 +0000 +++ src/w32term.c 2014-07-18 06:02:19 +0000 @@ -4135,7 +4135,18 @@ } } - +static void +set_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) +{ + register Lisp_Object old_alist_elt; + + old_alist_elt = Fassq (prop, f->param_alist); + if (EQ (old_alist_elt, Qnil)) + fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist)); + else + Fsetcdr (old_alist_elt, val); +} + /* The main W32 event-reading loop - w32_read_socket. */ /* Record the last 100 characters stored @@ -5561,6 +5572,47 @@ unblock_input (); } +/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the + wanted positions of the WM window (not Emacs window). + Return in *WIDTH and *HEIGHT the wanted width and height of Emacs + window (FRAME_X_WINDOW). + */ + +static void +x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int *left_pos) +{ + int newwidth = FRAME_COLS (f); + int newheight = FRAME_LINES (f); + Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); + + *top_pos = f->top_pos; + *left_pos = f->left_pos; + + if (f->want_fullscreen & FULLSCREEN_HEIGHT) + { + int ph; + + ph = x_display_pixel_height (dpyinfo); + newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph); + ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, newheight) - f->y_pixels_diff; + newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph); + *top_pos = 0; + } + + if (f->want_fullscreen & FULLSCREEN_WIDTH) + { + int pw; + + pw = x_display_pixel_width (dpyinfo); + newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw); + pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, newwidth) - f->x_pixels_diff; + newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw); + *left_pos = 0; + } + + *width = newwidth; + *height = newheight; +} /* Check if we need to resize the frame due to a fullscreen request. If so needed, resize the frame. */ === modified file 'src/xterm.c' --- src/xterm.c 2014-07-07 23:33:05 +0000 +++ src/xterm.c 2014-07-18 06:02:19 +0000 @@ -442,19 +442,6 @@ x_uncatch_errors (); } -int -x_display_pixel_height (struct x_display_info *dpyinfo) -{ - return HeightOfScreen (dpyinfo->screen); -} - -int -x_display_pixel_width (struct x_display_info *dpyinfo) -{ - return WidthOfScreen (dpyinfo->screen); -} - - /*********************************************************************** Starting and ending an update ***********************************************************************/ === modified file 'src/xterm.h' --- src/xterm.h 2014-07-16 05:44:05 +0000 +++ src/xterm.h 2014-07-18 06:02:19 +0000 @@ -77,6 +77,8 @@ #include "dispextern.h" #include "termhooks.h" +INLINE_HEADER_BEGIN + /* Black and white pixel values for the screen which frame F is on. */ #define BLACK_PIX_DEFAULT(f) \ BlackPixel (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)) @@ -953,8 +955,18 @@ extern int x_dispatch_event (XEvent *, Display *); #endif extern int x_x_to_emacs_modifiers (struct x_display_info *, int); -extern int x_display_pixel_height (struct x_display_info *); -extern int x_display_pixel_width (struct x_display_info *); + +INLINE int +x_display_pixel_height (struct x_display_info *dpyinfo) +{ + return HeightOfScreen (dpyinfo->screen); +} + +INLINE int +x_display_pixel_width (struct x_display_info *dpyinfo) +{ + return WidthOfScreen (dpyinfo->screen); +} extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object); extern void x_wait_for_event (struct frame *, int); @@ -1062,4 +1074,6 @@ (nr).width = (rwidth), \ (nr).height = (rheight)) +INLINE_HEADER_END + #endif /* XTERM_H */ ------------------------------------------------------------ revno: 117546 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2014-07-17 14:18:19 +0400 message: * data.c (wrong_choice): Not static any more. * lisp.h (wrong_choice): Add prototype. * frame.h (struct frame) [USE_X_TOOLKIT || HAVE_NTGUI]: Declare namebuf as such. Tweak comment. [USE_GTK]: Likewise for tool_bar_position. (fset_tool_bar_position) [USE_GTK]: Ditto. (FRAME_TOOL_BAR_POSITION): New macro. * frame.c (x_report_frame_params): * gtkutil.c (update_frame_tool_bar): * xfns.c (Fx_create_frame): Use it. (x_set_tool_bar_position): Add meaningful diagnostic messages. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-17 09:12:51 +0000 +++ src/ChangeLog 2014-07-17 10:18:19 +0000 @@ -3,6 +3,18 @@ * print.c (print_preprocess): Adjust to match changed sub char-table structure and avoid crash (Bug#18038). + * data.c (wrong_choice): Not static any more. + * lisp.h (wrong_choice): Add prototype. + * frame.h (struct frame) [USE_X_TOOLKIT || HAVE_NTGUI]: + Declare namebuf as such. Tweak comment. + [USE_GTK]: Likewise for tool_bar_position. + (fset_tool_bar_position) [USE_GTK]: Ditto. + (FRAME_TOOL_BAR_POSITION): New macro. + * frame.c (x_report_frame_params): + * gtkutil.c (update_frame_tool_bar): + * xfns.c (Fx_create_frame): Use it. + (x_set_tool_bar_position): Add meaningful diagnostic messages. + 2014-07-16 Eli Zaretskii * xdisp.c (decode_mode_spec): Call file-remote-p on the current === modified file 'src/data.c' --- src/data.c 2014-07-16 08:45:22 +0000 +++ src/data.c 2014-07-17 10:18:19 +0000 @@ -974,7 +974,7 @@ /* Used to signal a user-friendly error when symbol WRONG is not a member of CHOICE, which should be a list of symbols. */ -static void +void wrong_choice (Lisp_Object choice, Lisp_Object wrong) { ptrdiff_t i = 0, len = XINT (Flength (choice)); === modified file 'src/frame.c' --- src/frame.c 2014-07-16 15:39:15 +0000 +++ src/frame.c 2014-07-17 10:18:19 +0000 @@ -336,9 +336,11 @@ f = allocate_frame (); XSETFRAME (frame, f); +#ifdef USE_GTK /* Initialize Lisp data. Note that allocate_frame initializes all Lisp data to nil, so do it only for slots which should not be nil. */ fset_tool_bar_position (f, Qtop); +#endif /* Initialize non-Lisp data. Note that allocate_frame zeroes out all non-Lisp data, so do it only for slots which should not be zero. @@ -1372,7 +1374,9 @@ fset_buried_buffer_list (f, Qnil); free_font_driver_list (f); +#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) xfree (f->namebuf); +#endif xfree (f->decode_mode_spec_buffer); xfree (FRAME_INSERT_COST (f)); xfree (FRAME_DELETEN_COST (f)); @@ -3202,7 +3206,7 @@ tem = make_natnum ((uintptr_t) FRAME_X_OUTPUT (f)->parent_desc); store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil)); store_in_alist (alistptr, Qparent_id, tem); - store_in_alist (alistptr, Qtool_bar_position, f->tool_bar_position); + store_in_alist (alistptr, Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)); } === modified file 'src/frame.h' --- src/frame.h 2014-07-16 15:39:15 +0000 +++ src/frame.h 2014-07-17 10:18:19 +0000 @@ -161,9 +161,11 @@ /* Desired and current tool-bar items. */ Lisp_Object tool_bar_items; - /* Where tool bar is, can be left, right, top or bottom. The native - tool bar only supports top. */ +#ifdef USE_GTK + /* Where tool bar is, can be left, right, top or bottom. + Except with GTK, the only supported position is `top'. */ Lisp_Object tool_bar_position; +#endif #if defined (HAVE_XFT) || defined (HAVE_FREETYPE) /* List of data specific to font-driver and frame, but common to faces. */ @@ -183,9 +185,12 @@ /* Number of elements in `menu_bar_vector' that have meaningful data. */ int menu_bar_items_used; - /* A buffer to hold the frame's name. We can't use the Lisp - string's pointer (`name', above) because it might get relocated. */ +#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) + /* A buffer to hold the frame's name. Since this is used by the + window system toolkit, we can't use the Lisp string's pointer + (`name', above) because it might get relocated. */ char *namebuf; +#endif /* Glyph pool and matrix. */ struct glyph_pool *current_pool; @@ -565,11 +570,13 @@ { f->tool_bar_items = val; } +#ifdef USE_GTK INLINE void fset_tool_bar_position (struct frame *f, Lisp_Object val) { f->tool_bar_position = val; } +#endif /* USE_GTK */ #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS) INLINE void fset_tool_bar_window (struct frame *f, Lisp_Object val) @@ -741,6 +748,13 @@ #define FRAME_EXTERNAL_TOOL_BAR(f) false #endif +/* This is really supported only with GTK. */ +#ifdef USE_GTK +#define FRAME_TOOL_BAR_POSITION(f) (f)->tool_bar_position +#else +#define FRAME_TOOL_BAR_POSITION(f) ((void) f, Qtop) +#endif + /* Number of lines of frame F used for the tool-bar. */ #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines === modified file 'src/gtkutil.c' --- src/gtkutil.c 2014-07-16 08:45:22 +0000 +++ src/gtkutil.c 2014-07-17 10:18:19 +0000 @@ -4865,7 +4865,7 @@ if (f->n_tool_bar_items != 0) { if (! x->toolbar_is_packed) - xg_pack_tool_bar (f, f->tool_bar_position); + xg_pack_tool_bar (f, FRAME_TOOL_BAR_POSITION (f)); gtk_widget_show_all (TOOLBAR_TOP_WIDGET (x)); if (xg_update_tool_bar_sizes (f)) xg_height_or_width_changed (f); === modified file 'src/lisp.h' --- src/lisp.h 2014-07-14 04:44:01 +0000 +++ src/lisp.h 2014-07-17 10:18:19 +0000 @@ -832,6 +832,7 @@ extern Lisp_Object Qvector_or_char_table_p, Qwholenump; extern Lisp_Object Qwindow; extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); +extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object); /* Defined in emacs.c. */ extern bool might_dump; === modified file 'src/xfns.c' --- src/xfns.c 2014-07-12 17:53:29 +0000 +++ src/xfns.c 2014-07-17 10:18:19 +0000 @@ -457,15 +457,23 @@ Lisp_Object new_value, Lisp_Object old_value) { - if (! EQ (new_value, Qleft) && ! EQ (new_value, Qright) - && ! EQ (new_value, Qbottom) && ! EQ (new_value, Qtop)) - return; - if (EQ (new_value, old_value)) return; + Lisp_Object choice = list4 (Qleft, Qright, Qtop, Qbottom); + if (!NILP (Fmemq (new_value, choice))) + { #ifdef USE_GTK - xg_change_toolbar_position (f, new_value); - fset_tool_bar_position (f, new_value); + if (!EQ (new_value, old_value)) + { + xg_change_toolbar_position (f, new_value); + fset_tool_bar_position (f, new_value); + } +#else + if (!EQ (new_value, Qtop)) + error ("The only supported tool bar position is top"); #endif + } + else + wrong_choice (choice, new_value); } #ifdef USE_GTK @@ -3182,7 +3190,7 @@ x_default_parameter (f, parms, Qfullscreen, Qnil, "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); x_default_parameter (f, parms, Qtool_bar_position, - f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL); + FRAME_TOOL_BAR_POSITION (f), 0, 0, RES_TYPE_SYMBOL); /* Compute the size of the X window. */ window_prompting = x_figure_window_size (f, parms, 1); ------------------------------------------------------------ revno: 117545 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2014-07-17 13:12:51 +0400 message: * print.c (print_preprocess): Adjust to match changed sub char-table structure and avoid crash (Bug#18038). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-16 17:06:12 +0000 +++ src/ChangeLog 2014-07-17 09:12:51 +0000 @@ -1,3 +1,8 @@ +2014-07-17 Dmitry Antipov + + * print.c (print_preprocess): Adjust to match changed + sub char-table structure and avoid crash (Bug#18038). + 2014-07-16 Eli Zaretskii * xdisp.c (decode_mode_spec): Call file-remote-p on the current === modified file 'src/print.c' --- src/print.c 2014-07-02 14:00:41 +0000 +++ src/print.c 2014-07-17 09:12:51 +0000 @@ -1228,7 +1228,8 @@ size = ASIZE (obj); if (size & PSEUDOVECTOR_FLAG) size &= PSEUDOVECTOR_SIZE_MASK; - for (i = 0; i < size; i++) + for (i = (SUB_CHAR_TABLE_P (obj) + ? SUB_CHAR_TABLE_OFFSET : 0); i < size; i++) print_preprocess (AREF (obj, i)); if (HASH_TABLE_P (obj)) { /* For hash tables, the key_and_value slot is past ------------------------------------------------------------ revno: 117544 [merge] committer: Glenn Morris branch nick: trunk timestamp: Wed 2014-07-16 13:06:12 -0400 message: Merge from emacs-24; up to r117380 diff: === modified file 'doc/lispintro/ChangeLog' --- doc/lispintro/ChangeLog 2014-07-03 06:00:53 +0000 +++ doc/lispintro/ChangeLog 2014-07-16 17:06:12 +0000 @@ -1,3 +1,8 @@ +2014-07-16 Álvar Jesús Ibeas Martín (tiny change) + + * emacs-lisp-intro.texi (Variables, Buffer Names, if & or) + (Symbols as Chest, fwd-para while): Fix typos. + 2014-07-03 Glenn Morris * emacs-lisp-intro.texi (Note for Novices, Finding More, Conclusion): === modified file 'doc/lispintro/emacs-lisp-intro.texi' --- doc/lispintro/emacs-lisp-intro.texi 2014-07-03 06:00:53 +0000 +++ doc/lispintro/emacs-lisp-intro.texi 2014-07-16 17:06:12 +0000 @@ -1700,7 +1700,7 @@ of drawers. The function definition is put in one drawer, the value in another, and so on. What is put in the drawer holding the value can be changed without affecting the contents of the drawer holding the -function definition, and vice-verse. +function definition, and vice versa. @menu * fill-column Example:: @@ -2653,7 +2653,7 @@ evaluate the symbols as variables. @xref{Variables}.) In spite of the distinction between files and buffers, you will often -find that people refer to a file when they mean a buffer and vice-verse. +find that people refer to a file when they mean a buffer and vice versa. Indeed, most people say, ``I am editing a file,'' rather than saying, ``I am editing a buffer which I will soon save to a file.'' It is almost always clear from context what people mean. When dealing with @@ -5756,7 +5756,7 @@ @noindent @code{not} is a function that returns true if its argument is false and false if its argument is true. So if @code{(bufferp buffer)} -returns true, the @code{not} expression returns false and vice-verse: +returns true, the @code{not} expression returns false and vice versa: what is ``not true'' is false and what is ``not false'' is true. Using this test, the @code{if} expression works as follows: when the @@ -9805,7 +9805,7 @@ being a chest of drawers. The function definition is put in one drawer, the value in another, and so on. What is put in the drawer holding the value can be changed without affecting the contents of the -drawer holding the function definition, and vice-verse. +drawer holding the function definition, and vice versa. Actually, what is put in each drawer is the address of the value or function definition. It is as if you found an old chest in the attic, @@ -13235,7 +13235,7 @@ @noindent This @code{while} loop has us searching forward for @code{sp-parstart}, which is the combination of possible whitespace -with a the local value of the start of a paragraph or of a paragraph +with the local value of the start of a paragraph or of a paragraph separator. (The latter two are within an expression starting @code{\(?:} so that they are not referenced by the @code{match-beginning} function.) === modified file 'etc/TODO' --- etc/TODO 2014-07-09 02:04:12 +0000 +++ etc/TODO 2014-07-16 17:06:12 +0000 @@ -62,8 +62,7 @@ ** Convert modes that use view-mode to be derived from special-mode instead. -** Major modes should have a menu entry. Examples of modes that do -not have one at the moment and probably should: text-mode, inferior-lisp-mode. +** Major modes should have a menu entry. ** Check if all items on the mode-line have a suitable tooltip for all modes. @@ -141,7 +140,9 @@ using a heuristic of some kind? ** Define recompute-arg and recompute-arg-if for fix_command to use. - See rms message of 11 Dec 05. + See rms message of 11 Dec 05 in + http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-12/msg00165.html, + and the rest of that discussion. ** Height returned by frame-parameter ... and height given to make-frame does not mean the same thing. The former includes menu and === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-07-14 23:58:52 +0000 +++ lisp/ChangeLog 2014-07-16 17:06:12 +0000 @@ -1,3 +1,17 @@ +2014-07-16 Glenn Morris + + * desktop.el (after-init-hook): Disable startup frame restoration + in non-graphical situations. (Bug#17693) + + * vc/vc-dispatcher.el (vc-log-edit): Do set up the log buffer + if it was "empty", or used for a different set of files. (Bug#17884) + +2014-07-16 Eli Zaretskii + + * bindings.el (mode-line-remote): If default-directory is not a + string, don't call file-remote-p on it; instead state in the + help-echo that it is nil. (Bug#17986) + 2014-07-14 Daniel Colascione * progmodes/cc-langs.el: Change comments from `cl-macroexpand-all' === modified file 'lisp/bindings.el' --- lisp/bindings.el 2014-06-14 09:50:13 +0000 +++ lisp/bindings.el 2014-07-13 14:49:59 +0000 @@ -229,11 +229,13 @@ 'help-echo (purecopy (lambda (window _object _point) (format "%s" (with-selected-window window - (concat - (if (file-remote-p default-directory) - "Current directory is remote: " - "Current directory is local: ") - default-directory))))))) + (if (stringp default-directory) + (concat + (if (file-remote-p default-directory) + "Current directory is remote: " + "Current directory is local: ") + default-directory) + "Current directory is nil"))))))) "Mode line construct to indicate a remote buffer.") ;;;###autoload (put 'mode-line-remote 'risky-local-variable t) === modified file 'lisp/desktop.el' --- lisp/desktop.el 2014-07-03 23:48:24 +0000 +++ lisp/desktop.el 2014-07-16 04:28:42 +0000 @@ -1516,8 +1516,15 @@ (setq command-line-args (delete key command-line-args)) (desktop-save-mode 0))) (when desktop-save-mode - (desktop-read) - (setq inhibit-startup-screen t)))) + ;; People don't expect emacs -nw, or --daemon, + ;; to create graphical frames (bug#17693). + ;; TODO perhaps there should be a separate value + ;; for desktop-restore-frames to control this startup behavior? + (let ((desktop-restore-frames (and desktop-restore-frames + initial-window-system + (not (daemonp))))) + (desktop-read) + (setq inhibit-startup-screen t))))) ;; So we can restore vc-dir buffers. (autoload 'vc-dir-mode "vc-dir" nil t) === modified file 'lisp/vc/vc-dispatcher.el' --- lisp/vc/vc-dispatcher.el 2014-07-12 02:24:02 +0000 +++ lisp/vc/vc-dispatcher.el 2014-07-14 19:29:29 +0000 @@ -591,12 +591,19 @@ ;; Set up key bindings for use while editing log messages +(declare-function log-edit-empty-buffer-p "log-edit" ()) + (defun vc-log-edit (fileset mode backend) "Set up `log-edit' for use on FILE." (setq default-directory (buffer-local-value 'default-directory vc-parent-buffer)) + (require 'log-edit) (log-edit 'vc-finish-logentry - (= (point-min) (point-max)) + ;; Setup a new log message if the log buffer is "empty", + ;; or was previously used for a different set of files. + (or (log-edit-empty-buffer-p) + (and (local-variable-p 'vc-log-fileset) + (not (equal vc-log-fileset fileset)))) `((log-edit-listfun . (lambda () ;; FIXME: Should expand the list ;; for directories. === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-16 15:39:15 +0000 +++ src/ChangeLog 2014-07-16 17:06:12 +0000 @@ -1,3 +1,8 @@ +2014-07-16 Eli Zaretskii + + * xdisp.c (decode_mode_spec): Call file-remote-p on the current + buffer's default-directory only if it is a string. (Bug#17986) + 2014-07-16 Dmitry Antipov More precise control over values of some buffer-local variables. === modified file 'src/xdisp.c' --- src/xdisp.c 2014-07-12 17:53:29 +0000 +++ src/xdisp.c 2014-07-16 17:06:12 +0000 @@ -22889,8 +22889,12 @@ case '@': { ptrdiff_t count = inhibit_garbage_collection (); - Lisp_Object val = call1 (intern ("file-remote-p"), - BVAR (current_buffer, directory)); + Lisp_Object curdir = BVAR (current_buffer, directory); + Lisp_Object val = Qnil; + + if (STRINGP (curdir)) + val = call1 (intern ("file-remote-p"), curdir); + unbind_to (count, Qnil); if (NILP (val)) ------------------------------------------------------------ revno: 117543 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-07-16 19:39:15 +0400 message: * frame.h (enum fullscreen_type) [HAVE_WINDOW_SYSTEM]: Use more natural values. Add comment. (struct frame): Re-arrange layout to avoid extra padding and use bit fields for output_method, want_fullscreen and vertical_scroll_bar_type. (FRAME_VERTICAL_SCROLL_BAR_TYPE, FRAME_HAS_VERTICAL_SCROLL_BARS) (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT) (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT) [!HAVE_WINDOW_SYSTEM]: Define as no-ops because there are no scroll bars anyway. * frame.c (make_frame, make_terminal_frame, make_initial_frame): Adjust users. * font.c (fset_font_data) [HAVE_XFT || HAVE_FREETYPE]: Add convenient setter. (font_put_frame_data, font_get_frame_data): Use it. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-16 08:45:22 +0000 +++ src/ChangeLog 2014-07-16 15:39:15 +0000 @@ -18,6 +18,21 @@ (store_symval_forwarding): Handle special properties of buffer-local variables and use functions from the above to signal error, if any. + * frame.h (enum fullscreen_type) [HAVE_WINDOW_SYSTEM]: Use more natural + values. Add comment. + (struct frame): Re-arrange layout to avoid extra padding and use bit + fields for output_method, want_fullscreen and vertical_scroll_bar_type. + (FRAME_VERTICAL_SCROLL_BAR_TYPE, FRAME_HAS_VERTICAL_SCROLL_BARS) + (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT) + (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT) [!HAVE_WINDOW_SYSTEM]: + Define as no-ops because there are no scroll bars anyway. + * frame.c (make_frame, make_terminal_frame, make_initial_frame): + Adjust users. + + * font.c (fset_font_data) [HAVE_XFT || HAVE_FREETYPE]: + Add convenient setter. + (font_put_frame_data, font_get_frame_data): Use it. + 2014-07-15 Daiki Ueno * nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around === modified file 'src/font.c' --- src/font.c 2014-07-09 23:35:31 +0000 +++ src/font.c 2014-07-16 15:39:15 +0000 @@ -3574,18 +3574,24 @@ #if defined (HAVE_XFT) || defined (HAVE_FREETYPE) +static void +fset_font_data (struct frame *f, Lisp_Object val) +{ + f->font_data = val; +} + void font_put_frame_data (struct frame *f, Lisp_Object driver, void *data) { Lisp_Object val = assq_no_quit (driver, f->font_data); if (!data) - f->font_data = Fdelq (val, f->font_data); + fset_font_data (f, Fdelq (val, f->font_data)); else { if (NILP (val)) - f->font_data = Fcons (Fcons (driver, make_save_ptr (data)), - f->font_data); + fset_font_data (f, Fcons (Fcons (driver, make_save_ptr (data)), + f->font_data)); else XSETCDR (val, make_save_ptr (data)); } === modified file 'src/frame.c' --- src/frame.c 2014-07-16 08:45:22 +0000 +++ src/frame.c 2014-07-16 15:39:15 +0000 @@ -347,10 +347,10 @@ f->wants_modeline = true; f->redisplay = true; f->garbaged = true; - f->vertical_scroll_bar_type = vertical_scroll_bar_none; f->column_width = 1; /* !FRAME_WINDOW_P value. */ f->line_height = 1; /* !FRAME_WINDOW_P value. */ #ifdef HAVE_WINDOW_SYSTEM + f->vertical_scroll_bar_type = vertical_scroll_bar_none; f->want_fullscreen = FULLSCREEN_NONE; #if ! defined (USE_GTK) && ! defined (HAVE_NS) f->last_tool_bar_item = -1; @@ -569,7 +569,9 @@ FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR; FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; - FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; +#ifdef HAVE_WINDOW_SYSTEM + f->vertical_scroll_bar_type = vertical_scroll_bar_none; +#endif /* The default value of menu-bar-mode is t. */ set_menu_bar_lines (f, make_number (1), Qnil); @@ -619,7 +621,10 @@ FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; #endif /* not MSDOS */ - FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; +#ifdef HAVE_WINDOW_SYSTEM + f->vertical_scroll_bar_type = vertical_scroll_bar_none; +#endif + FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); === modified file 'src/frame.h' --- src/frame.h 2014-07-16 08:45:22 +0000 +++ src/frame.h 2014-07-16 15:39:15 +0000 @@ -36,16 +36,22 @@ vertical_scroll_bar_right }; +#ifdef HAVE_WINDOW_SYSTEM + enum fullscreen_type { FULLSCREEN_NONE, - FULLSCREEN_WIDTH = 0x001, - FULLSCREEN_HEIGHT = 0x002, - FULLSCREEN_BOTH = 0x003, - FULLSCREEN_MAXIMIZED = 0x013, - FULLSCREEN_WAIT = 0x100 + FULLSCREEN_WIDTH = 0x1, + FULLSCREEN_HEIGHT = 0x2, + FULLSCREEN_BOTH = 0x3, /* Not a typo but means "width and height". */ + FULLSCREEN_MAXIMIZED = 0x4, +#ifdef HAVE_NTGUI + FULLSCREEN_WAIT = 0x8 +#endif }; +#endif /* HAVE_WINDOW_SYSTEM */ + /* The structure representing a frame. */ struct frame @@ -187,6 +193,8 @@ struct glyph_matrix *desired_matrix; struct glyph_matrix *current_matrix; + /* Bitfield area begins here. Keep them together to avoid extra padding. */ + /* True means that glyphs on this frame have been initialized so it can be used for output. */ bool_bf glyphs_initialized_p : 1; @@ -228,6 +236,85 @@ /* True if it needs to be redisplayed. */ bool_bf redisplay : 1; +#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ + || defined (HAVE_NS) || defined (USE_GTK) + /* True means using a menu bar that comes from the X toolkit. */ + bool_bf external_menu_bar : 1; +#endif + + /* Next two bitfields are mutually exclusive. They might both be + zero if the frame has been made invisible without an icon. */ + + /* Nonzero if the frame is currently displayed; we check + it to see if we should bother updating the frame's contents. + + On ttys and on Windows NT/9X, to avoid wasting effort updating + visible frames that are actually completely obscured by other + windows on the display, we bend the meaning of visible slightly: + if equal to 2, then the frame is obscured - we still consider + it to be "visible" as seen from lisp, but we don't bother + updating it. */ + unsigned visible : 2; + + /* True if the frame is currently iconified. Do not + set this directly, use SET_FRAME_ICONIFIED instead. */ + bool_bf iconified : 1; + + /* True if this frame should be fully redisplayed. Disables all + optimizations while rebuilding matrices and redrawing. */ + bool_bf garbaged : 1; + + /* False means, if this frame has just one window, + show no modeline for that window. */ + bool_bf wants_modeline : 1; + + /* True means raise this frame to the top of the heap when selected. */ + bool_bf auto_raise : 1; + + /* True means lower this frame to the bottom of the stack when left. */ + bool_bf auto_lower : 1; + + /* True if frame's root window can't be split. */ + bool_bf no_split : 1; + + /* If this is set, then Emacs won't change the frame name to indicate + the current buffer, etcetera. If the user explicitly sets the frame + name, this gets set. If the user sets the name to Qnil, this is + cleared. */ + bool_bf explicit_name : 1; + + /* True if size of some window on this frame has changed. */ + bool_bf window_sizes_changed : 1; + + /* True if the mouse has moved on this display device + since the last time we checked. */ + bool_bf mouse_moved : 1; + + /* True means that the pointer is invisible. */ + bool_bf pointer_invisible : 1; + + /* True means that all windows except mini-window and + selected window on this frame have frozen window starts. */ + bool_bf frozen_window_starts : 1; + + /* The output method says how the contents of this frame are + displayed. It could be using termcap, or using an X window. + This must be the same as the terminal->type. */ + ENUM_BF (output_method) output_method : 3; + +#ifdef HAVE_WINDOW_SYSTEM + + /* See FULLSCREEN_ enum on top. */ + ENUM_BF (fullscreen_type) want_fullscreen : 4; + + /* If not vertical_scroll_bar_none, we should actually + display the scroll bars of this type on this frame. */ + ENUM_BF (vertical_scroll_bar_type) vertical_scroll_bar_type : 2; + +#endif /* HAVE_WINDOW_SYSTEM */ + + /* Bitfield area ends here. */ + /* Margin at the top of the frame. Used to display the tool-bar. */ int tool_bar_lines; @@ -309,11 +396,6 @@ /* Canonical Y unit. Height of a line, in pixels. */ int line_height; - /* The output method says how the contents of this frame are - displayed. It could be using termcap, or using an X window. - This must be the same as the terminal->type. */ - enum output_method output_method; - /* The terminal device that this frame uses. If this is NULL, then the frame has been deleted. */ struct terminal *terminal; @@ -344,9 +426,6 @@ /* The extra width (in pixels) currently allotted for fringes. */ int left_fringe_width, right_fringe_width; - /* See FULLSCREEN_ enum below. */ - enum fullscreen_type want_fullscreen; - /* Number of lines of menu bar. */ int menu_bar_lines; @@ -358,70 +437,6 @@ int wait_event_type; #endif -#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ - || defined (HAVE_NS) || defined (USE_GTK) - /* True means using a menu bar that comes from the X toolkit. */ - bool_bf external_menu_bar : 1; -#endif - - /* Next two bitfields are mutually exclusive. They might both be - zero if the frame has been made invisible without an icon. */ - - /* Nonzero if the frame is currently displayed; we check - it to see if we should bother updating the frame's contents. - - On ttys and on Windows NT/9X, to avoid wasting effort updating - visible frames that are actually completely obscured by other - windows on the display, we bend the meaning of visible slightly: - if equal to 2, then the frame is obscured - we still consider - it to be "visible" as seen from lisp, but we don't bother - updating it. */ - unsigned visible : 2; - - /* True if the frame is currently iconified. Do not - set this directly, use SET_FRAME_ICONIFIED instead. */ - bool_bf iconified : 1; - - /* True if this frame should be fully redisplayed. Disables all - optimizations while rebuilding matrices and redrawing. */ - bool_bf garbaged : 1; - - /* False means, if this frame has just one window, - show no modeline for that window. */ - bool_bf wants_modeline : 1; - - /* True means raise this frame to the top of the heap when selected. */ - bool_bf auto_raise : 1; - - /* True means lower this frame to the bottom of the stack when left. */ - bool_bf auto_lower : 1; - - /* True if frame's root window can't be split. */ - bool_bf no_split : 1; - - /* If this is set, then Emacs won't change the frame name to indicate - the current buffer, etcetera. If the user explicitly sets the frame - name, this gets set. If the user sets the name to Qnil, this is - cleared. */ - bool_bf explicit_name : 1; - - /* True if size of some window on this frame has changed. */ - bool_bf window_sizes_changed : 1; - - /* True if the mouse has moved on this display device - since the last time we checked. */ - bool_bf mouse_moved : 1; - - /* True means that the pointer is invisible. */ - bool_bf pointer_invisible : 1; - - /* True means that all windows except mini-window and - selected window on this frame have frozen window starts. */ - bool_bf frozen_window_starts : 1; - - /* Nonzero if we should actually display the scroll bars on this frame. */ - enum vertical_scroll_bar_type vertical_scroll_bar_type; - /* What kind of text cursor should we draw in the future? This should always be filled_box_cursor or bar_cursor. */ enum text_cursor_kinds desired_cursor; @@ -793,6 +808,8 @@ #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost #define FRAME_FOCUS_FRAME(f) f->focus_frame +#ifdef HAVE_WINDOW_SYSTEM + /* This frame slot says whether scroll bars are currently enabled for frame F, and which side they are on. */ #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type) @@ -803,6 +820,16 @@ #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \ ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right) +#else /* not HAVE_WINDOW_SYSTEM */ + +/* If there is no window system, there are no scroll bars. */ +#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((void) f, vertical_scroll_bar_none) +#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) ((void) f, 0) +#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) f, 0) +#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) f, 0) + +#endif /* HAVE_WINDOW_SYSTEM */ + /* Width that a scroll bar in frame F should have, if there is one. Measured in pixels. If scroll bars are turned off, this is still nonzero. */ ------------------------------------------------------------ revno: 117542 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-07-16 12:45:22 +0400 message: More precise control over values of some buffer-local variables. * keyboard.c (Qvertical_scroll_bar): * frame.c (Qleft, Qright): Move to ... * buffer.c (Qleft, Qright, Qvertical_scroll_bar): ... here. * buffer.c (Qchoice, Qrange, Qoverwrite_mode, Qfraction): New symbols. (syms_of_buffer): DEFSYM all of the above, attach special properties. Use special symbols to DEFVAR_PER_BUFFER overwrite-mode, vertical-scroll-bar, scroll-up-aggressively and scroll-down-aggressively. * buffer.h (Qchoice, Qrange, Qleft, Qright, Qvertical_scroll_bar): Add declarations. * nsfns.m, frame.h (Qleft, Qright): * nsterm.m (Qleft): Remove declarations. * gtkutil.c (toplevel): Include buffer.h. * data.c (wrong_choice, wrong_range): New functions. (store_symval_forwarding): Handle special properties of buffer-local variables and use functions from the above to signal error, if any. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-16 05:44:05 +0000 +++ src/ChangeLog 2014-07-16 08:45:22 +0000 @@ -1,3 +1,23 @@ +2014-07-16 Dmitry Antipov + + More precise control over values of some buffer-local variables. + * keyboard.c (Qvertical_scroll_bar): + * frame.c (Qleft, Qright): Move to ... + * buffer.c (Qleft, Qright, Qvertical_scroll_bar): ... here. + * buffer.c (Qchoice, Qrange, Qoverwrite_mode, Qfraction): New symbols. + (syms_of_buffer): DEFSYM all of the above, attach special properties. + Use special symbols to DEFVAR_PER_BUFFER overwrite-mode, + vertical-scroll-bar, scroll-up-aggressively + and scroll-down-aggressively. + * buffer.h (Qchoice, Qrange, Qleft, Qright, Qvertical_scroll_bar): + Add declarations. + * nsfns.m, frame.h (Qleft, Qright): + * nsterm.m (Qleft): Remove declarations. + * gtkutil.c (toplevel): Include buffer.h. + * data.c (wrong_choice, wrong_range): New functions. + (store_symval_forwarding): Handle special properties of buffer-local + variables and use functions from the above to signal error, if any. + 2014-07-15 Daiki Ueno * nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around === modified file 'src/buffer.c' --- src/buffer.c 2014-06-23 04:11:29 +0000 +++ src/buffer.c 2014-07-16 08:45:22 +0000 @@ -145,6 +145,9 @@ Lisp_Object Qinsert_in_front_hooks; Lisp_Object Qinsert_behind_hooks; +Lisp_Object Qchoice, Qrange, Qleft, Qright, Qvertical_scroll_bar; +static Lisp_Object Qoverwrite_mode, Qfraction; + static void alloc_buffer_text (struct buffer *, ptrdiff_t); static void free_buffer_text (struct buffer *b); static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); @@ -5422,6 +5425,10 @@ staticpro (&Qpermanent_local); staticpro (&Qkill_buffer_hook); + DEFSYM (Qleft, "left"); + DEFSYM (Qright, "right"); + DEFSYM (Qrange, "range"); + DEFSYM (Qpermanent_local_hook, "permanent-local-hook"); DEFSYM (Qoverlayp, "overlayp"); DEFSYM (Qevaporate, "evaporate"); @@ -5437,6 +5444,17 @@ DEFSYM (Qafter_change_functions, "after-change-functions"); DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); + DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar"); + Fput (Qvertical_scroll_bar, Qchoice, list4 (Qnil, Qt, Qleft, Qright)); + + DEFSYM (Qfraction, "fraction"); + Fput (Qfraction, Qrange, Fcons (make_float (0.0), make_float (1.0))); + + DEFSYM (Qoverwrite_mode, "overwrite-mode"); + Fput (Qoverwrite_mode, Qchoice, + list3 (Qnil, intern ("overwrite-mode-textual"), + intern ("overwrite-mode-binary"))); + Fput (Qprotected_field, Qerror_conditions, listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); Fput (Qprotected_field, Qerror_message, @@ -5842,7 +5860,8 @@ Qnil, doc: /* Non-nil means display ... on previous line when a line is invisible. */); - DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, + DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), + Qoverwrite_mode, doc: /* Non-nil if self-insertion should replace existing text. The value should be one of `overwrite-mode-textual', `overwrite-mode-binary', or nil. @@ -5936,7 +5955,7 @@ A value of nil means to use the scroll bar width from the window's frame. */); DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), - Qnil, + Qvertical_scroll_bar, doc: /* Position of this buffer's vertical scroll bar. The value takes effect whenever you tell a window to display this buffer; for instance, with `set-window-buffer' or when `display-buffer' displays it. @@ -6011,7 +6030,7 @@ cursor type. */); DEFVAR_PER_BUFFER ("scroll-up-aggressively", - &BVAR (current_buffer, scroll_up_aggressively), Qfloatp, + &BVAR (current_buffer, scroll_up_aggressively), Qfraction, doc: /* How far to scroll windows upward. If you move point off the bottom, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -6024,7 +6043,7 @@ between 0.0 and 1.0, inclusive. */); DEFVAR_PER_BUFFER ("scroll-down-aggressively", - &BVAR (current_buffer, scroll_down_aggressively), Qfloatp, + &BVAR (current_buffer, scroll_down_aggressively), Qfraction, doc: /* How far to scroll windows downward. If you move point off the top, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, === modified file 'src/buffer.h' --- src/buffer.h 2014-04-24 03:59:19 +0000 +++ src/buffer.h 2014-07-16 08:45:22 +0000 @@ -1135,6 +1135,7 @@ extern Lisp_Object Qafter_change_functions; extern Lisp_Object Qfirst_change_hook; extern Lisp_Object Qpriority, Qbefore_string, Qafter_string; +extern Lisp_Object Qchoice, Qrange, Qleft, Qright, Qvertical_scroll_bar; /* FOR_EACH_LIVE_BUFFER (LIST_VAR, BUF_VAR) followed by a statement is a `for' loop which iterates over the buffers from Vbuffer_alist. */ === modified file 'src/data.c' --- src/data.c 2014-06-08 23:41:43 +0000 +++ src/data.c 2014-07-16 08:45:22 +0000 @@ -971,6 +971,48 @@ } } +/* Used to signal a user-friendly error when symbol WRONG is + not a member of CHOICE, which should be a list of symbols. */ + +static void +wrong_choice (Lisp_Object choice, Lisp_Object wrong) +{ + ptrdiff_t i = 0, len = XINT (Flength (choice)); + Lisp_Object obj, *args; + + USE_SAFE_ALLOCA; + SAFE_ALLOCA_LISP (args, len * 2 + 1); + + args[i++] = build_string ("One of "); + + for (obj = choice; !NILP (obj); obj = XCDR (obj)) + { + args[i++] = SYMBOL_NAME (XCAR (obj)); + args[i++] = build_string (NILP (XCDR (obj)) ? " should be specified" + : (NILP (XCDR (XCDR (obj))) ? " or " : ", ")); + } + + obj = Fconcat (i, args); + SAFE_FREE (); + xsignal2 (Qerror, obj, wrong); +} + +/* Used to signal a user-friendly error if WRONG is not a number or + integer/floating-point number outsize of inclusive MIN..MAX range. */ + +static void +wrong_range (Lisp_Object min, Lisp_Object max, Lisp_Object wrong) +{ + Lisp_Object args[4]; + + args[0] = build_string ("Value should be from "); + args[1] = Fnumber_to_string (min); + args[2] = build_string (" to "); + args[3] = Fnumber_to_string (max); + + xsignal2 (Qerror, Fconcat (4, args), wrong); +} + /* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell of SYMBOL. If SYMBOL is buffer-local, VALCONTENTS should be the buffer-independent contents of the value cell: forwarded just one @@ -1027,10 +1069,33 @@ int offset = XBUFFER_OBJFWD (valcontents)->offset; Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate; - if (!NILP (predicate) && !NILP (newval) - && NILP (call1 (predicate, newval))) - wrong_type_argument (predicate, newval); - + if (!NILP (newval)) + { + if (SYMBOLP (predicate)) + { + Lisp_Object prop; + + if ((prop = Fget (predicate, Qchoice), !NILP (prop))) + { + if (NILP (Fmemq (newval, prop))) + wrong_choice (prop, newval); + } + else if ((prop = Fget (predicate, Qrange), !NILP (prop))) + { + Lisp_Object min = XCAR (prop), max = XCDR (prop); + + if (!NUMBERP (newval) + || !NILP (arithcompare (newval, min, ARITH_LESS)) + || !NILP (arithcompare (newval, max, ARITH_GRTR))) + wrong_range (min, max, newval); + } + else if (FUNCTIONP (predicate)) + { + if (NILP (call1 (predicate, newval))) + wrong_type_argument (predicate, newval); + } + } + } if (buf == NULL) buf = current_buffer; set_per_buffer_value (buf, offset, newval); === modified file 'src/frame.c' --- src/frame.c 2014-07-03 06:00:53 +0000 +++ src/frame.c 2014-07-16 08:45:22 +0000 @@ -78,7 +78,6 @@ Lisp_Object Qborder_color, Qborder_width; Lisp_Object Qcursor_color, Qcursor_type; Lisp_Object Qheight, Qwidth; -Lisp_Object Qleft, Qright; Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name; Lisp_Object Qtooltip; Lisp_Object Qinternal_border_width; @@ -4547,8 +4546,6 @@ DEFSYM (Qicon_left, "icon-left"); DEFSYM (Qicon_top, "icon-top"); DEFSYM (Qtooltip, "tooltip"); - DEFSYM (Qleft, "left"); - DEFSYM (Qright, "right"); DEFSYM (Quser_position, "user-position"); DEFSYM (Quser_size, "user-size"); DEFSYM (Qwindow_id, "window-id"); === modified file 'src/frame.h' --- src/frame.h 2014-07-03 12:20:00 +0000 +++ src/frame.h 2014-07-16 08:45:22 +0000 @@ -1255,7 +1255,7 @@ extern Lisp_Object Qx_resource_name; -extern Lisp_Object Qleft, Qright, Qtop, Qbox, Qbottom; +extern Lisp_Object Qtop, Qbox, Qbottom; extern Lisp_Object Qdisplay; extern Lisp_Object Qrun_hook_with_args; === modified file 'src/gtkutil.c' --- src/gtkutil.c 2014-06-02 18:01:21 +0000 +++ src/gtkutil.c 2014-07-16 08:45:22 +0000 @@ -30,6 +30,7 @@ #include "blockinput.h" #include "syssignal.h" #include "window.h" +#include "buffer.h" #include "gtkutil.h" #include "termhooks.h" #include "keyboard.h" === modified file 'src/keyboard.c' --- src/keyboard.c 2014-06-23 04:11:29 +0000 +++ src/keyboard.c 2014-07-16 08:45:22 +0000 @@ -348,7 +348,6 @@ Lisp_Object Qmode_line; Lisp_Object Qvertical_line; Lisp_Object Qright_divider, Qbottom_divider; -static Lisp_Object Qvertical_scroll_bar; Lisp_Object Qmenu_bar; static Lisp_Object Qecho_keystrokes; @@ -11012,7 +11011,6 @@ DEFSYM (Qmode_line, "mode-line"); DEFSYM (Qvertical_line, "vertical-line"); - DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar"); DEFSYM (Qmenu_bar, "menu-bar"); DEFSYM (Qright_divider, "right-divider"); DEFSYM (Qbottom_divider, "bottom-divider"); === modified file 'src/nsfns.m' --- src/nsfns.m 2014-07-11 16:33:17 +0000 +++ src/nsfns.m 2014-07-16 08:45:22 +0000 @@ -73,8 +73,6 @@ extern Lisp_Object Qicon_name; extern Lisp_Object Qicon_left; extern Lisp_Object Qicon_top; -extern Lisp_Object Qleft; -extern Lisp_Object Qright; extern Lisp_Object Qtop; extern Lisp_Object Qdisplay; extern Lisp_Object Qvertical_scroll_bars; === modified file 'src/nsterm.m' --- src/nsterm.m 2014-07-11 16:33:17 +0000 +++ src/nsterm.m 2014-07-16 08:45:22 +0000 @@ -229,7 +229,7 @@ static Lisp_Object Qmodifier_value; Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper; -extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft; +extern Lisp_Object Qcursor_color, Qcursor_type, Qns; static Lisp_Object QUTF8_STRING; static Lisp_Object Qcocoa, Qgnustep; ------------------------------------------------------------ revno: 117541 committer: Daiki Ueno branch nick: trunk timestamp: Wed 2014-07-16 14:44:05 +0900 message: Revert r117538 and fix XCHAR2B_BYTE[12] in nsgui.h only * nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around pointer argument, before dereferencing. (XCHAR2B_BYTE2): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-16 04:31:31 +0000 +++ src/ChangeLog 2014-07-16 05:44:05 +0000 @@ -1,15 +1,8 @@ -2014-07-16 Daiki Ueno +2014-07-15 Daiki Ueno - Consolidate XChar2b macros for the X, W32, and NS - Suggested by Jan Djärv in: - https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html - * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move the - fallback definitions to dispextern.h. - * nsgui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Likewise. - Share the same definition with W32. - * xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ... - * dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): - ... here for the consistency with W32 and NS. + * nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around + pointer argument, before dereferencing. + (XCHAR2B_BYTE2): Likewise. 2014-07-15 Dmitry Antipov === modified file 'src/dispextern.h' --- src/dispextern.h 2014-07-16 04:31:31 +0000 +++ src/dispextern.h 2014-07-16 05:44:05 +0000 @@ -31,15 +31,6 @@ #include #endif /* USE_X_TOOLKIT */ -#define STORE_XCHAR2B(chp, b1, b2) \ - ((chp)->byte1 = (b1), (chp)->byte2 = (b2)) - -#define XCHAR2B_BYTE1(chp) \ - ((chp)->byte1) - -#define XCHAR2B_BYTE2(chp) \ - ((chp)->byte2) - #else /* !HAVE_X_WINDOWS */ /* X-related stuff used by non-X gui code. */ @@ -51,15 +42,6 @@ char pad; } XColor; -#define STORE_XCHAR2B(chp, b1, b2) \ - (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff)))) - -#define XCHAR2B_BYTE1(chp) \ - ((*(chp) & 0xff00) >> 8) - -#define XCHAR2B_BYTE2(chp) \ - (*(chp) & 0x00ff) - #endif /* HAVE_X_WINDOWS */ #ifdef MSDOS === modified file 'src/nsgui.h' --- src/nsgui.h 2014-07-16 04:40:43 +0000 +++ src/nsgui.h 2014-07-16 05:44:05 +0000 @@ -64,6 +64,15 @@ #endif typedef unichar XChar2b; +#define STORE_XCHAR2B(chp, b1, b2) \ + (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff)))) + +#define XCHAR2B_BYTE1(chp) \ + ((*(chp) & 0xff00) >> 8) + +#define XCHAR2B_BYTE2(chp) \ + (*(chp) & 0x00ff) + /* XXX: xfaces requires these structures, but the question is are we forced to use them? */ === modified file 'src/w32gui.h' --- src/w32gui.h 2014-07-16 04:31:31 +0000 +++ src/w32gui.h 2014-07-16 05:44:05 +0000 @@ -54,6 +54,16 @@ #define XChar2b wchar_t +/* Dealing with bits of wchar_t as if they were an XChar2b. */ +#define STORE_XCHAR2B(chp, byte1, byte2) \ + ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) + +#define XCHAR2B_BYTE1(chp) \ + (((*(chp)) & 0xff00) >> 8) + +#define XCHAR2B_BYTE2(chp) \ + ((*(chp)) & 0x00ff) + /* Windows equivalent of XImage. */ typedef struct _XImage === modified file 'src/xterm.h' --- src/xterm.h 2014-07-16 04:11:08 +0000 +++ src/xterm.h 2014-07-16 05:44:05 +0000 @@ -1047,6 +1047,15 @@ #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0) +#define STORE_XCHAR2B(chp, b1, b2) \ + ((chp)->byte1 = (b1), (chp)->byte2 = (b2)) + +#define XCHAR2B_BYTE1(chp) \ + ((chp)->byte1) + +#define XCHAR2B_BYTE2(chp) \ + ((chp)->byte2) + #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \ ((nr).x = (rx), \ (nr).y = (ry), \ ------------------------------------------------------------ revno: 117540 committer: Daiki Ueno branch nick: trunk timestamp: Wed 2014-07-16 13:40:43 +0900 message: Remove unnecessary ifdef from nsgui.h, introduced by my last commit diff: === modified file 'src/nsgui.h' --- src/nsgui.h 2014-07-16 04:31:31 +0000 +++ src/nsgui.h 2014-07-16 04:40:43 +0000 @@ -59,12 +59,10 @@ } XCharStruct; /* Fake structure from Xlib.h to represent two-byte characters. */ -#ifdef HAVE_NS #ifndef __OBJC__ typedef unsigned short unichar; #endif typedef unichar XChar2b; -#endif /* XXX: xfaces requires these structures, but the question is are we ------------------------------------------------------------ revno: 117539 committer: Daiki Ueno branch nick: trunk timestamp: Wed 2014-07-16 13:31:31 +0900 message: Move back the XChar2b definition to w32gui.h and nsgui.h Fix the last change. XChar2b still needs to be defined platform dependently, to match with the argument types of drawing functions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-16 04:11:08 +0000 +++ src/ChangeLog 2014-07-16 04:31:31 +0000 @@ -3,10 +3,10 @@ Consolidate XChar2b macros for the X, W32, and NS Suggested by Jan Djärv in: https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html - * w32gui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): - Move the fallback definitions to dispextern.h. - * nsgui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): - Likewise. Share the same definition with W32. + * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move the + fallback definitions to dispextern.h. + * nsgui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Likewise. + Share the same definition with W32. * xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ... * dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): ... here for the consistency with W32 and NS. === modified file 'src/dispextern.h' --- src/dispextern.h 2014-07-16 04:11:08 +0000 +++ src/dispextern.h 2014-07-16 04:31:31 +0000 @@ -51,8 +51,6 @@ char pad; } XColor; -typedef unsigned short XChar2b; - #define STORE_XCHAR2B(chp, b1, b2) \ (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff)))) === modified file 'src/nsgui.h' --- src/nsgui.h 2014-07-16 04:11:08 +0000 +++ src/nsgui.h 2014-07-16 04:31:31 +0000 @@ -58,6 +58,14 @@ int descent; } XCharStruct; +/* Fake structure from Xlib.h to represent two-byte characters. */ +#ifdef HAVE_NS +#ifndef __OBJC__ +typedef unsigned short unichar; +#endif +typedef unichar XChar2b; +#endif + /* XXX: xfaces requires these structures, but the question is are we forced to use them? */ === modified file 'src/w32gui.h' --- src/w32gui.h 2014-07-16 04:11:08 +0000 +++ src/w32gui.h 2014-07-16 04:31:31 +0000 @@ -52,6 +52,8 @@ #define No_Cursor (0) +#define XChar2b wchar_t + /* Windows equivalent of XImage. */ typedef struct _XImage ------------------------------------------------------------ revno: 117538 committer: Daiki Ueno branch nick: trunk timestamp: Wed 2014-07-16 13:11:08 +0900 message: Consolidate XChar2b macros for the X, W32, and NS Suggested by Jan Dj?rv in: https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html * w32gui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move the fallback definitions to dispextern.h. * nsgui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Likewise. Share the same definition with W32. * xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ... * dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): ... here for the consistency with W32 and NS. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-15 14:04:06 +0000 +++ src/ChangeLog 2014-07-16 04:11:08 +0000 @@ -1,3 +1,16 @@ +2014-07-16 Daiki Ueno + + Consolidate XChar2b macros for the X, W32, and NS + Suggested by Jan Djärv in: + https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html + * w32gui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): + Move the fallback definitions to dispextern.h. + * nsgui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): + Likewise. Share the same definition with W32. + * xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ... + * dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): + ... here for the consistency with W32 and NS. + 2014-07-15 Dmitry Antipov * xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id. === modified file 'src/dispextern.h' --- src/dispextern.h 2014-07-03 06:00:53 +0000 +++ src/dispextern.h 2014-07-16 04:11:08 +0000 @@ -31,6 +31,15 @@ #include #endif /* USE_X_TOOLKIT */ +#define STORE_XCHAR2B(chp, b1, b2) \ + ((chp)->byte1 = (b1), (chp)->byte2 = (b2)) + +#define XCHAR2B_BYTE1(chp) \ + ((chp)->byte1) + +#define XCHAR2B_BYTE2(chp) \ + ((chp)->byte2) + #else /* !HAVE_X_WINDOWS */ /* X-related stuff used by non-X gui code. */ @@ -42,6 +51,17 @@ char pad; } XColor; +typedef unsigned short XChar2b; + +#define STORE_XCHAR2B(chp, b1, b2) \ + (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff)))) + +#define XCHAR2B_BYTE1(chp) \ + ((*(chp) & 0xff00) >> 8) + +#define XCHAR2B_BYTE2(chp) \ + (*(chp) & 0x00ff) + #endif /* HAVE_X_WINDOWS */ #ifdef MSDOS === modified file 'src/nsgui.h' --- src/nsgui.h 2014-06-02 18:01:21 +0000 +++ src/nsgui.h 2014-07-16 04:11:08 +0000 @@ -58,21 +58,6 @@ int descent; } XCharStruct; -/* Fake structure from Xlib.h to represent two-byte characters. */ -#ifndef __OBJC__ -typedef unsigned short unichar; -#endif -typedef unichar XChar2b; - -#define STORE_XCHAR2B(chp, b1, b2) \ - (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff)))) - -#define XCHAR2B_BYTE1(chp) \ - (((*chp) & 0xff00) >> 8) - -#define XCHAR2B_BYTE2(chp) \ - ((*chp) & 0x00ff) - /* XXX: xfaces requires these structures, but the question is are we forced to use them? */ === modified file 'src/w32gui.h' --- src/w32gui.h 2014-06-02 18:01:21 +0000 +++ src/w32gui.h 2014-07-16 04:11:08 +0000 @@ -52,18 +52,6 @@ #define No_Cursor (0) -#define XChar2b wchar_t - -/* Dealing with bits of wchar_t as if they were an XChar2b. */ -#define STORE_XCHAR2B(chp, byte1, byte2) \ - ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) - -#define XCHAR2B_BYTE1(chp) \ - (((*(chp)) & 0xff00) >> 8) - -#define XCHAR2B_BYTE2(chp) \ - ((*(chp)) & 0x00ff) - /* Windows equivalent of XImage. */ typedef struct _XImage === modified file 'src/xterm.h' --- src/xterm.h 2014-06-22 05:00:14 +0000 +++ src/xterm.h 2014-07-16 04:11:08 +0000 @@ -1047,15 +1047,6 @@ #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0) -#define STORE_XCHAR2B(chp, b1, b2) \ - ((chp)->byte1 = (b1), (chp)->byte2 = (b2)) - -#define XCHAR2B_BYTE1(chp) \ - ((chp)->byte1) - -#define XCHAR2B_BYTE2(chp) \ - ((chp)->byte2) - #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \ ((nr).x = (rx), \ (nr).y = (ry), \ ------------------------------------------------------------ revno: 117537 fixes bug: http://debbugs.gnu.org/18006 committer: Paul Eggert branch nick: trunk timestamp: Tue 2014-07-15 12:28:25 -0700 message: Use "b" flag more consistently; avoid "t". * make-docfile.c (READ_TEXT): Remove; all uses replaced by "r". (READ_BINARY): Remove; all uses replaced by "rb". diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2014-07-14 19:23:18 +0000 +++ lib-src/ChangeLog 2014-07-15 19:28:25 +0000 @@ -1,3 +1,9 @@ +2014-07-15 Paul Eggert + + Use "b" flag more consistently; avoid "t" (Bug#18006). + * make-docfile.c (READ_TEXT): Remove; all uses replaced by "r". + (READ_BINARY): Remove; all uses replaced by "rb". + 2014-07-14 Paul Eggert Use binary-io module, O_BINARY, and "b" flag (Bug#18006). === modified file 'lib-src/make-docfile.c' --- lib-src/make-docfile.c 2014-07-14 19:23:18 +0000 +++ lib-src/make-docfile.c 2014-07-15 19:28:25 +0000 @@ -55,12 +55,8 @@ Similarly, msdos defines this as sys_chdir, but we're not linking with the file where that function is defined. */ #undef chdir -#define READ_TEXT "rt" -#define READ_BINARY "rb" #define IS_SLASH(c) ((c) == '/' || (c) == '\\' || (c) == ':') #else /* not DOS_NT */ -#define READ_TEXT "r" -#define READ_BINARY "r" #define IS_SLASH(c) ((c) == '/') #endif /* not DOS_NT */ @@ -216,11 +212,11 @@ if (!generate_globals) put_filename (filename); if (len > 4 && !strcmp (filename + len - 4, ".elc")) - return scan_lisp_file (filename, READ_BINARY); + return scan_lisp_file (filename, "rb"); else if (len > 3 && !strcmp (filename + len - 3, ".el")) - return scan_lisp_file (filename, READ_TEXT); + return scan_lisp_file (filename, "r"); else - return scan_c_file (filename, READ_TEXT); + return scan_c_file (filename, "r"); } static void ------------------------------------------------------------ revno: 117536 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2014-07-15 18:04:06 +0400 message: * regex.c (re_search_2): Use ssize_t to avoid integer overflow. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-15 09:59:05 +0000 +++ src/ChangeLog 2014-07-15 14:04:06 +0000 @@ -6,6 +6,8 @@ Use record_unwind_protect_int and avoid consing. (syms_of_xmenu) [USE_X_TOOLKIT]: Declare WIDGET_ID_TICK_START. + * regex.c (re_search_2): Use ssize_t to avoid integer overflow. + 2014-07-14 Paul Eggert Use binary-io module, O_BINARY, and "b" flag (Bug#18006). === modified file 'src/regex.c' --- src/regex.c 2014-05-17 08:11:31 +0000 +++ src/regex.c 2014-07-15 14:04:06 +0000 @@ -4342,8 +4342,7 @@ if (range > 0) /* Searching forwards. */ { - register int lim = 0; - ssize_t irange = range; + ssize_t irange = range, lim = 0; if (startpos < size1 && startpos + range >= size1) lim = range - (size1 - startpos); ------------------------------------------------------------ revno: 117535 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2014-07-15 13:59:05 +0400 message: * lwlib/lwlib.h (toplevel): Use unsigned int for LWLIB_ID. * src/xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id. (pop_down_menu) [USE_X_TOOLKIT]: Accept integer arg. (create_and_show_popup_menu, create_and_show_dialog) [USE_X_TOOLKIT]: Use record_unwind_protect_int and avoid consing. (syms_of_xmenu) [USE_X_TOOLKIT]: Declare WIDGET_ID_TICK_START. diff: === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2014-06-28 22:57:23 +0000 +++ lwlib/ChangeLog 2014-07-15 09:59:05 +0000 @@ -1,3 +1,7 @@ +2014-07-15 Dmitry Antipov + + * lwlib.h (toplevel): Use unsigned int for LWLIB_ID. + 2014-06-28 Glenn Morris * Makefile.in: Use gcc auto-dependency information. === modified file 'lwlib/lwlib.h' --- lwlib/lwlib.h 2014-06-03 19:59:55 +0000 +++ lwlib/lwlib.h 2014-07-15 09:59:05 +0000 @@ -44,7 +44,7 @@ #include "lwlib-widget.h" -typedef unsigned long LWLIB_ID; +typedef unsigned int LWLIB_ID; /* Menu separator types. */ === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-14 19:23:18 +0000 +++ src/ChangeLog 2014-07-15 09:59:05 +0000 @@ -1,3 +1,11 @@ +2014-07-15 Dmitry Antipov + + * xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id. + (pop_down_menu) [USE_X_TOOLKIT]: Accept integer arg. + (create_and_show_popup_menu, create_and_show_dialog) [USE_X_TOOLKIT]: + Use record_unwind_protect_int and avoid consing. + (syms_of_xmenu) [USE_X_TOOLKIT]: Declare WIDGET_ID_TICK_START. + 2014-07-14 Paul Eggert Use binary-io module, O_BINARY, and "b" flag (Bug#18006). === modified file 'src/xmenu.c' --- src/xmenu.c 2014-06-22 05:00:14 +0000 +++ src/xmenu.c 2014-07-15 09:59:05 +0000 @@ -117,7 +117,7 @@ #ifdef USE_X_TOOLKIT -static int next_menubar_widget_id; +static LWLIB_ID next_menubar_widget_id; /* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */ @@ -1273,8 +1273,8 @@ /* We need a unique id for each widget handled by the Lucid Widget library. - For the main windows, and popup menus, we use this counter, - which we increment each time after use. This starts from 1<<16. + For the main windows, and popup menus, we use this counter, which we + increment each time after use. This starts from WIDGET_ID_TICK_START. For menu bars, we use numbers starting at 0, counted in next_menubar_widget_id. */ @@ -1286,17 +1286,13 @@ menu_item_selection = client_data; } -/* ARG is the LWLIB ID of the dialog box, represented - as a Lisp object as (HIGHPART . LOWPART). */ +/* ID is the LWLIB ID of the dialog box. */ static void -pop_down_menu (Lisp_Object arg) +pop_down_menu (int id) { - LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID) - | XINT (XCDR (arg))); - block_input (); - lw_destroy_all_widgets (id); + lw_destroy_all_widgets ((LWLIB_ID) id); unblock_input (); popup_activated_flag = 0; } @@ -1362,11 +1358,9 @@ x_activate_timeout_atimer (); { - int fact = 4 * sizeof (LWLIB_ID); ptrdiff_t specpdl_count = SPECPDL_INDEX (); - record_unwind_protect (pop_down_menu, - Fcons (make_number (menu_id >> (fact)), - make_number (menu_id & ~(-1 << (fact))))); + + record_unwind_protect_int (pop_down_menu, (int) menu_id); /* Process events that apply to the menu. */ popup_get_selection (0, FRAME_DISPLAY_INFO (f), menu_id, 1); @@ -1732,12 +1726,10 @@ Also handle timers. */ { ptrdiff_t count = SPECPDL_INDEX (); - int fact = 4 * sizeof (LWLIB_ID); /* xdialog_show_unwind is responsible for popping the dialog box down. */ - record_unwind_protect (pop_down_menu, - Fcons (make_number (dialog_id >> (fact)), - make_number (dialog_id & ~(-1 << (fact))))); + + record_unwind_protect_int (pop_down_menu, (int) dialog_id); popup_get_selection (0, FRAME_DISPLAY_INFO (f), dialog_id, 1); @@ -2330,13 +2322,13 @@ void syms_of_xmenu (void) { +#ifdef USE_X_TOOLKIT + enum { WIDGET_ID_TICK_START = 1 << 16 }; + widget_id_tick = WIDGET_ID_TICK_START; + next_menubar_widget_id = 1; +#endif + DEFSYM (Qdebug_on_next_call, "debug-on-next-call"); - -#ifdef USE_X_TOOLKIT - widget_id_tick = (1<<16); - next_menubar_widget_id = 1; -#endif - defsubr (&Smenu_or_popup_active_p); #if defined (USE_GTK) || defined (USE_X_TOOLKIT) ------------------------------------------------------------ revno: 117534 committer: Daniel Colascione branch nick: trunk timestamp: Mon 2014-07-14 16:58:52 -0700 message: Unbreak compilation of derived cc-mode modes * lisp/progmodes/cc-defs.el (c-lang-defconst-eval-immediately): Use `macroexpand-all' instead of `cl-macroexpand-all'. * lisp/progmodes/cc-langs.el: Change comments from `cl-macroexpand-all' to `macroexpand-all' diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-07-12 17:53:29 +0000 +++ lisp/ChangeLog 2014-07-14 23:58:52 +0000 @@ -1,3 +1,11 @@ +2014-07-14 Daniel Colascione + + * progmodes/cc-langs.el: Change comments from `cl-macroexpand-all' + to `macroexpand-all' + + * progmodes/cc-defs.el (c-lang-defconst-eval-immediately): + Use `macroexpand-all' instead of `cl-macroexpand-all'. + 2014-07-12 Paul Eggert Fix bug: C-x v v discarded existing log message (Bug#17884). === modified file 'lisp/progmodes/cc-defs.el' --- lisp/progmodes/cc-defs.el 2014-06-29 11:26:47 +0000 +++ lisp/progmodes/cc-defs.el 2014-07-14 23:58:52 +0000 @@ -1836,12 +1836,9 @@ immediately, i.e. at the same time as the `c-lang-defconst' form itself is evaluated." ;; Evaluate at macro expansion time, i.e. in the - ;; `cl-macroexpand-all' inside `c-lang-defconst'. + ;; `macroexpand-all' inside `c-lang-defconst'. (eval form)) -;; Only used at compile time - suppress "might not be defined at runtime". -(declare-function cl-macroexpand-all "cl" (form &optional env)) - (defmacro c-lang-defconst (name &rest args) "Set the language specific values of the language constant NAME. The second argument can optionally be a docstring. The rest of the @@ -1883,7 +1880,7 @@ (let* ((sym (intern (symbol-name name) c-lang-constants)) ;; Make `c-lang-const' expand to a straightforward call to - ;; `c-get-lang-constant' in `cl-macroexpand-all' below. + ;; `c-get-lang-constant' in `macroexpand-all' below. ;; ;; (The default behavior, i.e. to expand to a call inside ;; `eval-when-compile' should be equivalent, since that macro @@ -1946,7 +1943,7 @@ ;; reason, but we also use this expansion handle ;; `c-lang-defconst-eval-immediately' and to register ;; dependencies on the `c-lang-const's in VAL.) - (setq val (cl-macroexpand-all val)) + (setq val (macroexpand-all val)) (setq bindings (cons (cons assigned-mode val) bindings) args (cdr args)))) === modified file 'lisp/progmodes/cc-langs.el' --- lisp/progmodes/cc-langs.el 2014-06-29 11:26:47 +0000 +++ lisp/progmodes/cc-langs.el 2014-07-14 23:58:52 +0000 @@ -213,7 +213,6 @@ ;; These are defined in cl as aliases to the cl- versions. ;(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t) ;(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t) -;(declare-function cl-macroexpand-all "cl" (form &optional env)) (eval-and-compile ;; Some helper functions used when building the language constants. @@ -3185,7 +3184,7 @@ `(lambda () ;; This let sets up the context for `c-mode-var' and similar - ;; that could be in the result from `cl-macroexpand-all'. + ;; that could be in the result from `macroexpand-all'. (let ((c-buffer-is-cc-mode ',mode) current-var source-eval) (c-make-emacs-variables-local) @@ -3195,7 +3194,7 @@ (setq ,@(let ((c-buffer-is-cc-mode mode) (c-lang-const-expansion 'immediate)) ;; `c-lang-const' will expand to the evaluated - ;; constant immediately in `cl-macroexpand-all' + ;; constant immediately in `macroexpand-all' ;; below. (cl-mapcan (lambda (init) ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.