diff options
| author | Kim F. Storm | 2006-07-18 13:30:20 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-07-18 13:30:20 +0000 |
| commit | 4d30ce50e9361c678a1162a062591a5a556340f5 (patch) | |
| tree | d0f64c1735fd1bd1e1a310b038d78c7909b2d3ba /src | |
| parent | 93217cef09eec89554157b06b7d15a6c69f0694f (diff) | |
| download | emacs-4d30ce50e9361c678a1162a062591a5a556340f5.tar.gz emacs-4d30ce50e9361c678a1162a062591a5a556340f5.zip | |
(x_get_local_selection, copy_multiple_data)
(x_get_window_property_as_lisp_data)
(lisp_data_to_selection_data, CHECK_CUT_BUFFER)
(Fx_get_cut_buffer_internal): Use signal_error.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 82 |
1 files changed, 30 insertions, 52 deletions
diff --git a/src/xselect.c b/src/xselect.c index 9c2c221c021..fcac2860359 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -555,11 +555,9 @@ x_get_local_selection (selection_symbol, target_type, local_request) | |||
| 555 | && INTEGERP (XCAR (XCDR (check))) | 555 | && INTEGERP (XCAR (XCDR (check))) |
| 556 | && NILP (XCDR (XCDR (check)))))) | 556 | && NILP (XCDR (XCDR (check)))))) |
| 557 | return value; | 557 | return value; |
| 558 | else | 558 | |
| 559 | return | 559 | signal_error ("Invalid data returned by selection-conversion function", |
| 560 | Fsignal (Qerror, | 560 | list2 (handler_fn, value)); |
| 561 | Fcons (build_string ("invalid data returned by selection-conversion function"), | ||
| 562 | Fcons (handler_fn, Fcons (value, Qnil)))); | ||
| 563 | } | 561 | } |
| 564 | 562 | ||
| 565 | /* Subroutines of x_reply_selection_request. */ | 563 | /* Subroutines of x_reply_selection_request. */ |
| @@ -1348,8 +1346,7 @@ copy_multiple_data (obj) | |||
| 1348 | CHECK_VECTOR (vec2); | 1346 | CHECK_VECTOR (vec2); |
| 1349 | if (XVECTOR (vec2)->size != 2) | 1347 | if (XVECTOR (vec2)->size != 2) |
| 1350 | /* ??? Confusing error message */ | 1348 | /* ??? Confusing error message */ |
| 1351 | Fsignal (Qerror, Fcons (build_string ("vectors must be of length 2"), | 1349 | signal_error ("Vectors must be of length 2", vec2); |
| 1352 | Fcons (vec2, Qnil))); | ||
| 1353 | XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil); | 1350 | XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil); |
| 1354 | XVECTOR (XVECTOR (vec)->contents [i])->contents [0] | 1351 | XVECTOR (XVECTOR (vec)->contents [i])->contents [0] |
| 1355 | = XVECTOR (vec2)->contents [0]; | 1352 | = XVECTOR (vec2)->contents [0]; |
| @@ -1717,19 +1714,15 @@ x_get_window_property_as_lisp_data (display, window, property, target_type, | |||
| 1717 | there_is_a_selection_owner | 1714 | there_is_a_selection_owner |
| 1718 | = XGetSelectionOwner (display, selection_atom); | 1715 | = XGetSelectionOwner (display, selection_atom); |
| 1719 | UNBLOCK_INPUT; | 1716 | UNBLOCK_INPUT; |
| 1720 | Fsignal (Qerror, | 1717 | if (there_is_a_selection_owner) |
| 1721 | there_is_a_selection_owner | 1718 | signal_error ("Selection owner couldn't convert", |
| 1722 | ? Fcons (build_string ("selection owner couldn't convert"), | 1719 | actual_type |
| 1723 | actual_type | 1720 | ? list2 (target_type, |
| 1724 | ? Fcons (target_type, | 1721 | x_atom_to_symbol (display, actual_type)) |
| 1725 | Fcons (x_atom_to_symbol (display, | 1722 | : target_type); |
| 1726 | actual_type), | 1723 | else |
| 1727 | Qnil)) | 1724 | signal_error ("No selection", |
| 1728 | : Fcons (target_type, Qnil)) | 1725 | x_atom_to_symbol (display, selection_atom)); |
| 1729 | : Fcons (build_string ("no selection"), | ||
| 1730 | Fcons (x_atom_to_symbol (display, | ||
| 1731 | selection_atom), | ||
| 1732 | Qnil))); | ||
| 1733 | } | 1726 | } |
| 1734 | 1727 | ||
| 1735 | if (actual_type == dpyinfo->Xatom_INCR) | 1728 | if (actual_type == dpyinfo->Xatom_INCR) |
| @@ -1929,10 +1922,7 @@ lisp_data_to_selection_data (display, obj, | |||
| 1929 | { | 1922 | { |
| 1930 | if (SCHARS (obj) < SBYTES (obj)) | 1923 | if (SCHARS (obj) < SBYTES (obj)) |
| 1931 | /* OBJ is a multibyte string containing a non-ASCII char. */ | 1924 | /* OBJ is a multibyte string containing a non-ASCII char. */ |
| 1932 | Fsignal (Qerror, /* Qselection_error */ | 1925 | signal_error ("Non-ASCII string must be encoded in advance", obj); |
| 1933 | Fcons (build_string | ||
| 1934 | ("Non-ASCII string must be encoded in advance"), | ||
| 1935 | Fcons (obj, Qnil))); | ||
| 1936 | if (NILP (type)) | 1926 | if (NILP (type)) |
| 1937 | type = QSTRING; | 1927 | type = QSTRING; |
| 1938 | *format_ret = 8; | 1928 | *format_ret = 8; |
| @@ -1993,10 +1983,7 @@ lisp_data_to_selection_data (display, obj, | |||
| 1993 | (*(Atom **) data_ret) [i] | 1983 | (*(Atom **) data_ret) [i] |
| 1994 | = symbol_to_x_atom (dpyinfo, display, XVECTOR (obj)->contents [i]); | 1984 | = symbol_to_x_atom (dpyinfo, display, XVECTOR (obj)->contents [i]); |
| 1995 | else | 1985 | else |
| 1996 | Fsignal (Qerror, /* Qselection_error */ | 1986 | signal_error ("All elements of selection vector must have same type", obj); |
| 1997 | Fcons (build_string | ||
| 1998 | ("all elements of selection vector must have same type"), | ||
| 1999 | Fcons (obj, Qnil))); | ||
| 2000 | } | 1987 | } |
| 2001 | #if 0 /* #### MULTIPLE doesn't work yet */ | 1988 | #if 0 /* #### MULTIPLE doesn't work yet */ |
| 2002 | else if (VECTORP (XVECTOR (obj)->contents [0])) | 1989 | else if (VECTORP (XVECTOR (obj)->contents [0])) |
| @@ -2012,10 +1999,9 @@ lisp_data_to_selection_data (display, obj, | |||
| 2012 | { | 1999 | { |
| 2013 | Lisp_Object pair = XVECTOR (obj)->contents [i]; | 2000 | Lisp_Object pair = XVECTOR (obj)->contents [i]; |
| 2014 | if (XVECTOR (pair)->size != 2) | 2001 | if (XVECTOR (pair)->size != 2) |
| 2015 | Fsignal (Qerror, | 2002 | signal_error ( |
| 2016 | Fcons (build_string | 2003 | "Elements of the vector must be vectors of exactly two elements", |
| 2017 | ("elements of the vector must be vectors of exactly two elements"), | 2004 | pair); |
| 2018 | Fcons (pair, Qnil))); | ||
| 2019 | 2005 | ||
| 2020 | (*(Atom **) data_ret) [i * 2] | 2006 | (*(Atom **) data_ret) [i * 2] |
| 2021 | = symbol_to_x_atom (dpyinfo, display, | 2007 | = symbol_to_x_atom (dpyinfo, display, |
| @@ -2025,10 +2011,8 @@ lisp_data_to_selection_data (display, obj, | |||
| 2025 | XVECTOR (pair)->contents [1]); | 2011 | XVECTOR (pair)->contents [1]); |
| 2026 | } | 2012 | } |
| 2027 | else | 2013 | else |
| 2028 | Fsignal (Qerror, | 2014 | signal_error ("All elements of the vector must be of the same type", |
| 2029 | Fcons (build_string | 2015 | obj); |
| 2030 | ("all elements of the vector must be of the same type"), | ||
| 2031 | Fcons (obj, Qnil))); | ||
| 2032 | 2016 | ||
| 2033 | } | 2017 | } |
| 2034 | #endif | 2018 | #endif |
| @@ -2043,10 +2027,9 @@ lisp_data_to_selection_data (display, obj, | |||
| 2043 | if (CONSP (XVECTOR (obj)->contents [i])) | 2027 | if (CONSP (XVECTOR (obj)->contents [i])) |
| 2044 | *format_ret = 32; | 2028 | *format_ret = 32; |
| 2045 | else if (!INTEGERP (XVECTOR (obj)->contents [i])) | 2029 | else if (!INTEGERP (XVECTOR (obj)->contents [i])) |
| 2046 | Fsignal (Qerror, /* Qselection_error */ | 2030 | signal_error (/* Qselection_error */ |
| 2047 | Fcons (build_string | 2031 | "Elements of selection vector must be integers or conses of integers", |
| 2048 | ("elements of selection vector must be integers or conses of integers"), | 2032 | obj); |
| 2049 | Fcons (obj, Qnil))); | ||
| 2050 | 2033 | ||
| 2051 | /* Use sizeof(long) even if it is more than 32 bits. See comment | 2034 | /* Use sizeof(long) even if it is more than 32 bits. See comment |
| 2052 | in x_get_window_property and x_fill_property_data. */ | 2035 | in x_get_window_property and x_fill_property_data. */ |
| @@ -2063,9 +2046,7 @@ lisp_data_to_selection_data (display, obj, | |||
| 2063 | } | 2046 | } |
| 2064 | } | 2047 | } |
| 2065 | else | 2048 | else |
| 2066 | Fsignal (Qerror, /* Qselection_error */ | 2049 | signal_error (/* Qselection_error */ "Unrecognized selection data", obj); |
| 2067 | Fcons (build_string ("unrecognized selection data"), | ||
| 2068 | Fcons (obj, Qnil))); | ||
| 2069 | 2050 | ||
| 2070 | *type_ret = symbol_to_x_atom (dpyinfo, display, type); | 2051 | *type_ret = symbol_to_x_atom (dpyinfo, display, type); |
| 2071 | } | 2052 | } |
| @@ -2351,15 +2332,13 @@ initialize_cut_buffers (display, window) | |||
| 2351 | 2332 | ||
| 2352 | 2333 | ||
| 2353 | #define CHECK_CUT_BUFFER(symbol) \ | 2334 | #define CHECK_CUT_BUFFER(symbol) \ |
| 2354 | { CHECK_SYMBOL ((symbol)); \ | 2335 | do { CHECK_SYMBOL ((symbol)); \ |
| 2355 | if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \ | 2336 | if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \ |
| 2356 | && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \ | 2337 | && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \ |
| 2357 | && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \ | 2338 | && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \ |
| 2358 | && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \ | 2339 | && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \ |
| 2359 | Fsignal (Qerror, \ | 2340 | signal_error ("Doesn't name a cut buffer", (symbol)); \ |
| 2360 | Fcons (build_string ("doesn't name a cut buffer"), \ | 2341 | } while (0) |
| 2361 | Fcons ((symbol), Qnil))); \ | ||
| 2362 | } | ||
| 2363 | 2342 | ||
| 2364 | DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, | 2343 | DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, |
| 2365 | Sx_get_cut_buffer_internal, 1, 1, 0, | 2344 | Sx_get_cut_buffer_internal, 1, 1, 0, |
| @@ -2392,10 +2371,9 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, | |||
| 2392 | return Qnil; | 2371 | return Qnil; |
| 2393 | 2372 | ||
| 2394 | if (format != 8 || type != XA_STRING) | 2373 | if (format != 8 || type != XA_STRING) |
| 2395 | Fsignal (Qerror, | 2374 | signal_error ("Cut buffer doesn't contain 8-bit data", |
| 2396 | Fcons (build_string ("cut buffer doesn't contain 8-bit data"), | 2375 | list2 (x_atom_to_symbol (display, type), |
| 2397 | Fcons (x_atom_to_symbol (display, type), | 2376 | make_number (format))); |
| 2398 | Fcons (make_number (format), Qnil)))); | ||
| 2399 | 2377 | ||
| 2400 | ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil); | 2378 | ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil); |
| 2401 | /* Use xfree, not XFree, because x_get_window_property | 2379 | /* Use xfree, not XFree, because x_get_window_property |