aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2012-08-30 21:07:42 +0900
committerKenichi Handa2012-08-30 21:07:42 +0900
commit31e7d6e0902a895e13833204907dfb86268b5acf (patch)
tree445b59dd5e87c8e2a8b969356386f45cae8cd6d9 /src
parent4eb4de01df384be9b8d811f7ab476eeb37ece748 (diff)
parentf17e1d00e0513d781d2bd9a80af24bb047d32d5c (diff)
downloademacs-31e7d6e0902a895e13833204907dfb86268b5acf.tar.gz
emacs-31e7d6e0902a895e13833204907dfb86268b5acf.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog47
-rw-r--r--src/eval.c9
-rw-r--r--src/lread.c9
-rw-r--r--src/nsmenu.m82
-rw-r--r--src/nsterm.h10
-rw-r--r--src/ralloc.c45
-rw-r--r--src/window.c31
7 files changed, 158 insertions, 75 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1040b93fe70..fef02d8cbb5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,50 @@
12012-08-30 Glenn Morris <rgm@gnu.org>
2
3 * lread.c (init_lread): For out-of-tree builds, only add the
4 source directory's site-lisp dir to the load-path if it exists,
5 consistent with in-tree builds. (Bug#12302)
6
72012-08-28 Jan Djärv <jan.h.d@swipnet.se>
8
9 * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
10 button_values to NULL. Call setStykeMask so dialogs get a close button.
11 (windowShouldClose:): Set window_closed.
12 (dealloc): New member, free button_values.
13 (process_dialog:): Make member function. Remove window argument,
14 replace window with self. Count buttons and allocate and store values
15 in button_values.
16 (addButton:value:row:): value is int with the name tag. Call setTag
17 with tag. Remove return self, declare return value as void.
18 (addString:row:): Remove return self, declare return value as void.
19 (addSplit): Remove return self, declare return value as void.
20 (clicked:): Remove return self, declare return value as void.
21 Set dialog_return to button_values[seltag]. Code formatting change.
22 (initFromContents:isQuestion:): Adjust call to process_dialog.
23 Code formatting change.
24 (timeout_handler:): Set timer_fired to YES.
25 (runDialogAt:): Set timer_fired to NO.
26 Handle click on close button as quit.
27
28 * nsterm.h (EmacsDialogPanel): Make timer_fired BOOL.
29 Add window_closed and button_values. Add void as return value for
30 add(Button|String|Split). addButton takes int instead of Lisp_Object.
31 Add process_dialog as new member.
32
332012-08-28 Eli Zaretskii <eliz@gnu.org>
34
35 * ralloc.c (free_bloc): Don't dereference a 'heap' structure if it
36 is not one of the heaps we manage. (Bug#12242)
37
382012-08-28 Glenn Morris <rgm@gnu.org>
39
40 * eval.c (Fcalled_interactively_p): Doc fix. (Bug#11747)
41
422012-08-28 Martin Rudalics <rudalics@gmx.at>
43
44 * window.c (Fset_window_configuration): Remove handling of
45 auto-buffer-name window parameter. Install revision of reverted
46 fix.
47
12012-08-28 Dmitry Antipov <dmantipov@yandex.ru> 482012-08-28 Dmitry Antipov <dmantipov@yandex.ru>
2 49
3 Do not allow to set major mode for a dead buffer. 50 Do not allow to set major mode for a dead buffer.
diff --git a/src/eval.c b/src/eval.c
index df44c87dc25..c56be10c5a0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -544,11 +544,10 @@ thinking of using it for any other purpose, it is quite likely that
544you're making a mistake. Think: what do you want to do when the 544you're making a mistake. Think: what do you want to do when the
545command is called from a keyboard macro? 545command is called from a keyboard macro?
546 546
547This function is meant for implementing advice and other 547Instead of using this function, it is sometimes cleaner to give your
548function-modifying features. Instead of using this, it is sometimes 548function an extra optional argument whose `interactive' spec specifies
549cleaner to give your function an extra optional argument whose 549non-nil unconditionally (\"p\" is a good way to do this), or via
550`interactive' spec specifies non-nil unconditionally (\"p\" is a good 550\(not (or executing-kbd-macro noninteractive)). */)
551way to do this), or via (not (or executing-kbd-macro noninteractive)). */)
552 (Lisp_Object kind) 551 (Lisp_Object kind)
553{ 552{
554 return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) 553 return ((INTERACTIVE || !EQ (kind, intern ("interactive")))
diff --git a/src/lread.c b/src/lread.c
index b0413c98765..aa3e0cfc5b8 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4253,9 +4253,12 @@ init_lread (void)
4253 { 4253 {
4254 tem = Fexpand_file_name (build_string ("site-lisp"), 4254 tem = Fexpand_file_name (build_string ("site-lisp"),
4255 Vsource_directory); 4255 Vsource_directory);
4256 4256 tem1 = Ffile_exists_p (tem);
4257 if (NILP (Fmember (tem, Vload_path))) 4257 if (!NILP (tem1))
4258 Vload_path = Fcons (tem, Vload_path); 4258 {
4259 if (NILP (Fmember (tem, Vload_path)))
4260 Vload_path = Fcons (tem, Vload_path);
4261 }
4259 } 4262 }
4260 } 4263 }
4261 } /* Vinstallation_directory != Vsource_directory */ 4264 } /* Vinstallation_directory != Vsource_directory */
diff --git a/src/nsmenu.m b/src/nsmenu.m
index ab285f26df2..9e290486213 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1498,6 +1498,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1498 NSImage *img; 1498 NSImage *img;
1499 1499
1500 dialog_return = Qundefined; 1500 dialog_return = Qundefined;
1501 button_values = NULL;
1501 area.origin.x = 3*SPACER; 1502 area.origin.x = 3*SPACER;
1502 area.origin.y = 2*SPACER; 1503 area.origin.y = 2*SPACER;
1503 area.size.width = ICONSIZE; 1504 area.size.width = ICONSIZE;
@@ -1579,44 +1580,65 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1579 [self setOneShot: YES]; 1580 [self setOneShot: YES];
1580 [self setReleasedWhenClosed: YES]; 1581 [self setReleasedWhenClosed: YES];
1581 [self setHidesOnDeactivate: YES]; 1582 [self setHidesOnDeactivate: YES];
1583 [self setStyleMask:
1584 NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask];
1585
1582 return self; 1586 return self;
1583} 1587}
1584 1588
1585 1589
1586- (BOOL)windowShouldClose: (id)sender 1590- (BOOL)windowShouldClose: (id)sender
1587{ 1591{
1592 window_closed = YES;
1588 [NSApp stop:self]; 1593 [NSApp stop:self];
1589 return NO; 1594 return NO;
1590} 1595}
1591 1596
1597- (void)dealloc
1598{
1599 xfree (button_values);
1600 [super dealloc];
1601}
1592 1602
1593void process_dialog (id window, Lisp_Object list) 1603- (void)process_dialog: (Lisp_Object) list
1594{ 1604{
1595 Lisp_Object item; 1605 Lisp_Object item, lst = list;
1596 int row = 0; 1606 int row = 0;
1607 int buttons = 0, btnnr = 0;
1608
1609 for (; XTYPE (lst) == Lisp_Cons; lst = XCDR (lst))
1610 {
1611 item = XCAR (list);
1612 if (XTYPE (item) == Lisp_Cons)
1613 ++buttons;
1614 }
1615
1616 if (buttons > 0)
1617 button_values = (Lisp_Object *) xmalloc (buttons * sizeof (*button_values));
1597 1618
1598 for (; XTYPE (list) == Lisp_Cons; list = XCDR (list)) 1619 for (; XTYPE (list) == Lisp_Cons; list = XCDR (list))
1599 { 1620 {
1600 item = XCAR (list); 1621 item = XCAR (list);
1601 if (XTYPE (item) == Lisp_String) 1622 if (XTYPE (item) == Lisp_String)
1602 { 1623 {
1603 [window addString: SSDATA (item) row: row++]; 1624 [self addString: SSDATA (item) row: row++];
1604 } 1625 }
1605 else if (XTYPE (item) == Lisp_Cons) 1626 else if (XTYPE (item) == Lisp_Cons)
1606 { 1627 {
1607 [window addButton: SSDATA (XCAR (item)) 1628 button_values[btnnr] = XCDR (item);
1608 value: XCDR (item) row: row++]; 1629 [self addButton: SSDATA (XCAR (item)) value: btnnr row: row++];
1630 ++btnnr;
1609 } 1631 }
1610 else if (NILP (item)) 1632 else if (NILP (item))
1611 { 1633 {
1612 [window addSplit]; 1634 [self addSplit];
1613 row = 0; 1635 row = 0;
1614 } 1636 }
1615 } 1637 }
1616} 1638}
1617 1639
1618 1640
1619- addButton: (char *)str value: (Lisp_Object)val row: (int)row 1641- (void)addButton: (char *)str value: (int)tag row: (int)row
1620{ 1642{
1621 id cell; 1643 id cell;
1622 1644
@@ -1629,15 +1651,13 @@ void process_dialog (id window, Lisp_Object list)
1629 [cell setTarget: self]; 1651 [cell setTarget: self];
1630 [cell setAction: @selector (clicked: )]; 1652 [cell setAction: @selector (clicked: )];
1631 [cell setTitle: [NSString stringWithUTF8String: str]]; 1653 [cell setTitle: [NSString stringWithUTF8String: str]];
1632 [cell setTag: XHASH (val)]; // FIXME: BIG UGLY HACK!! 1654 [cell setTag: tag];
1633 [cell setBordered: YES]; 1655 [cell setBordered: YES];
1634 [cell setEnabled: YES]; 1656 [cell setEnabled: YES];
1635
1636 return self;
1637} 1657}
1638 1658
1639 1659
1640- addString: (char *)str row: (int)row 1660- (void)addString: (char *)str row: (int)row
1641{ 1661{
1642 id cell; 1662 id cell;
1643 1663
@@ -1650,36 +1670,28 @@ void process_dialog (id window, Lisp_Object list)
1650 [cell setTitle: [NSString stringWithUTF8String: str]]; 1670 [cell setTitle: [NSString stringWithUTF8String: str]];
1651 [cell setBordered: YES]; 1671 [cell setBordered: YES];
1652 [cell setEnabled: NO]; 1672 [cell setEnabled: NO];
1653
1654 return self;
1655} 1673}
1656 1674
1657 1675
1658- addSplit 1676- (void)addSplit
1659{ 1677{
1660 [matrix addColumn]; 1678 [matrix addColumn];
1661 cols++; 1679 cols++;
1662 return self;
1663} 1680}
1664 1681
1665 1682
1666- clicked: sender 1683- (void)clicked: sender
1667{ 1684{
1668 NSArray *sellist = nil; 1685 NSArray *sellist = nil;
1669 EMACS_INT seltag; 1686 EMACS_INT seltag;
1670 1687
1671 sellist = [sender selectedCells]; 1688 sellist = [sender selectedCells];
1672 if ([sellist count]<1) 1689 if ([sellist count] < 1)
1673 return self; 1690 return;
1674 1691
1675 seltag = [[sellist objectAtIndex: 0] tag]; 1692 seltag = [[sellist objectAtIndex: 0] tag];
1676 if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!! 1693 dialog_return = button_values[seltag];
1677 { 1694 [NSApp stop:self];
1678 dialog_return = seltag;
1679 [NSApp stop:self];
1680 }
1681
1682 return self;
1683} 1695}
1684 1696
1685 1697
@@ -1691,7 +1703,7 @@ void process_dialog (id window, Lisp_Object list)
1691 if (XTYPE (contents) == Lisp_Cons) 1703 if (XTYPE (contents) == Lisp_Cons)
1692 { 1704 {
1693 head = Fcar (contents); 1705 head = Fcar (contents);
1694 process_dialog (self, Fcdr (contents)); 1706 [self process_dialog: Fcdr (contents)];
1695 } 1707 }
1696 else 1708 else
1697 head = contents; 1709 head = contents;
@@ -1711,7 +1723,7 @@ void process_dialog (id window, Lisp_Object list)
1711 if (cols == 1 && rows > 1) /* Never told where to split */ 1723 if (cols == 1 && rows > 1) /* Never told where to split */
1712 { 1724 {
1713 [matrix addColumn]; 1725 [matrix addColumn];
1714 for (i = 0; i<rows/2; i++) 1726 for (i = 0; i < rows/2; i++)
1715 { 1727 {
1716 [matrix putCell: [matrix cellAtRow: (rows+1)/2 column: 0] 1728 [matrix putCell: [matrix cellAtRow: (rows+1)/2 column: 0]
1717 atRow: i column: 1]; 1729 atRow: i column: 1];
@@ -1771,7 +1783,7 @@ void process_dialog (id window, Lisp_Object list)
1771 data1: 0 1783 data1: 0
1772 data2: 0]; 1784 data2: 0];
1773 1785
1774 timer_fired = 1; 1786 timer_fired = YES;
1775 /* We use sto because stopModal/abortModal out of the main loop does not 1787 /* We use sto because stopModal/abortModal out of the main loop does not
1776 seem to work in 10.6. But as we use stop we must send a real event so 1788 seem to work in 10.6. But as we use stop we must send a real event so
1777 the stop is seen and acted upon. */ 1789 the stop is seen and acted upon. */
@@ -1799,9 +1811,9 @@ void process_dialog (id window, Lisp_Object list)
1799 [[NSRunLoop currentRunLoop] addTimer: tmo 1811 [[NSRunLoop currentRunLoop] addTimer: tmo
1800 forMode: NSModalPanelRunLoopMode]; 1812 forMode: NSModalPanelRunLoopMode];
1801 } 1813 }
1802 timer_fired = 0; 1814 timer_fired = NO;
1803 dialog_return = Qundefined; 1815 dialog_return = Qundefined;
1804 ret = [NSApp runModalForWindow: self]; 1816 [NSApp runModalForWindow: self];
1805 ret = dialog_return; 1817 ret = dialog_return;
1806 if (! timer_fired) 1818 if (! timer_fired)
1807 { 1819 {
@@ -1810,11 +1822,11 @@ void process_dialog (id window, Lisp_Object list)
1810 } 1822 }
1811 } 1823 }
1812 1824
1813 { /* FIXME: BIG UGLY HACK!!! */ 1825 if (EQ (ret, Qundefined) && window_closed)
1814 Lisp_Object tmp; 1826 /* Make close button pressed equivalent to C-g. */
1815 *(EMACS_INT*)(&tmp) = ret; 1827 Fsignal (Qquit, Qnil);
1816 return tmp; 1828
1817 } 1829 return ret;
1818} 1830}
1819 1831
1820@end 1832@end
diff --git a/src/nsterm.h b/src/nsterm.h
index 72b8d13cc47..f9149d97571 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -195,13 +195,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
195 NSTextField *title; 195 NSTextField *title;
196 NSMatrix *matrix; 196 NSMatrix *matrix;
197 int rows, cols; 197 int rows, cols;
198 int timer_fired; 198 BOOL timer_fired, window_closed;
199 Lisp_Object dialog_return; 199 Lisp_Object dialog_return;
200 Lisp_Object *button_values;
200 } 201 }
201- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ; 202- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
202- addButton: (char *)str value: (Lisp_Object)val row: (int)row; 203- (void)process_dialog: (Lisp_Object)list;
203- addString: (char *)str row: (int)row; 204- (void)addButton: (char *)str value: (int)tag row: (int)row;
204- addSplit; 205- (void)addString: (char *)str row: (int)row;
206- (void)addSplit;
205- (Lisp_Object)runDialogAt: (NSPoint)p; 207- (Lisp_Object)runDialogAt: (NSPoint)p;
206- (void)timeout_handler: (NSTimer *)timedEntry; 208- (void)timeout_handler: (NSTimer *)timedEntry;
207@end 209@end
diff --git a/src/ralloc.c b/src/ralloc.c
index c40258693f5..3877e21d4f6 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -670,6 +670,7 @@ static void
670free_bloc (bloc_ptr bloc) 670free_bloc (bloc_ptr bloc)
671{ 671{
672 heap_ptr heap = bloc->heap; 672 heap_ptr heap = bloc->heap;
673 heap_ptr h;
673 674
674 if (r_alloc_freeze_level) 675 if (r_alloc_freeze_level)
675 { 676 {
@@ -699,20 +700,38 @@ free_bloc (bloc_ptr bloc)
699 bloc->prev->next = bloc->next; 700 bloc->prev->next = bloc->next;
700 } 701 }
701 702
702 /* Update the records of which blocs are in HEAP. */ 703 /* Sometimes, 'heap' obtained from bloc->heap above is not really a
703 if (heap->first_bloc == bloc) 704 'heap' structure. It can even be beyond the current break point,
705 which will cause crashes when we dereference it below (see
706 bug#12242). Evidently, the reason is bloc allocations done while
707 use_relocatable_buffers was non-positive, because additional
708 memory we get then is not recorded in the heaps we manage. If
709 bloc->heap records such a "heap", we cannot (and don't need to)
710 update its records. So we validate the 'heap' value by making
711 sure it is one of the heaps we manage via the heaps linked list,
712 and don't touch a 'heap' that isn't found there. This avoids
713 accessing memory we know nothing about. */
714 for (h = first_heap; h != NIL_HEAP; h = h->next)
715 if (heap == h)
716 break;
717
718 if (h)
704 { 719 {
705 if (bloc->next != 0 && bloc->next->heap == heap) 720 /* Update the records of which blocs are in HEAP. */
706 heap->first_bloc = bloc->next; 721 if (heap->first_bloc == bloc)
707 else 722 {
708 heap->first_bloc = heap->last_bloc = NIL_BLOC; 723 if (bloc->next != 0 && bloc->next->heap == heap)
709 } 724 heap->first_bloc = bloc->next;
710 if (heap->last_bloc == bloc) 725 else
711 { 726 heap->first_bloc = heap->last_bloc = NIL_BLOC;
712 if (bloc->prev != 0 && bloc->prev->heap == heap) 727 }
713 heap->last_bloc = bloc->prev; 728 if (heap->last_bloc == bloc)
714 else 729 {
715 heap->first_bloc = heap->last_bloc = NIL_BLOC; 730 if (bloc->prev != 0 && bloc->prev->heap == heap)
731 heap->last_bloc = bloc->prev;
732 else
733 heap->first_bloc = heap->last_bloc = NIL_BLOC;
734 }
716 } 735 }
717 736
718 relinquish (); 737 relinquish ();
diff --git a/src/window.c b/src/window.c
index ba1ec2544f8..38124cb13a9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -62,7 +62,7 @@ static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
62static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; 62static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically;
63static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 63static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
64static Lisp_Object Qsafe, Qabove, Qbelow; 64static Lisp_Object Qsafe, Qabove, Qbelow;
65static Lisp_Object Qauto_buffer_name, Qclone_of; 65static Lisp_Object Qclone_of;
66 66
67static int displayed_window_lines (struct window *); 67static int displayed_window_lines (struct window *);
68static int count_windows (struct window *); 68static int count_windows (struct window *);
@@ -5540,7 +5540,6 @@ the return value is nil. Otherwise the value is t. */)
5540 struct Lisp_Vector *saved_windows; 5540 struct Lisp_Vector *saved_windows;
5541 Lisp_Object new_current_buffer; 5541 Lisp_Object new_current_buffer;
5542 Lisp_Object frame; 5542 Lisp_Object frame;
5543 Lisp_Object auto_buffer_name;
5544 FRAME_PTR f; 5543 FRAME_PTR f;
5545 ptrdiff_t old_point = -1; 5544 ptrdiff_t old_point = -1;
5546 5545
@@ -5616,6 +5615,21 @@ the return value is nil. Otherwise the value is t. */)
5616 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); 5615 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
5617 int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); 5616 int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
5618 5617
5618 /* Don't do this within the main loop below: This may call Lisp
5619 code and is thus potentially unsafe while input is blocked. */
5620 for (k = 0; k < saved_windows->header.size; k++)
5621 {
5622 p = SAVED_WINDOW_N (saved_windows, k);
5623 window = p->window;
5624 w = XWINDOW (window);
5625 if (!NILP (w->buffer)
5626 && !EQ (w->buffer, p->buffer)
5627 && !NILP (BVAR (XBUFFER (p->buffer), name)))
5628 /* If a window we restore gets another buffer, record the
5629 window's old buffer. */
5630 call1 (Qrecord_window_buffer, window);
5631 }
5632
5619 /* The mouse highlighting code could get screwed up 5633 /* The mouse highlighting code could get screwed up
5620 if it runs during this. */ 5634 if it runs during this. */
5621 BLOCK_INPUT; 5635 BLOCK_INPUT;
@@ -5794,18 +5808,6 @@ the return value is nil. Otherwise the value is t. */)
5794 BUF_PT_BYTE (XBUFFER (w->buffer))); 5808 BUF_PT_BYTE (XBUFFER (w->buffer)));
5795 w->start_at_line_beg = 1; 5809 w->start_at_line_beg = 1;
5796 } 5810 }
5797 else if (STRINGP (auto_buffer_name =
5798 Fwindow_parameter (window, Qauto_buffer_name))
5799 && SCHARS (auto_buffer_name) != 0
5800 && (wset_buffer (w, Fget_buffer_create (auto_buffer_name)),
5801 !NILP (w->buffer)))
5802 {
5803 set_marker_restricted (w->start,
5804 make_number (0), w->buffer);
5805 set_marker_restricted (w->pointm,
5806 make_number (0), w->buffer);
5807 w->start_at_line_beg = 1;
5808 }
5809 else 5811 else
5810 /* Window has no live buffer, get one. */ 5812 /* Window has no live buffer, get one. */
5811 { 5813 {
@@ -6711,7 +6713,6 @@ syms_of_window (void)
6711 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook"); 6713 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook");
6712 DEFSYM (Qabove, "above"); 6714 DEFSYM (Qabove, "above");
6713 DEFSYM (Qbelow, "below"); 6715 DEFSYM (Qbelow, "below");
6714 DEFSYM (Qauto_buffer_name, "auto-buffer-name");
6715 DEFSYM (Qclone_of, "clone-of"); 6716 DEFSYM (Qclone_of, "clone-of");
6716 6717
6717 staticpro (&Vwindow_list); 6718 staticpro (&Vwindow_list);