aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2006-02-20 16:30:15 +0000
committerKaroly Lorentey2006-02-20 16:30:15 +0000
commitf2aa3ae43bd451a6566f83ac5119b168d40891bc (patch)
treedaa6020fddc659be56fdc54646c2d97d7d3571f8 /src
parent322c30faa92c5ba2accc1027893a7cc24abbde72 (diff)
parent58f7100978e6647a6655a008554daf2d1bab3665 (diff)
downloademacs-f2aa3ae43bd451a6566f83ac5119b168d40891bc.tar.gz
emacs-f2aa3ae43bd451a6566f83ac5119b168d40891bc.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-91 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-92 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-93 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-94 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-95 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-96 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-97 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-98 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-99 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-100 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-101 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-102 Merge from erc--emacs--0 * emacs@sv.gnu.org/emacs--devo--0--patch-103 Update from CVS: src/regex.c (extend_range_table_work_area): Fix typo. * emacs@sv.gnu.org/emacs--devo--0--patch-104 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-30 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-31 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-32 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-33 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-34 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-35 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-36 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-514
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog63
-rw-r--r--src/alloc.c2
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/macmenu.c243
-rw-r--r--src/regex.c20
-rw-r--r--src/vm-limit.c19
-rw-r--r--src/window.c10
-rw-r--r--src/xdisp.c22
-rw-r--r--src/xmenu.c5
-rw-r--r--src/xterm.c2
10 files changed, 235 insertions, 153 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 18dcc803efa..f2a6e1e2752 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,66 @@
12006-02-19 Luc Teirlinck <teirllm@auburn.edu>
2
3 * regex.c (extend_range_table_work_area): Fix typo.
4
52006-02-19 Richard M. Stallman <rms@gnu.org>
6
7 * xterm.c (x_catch_errors): Use xmalloc.
8
9 * regex.c (extend_range_table_work_area): Call xmalloc and xrealloc.
10 (regex_compile): Likewise.
11 (regcomp): Use xmalloc.
12
13 * gtkutil.c (malloc_widget_value): Use xmalloc.
14
15 * vm-limit.c [HAVE_GETRLIMIT]: Include sys/resource.h.
16 (check_memory_limits) [HAVE_GETRLIMIT]: Use getrlimit.
17
18 * xmenu.c (digest_single_submenu): When pane_string is empty,
19 do initialize save_wv.
20
212006-02-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
22
23 * xdisp.c (update_menu_bar) [MAC_OS]: Don't set
24 w->update_mode_line if arg F is not the selected frame.
25
26 * macmenu.c (popup_activated_flag, submenu_id)
27 (next_menubar_widget_id): Remove variables.
28 (initialize_frame_menubar): Remove function.
29 (pop_down_menu, mac_menu_show): Simplify save value.
30 (dispose_menus): New function.
31 (pop_down_menu, fill_menubar): Use it.
32 (fill_submenu): Remove function. All uses changed to fill_menu.
33 (add_menu_item): Remove args SUBMENU and FORCE_DISABLE. New arg
34 POS. Don't call SetMenuItemHierarchicalID here.
35 (fill_menu): Add arg SUBMENU_ID. Return submenu_id that is to be
36 used next. Call SetMenuItemHierarchicalID here.
37 (fill_menubar): Add arg DEEP_P. All uses changed. Clean up menu
38 objects if needed. Reuse existing menu bar titles if possible.
39 (set_frame_menubar): Don't clean up menu objects here.
40
412006-02-18 Chong Yidong <cyd@stupidchicken.com>
42
43 * window.c (window_min_size_1): Ensure room for the scroll bar and
44 fringes.
45
462006-02-17 Romain Francoise <romain@orebokech.com>
47
48 * puresize.h (BASE_PURESIZE): Increment to 1200000.
49
502006-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
51
52 * alloc.c (Fmake_symbol): Comment-out left-over assert from before the
53 addition of the BLOCK_INPUTs.
54
552006-02-17 Juanma Barranquero <lekktu@gmail.com>
56
57 * window.c (Fset_window_scroll_bars): Doc fix.
58
592006-02-17 Kenichi Handa <handa@m17n.org>
60
61 * xdisp.c (display_mode_element): Call display_string with correct
62 PREC arg (which must be a number of characters, not column width).
63
12006-02-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 642006-02-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 65
3 * frame.c (x_get_arg): Clear out PARAM in ALIST also on Mac. 66 * frame.c (x_get_arg): Clear out PARAM in ALIST also on Mac.
diff --git a/src/alloc.c b/src/alloc.c
index 27fe3f86961..74c3c66173a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3211,7 +3211,7 @@ Its value and function definition are void, and its property list is nil. */)
3211 3211
3212 CHECK_STRING (name); 3212 CHECK_STRING (name);
3213 3213
3214 eassert (!handling_signal); 3214 /* eassert (!handling_signal); */
3215 3215
3216#ifndef SYNC_INPUT 3216#ifndef SYNC_INPUT
3217 BLOCK_INPUT; 3217 BLOCK_INPUT;
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 5b7a5166888..203eab257f3 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -199,7 +199,7 @@ malloc_widget_value ()
199 } 199 }
200 else 200 else
201 { 201 {
202 wv = (widget_value *) malloc (sizeof (widget_value)); 202 wv = (widget_value *) xmalloc (sizeof (widget_value));
203 malloc_cpt++; 203 malloc_cpt++;
204 } 204 }
205 memset (wv, 0, sizeof (widget_value)); 205 memset (wv, 0, sizeof (widget_value));
diff --git a/src/macmenu.c b/src/macmenu.c
index bd4ad6291cf..fccbbe6402c 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -189,8 +189,9 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
189static void list_of_panes P_ ((Lisp_Object)); 189static void list_of_panes P_ ((Lisp_Object));
190static void list_of_items P_ ((Lisp_Object)); 190static void list_of_items P_ ((Lisp_Object));
191 191
192static void fill_submenu (MenuHandle, widget_value *); 192static int fill_menu P_ ((MenuHandle, widget_value *, int));
193static void fill_menubar (widget_value *); 193static void fill_menubar P_ ((widget_value *, int));
194static void dispose_menus P_ ((int));
194 195
195 196
196/* This holds a Lisp vector that holds the results of decoding 197/* This holds a Lisp vector that holds the results of decoding
@@ -247,15 +248,6 @@ static int menu_items_n_panes;
247/* Current depth within submenus. */ 248/* Current depth within submenus. */
248static int menu_items_submenu_depth; 249static int menu_items_submenu_depth;
249 250
250/* Flag which when set indicates a dialog or menu has been posted by
251 Xt on behalf of one of the widget sets. */
252static int popup_activated_flag;
253
254/* Index of the next submenu */
255static int submenu_id;
256
257static int next_menubar_widget_id;
258
259/* This is set nonzero after the user activates the menu bar, and set 251/* This is set nonzero after the user activates the menu bar, and set
260 to zero again after the menu bars are redisplayed by prepare_menu_bar. 252 to zero again after the menu bars are redisplayed by prepare_menu_bar.
261 While it is nonzero, all calls to set_frame_menubar go deep. 253 While it is nonzero, all calls to set_frame_menubar go deep.
@@ -1440,7 +1432,7 @@ install_menu_quit_handler (MenuHandle menu_handle)
1440 menu = GetMenuHandle (++i); 1432 menu = GetMenuHandle (++i);
1441 } 1433 }
1442 1434
1443 i = menu_handle ? MIN_POPUP_SUBMENU_ID : MIN_SUBMENU_ID; 1435 i = menu_handle ? MIN_POPUP_SUBMENU_ID : MIN_SUBMENU_ID;
1444 menu = GetMenuHandle (i); 1436 menu = GetMenuHandle (i);
1445 while (menu != NULL) 1437 while (menu != NULL)
1446 { 1438 {
@@ -1679,27 +1671,7 @@ set_frame_menubar (f, first_time, deep_p)
1679 /* Non-null value to indicate menubar has already been "created". */ 1671 /* Non-null value to indicate menubar has already been "created". */
1680 f->output_data.mac->menubar_widget = 1; 1672 f->output_data.mac->menubar_widget = 1;
1681 1673
1682 { 1674 fill_menubar (first_wv->contents, deep_p);
1683 int i = MIN_MENU_ID;
1684 MenuHandle menu = GetMenuHandle (i);
1685 while (menu != NULL)
1686 {
1687 DeleteMenu (i);
1688 DisposeMenu (menu);
1689 menu = GetMenuHandle (++i);
1690 }
1691
1692 i = MIN_SUBMENU_ID;
1693 menu = GetMenuHandle (i);
1694 while (menu != NULL)
1695 {
1696 DeleteMenu (i);
1697 DisposeMenu (menu);
1698 menu = GetMenuHandle (++i);
1699 }
1700 }
1701
1702 fill_menubar (first_wv->contents);
1703 1675
1704 /* Add event handler so we can detect C-g. */ 1676 /* Add event handler so we can detect C-g. */
1705 install_menu_quit_handler (NULL); 1677 install_menu_quit_handler (NULL);
@@ -1708,22 +1680,6 @@ set_frame_menubar (f, first_time, deep_p)
1708 UNBLOCK_INPUT; 1680 UNBLOCK_INPUT;
1709} 1681}
1710 1682
1711/* Called from Fx_create_frame to create the initial menubar of a frame
1712 before it is mapped, so that the window is mapped with the menubar already
1713 there instead of us tacking it on later and thrashing the window after it
1714 is visible. */
1715
1716void
1717initialize_frame_menubar (f)
1718 FRAME_PTR f;
1719{
1720 /* This function is called before the first chance to redisplay
1721 the frame. It has to be, so the frame will have the right size. */
1722 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
1723 set_frame_menubar (f, 1, 1);
1724}
1725
1726
1727/* Get rid of the menu bar of frame F, and free its storage. 1683/* Get rid of the menu bar of frame F, and free its storage.
1728 This is used when deleting a frame, and when turning off the menu bar. */ 1684 This is used when deleting a frame, and when turning off the menu bar. */
1729 1685
@@ -1739,11 +1695,9 @@ static Lisp_Object
1739pop_down_menu (arg) 1695pop_down_menu (arg)
1740 Lisp_Object arg; 1696 Lisp_Object arg;
1741{ 1697{
1742 struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg)); 1698 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1743 struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg)); 1699 FRAME_PTR f = p->pointer;
1744 1700 MenuHandle menu = GetMenuHandle (POPUP_SUBMENU_ID);
1745 FRAME_PTR f = p1->pointer;
1746 MenuHandle *menu = p2->pointer;
1747 1701
1748 BLOCK_INPUT; 1702 BLOCK_INPUT;
1749 1703
@@ -1752,19 +1706,9 @@ pop_down_menu (arg)
1752 FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0; 1706 FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0;
1753 1707
1754 /* delete all menus */ 1708 /* delete all menus */
1755 { 1709 dispose_menus (MIN_POPUP_SUBMENU_ID);
1756 int i = MIN_POPUP_SUBMENU_ID;
1757 MenuHandle submenu = GetMenuHandle (i);
1758 while (submenu != NULL)
1759 {
1760 DeleteMenu (i);
1761 DisposeMenu (submenu);
1762 submenu = GetMenuHandle (++i);
1763 }
1764 }
1765
1766 DeleteMenu (POPUP_SUBMENU_ID); 1710 DeleteMenu (POPUP_SUBMENU_ID);
1767 DisposeMenu (*menu); 1711 DisposeMenu (menu);
1768 1712
1769 UNBLOCK_INPUT; 1713 UNBLOCK_INPUT;
1770 1714
@@ -1998,8 +1942,8 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1998 1942
1999 /* Actually create the menu. */ 1943 /* Actually create the menu. */
2000 menu = NewMenu (POPUP_SUBMENU_ID, "\p"); 1944 menu = NewMenu (POPUP_SUBMENU_ID, "\p");
2001 submenu_id = MIN_POPUP_SUBMENU_ID; 1945 InsertMenu (menu, -1);
2002 fill_submenu (menu, first_wv->contents); 1946 fill_menu (menu, first_wv->contents, MIN_POPUP_SUBMENU_ID);
2003 1947
2004 /* Free the widget_value objects we used to specify the 1948 /* Free the widget_value objects we used to specify the
2005 contents. */ 1949 contents. */
@@ -2016,11 +1960,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
2016 menu_item_choice = 0; 1960 menu_item_choice = 0;
2017 menu_item_selection = 0; 1961 menu_item_selection = 0;
2018 1962
2019 InsertMenu (menu, -1); 1963 record_unwind_protect (pop_down_menu, make_save_value (f, 0));
2020
2021 record_unwind_protect (pop_down_menu,
2022 Fcons (make_save_value (f, 0),
2023 make_save_value (&menu, 0)));
2024 1964
2025 /* Add event handler so we can detect C-g. */ 1965 /* Add event handler so we can detect C-g. */
2026 install_menu_quit_handler (menu); 1966 install_menu_quit_handler (menu);
@@ -2421,15 +2361,16 @@ name_is_separator (name)
2421} 2361}
2422 2362
2423static void 2363static void
2424add_menu_item (MenuHandle menu, widget_value *wv, int submenu, 2364add_menu_item (menu, pos, wv)
2425 int force_disable) 2365 MenuHandle menu;
2366 int pos;
2367 widget_value *wv;
2426{ 2368{
2427#if TARGET_API_MAC_CARBON 2369#if TARGET_API_MAC_CARBON
2428 CFStringRef item_name; 2370 CFStringRef item_name;
2429#else 2371#else
2430 Str255 item_name; 2372 Str255 item_name;
2431#endif 2373#endif
2432 int pos;
2433 2374
2434 if (name_is_separator (wv->name)) 2375 if (name_is_separator (wv->name))
2435 AppendMenu (menu, "\p-"); 2376 AppendMenu (menu, "\p-");
@@ -2438,8 +2379,6 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu,
2438 AppendMenu (menu, "\pX"); 2379 AppendMenu (menu, "\pX");
2439 2380
2440#if TARGET_API_MAC_CARBON 2381#if TARGET_API_MAC_CARBON
2441 pos = CountMenuItems (menu);
2442
2443 item_name = cfstring_create_with_utf8_cstring (wv->name); 2382 item_name = cfstring_create_with_utf8_cstring (wv->name);
2444 2383
2445 if (wv->key != NULL) 2384 if (wv->key != NULL)
@@ -2457,13 +2396,11 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu,
2457 SetMenuItemTextWithCFString (menu, pos, item_name); 2396 SetMenuItemTextWithCFString (menu, pos, item_name);
2458 CFRelease (item_name); 2397 CFRelease (item_name);
2459 2398
2460 if (wv->enabled && !force_disable) 2399 if (wv->enabled)
2461 EnableMenuItem (menu, pos); 2400 EnableMenuItem (menu, pos);
2462 else 2401 else
2463 DisableMenuItem (menu, pos); 2402 DisableMenuItem (menu, pos);
2464#else /* ! TARGET_API_MAC_CARBON */ 2403#else /* ! TARGET_API_MAC_CARBON */
2465 pos = CountMItems (menu);
2466
2467 item_name[sizeof (item_name) - 1] = '\0'; 2404 item_name[sizeof (item_name) - 1] = '\0';
2468 strncpy (item_name, wv->name, sizeof (item_name) - 1); 2405 strncpy (item_name, wv->name, sizeof (item_name) - 1);
2469 if (wv->key != NULL) 2406 if (wv->key != NULL)
@@ -2477,88 +2414,140 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu,
2477 c2pstr (item_name); 2414 c2pstr (item_name);
2478 SetMenuItemText (menu, pos, item_name); 2415 SetMenuItemText (menu, pos, item_name);
2479 2416
2480 if (wv->enabled && !force_disable) 2417 if (wv->enabled)
2481 EnableItem (menu, pos); 2418 EnableItem (menu, pos);
2482 else 2419 else
2483 DisableItem (menu, pos); 2420 DisableItem (menu, pos);
2484#endif /* ! TARGET_API_MAC_CARBON */ 2421#endif /* ! TARGET_API_MAC_CARBON */
2485 2422
2486 /* Draw radio buttons and tickboxes. */ 2423 /* Draw radio buttons and tickboxes. */
2487 {
2488 if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || 2424 if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE ||
2489 wv->button_type == BUTTON_TYPE_RADIO)) 2425 wv->button_type == BUTTON_TYPE_RADIO))
2490 SetItemMark (menu, pos, checkMark); 2426 SetItemMark (menu, pos, checkMark);
2491 else 2427 else
2492 SetItemMark (menu, pos, noMark); 2428 SetItemMark (menu, pos, noMark);
2493 }
2494 2429
2495 SetMenuItemRefCon (menu, pos, (UInt32) wv->call_data); 2430 SetMenuItemRefCon (menu, pos, (UInt32) wv->call_data);
2496 } 2431 }
2497
2498 if (submenu != 0)
2499 SetMenuItemHierarchicalID (menu, pos, submenu);
2500} 2432}
2501 2433
2502/* Construct native Mac OS menubar based on widget_value tree. */ 2434/* Construct native Mac OS menu based on widget_value tree. */
2503 2435
2504static void 2436static int
2505fill_submenu (MenuHandle menu, widget_value *wv) 2437fill_menu (menu, wv, submenu_id)
2438 MenuHandle menu;
2439 widget_value *wv;
2440 int submenu_id;
2506{ 2441{
2507 for ( ; wv != NULL; wv = wv->next) 2442 int pos;
2508 if (wv->contents)
2509 {
2510 int cur_submenu = submenu_id++;
2511 MenuHandle submenu = NewMenu (cur_submenu, "\pX");
2512 fill_submenu (submenu, wv->contents);
2513 InsertMenu (submenu, -1);
2514 add_menu_item (menu, wv, cur_submenu, 0);
2515 }
2516 else
2517 add_menu_item (menu, wv, 0, 0);
2518}
2519 2443
2444 for (pos = 1; wv != NULL; wv = wv->next, pos++)
2445 {
2446 add_menu_item (menu, pos, wv);
2447 if (wv->contents)
2448 {
2449 MenuHandle submenu = NewMenu (submenu_id, "\pX");
2520 2450
2521/* Construct native Mac OS menu based on widget_value tree. */ 2451 InsertMenu (submenu, -1);
2452 SetMenuItemHierarchicalID (menu, pos, submenu_id);
2453 submenu_id = fill_menu (submenu, wv->contents, submenu_id + 1);
2454 }
2455 }
2522 2456
2523static void 2457 return submenu_id;
2524fill_menu (MenuHandle menu, widget_value *wv)
2525{
2526 for ( ; wv != NULL; wv = wv->next)
2527 if (wv->contents)
2528 {
2529 int cur_submenu = submenu_id++;
2530 MenuHandle submenu = NewMenu (cur_submenu, "\pX");
2531 fill_submenu (submenu, wv->contents);
2532 InsertMenu (submenu, -1);
2533 add_menu_item (menu, wv, cur_submenu, 0);
2534 }
2535 else
2536 add_menu_item (menu, wv, 0, 0);
2537} 2458}
2538 2459
2539/* Construct native Mac OS menubar based on widget_value tree. */ 2460/* Construct native Mac OS menubar based on widget_value tree. */
2540 2461
2541static void 2462static void
2542fill_menubar (widget_value *wv) 2463fill_menubar (wv, deep_p)
2464 widget_value *wv;
2465 int deep_p;
2543{ 2466{
2544 int id; 2467 int id, submenu_id;
2468 MenuHandle menu;
2469 Str255 title;
2470#if !TARGET_API_MAC_CARBON
2471 int title_changed_p = 0;
2472#endif
2545 2473
2546 submenu_id = MIN_SUBMENU_ID; 2474 /* Clean up the menu bar when filled by the entire menu trees. */
2475 if (deep_p)
2476 {
2477 dispose_menus (MIN_MENU_ID);
2478 dispose_menus (MIN_SUBMENU_ID);
2479#if !TARGET_API_MAC_CARBON
2480 title_changed_p = 1;
2481#endif
2482 }
2547 2483
2484 /* Fill menu bar titles and submenus. Reuse the existing menu bar
2485 titles as much as possible to minimize redraw (if !deep_p). */
2486 submenu_id = MIN_SUBMENU_ID;
2548 for (id = MIN_MENU_ID; wv != NULL; wv = wv->next, id++) 2487 for (id = MIN_MENU_ID; wv != NULL; wv = wv->next, id++)
2549 { 2488 {
2550 MenuHandle menu;
2551 Str255 title;
2552
2553 strncpy (title, wv->name, 255); 2489 strncpy (title, wv->name, 255);
2554 title[255] = 0; 2490 title[255] = '\0';
2555 c2pstr (title); 2491 c2pstr (title);
2556 menu = NewMenu (id, title); 2492
2493 menu = GetMenuHandle (id);
2494 if (menu)
2495 {
2496#if TARGET_API_MAC_CARBON
2497 Str255 old_title;
2498
2499 GetMenuTitle (menu, old_title);
2500 if (!EqualString (title, old_title, false, false))
2501 SetMenuTitle (menu, title);
2502#else /* !TARGET_API_MAC_CARBON */
2503 if (!EqualString (title, (*menu)->menuData, false, false))
2504 {
2505 DeleteMenu (id);
2506 DisposeMenu (menu);
2507 menu = NewMenu (id, title);
2508 InsertMenu (menu, GetMenuHandle (id + 1) ? id + 1 : 0);
2509 title_changed_p = 1;
2510 }
2511#endif /* !TARGET_API_MAC_CARBON */
2512 }
2513 else
2514 {
2515 menu = NewMenu (id, title);
2516 InsertMenu (menu, 0);
2517#if !TARGET_API_MAC_CARBON
2518 title_changed_p = 1;
2519#endif
2520 }
2557 2521
2558 if (wv->contents) 2522 if (wv->contents)
2559 fill_menu (menu, wv->contents); 2523 submenu_id = fill_menu (menu, wv->contents, submenu_id);
2524 }
2560 2525
2561 InsertMenu (menu, 0); 2526 if (GetMenuHandle (id))
2527 {
2528 dispose_menus (id);
2529#if !TARGET_API_MAC_CARBON
2530 title_changed_p = 1;
2531#endif
2532 }
2533
2534#if !TARGET_API_MAC_CARBON
2535 if (title_changed_p)
2536 InvalMenuBar ();
2537#endif
2538}
2539
2540static void
2541dispose_menus (id)
2542 int id;
2543{
2544 MenuHandle menu;
2545
2546 while ((menu = GetMenuHandle (id)) != NULL)
2547 {
2548 DeleteMenu (id);
2549 DisposeMenu (menu);
2550 id++;
2562 } 2551 }
2563} 2552}
2564 2553
diff --git a/src/regex.c b/src/regex.c
index 60231826380..c08471355fd 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2067,10 +2067,10 @@ extend_range_table_work_area (work_area)
2067 work_area->allocated += 16 * sizeof (int); 2067 work_area->allocated += 16 * sizeof (int);
2068 if (work_area->table) 2068 if (work_area->table)
2069 work_area->table 2069 work_area->table
2070 = (int *) realloc (work_area->table, work_area->allocated); 2070 = (int *) xrealloc (work_area->table, work_area->allocated);
2071 else 2071 else
2072 work_area->table 2072 work_area->table
2073 = (int *) malloc (work_area->allocated); 2073 = (int *) xmalloc (work_area->allocated);
2074} 2074}
2075 2075
2076#ifdef emacs 2076#ifdef emacs
@@ -3608,13 +3608,13 @@ regex_compile (pattern, size, syntax, bufp)
3608 3608
3609 if (! fail_stack.stack) 3609 if (! fail_stack.stack)
3610 fail_stack.stack 3610 fail_stack.stack
3611 = (fail_stack_elt_t *) malloc (fail_stack.size 3611 = (fail_stack_elt_t *) xmalloc (fail_stack.size
3612 * sizeof (fail_stack_elt_t)); 3612 * sizeof (fail_stack_elt_t));
3613 else 3613 else
3614 fail_stack.stack 3614 fail_stack.stack
3615 = (fail_stack_elt_t *) realloc (fail_stack.stack, 3615 = (fail_stack_elt_t *) xrealloc (fail_stack.stack,
3616 (fail_stack.size 3616 (fail_stack.size
3617 * sizeof (fail_stack_elt_t))); 3617 * sizeof (fail_stack_elt_t)));
3618 } 3618 }
3619 3619
3620 regex_grow_registers (num_regs); 3620 regex_grow_registers (num_regs);
@@ -6292,15 +6292,15 @@ regcomp (preg, pattern, cflags)
6292 preg->used = 0; 6292 preg->used = 0;
6293 6293
6294 /* Try to allocate space for the fastmap. */ 6294 /* Try to allocate space for the fastmap. */
6295 preg->fastmap = (char *) malloc (1 << BYTEWIDTH); 6295 preg->fastmap = (char *) xmalloc (1 << BYTEWIDTH);
6296 6296
6297 if (cflags & REG_ICASE) 6297 if (cflags & REG_ICASE)
6298 { 6298 {
6299 unsigned i; 6299 unsigned i;
6300 6300
6301 preg->translate 6301 preg->translate
6302 = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE 6302 = (RE_TRANSLATE_TYPE) xmalloc (CHAR_SET_SIZE
6303 * sizeof (*(RE_TRANSLATE_TYPE)0)); 6303 * sizeof (*(RE_TRANSLATE_TYPE)0));
6304 if (preg->translate == NULL) 6304 if (preg->translate == NULL)
6305 return (int) REG_ESPACE; 6305 return (int) REG_ESPACE;
6306 6306
diff --git a/src/vm-limit.c b/src/vm-limit.c
index fb127b27b74..48d13c323ae 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -33,6 +33,10 @@ typedef void *POINTER;
33 33
34#include "mem-limits.h" 34#include "mem-limits.h"
35 35
36#ifdef HAVE_GETRLIMIT
37#include <sys/resource.h>
38#endif
39
36/* 40/*
37 Level number of warnings already issued. 41 Level number of warnings already issued.
38 0 -- no warnings issued. 42 0 -- no warnings issued.
@@ -61,6 +65,19 @@ check_memory_limits ()
61 unsigned long five_percent; 65 unsigned long five_percent;
62 unsigned long data_size; 66 unsigned long data_size;
63 67
68#ifdef HAVE_GETRLIMIT
69 struct rlimit {
70 rlim_t rlim_cur;
71 rlim_t rlim_max;
72 } rlimit;
73
74 getrlimit (RLIMIT_DATA, &rlimit);
75
76 five_percent = rlimit.rlim_max / 20;
77 data_size = rlimit.rlim_cur;
78
79#else /* not HAVE_GETRLIMIT */
80
64 if (lim_data == 0) 81 if (lim_data == 0)
65 get_lim_data (); 82 get_lim_data ();
66 five_percent = lim_data / 20; 83 five_percent = lim_data / 20;
@@ -74,6 +91,8 @@ check_memory_limits ()
74 cp = (char *) (*__morecore) (0); 91 cp = (char *) (*__morecore) (0);
75 data_size = (char *) cp - (char *) data_space_start; 92 data_size = (char *) cp - (char *) data_space_start;
76 93
94#endif /* not HAVE_GETRLIMIT */
95
77 if (warn_function) 96 if (warn_function)
78 switch (warnlevel) 97 switch (warnlevel)
79 { 98 {
diff --git a/src/window.c b/src/window.c
index 58ab3ee14a0..350b4753491 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2570,7 +2570,10 @@ window_min_size_1 (w, width_p)
2570 else 2570 else
2571 { 2571 {
2572 if (width_p) 2572 if (width_p)
2573 size = window_min_width; 2573 size = max (window_min_width,
2574 (MIN_SAFE_WINDOW_WIDTH
2575 + WINDOW_FRINGE_COLS (w)
2576 + WINDOW_SCROLL_BAR_COLS (w)));
2574 else 2577 else
2575 { 2578 {
2576 if (MINI_WINDOW_P (w) 2579 if (MINI_WINDOW_P (w)
@@ -4288,7 +4291,7 @@ adjust_window_trailing_edge (window, delta, horiz_flag)
4288 { 4291 {
4289 /* This may happen for the minibuffer. In that case 4292 /* This may happen for the minibuffer. In that case
4290 the window_deletion_count check below does not work. */ 4293 the window_deletion_count check below does not work. */
4291 if (XINT (CURSIZE (p->next)) - delta <= 0) 4294 if (XINT (CURSIZE (p->next)) - delta <= 0)
4292 { 4295 {
4293 Fset_window_configuration (old_config); 4296 Fset_window_configuration (old_config);
4294 error ("Cannot adjust window size as specified"); 4297 error ("Cannot adjust window size as specified");
@@ -6602,7 +6605,8 @@ this is automatically adjusted to a multiple of the frame column width.
6602Third parameter VERTICAL-TYPE specifies the type of the vertical scroll 6605Third parameter VERTICAL-TYPE specifies the type of the vertical scroll
6603bar: left, right, or nil. 6606bar: left, right, or nil.
6604If WIDTH is nil, use the frame's scroll-bar width. 6607If WIDTH is nil, use the frame's scroll-bar width.
6605If TYPE is t, use the frame's scroll-bar type. */) 6608If VERTICAL-TYPE is t, use the frame's scroll-bar type.
6609Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6606 (window, width, vertical_type, horizontal_type) 6610 (window, width, vertical_type, horizontal_type)
6607 Lisp_Object window, width, vertical_type, horizontal_type; 6611 Lisp_Object window, width, vertical_type, horizontal_type;
6608{ 6612{
diff --git a/src/xdisp.c b/src/xdisp.c
index 9efa1c60cbc..1361607010a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9057,14 +9057,15 @@ update_menu_bar (f, save_match_data)
9057 /* Redisplay the menu bar in case we changed it. */ 9057 /* Redisplay the menu bar in case we changed it. */
9058#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ 9058#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \
9059 || defined (USE_GTK) 9059 || defined (USE_GTK)
9060 if (FRAME_WINDOW_P (f) 9060 if (FRAME_WINDOW_P (f))
9061#if defined (MAC_OS) 9061 {
9062 /* All frames on Mac OS share the same menubar. So only the 9062#ifdef MAC_OS
9063 selected frame should be allowed to set it. */ 9063 /* All frames on Mac OS share the same menubar. So only
9064 && f == SELECTED_FRAME () 9064 the selected frame should be allowed to set it. */
9065 if (f == SELECTED_FRAME ())
9065#endif 9066#endif
9066 ) 9067 set_frame_menubar (f, 0, 0);
9067 set_frame_menubar (f, 0, 0); 9068 }
9068 else 9069 else
9069 /* On a terminal screen, the menu bar is an ordinary screen 9070 /* On a terminal screen, the menu bar is an ordinary screen
9070 line, and this makes it get updated. */ 9071 line, and this makes it get updated. */
@@ -16492,8 +16493,11 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
16492 { 16493 {
16493 int bytepos = last_offset; 16494 int bytepos = last_offset;
16494 int charpos = string_byte_to_char (elt, bytepos); 16495 int charpos = string_byte_to_char (elt, bytepos);
16496
16497 if (precision <= 0)
16498 nchars = string_byte_to_char (elt, offset) - charpos;
16495 n += display_string (NULL, elt, Qnil, 0, charpos, 16499 n += display_string (NULL, elt, Qnil, 0, charpos,
16496 it, 0, prec, 0, 16500 it, 0, nchars, 0,
16497 STRING_MULTIBYTE (elt)); 16501 STRING_MULTIBYTE (elt));
16498 } 16502 }
16499 break; 16503 break;
@@ -17742,7 +17746,7 @@ display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr)
17742 display them, and < 0 means obey the current buffer's value of 17746 display them, and < 0 means obey the current buffer's value of
17743 enable_multibyte_characters. 17747 enable_multibyte_characters.
17744 17748
17745 Value is the number of glyphs produced. */ 17749 Value is the number of columns displayed. */
17746 17750
17747static int 17751static int
17748display_string (string, lisp_string, face_string, face_string_pos, 17752display_string (string, lisp_string, face_string, face_string_pos,
diff --git a/src/xmenu.c b/src/xmenu.c
index ddb93aa8c77..3c8c6d81a37 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1819,8 +1819,11 @@ digest_single_submenu (start, end, top_level_items)
1819 wv->enabled = 1; 1819 wv->enabled = 1;
1820 wv->button_type = BUTTON_TYPE_NONE; 1820 wv->button_type = BUTTON_TYPE_NONE;
1821 wv->help = Qnil; 1821 wv->help = Qnil;
1822 save_wv = wv;
1822 } 1823 }
1823 save_wv = wv; 1824 else
1825 save_wv = first_wv;
1826
1824 prev_wv = 0; 1827 prev_wv = 0;
1825 i += MENU_ITEMS_PANE_LENGTH; 1828 i += MENU_ITEMS_PANE_LENGTH;
1826 } 1829 }
diff --git a/src/xterm.c b/src/xterm.c
index 86e780cc611..1b1dbdda552 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7527,7 +7527,7 @@ x_catch_errors (dpy)
7527 Display *dpy; 7527 Display *dpy;
7528{ 7528{
7529 int count = SPECPDL_INDEX (); 7529 int count = SPECPDL_INDEX ();
7530 struct x_error_message_stack *data = malloc (sizeof (*data)); 7530 struct x_error_message_stack *data = xmalloc (sizeof (*data));
7531 Lisp_Object dummy; 7531 Lisp_Object dummy;
7532#ifdef ENABLE_CHECKING 7532#ifdef ENABLE_CHECKING
7533 dummy = make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message); 7533 dummy = make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message);