aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-01-29 06:13:16 -0500
committerEli Zaretskii2010-01-29 06:13:16 -0500
commit6e7d621c18f9645c886c0bb4fac69ec5c9c1fd12 (patch)
treeee47ac31cedff21b6c447cb78450d776087cb9b0 /src
parent639dd35751e5d43072ef14bc679286136a4feae9 (diff)
parentdb68501ffba02fb185f80d78c07bb44659473c86 (diff)
downloademacs-6e7d621c18f9645c886c0bb4fac69ec5c9c1fd12.tar.gz
emacs-6e7d621c18f9645c886c0bb4fac69ec5c9c1fd12.zip
Merge from mainline.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog32
-rw-r--r--src/fileio.c28
-rw-r--r--src/m/alpha.h2
-rw-r--r--src/m/mips.h4
-rw-r--r--src/regex.c3
-rw-r--r--src/w32inevt.c77
-rw-r--r--src/xfns.c147
7 files changed, 126 insertions, 167 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 96dc0066fd9..38368f33a70 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,33 @@
12010-01-28 Chong Yidong <cyd@stupidchicken.com>
2
3 * fileio.c (Frename_file): Fix last change (Bug#5487).
4
5 * m/mips.h: Remove DATA_START. Suggested by Dan Nicolaescu.
6
7 * m/alpha.h: Don't define DATA_START on NetBSD (Bug#4629).
8
92010-01-28 Jan Djärv <jan.h.d@swipnet.se>
10
11 * xfns.c (Fx_create_frame): Remove window size matching code from
12 2010-01-15.
13 (x_get_current_desktop, x_get_desktop_workarea): Remove
14
152010-01-27 Jason Rumney <jasonr@gnu.org>
16
17 * w32inevt.c (w32_kbd_patch_key): Save the unicode character.
18 (key_event): Use unicode for characters 128 and higher (Bug#4567).
19
202010-01-27 Kenichi Handa <handa@m17n.org>
21
22 * regex.c (analyse_first): Fix setting of fastmap for unibyte
23 pattern string (Bug#4209).
24
252010-01-27 David De La Harpe Golden <david@harpegolden.net>
26
27 * fileio.c (Frename_file): Call copy-directory and
28 delete-directory for directories, in order to handle cross-device
29 renaming (Bug#3353).
30
12010-01-25 Jan Djärv <jan.h.d@swipnet.se> 312010-01-25 Jan Djärv <jan.h.d@swipnet.se>
2 32
3 * xfns.c (Fx_create_frame): If frame height is too big, try 33 * xfns.c (Fx_create_frame): If frame height is too big, try
@@ -9323,7 +9353,7 @@
9323 (syms_of_xterm): Don't declare it any more. 9353 (syms_of_xterm): Don't declare it any more.
9324 (x_draw_glyph_string): Adjust to the new name. 9354 (x_draw_glyph_string): Adjust to the new name.
9325 9355
93262008-06-10 David De La Harpe Golden <david@harpegolden.net> (tiny change) 93562008-06-10 David De La Harpe Golden <david@harpegolden.net>
9327 9357
9328 * xterm.c (x_underline_minimum_display_offset): New var. 9358 * xterm.c (x_underline_minimum_display_offset): New var.
9329 (x_draw_glyph_string): Use it. 9359 (x_draw_glyph_string): Use it.
diff --git a/src/fileio.c b/src/fileio.c
index d6cb814641b..72f695acb68 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -215,6 +215,12 @@ Lisp_Object Qdelete_by_moving_to_trash;
215/* Lisp function for moving files to trash. */ 215/* Lisp function for moving files to trash. */
216Lisp_Object Qmove_file_to_trash; 216Lisp_Object Qmove_file_to_trash;
217 217
218/* Lisp function for recursively copying directories. */
219Lisp_Object Qcopy_directory;
220
221/* Lisp function for recursively deleting directories. */
222Lisp_Object Qdelete_directory;
223
218extern Lisp_Object Vuser_login_name; 224extern Lisp_Object Vuser_login_name;
219 225
220#ifdef WINDOWSNT 226#ifdef WINDOWSNT
@@ -2241,7 +2247,11 @@ This is what happens in interactive use with M-x. */)
2241 && (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname)))) 2247 && (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
2242#endif 2248#endif
2243 ) 2249 )
2244 newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); 2250 {
2251 Lisp_Object fname = NILP (Ffile_directory_p (file))
2252 ? file : Fdirectory_file_name (file);
2253 newname = Fexpand_file_name (Ffile_name_nondirectory (fname), newname);
2254 }
2245 else 2255 else
2246 newname = Fexpand_file_name (newname, Qnil); 2256 newname = Fexpand_file_name (newname, Qnil);
2247 2257
@@ -2279,15 +2289,21 @@ This is what happens in interactive use with M-x. */)
2279 NILP (ok_if_already_exists) ? Qnil : Qt); 2289 NILP (ok_if_already_exists) ? Qnil : Qt);
2280 else 2290 else
2281#endif 2291#endif
2292 if (!NILP (Ffile_directory_p (file)))
2293 call4 (Qcopy_directory, file, newname, Qt, Qnil);
2294 else
2295 /* We have already prompted if it was an integer, so don't
2296 have copy-file prompt again. */
2282 Fcopy_file (file, newname, 2297 Fcopy_file (file, newname,
2283 /* We have already prompted if it was an integer,
2284 so don't have copy-file prompt again. */
2285 NILP (ok_if_already_exists) ? Qnil : Qt, 2298 NILP (ok_if_already_exists) ? Qnil : Qt,
2286 Qt, Qt); 2299 Qt, Qt);
2287 2300
2288 count = SPECPDL_INDEX (); 2301 count = SPECPDL_INDEX ();
2289 specbind (Qdelete_by_moving_to_trash, Qnil); 2302 specbind (Qdelete_by_moving_to_trash, Qnil);
2290 Fdelete_file (file); 2303 if (!NILP (Ffile_directory_p (file)))
2304 call2 (Qdelete_directory, file, Qt);
2305 else
2306 Fdelete_file (file);
2291 unbind_to (count, Qnil); 2307 unbind_to (count, Qnil);
2292 } 2308 }
2293 else 2309 else
@@ -5727,6 +5743,10 @@ When non-nil, the function `move-file-to-trash' will be used by
5727 Qdelete_by_moving_to_trash = intern_c_string ("delete-by-moving-to-trash"); 5743 Qdelete_by_moving_to_trash = intern_c_string ("delete-by-moving-to-trash");
5728 Qmove_file_to_trash = intern_c_string ("move-file-to-trash"); 5744 Qmove_file_to_trash = intern_c_string ("move-file-to-trash");
5729 staticpro (&Qmove_file_to_trash); 5745 staticpro (&Qmove_file_to_trash);
5746 Qcopy_directory = intern_c_string ("copy-directory");
5747 staticpro (&Qcopy_directory);
5748 Qdelete_directory = intern_c_string ("delete-directory");
5749 staticpro (&Qdelete_directory);
5730 5750
5731 defsubr (&Sfind_file_name_handler); 5751 defsubr (&Sfind_file_name_handler);
5732 defsubr (&Sfile_name_directory); 5752 defsubr (&Sfile_name_directory);
diff --git a/src/m/alpha.h b/src/m/alpha.h
index 26cdb807452..5abf8bba726 100644
--- a/src/m/alpha.h
+++ b/src/m/alpha.h
@@ -95,7 +95,7 @@ NOTE-END
95 95
96#undef UNEXEC 96#undef UNEXEC
97#define UNEXEC unexelf.o 97#define UNEXEC unexelf.o
98#ifndef GNU_LINUX 98#if !defined(GNU_LINUX) && !defined(__NetBSD__)
99#define DATA_START 0x140000000 99#define DATA_START 0x140000000
100#endif 100#endif
101 101
diff --git a/src/m/mips.h b/src/m/mips.h
index 2b47dba25fa..7a84b6596c8 100644
--- a/src/m/mips.h
+++ b/src/m/mips.h
@@ -50,10 +50,6 @@ NOTE-END */
50 50
51#define TEXT_START 0x00400000 51#define TEXT_START 0x00400000
52 52
53#ifndef GNU_LINUX
54#define DATA_START 0x10000000
55#endif
56
57 53
58#if 0 /* These definitions were advantageous when not using 54#if 0 /* These definitions were advantageous when not using
59 USE_LSB_TAG. With that, they get ignored but cause errors. */ 55 USE_LSB_TAG. With that, they get ignored but cause errors. */
diff --git a/src/regex.c b/src/regex.c
index 0dbfa5971b3..bb921a5b519 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -4083,8 +4083,7 @@ analyse_first (p, pend, fastmap, multibyte)
4083 the corresponding multibyte character. */ 4083 the corresponding multibyte character. */
4084 int c = RE_CHAR_TO_MULTIBYTE (p[1]); 4084 int c = RE_CHAR_TO_MULTIBYTE (p[1]);
4085 4085
4086 if (! CHAR_BYTE8_P (c)) 4086 fastmap[CHAR_LEADING_CODE (c)] = 1;
4087 fastmap[CHAR_LEADING_CODE (c)] = 1;
4088 } 4087 }
4089 } 4088 }
4090 break; 4089 break;
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 5ba8430eb84..159751c8b46 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -81,6 +81,9 @@ extern unsigned int w32_key_to_modifier (int key);
81static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE]; 81static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE];
82static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue; 82static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue;
83 83
84/* Temporarily store lead byte of DBCS input sequences. */
85static char dbcs_lead = 0;
86
84static int 87static int
85fill_queue (BOOL block) 88fill_queue (BOOL block)
86{ 89{
@@ -253,13 +256,15 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event)
253 keystate, buf, 128, 0); 256 keystate, buf, 128, 0);
254 if (isdead > 0) 257 if (isdead > 0)
255 { 258 {
256 char cp[20]; 259 char cp[20];
257 int cpId; 260 int cpId;
258 261
259 GetLocaleInfo (GetThreadLocale (), 262 event->uChar.UnicodeChar = buf[isdead - 1];
263
264 GetLocaleInfo (GetThreadLocale (),
260 LOCALE_IDEFAULTANSICODEPAGE, cp, 20); 265 LOCALE_IDEFAULTANSICODEPAGE, cp, 20);
261 cpId = atoi (cp); 266 cpId = atoi (cp);
262 isdead = WideCharToMultiByte (cpId, 0, buf, isdead, 267 isdead = WideCharToMultiByte (cpId, 0, buf, isdead,
263 ansi_code, 4, NULL, NULL); 268 ansi_code, 4, NULL, NULL);
264 } 269 }
265 else 270 else
@@ -425,8 +430,6 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
425 430
426 if (lispy_function_keys[event->wVirtualKeyCode] == 0) 431 if (lispy_function_keys[event->wVirtualKeyCode] == 0)
427 { 432 {
428 emacs_ev->kind = ASCII_KEYSTROKE_EVENT;
429
430 if (!NILP (Vw32_recognize_altgr) 433 if (!NILP (Vw32_recognize_altgr)
431 && (event->dwControlKeyState & LEFT_CTRL_PRESSED) 434 && (event->dwControlKeyState & LEFT_CTRL_PRESSED)
432 && (event->dwControlKeyState & RIGHT_ALT_PRESSED)) 435 && (event->dwControlKeyState & RIGHT_ALT_PRESSED))
@@ -461,9 +464,65 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
461 else if (event->uChar.AsciiChar == 0) 464 else if (event->uChar.AsciiChar == 0)
462 w32_kbd_patch_key (event); 465 w32_kbd_patch_key (event);
463 } 466 }
467
464 if (event->uChar.AsciiChar == 0) 468 if (event->uChar.AsciiChar == 0)
465 return 0; 469 {
466 emacs_ev->code = event->uChar.AsciiChar; 470 emacs_ev->kind = NO_EVENT;
471 return 0;
472 }
473 else if (event->uChar.AsciiChar > 0 && event->uChar.AsciiChar < 128)
474 {
475 emacs_ev->kind = ASCII_KEYSTROKE_EVENT;
476 emacs_ev->code = event->uChar.AsciiChar;
477 }
478 else if (event->uChar.UnicodeChar > 0)
479 {
480 emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
481 emacs_ev->code = event->uChar.UnicodeChar;
482 }
483 else
484 {
485 /* Fallback for non-Unicode versions of Windows. */
486 wchar_t code;
487 char dbcs[2];
488 char cp[20];
489 int cpId;
490
491 /* Get the codepage to interpret this key with. */
492 GetLocaleInfo (GetThreadLocale (),
493 LOCALE_IDEFAULTANSICODEPAGE, cp, 20);
494 cpId = atoi (cp);
495
496 dbcs[0] = dbcs_lead;
497 dbcs[1] = event->uChar.AsciiChar;
498 if (dbcs_lead)
499 {
500 dbcs_lead = 0;
501 if (!MultiByteToWideChar (cpId, 0, dbcs, 2, &code, 1))
502 {
503 /* Garbage */
504 DebPrint (("Invalid DBCS sequence: %d %d\n",
505 dbcs[0], dbcs[1]));
506 emacs_ev->kind = NO_EVENT;
507 }
508 }
509 else if (IsDBCSLeadByteEx (cpId, dbcs[1]))
510 {
511 dbcs_lead = dbcs[1];
512 emacs_ev->kind = NO_EVENT;
513 }
514 else
515 {
516 if (!MultiByteToWideChar (cpId, 0, &dbcs[1], 1, &code, 1))
517 {
518 /* Garbage */
519 DebPrint (("Invalid character: %d\n", dbcs[1]));
520 emacs_ev->kind = NO_EVENT;
521 }
522 }
523 emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
524 emacs_ev->code = code;
525 }
467 } 526 }
468 else 527 else
469 { 528 {
diff --git a/src/xfns.c b/src/xfns.c
index 905ed9c576a..0ebce8d1e24 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3145,91 +3145,6 @@ If FRAME is nil, use the selected frame. */)
3145 return Qnil; 3145 return Qnil;
3146} 3146}
3147 3147
3148/* Return current desktop index for the display where frame F is.
3149 If we can't find out the current desktop, return 0. */
3150
3151static int
3152x_get_current_desktop (f)
3153 struct frame *f;
3154{
3155 Atom actual_type;
3156 unsigned long actual_size, bytes_remaining;
3157 int rc, actual_format;
3158 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
3159 long max_len = 10;
3160 Display *dpy = FRAME_X_DISPLAY (f);
3161 long *data = NULL;
3162 int current_desktop;
3163
3164 BLOCK_INPUT;
3165 x_catch_errors (dpy);
3166 rc = XGetWindowProperty (dpy, dpyinfo->root_window,
3167 XInternAtom (dpy, "_NET_CURRENT_DESKTOP", False),
3168 0, max_len, False, XA_CARDINAL,
3169 &actual_type, &actual_format, &actual_size,
3170 &bytes_remaining, (unsigned char **)&data);
3171
3172 if (rc != Success || actual_type != XA_CARDINAL || x_had_errors_p (dpy)
3173 || actual_size == 0 || actual_format != 32)
3174 current_desktop = 0;
3175 else
3176 current_desktop = (int)*data;
3177
3178 if (data) XFree (data);
3179 x_uncatch_errors ();
3180 UNBLOCK_INPUT;
3181 return current_desktop;
3182}
3183
3184/* Return current size for DESKTOP_INDEX on the display where frame F is.
3185 If we can't find out the size, return 0, otherwise 1. */
3186
3187static int
3188x_get_desktop_workarea (f, desktop_index, deskw, deskh)
3189 struct frame *f;
3190 int desktop_index;
3191 int *deskw, *deskh;
3192{
3193 Atom actual_type;
3194 unsigned long actual_size, bytes_remaining;
3195 int rc, actual_format;
3196 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
3197 long max_len = 1000; /* This handles 250 desktops, who has that many? */
3198 Display *dpy = FRAME_X_DISPLAY (f);
3199 long *data = NULL;
3200 int retval;
3201
3202 BLOCK_INPUT;
3203 x_catch_errors (dpy);
3204 rc = XGetWindowProperty (dpy, dpyinfo->root_window,
3205 XInternAtom (dpy, "_NET_WORKAREA", False),
3206 0, max_len, False, XA_CARDINAL,
3207 &actual_type, &actual_format, &actual_size,
3208 &bytes_remaining, (unsigned char **)&data);
3209
3210 if (rc != Success || actual_type != XA_CARDINAL || x_had_errors_p (dpy)
3211 || actual_size < 3 || actual_format != 32)
3212 retval = 0;
3213 else
3214 {
3215 int idx;
3216
3217 if (actual_size == 4 /* Only one info for all desktops. */
3218 || desktop_index*4 > actual_size) /* destop_index out of range. */
3219 desktop_index = 0;
3220
3221 idx = desktop_index*4;
3222 *deskw = data[idx+2] - data[idx];
3223 *deskh = data[idx+3] - data[idx+1];
3224 retval = 1;
3225 }
3226
3227 if (data) XFree (data);
3228 x_uncatch_errors ();
3229 UNBLOCK_INPUT;
3230 return retval;
3231}
3232
3233DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 3148DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
3234 1, 1, 0, 3149 1, 1, 0,
3235 doc: /* Make a new X window, which is called a "frame" in Emacs terms. 3150 doc: /* Make a new X window, which is called a "frame" in Emacs terms.
@@ -3249,7 +3164,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3249 Lisp_Object name; 3164 Lisp_Object name;
3250 int minibuffer_only = 0; 3165 int minibuffer_only = 0;
3251 long window_prompting = 0; 3166 long window_prompting = 0;
3252 int width, height, deskw = -1, deskh = -1, current_desktop = -1; 3167 int width, height;
3253 int count = SPECPDL_INDEX (); 3168 int count = SPECPDL_INDEX ();
3254 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 3169 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
3255 Lisp_Object display; 3170 Lisp_Object display;
@@ -3517,66 +3432,6 @@ This function is an internal primitive--use `make-frame' instead. */)
3517 /* Compute the size of the X window. */ 3432 /* Compute the size of the X window. */
3518 window_prompting = x_figure_window_size (f, parms, 1); 3433 window_prompting = x_figure_window_size (f, parms, 1);
3519 3434
3520 /* Don't make height higher than display height unless the user asked
3521 for it. Try sizes 24 and 10 if current is too large. */
3522 height = FRAME_LINES (f);
3523 tem = x_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER);
3524 if (EQ (tem, Qunbound))
3525 {
3526 int h = FRAME_LINES (f) + FRAME_TOOL_BAR_LINES (f)
3527 + FRAME_MENU_BAR_LINES (f) + 2;
3528 int ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, h);
3529 int dph = DisplayHeight (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f));
3530 static int tryheight[] = { 24, 10, 0 } ;
3531 int i;
3532
3533 ph += (FRAME_EXTERNAL_TOOL_BAR (f) ? 32 : 0) /* Gtk toolbar size */
3534 + (FRAME_EXTERNAL_MENU_BAR (f) ? 24 : 0); /* Arbitrary */
3535
3536 /* Some desktops have fixed menus above and/or panels below. Try to
3537 figure out the usable size we have for emacs. */
3538 current_desktop = x_get_current_desktop (f);
3539 x_get_desktop_workarea (f, current_desktop, &deskw, &deskh);
3540 if (deskh > 0 && deskh < dph) dph = deskh;
3541
3542 /* Allow 40 pixels for manager decorations. */
3543 for (i = 0; ph+40 > dph && tryheight[i] != 0; ++i)
3544 {
3545 height = tryheight[i];
3546 h = height + FRAME_TOOL_BAR_LINES (f) + FRAME_MENU_BAR_LINES (f) + 2;
3547 ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, h)
3548 + (FRAME_EXTERNAL_TOOL_BAR (f) ? 32 : 0)
3549 + (FRAME_EXTERNAL_MENU_BAR (f) ? 24 : 0);
3550 }
3551 }
3552
3553 /* Don't make width wider than display width unless the user asked
3554 for it. */
3555 width = FRAME_COLS (f);
3556 tem = x_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER);
3557 if (EQ (tem, Qunbound))
3558 {
3559 int pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, FRAME_COLS (f));
3560 int dpw = DisplayWidth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f));
3561 if (deskw == -1)
3562 {
3563 current_desktop = x_get_current_desktop (f);
3564 x_get_desktop_workarea (f, current_desktop, &deskw, &deskh);
3565 }
3566 if (deskw > 0 && deskw < dpw) dpw = deskw;
3567
3568 if (pw > dpw)
3569 width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, dpw);
3570 }
3571
3572 if (height != FRAME_LINES (f) || width != FRAME_COLS (f))
3573 {
3574 check_frame_size (f, &height, &width);
3575 FRAME_LINES (f) = height;
3576 SET_FRAME_COLS (f, width);
3577 }
3578
3579
3580 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); 3435 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
3581 f->no_split = minibuffer_only || EQ (tem, Qt); 3436 f->no_split = minibuffer_only || EQ (tem, Qt);
3582 3437