aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2013-01-10 00:04:21 +0100
committerJoakim Verona2013-01-10 00:04:21 +0100
commit09708f70bd02e7a2edec79e1bcfd04fb9b7f48d3 (patch)
tree9376433d772aa4a302b231af1c601bcb4440c9f1 /src
parent0f9ee7aa0e6b57e28b31699a912356c24b959b01 (diff)
parent51fb5578777d1041feaab31651b65e09e1731d33 (diff)
downloademacs-09708f70bd02e7a2edec79e1bcfd04fb9b7f48d3.tar.gz
emacs-09708f70bd02e7a2edec79e1bcfd04fb9b7f48d3.zip
auto upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog25
-rw-r--r--src/buffer.c18
-rw-r--r--src/buffer.h10
-rw-r--r--src/coding.c9
-rw-r--r--src/editfns.c6
-rw-r--r--src/insdel.c30
-rw-r--r--src/lisp.h1
-rw-r--r--src/nsfns.m8
-rw-r--r--src/w32.c2
-rw-r--r--src/w32term.c2
-rw-r--r--src/xfaces.c2
11 files changed, 73 insertions, 40 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9ab201c8be4..6ce141331ec 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,28 @@
12013-01-09 Juanma Barranquero <lekktu@gmail.com>
2
3 * w32.c (get_name_and_id, acl_set_file):
4 * w32term.c (w32fullscreen_hook): Remove unused local variables.
5
62013-01-09 Dmitry Antipov <dmantipov@yandex.ru>
7
8 * lisp.h (make_gap_1): New prototype.
9 * buffer.h (GAP_BYTES_DFL, GAP_BYTES_MIN): New macros for the special
10 gap size values.
11 * editfns.c (Fbuffer_size): Rename from Fbufsize to fit the common
12 naming convention.
13 (syms_of_editfns): Adjust defsubr. Drop commented-out obsolete code.
14 * insdel.c (make_gap_larger): Use GAP_BYTES_DFL. Adjust comment.
15 (make_gap_smaller): Use GAP_BYTES_MIN. Adjust comment.
16 (make_gap_1): New function to adjust the gap of any buffer.
17 * coding.c (coding_alloc_by_making_gap): Use it.
18 * buffer.c (compact_buffer): Likewise. Use BUF_Z_BYTE, BUF_GAP_SIZE,
19 GAP_BYTES_DFL and GAP_BYTES_MIN. Adjust comment.
20
212013-01-08 Juri Linkov <juri@jurta.org>
22
23 * xfaces.c (tty_supports_face_attributes_p): Return 0 for the case
24 of (supports :underline (:style wave)). (Bug#13000)
25
12013-01-08 Aaron S. Hawley <aaron.s.hawley@gmail.com> 262013-01-08 Aaron S. Hawley <aaron.s.hawley@gmail.com>
2 27
3 * undo.c (Fprimitive_undo): Move to simple.el. 28 * undo.c (Fprimitive_undo): Move to simple.el.
diff --git a/src/buffer.c b/src/buffer.c
index 5999fcb7e7d..51c4d9c71da 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1682,17 +1682,13 @@ compact_buffer (struct buffer *buffer)
1682 if (!buffer->text->inhibit_shrinking) 1682 if (!buffer->text->inhibit_shrinking)
1683 { 1683 {
1684 /* If a buffer's gap size is more than 10% of the buffer 1684 /* If a buffer's gap size is more than 10% of the buffer
1685 size, or larger than 2000 bytes, then shrink it 1685 size, or larger than GAP_BYTES_DFL bytes, then shrink it
1686 accordingly. Keep a minimum size of 20 bytes. */ 1686 accordingly. Keep a minimum size of GAP_BYTES_MIN bytes. */
1687 int size = min (2000, max (20, (buffer->text->z_byte / 10))); 1687 ptrdiff_t size = clip_to_bounds (GAP_BYTES_MIN,
1688 1688 BUF_Z_BYTE (buffer) / 10,
1689 if (buffer->text->gap_size > size) 1689 GAP_BYTES_DFL);
1690 { 1690 if (BUF_GAP_SIZE (buffer) > size)
1691 struct buffer *save_current = current_buffer; 1691 make_gap_1 (buffer, -(BUF_GAP_SIZE (buffer) - size));
1692 current_buffer = buffer;
1693 make_gap (-(buffer->text->gap_size - size));
1694 current_buffer = save_current;
1695 }
1696 } 1692 }
1697 BUF_COMPACT (buffer) = BUF_MODIFF (buffer); 1693 BUF_COMPACT (buffer) = BUF_MODIFF (buffer);
1698 } 1694 }
diff --git a/src/buffer.h b/src/buffer.h
index eb6a9d4d3e1..ec9c34b3eb3 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -320,6 +320,16 @@ while (0)
320#define BUF_BYTES_MAX \ 320#define BUF_BYTES_MAX \
321 (ptrdiff_t) min (MOST_POSITIVE_FIXNUM - 1, min (SIZE_MAX, PTRDIFF_MAX)) 321 (ptrdiff_t) min (MOST_POSITIVE_FIXNUM - 1, min (SIZE_MAX, PTRDIFF_MAX))
322 322
323/* Maximum gap size after compact_buffer, in bytes. Also
324 used in make_gap_larger to get some extra reserved space. */
325
326#define GAP_BYTES_DFL 2000
327
328/* Minimum gap size after compact_buffer, in bytes. Also
329 used in make_gap_smaller to avoid too small gap size. */
330
331#define GAP_BYTES_MIN 20
332
323/* Return the address of byte position N in current buffer. */ 333/* Return the address of byte position N in current buffer. */
324 334
325#define BYTE_POS_ADDR(n) \ 335#define BYTE_POS_ADDR(n) \
diff --git a/src/coding.c b/src/coding.c
index 5285a906823..a9bf9032a69 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1049,14 +1049,7 @@ coding_alloc_by_making_gap (struct coding_system *coding,
1049 GPT -= gap_head_used, GPT_BYTE -= gap_head_used; 1049 GPT -= gap_head_used, GPT_BYTE -= gap_head_used;
1050 } 1050 }
1051 else 1051 else
1052 { 1052 make_gap_1 (XBUFFER (coding->dst_object), bytes);
1053 Lisp_Object this_buffer;
1054
1055 this_buffer = Fcurrent_buffer ();
1056 set_buffer_internal (XBUFFER (coding->dst_object));
1057 make_gap (bytes);
1058 set_buffer_internal (XBUFFER (this_buffer));
1059 }
1060} 1053}
1061 1054
1062 1055
diff --git a/src/editfns.c b/src/editfns.c
index df0dad0669d..26dfdac3ba8 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -968,7 +968,7 @@ usage: (save-current-buffer &rest BODY) */)
968 return unbind_to (count, Fprogn (args)); 968 return unbind_to (count, Fprogn (args));
969} 969}
970 970
971DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0, 971DEFUN ("buffer-size", Fbuffer_size, Sbuffer_size, 0, 1, 0,
972 doc: /* Return the number of characters in the current buffer. 972 doc: /* Return the number of characters in the current buffer.
973If BUFFER, return the number of characters in that buffer instead. */) 973If BUFFER, return the number of characters in that buffer instead. */)
974 (Lisp_Object buffer) 974 (Lisp_Object buffer)
@@ -4883,12 +4883,10 @@ functions if all the text being accessed has this property. */);
4883 defsubr (&Sline_beginning_position); 4883 defsubr (&Sline_beginning_position);
4884 defsubr (&Sline_end_position); 4884 defsubr (&Sline_end_position);
4885 4885
4886/* defsubr (&Smark); */
4887/* defsubr (&Sset_mark); */
4888 defsubr (&Ssave_excursion); 4886 defsubr (&Ssave_excursion);
4889 defsubr (&Ssave_current_buffer); 4887 defsubr (&Ssave_current_buffer);
4890 4888
4891 defsubr (&Sbufsize); 4889 defsubr (&Sbuffer_size);
4892 defsubr (&Spoint_max); 4890 defsubr (&Spoint_max);
4893 defsubr (&Spoint_min); 4891 defsubr (&Spoint_min);
4894 defsubr (&Spoint_min_marker); 4892 defsubr (&Spoint_min_marker);
diff --git a/src/insdel.c b/src/insdel.c
index 52a017a62a2..905249d6714 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -388,14 +388,13 @@ make_gap_larger (ptrdiff_t nbytes_added)
388 ptrdiff_t real_gap_loc_byte; 388 ptrdiff_t real_gap_loc_byte;
389 ptrdiff_t old_gap_size; 389 ptrdiff_t old_gap_size;
390 ptrdiff_t current_size = Z_BYTE - BEG_BYTE + GAP_SIZE; 390 ptrdiff_t current_size = Z_BYTE - BEG_BYTE + GAP_SIZE;
391 enum { enough_for_a_while = 2000 };
392 391
393 if (BUF_BYTES_MAX - current_size < nbytes_added) 392 if (BUF_BYTES_MAX - current_size < nbytes_added)
394 buffer_overflow (); 393 buffer_overflow ();
395 394
396 /* If we have to get more space, get enough to last a while; 395 /* If we have to get more space, get enough to last a while;
397 but do not exceed the maximum buffer size. */ 396 but do not exceed the maximum buffer size. */
398 nbytes_added = min (nbytes_added + enough_for_a_while, 397 nbytes_added = min (nbytes_added + GAP_BYTES_DFL,
399 BUF_BYTES_MAX - current_size); 398 BUF_BYTES_MAX - current_size);
400 399
401 enlarge_buffer_text (current_buffer, nbytes_added); 400 enlarge_buffer_text (current_buffer, nbytes_added);
@@ -413,8 +412,7 @@ make_gap_larger (ptrdiff_t nbytes_added)
413 GPT_BYTE = Z_BYTE + GAP_SIZE; 412 GPT_BYTE = Z_BYTE + GAP_SIZE;
414 GAP_SIZE = nbytes_added; 413 GAP_SIZE = nbytes_added;
415 414
416 /* Move the new gap down to be consecutive with the end of the old one. 415 /* Move the new gap down to be consecutive with the end of the old one. */
417 This adjusts the markers properly too. */
418 gap_left (real_gap_loc + old_gap_size, real_gap_loc_byte + old_gap_size, 1); 416 gap_left (real_gap_loc + old_gap_size, real_gap_loc_byte + old_gap_size, 1);
419 417
420 /* Now combine the two into one large gap. */ 418 /* Now combine the two into one large gap. */
@@ -443,9 +441,9 @@ make_gap_smaller (ptrdiff_t nbytes_removed)
443 ptrdiff_t real_beg_unchanged; 441 ptrdiff_t real_beg_unchanged;
444 ptrdiff_t new_gap_size; 442 ptrdiff_t new_gap_size;
445 443
446 /* Make sure the gap is at least 20 bytes. */ 444 /* Make sure the gap is at least GAP_BYTES_MIN bytes. */
447 if (GAP_SIZE - nbytes_removed < 20) 445 if (GAP_SIZE - nbytes_removed < GAP_BYTES_MIN)
448 nbytes_removed = GAP_SIZE - 20; 446 nbytes_removed = GAP_SIZE - GAP_BYTES_MIN;
449 447
450 /* Prevent quitting in move_gap. */ 448 /* Prevent quitting in move_gap. */
451 tem = Vinhibit_quit; 449 tem = Vinhibit_quit;
@@ -468,8 +466,7 @@ make_gap_smaller (ptrdiff_t nbytes_removed)
468 Z_BYTE += new_gap_size; 466 Z_BYTE += new_gap_size;
469 GAP_SIZE = nbytes_removed; 467 GAP_SIZE = nbytes_removed;
470 468
471 /* Move the unwanted pretend gap to the end of the buffer. This 469 /* Move the unwanted pretend gap to the end of the buffer. */
472 adjusts the markers properly too. */
473 gap_right (Z, Z_BYTE); 470 gap_right (Z, Z_BYTE);
474 471
475 enlarge_buffer_text (current_buffer, -nbytes_removed); 472 enlarge_buffer_text (current_buffer, -nbytes_removed);
@@ -500,7 +497,20 @@ make_gap (ptrdiff_t nbytes_added)
500 make_gap_smaller (-nbytes_added); 497 make_gap_smaller (-nbytes_added);
501#endif 498#endif
502} 499}
503 500
501/* Add NBYTES to B's gap. It's enough to temporarily
502 fake current_buffer and avoid real switch to B. */
503
504void
505make_gap_1 (struct buffer *b, ptrdiff_t nbytes)
506{
507 struct buffer *oldb = current_buffer;
508
509 current_buffer = b;
510 make_gap (nbytes);
511 current_buffer = oldb;
512}
513
504/* Copy NBYTES bytes of text from FROM_ADDR to TO_ADDR. 514/* Copy NBYTES bytes of text from FROM_ADDR to TO_ADDR.
505 FROM_MULTIBYTE says whether the incoming text is multibyte. 515 FROM_MULTIBYTE says whether the incoming text is multibyte.
506 TO_MULTIBYTE says whether to store the text as multibyte. 516 TO_MULTIBYTE says whether to store the text as multibyte.
diff --git a/src/lisp.h b/src/lisp.h
index 897e5a85203..9be30563df8 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2783,6 +2783,7 @@ extern void move_gap (ptrdiff_t);
2783extern void move_gap_both (ptrdiff_t, ptrdiff_t); 2783extern void move_gap_both (ptrdiff_t, ptrdiff_t);
2784extern _Noreturn void buffer_overflow (void); 2784extern _Noreturn void buffer_overflow (void);
2785extern void make_gap (ptrdiff_t); 2785extern void make_gap (ptrdiff_t);
2786extern void make_gap_1 (struct buffer *, ptrdiff_t);
2786extern ptrdiff_t copy_text (const unsigned char *, unsigned char *, 2787extern ptrdiff_t copy_text (const unsigned char *, unsigned char *,
2787 ptrdiff_t, bool, bool); 2788 ptrdiff_t, bool, bool);
2788extern int count_combining_before (const unsigned char *, 2789extern int count_combining_before (const unsigned char *,
diff --git a/src/nsfns.m b/src/nsfns.m
index 1750eb62cdf..fac61d2ab53 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1503,12 +1503,12 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1503 [panel setDelegate: fileDelegate]; 1503 [panel setDelegate: fileDelegate];
1504 1504
1505 panelOK = 0; 1505 panelOK = 0;
1506 if (! NILP (dir_only_p)) 1506 if (! NILP (dir_only_p))
1507 { 1507 {
1508 [panel setCanChooseDirectories: YES]; 1508 [panel setCanChooseDirectories: YES];
1509 [panel setCanChooseFiles: NO]; 1509 [panel setCanChooseFiles: NO];
1510 } 1510 }
1511 1511
1512 block_input (); 1512 block_input ();
1513#if defined (NS_IMPL_COCOA) && \ 1513#if defined (NS_IMPL_COCOA) && \
1514 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 1514 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@@ -1519,7 +1519,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1519 [panel setNameFieldStringValue: [initS lastPathComponent]]; 1519 [panel setNameFieldStringValue: [initS lastPathComponent]];
1520 else 1520 else
1521 [panel setNameFieldStringValue: @""]; 1521 [panel setNameFieldStringValue: @""];
1522 1522
1523 ret = [panel runModal]; 1523 ret = [panel runModal];
1524#else 1524#else
1525 if (NILP (mustmatch) && NILP (dir_only_p)) 1525 if (NILP (mustmatch) && NILP (dir_only_p))
@@ -2147,7 +2147,7 @@ In case the execution fails, an error is signaled. */)
2147 [NSApp postEvent: nxev atStart: NO]; 2147 [NSApp postEvent: nxev atStart: NO];
2148 2148
2149 // If there are other events, the event loop may exit. Keep running 2149 // If there are other events, the event loop may exit. Keep running
2150 // until the script has been handeled. */ 2150 // until the script has been handled. */
2151 while (! NILP (as_script)) 2151 while (! NILP (as_script))
2152 [NSApp run]; 2152 [NSApp run];
2153 2153
diff --git a/src/w32.c b/src/w32.c
index 55581a17de5..812003e96c0 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3648,7 +3648,6 @@ static int
3648get_name_and_id (PSECURITY_DESCRIPTOR psd, unsigned *id, char *nm, int what) 3648get_name_and_id (PSECURITY_DESCRIPTOR psd, unsigned *id, char *nm, int what)
3649{ 3649{
3650 PSID sid = NULL; 3650 PSID sid = NULL;
3651 char machine[MAX_COMPUTERNAME_LENGTH+1];
3652 BOOL dflt; 3651 BOOL dflt;
3653 SID_NAME_USE ignore; 3652 SID_NAME_USE ignore;
3654 char name[UNLEN+1]; 3653 char name[UNLEN+1];
@@ -4800,7 +4799,6 @@ acl_set_file (const char *fname, acl_type_t type, acl_t acl)
4800{ 4799{
4801 TOKEN_PRIVILEGES old1, old2; 4800 TOKEN_PRIVILEGES old1, old2;
4802 DWORD err; 4801 DWORD err;
4803 BOOL res;
4804 int st = 0, retval = -1; 4802 int st = 0, retval = -1;
4805 SECURITY_INFORMATION flags = 0; 4803 SECURITY_INFORMATION flags = 0;
4806 PSID psid; 4804 PSID psid;
diff --git a/src/w32term.c b/src/w32term.c
index 36ae4d7797f..16c7bd415a5 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5652,7 +5652,7 @@ x_check_fullscreen (struct frame *f)
5652static void 5652static void
5653w32fullscreen_hook (FRAME_PTR f) 5653w32fullscreen_hook (FRAME_PTR f)
5654{ 5654{
5655 static int normal_width, normal_height, normal_top, normal_left; 5655 static int normal_width, normal_height;
5656 5656
5657 if (f->async_visible) 5657 if (f->async_visible)
5658 { 5658 {
diff --git a/src/xfaces.c b/src/xfaces.c
index ed2895c014c..43535b9ea0c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4877,6 +4877,8 @@ tty_supports_face_attributes_p (struct frame *f,
4877 { 4877 {
4878 if (STRINGP (val)) 4878 if (STRINGP (val))
4879 return 0; /* ttys can't use colored underlines */ 4879 return 0; /* ttys can't use colored underlines */
4880 else if (EQ (CAR_SAFE (val), QCstyle) && EQ (CAR_SAFE (CDR_SAFE (val)), Qwave))
4881 return 0; /* ttys can't use wave underlines */
4880 else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX])) 4882 else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX]))
4881 return 0; /* same as default */ 4883 return 0; /* same as default */
4882 else 4884 else