diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 41 | ||||
| -rw-r--r-- | src/callint.c | 26 | ||||
| -rw-r--r-- | src/coding.c | 2 | ||||
| -rw-r--r-- | src/dispextern.h | 6 | ||||
| -rw-r--r-- | src/font.c | 21 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/nsfns.m | 90 | ||||
| -rw-r--r-- | src/systime.h | 2 |
8 files changed, 154 insertions, 40 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 99e2c3d9a84..4245a1f0256 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,44 @@ | |||
| 1 | 2013-05-01 David Reitter <david.reitter@gmail.com> | ||
| 2 | |||
| 3 | * nsfns.m (ns_tooltip): Initialize. | ||
| 4 | |||
| 5 | 2013-04-28 Eli Zaretskii <eliz@gnu.org> | ||
| 6 | |||
| 7 | * coding.c (decode_coding_gap): Don't remove the character before | ||
| 8 | a newline unless it's a CR character. (Bug#14287) | ||
| 9 | |||
| 10 | 2013-04-28 Dan Nicolaescu <dann@gnu.org> | ||
| 11 | |||
| 12 | * dispextern.h (struct face): Move enum face_underline_type | ||
| 13 | earlier so that bitfields can be in the same word. | ||
| 14 | |||
| 15 | 2013-04-28 Jan Djärv <jan.h.d@swipnet.se> | ||
| 16 | |||
| 17 | * nsfns.m (handlePanelKeys): New function. | ||
| 18 | (EmacsOpenPanel:performKeyEquivalent:) | ||
| 19 | (EmacsSavePanel:performKeyEquivalent:): Call handlePanelKeys to handle | ||
| 20 | arrows/function/control and copy/paste keys (Bug#14296). | ||
| 21 | |||
| 22 | 2013-04-27 Juri Linkov <juri@jurta.org> | ||
| 23 | |||
| 24 | * callint.c (Fcall_interactively): Call `Qread_number' for | ||
| 25 | interactive code letter `n' instead of using duplicate code. | ||
| 26 | (Bug#14254) | ||
| 27 | |||
| 28 | 2013-04-27 Paul Eggert <eggert@cs.ucla.edu> | ||
| 29 | |||
| 30 | * systime.h (make_timeval): Declare as 'const'. | ||
| 31 | |||
| 32 | 2013-04-27 Kenichi Handa <handa@gnu.org> | ||
| 33 | |||
| 34 | * font.c (font_open_entity): Always open a font of manageable | ||
| 35 | size. | ||
| 36 | |||
| 37 | 2013-04-26 Paul Eggert <eggert@cs.ucla.edu> | ||
| 38 | Port better to AIX (Bug#14258). | ||
| 39 | * lisp.h (ENUM_BF) [__IBMC__]: Make it 'unsigned int' here, too, | ||
| 40 | to pacify AIX xlc. | ||
| 41 | |||
| 1 | 2013-04-24 Kenichi Handa <handa@gnu.org> | 42 | 2013-04-24 Kenichi Handa <handa@gnu.org> |
| 2 | 43 | ||
| 3 | * coding.c (decode_coding_iso_2022): When an invalid escape | 44 | * coding.c (decode_coding_iso_2022): When an invalid escape |
diff --git a/src/callint.c b/src/callint.c index 212dd2e3d62..940ff3ed249 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -34,6 +34,7 @@ static Lisp_Object Qcommand_debug_status; | |||
| 34 | static Lisp_Object Qenable_recursive_minibuffers; | 34 | static Lisp_Object Qenable_recursive_minibuffers; |
| 35 | 35 | ||
| 36 | static Lisp_Object Qhandle_shift_selection; | 36 | static Lisp_Object Qhandle_shift_selection; |
| 37 | static Lisp_Object Qread_number; | ||
| 37 | 38 | ||
| 38 | Lisp_Object Qmouse_leave_buffer_hook; | 39 | Lisp_Object Qmouse_leave_buffer_hook; |
| 39 | 40 | ||
| @@ -683,29 +684,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 683 | if (!NILP (prefix_arg)) | 684 | if (!NILP (prefix_arg)) |
| 684 | goto have_prefix_arg; | 685 | goto have_prefix_arg; |
| 685 | case 'n': /* Read number from minibuffer. */ | 686 | case 'n': /* Read number from minibuffer. */ |
| 686 | { | 687 | args[i] = call1 (Qread_number, callint_message); |
| 687 | bool first = 1; | ||
| 688 | do | ||
| 689 | { | ||
| 690 | Lisp_Object str; | ||
| 691 | if (! first) | ||
| 692 | { | ||
| 693 | message1 ("Please enter a number."); | ||
| 694 | sit_for (make_number (1), 0, 0); | ||
| 695 | } | ||
| 696 | first = 0; | ||
| 697 | |||
| 698 | str = Fread_from_minibuffer (callint_message, | ||
| 699 | Qnil, Qnil, Qnil, Qnil, Qnil, | ||
| 700 | Qnil); | ||
| 701 | if (! STRINGP (str) || SCHARS (str) == 0) | ||
| 702 | args[i] = Qnil; | ||
| 703 | else | ||
| 704 | args[i] = Fread (str); | ||
| 705 | } | ||
| 706 | while (! NUMBERP (args[i])); | ||
| 707 | } | ||
| 708 | visargs[i] = args[i]; | ||
| 709 | break; | 688 | break; |
| 710 | 689 | ||
| 711 | case 'P': /* Prefix arg in raw form. Does no I/O. */ | 690 | case 'P': /* Prefix arg in raw form. Does no I/O. */ |
| @@ -903,6 +882,7 @@ syms_of_callint (void) | |||
| 903 | DEFSYM (Qminus, "-"); | 882 | DEFSYM (Qminus, "-"); |
| 904 | DEFSYM (Qplus, "+"); | 883 | DEFSYM (Qplus, "+"); |
| 905 | DEFSYM (Qhandle_shift_selection, "handle-shift-selection"); | 884 | DEFSYM (Qhandle_shift_selection, "handle-shift-selection"); |
| 885 | DEFSYM (Qread_number, "read-number"); | ||
| 906 | DEFSYM (Qcall_interactively, "call-interactively"); | 886 | DEFSYM (Qcall_interactively, "call-interactively"); |
| 907 | DEFSYM (Qcommand_debug_status, "command-debug-status"); | 887 | DEFSYM (Qcommand_debug_status, "command-debug-status"); |
| 908 | DEFSYM (Qenable_recursive_minibuffers, "enable-recursive-minibuffers"); | 888 | DEFSYM (Qenable_recursive_minibuffers, "enable-recursive-minibuffers"); |
diff --git a/src/coding.c b/src/coding.c index b9fb92c481b..f6664e179b7 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -7774,7 +7774,7 @@ decode_coding_gap (struct coding_system *coding, | |||
| 7774 | while (src_beg < src) | 7774 | while (src_beg < src) |
| 7775 | { | 7775 | { |
| 7776 | *--dst = *--src; | 7776 | *--dst = *--src; |
| 7777 | if (*src == '\n') | 7777 | if (*src == '\n' && src > src_beg && src[-1] == '\r') |
| 7778 | src--; | 7778 | src--; |
| 7779 | } | 7779 | } |
| 7780 | diff = dst - src; | 7780 | diff = dst - src; |
diff --git a/src/dispextern.h b/src/dispextern.h index 9dc3a57c284..5ce7b19f173 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1591,13 +1591,13 @@ struct face | |||
| 1591 | shadow colors derived from the background color of the face. */ | 1591 | shadow colors derived from the background color of the face. */ |
| 1592 | enum face_box_type box; | 1592 | enum face_box_type box; |
| 1593 | 1593 | ||
| 1594 | /* Style of underlining. */ | ||
| 1595 | enum face_underline_type underline_type; | ||
| 1596 | |||
| 1594 | /* If `box' above specifies a 3D type, 1 means use box_color for | 1597 | /* If `box' above specifies a 3D type, 1 means use box_color for |
| 1595 | drawing shadows. */ | 1598 | drawing shadows. */ |
| 1596 | unsigned use_box_color_for_shadows_p : 1; | 1599 | unsigned use_box_color_for_shadows_p : 1; |
| 1597 | 1600 | ||
| 1598 | /* Style of underlining. */ | ||
| 1599 | enum face_underline_type underline_type; | ||
| 1600 | |||
| 1601 | /* Non-zero if text in this face should be underlined, overlined, | 1601 | /* Non-zero if text in this face should be underlined, overlined, |
| 1602 | strike-through or have a box drawn around it. */ | 1602 | strike-through or have a box drawn around it. */ |
| 1603 | unsigned underline_p : 1; | 1603 | unsigned underline_p : 1; |
diff --git a/src/font.c b/src/font.c index 6247eeca948..ad601177b50 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -2819,7 +2819,7 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 2819 | struct font_driver_list *driver_list; | 2819 | struct font_driver_list *driver_list; |
| 2820 | Lisp_Object objlist, size, val, font_object; | 2820 | Lisp_Object objlist, size, val, font_object; |
| 2821 | struct font *font; | 2821 | struct font *font; |
| 2822 | int min_width, height; | 2822 | int min_width, height, psize; |
| 2823 | 2823 | ||
| 2824 | eassert (FONT_ENTITY_P (entity)); | 2824 | eassert (FONT_ENTITY_P (entity)); |
| 2825 | size = AREF (entity, FONT_SIZE_INDEX); | 2825 | size = AREF (entity, FONT_SIZE_INDEX); |
| @@ -2846,12 +2846,19 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 2846 | } | 2846 | } |
| 2847 | } | 2847 | } |
| 2848 | 2848 | ||
| 2849 | font_object = driver_list->driver->open (f, entity, pixel_size); | 2849 | /* We always open a font of manageable size; i.e non-zero average |
| 2850 | if (!NILP (font_object)) | 2850 | width and height. */ |
| 2851 | ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); | 2851 | for (psize = pixel_size; ; psize++) |
| 2852 | { | ||
| 2853 | font_object = driver_list->driver->open (f, entity, psize); | ||
| 2854 | if (NILP (font_object)) | ||
| 2855 | return Qnil; | ||
| 2856 | font = XFONT_OBJECT (font_object); | ||
| 2857 | if (font->average_width > 0 && font->height > 0) | ||
| 2858 | break; | ||
| 2859 | } | ||
| 2860 | ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); | ||
| 2852 | FONT_ADD_LOG ("open", entity, font_object); | 2861 | FONT_ADD_LOG ("open", entity, font_object); |
| 2853 | if (NILP (font_object)) | ||
| 2854 | return Qnil; | ||
| 2855 | ASET (entity, FONT_OBJLIST_INDEX, | 2862 | ASET (entity, FONT_OBJLIST_INDEX, |
| 2856 | Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); | 2863 | Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); |
| 2857 | 2864 | ||
| @@ -3118,6 +3125,8 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) | |||
| 3118 | double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); | 3125 | double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); |
| 3119 | 3126 | ||
| 3120 | pixel_size = POINT_TO_PIXEL (pt / 10, FRAME_RES_Y (f)); | 3127 | pixel_size = POINT_TO_PIXEL (pt / 10, FRAME_RES_Y (f)); |
| 3128 | if (pixel_size < 1) | ||
| 3129 | pixel_size = 1; | ||
| 3121 | } | 3130 | } |
| 3122 | ASET (work, FONT_SIZE_INDEX, Qnil); | 3131 | ASET (work, FONT_SIZE_INDEX, Qnil); |
| 3123 | foundry[0] = AREF (work, FONT_FOUNDRY_INDEX); | 3132 | foundry[0] = AREF (work, FONT_FOUNDRY_INDEX); |
diff --git a/src/lisp.h b/src/lisp.h index bcb866b4cc4..e2c24eed352 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -231,9 +231,9 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; | |||
| 231 | #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 | 231 | #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 |
| 232 | #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) | 232 | #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) |
| 233 | 233 | ||
| 234 | /* Stolen from GDB. The only known compiler that doesn't support | 234 | /* Idea stolen from GDB. MSVC doesn't support enums in bitfields, |
| 235 | enums in bitfields is MSVC. */ | 235 | and xlc complains vociferously about them. */ |
| 236 | #ifdef _MSC_VER | 236 | #if defined _MSC_VER || defined __IBMC__ |
| 237 | #define ENUM_BF(TYPE) unsigned int | 237 | #define ENUM_BF(TYPE) unsigned int |
| 238 | #else | 238 | #else |
| 239 | #define ENUM_BF(TYPE) enum TYPE | 239 | #define ENUM_BF(TYPE) enum TYPE |
diff --git a/src/nsfns.m b/src/nsfns.m index a483f847dec..0d9ebe0ef50 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -88,7 +88,7 @@ Lisp_Object Qfontsize; | |||
| 88 | /* hack for OS X file panels */ | 88 | /* hack for OS X file panels */ |
| 89 | char panelOK = 0; | 89 | char panelOK = 0; |
| 90 | 90 | ||
| 91 | EmacsTooltip *ns_tooltip; | 91 | EmacsTooltip *ns_tooltip = nil; |
| 92 | 92 | ||
| 93 | /* Need forward declaration here to preserve organizational integrity of file */ | 93 | /* Need forward declaration here to preserve organizational integrity of file */ |
| 94 | Lisp_Object Fx_open_connection (Lisp_Object, Lisp_Object, Lisp_Object); | 94 | Lisp_Object Fx_open_connection (Lisp_Object, Lisp_Object, Lisp_Object); |
| @@ -1477,7 +1477,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1477 | [panel setCanChooseFiles: YES]; | 1477 | [panel setCanChooseFiles: YES]; |
| 1478 | } | 1478 | } |
| 1479 | 1479 | ||
| 1480 | block_input (); | 1480 | block_input (); |
| 1481 | #if defined (NS_IMPL_COCOA) && \ | 1481 | #if defined (NS_IMPL_COCOA) && \ |
| 1482 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | 1482 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 1483 | if (! NILP (mustmatch) || ! NILP (dir_only_p)) | 1483 | if (! NILP (mustmatch) || ! NILP (dir_only_p)) |
| @@ -2544,6 +2544,75 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 2544 | 2544 | ||
| 2545 | ========================================================================== */ | 2545 | ========================================================================== */ |
| 2546 | 2546 | ||
| 2547 | /* | ||
| 2548 | Handle arrow/function/control keys and copy/paste/cut in file dialogs. | ||
| 2549 | Return YES if handeled, NO if not. | ||
| 2550 | */ | ||
| 2551 | static BOOL | ||
| 2552 | handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | ||
| 2553 | { | ||
| 2554 | NSString *s; | ||
| 2555 | int i; | ||
| 2556 | BOOL ret = NO; | ||
| 2557 | |||
| 2558 | if ([theEvent type] != NSKeyDown) return NO; | ||
| 2559 | s = [theEvent characters]; | ||
| 2560 | |||
| 2561 | for (i = 0; i < [s length]; ++i) | ||
| 2562 | { | ||
| 2563 | int ch = (int) [s characterAtIndex: i]; | ||
| 2564 | switch (ch) | ||
| 2565 | { | ||
| 2566 | case NSHomeFunctionKey: | ||
| 2567 | case NSDownArrowFunctionKey: | ||
| 2568 | case NSUpArrowFunctionKey: | ||
| 2569 | case NSLeftArrowFunctionKey: | ||
| 2570 | case NSRightArrowFunctionKey: | ||
| 2571 | case NSPageUpFunctionKey: | ||
| 2572 | case NSPageDownFunctionKey: | ||
| 2573 | case NSEndFunctionKey: | ||
| 2574 | [panel sendEvent: theEvent]; | ||
| 2575 | ret = YES; | ||
| 2576 | break; | ||
| 2577 | /* As we don't have the standard key commands for | ||
| 2578 | copy/paste/cut/select-all in our edit menu, we must handle | ||
| 2579 | them here. TODO: handle Emacs key bindings for copy/cut/select-all | ||
| 2580 | here, paste works, because we have that in our Edit menu. | ||
| 2581 | I.e. refactor out code in nsterm.m, keyDown: to figure out the | ||
| 2582 | correct modifier. | ||
| 2583 | */ | ||
| 2584 | case 'x': // Cut | ||
| 2585 | case 'c': // Copy | ||
| 2586 | case 'v': // Paste | ||
| 2587 | case 'a': // Select all | ||
| 2588 | if ([theEvent modifierFlags] & NSCommandKeyMask) | ||
| 2589 | { | ||
| 2590 | [NSApp sendAction: | ||
| 2591 | (ch == 'x' | ||
| 2592 | ? @selector(cut:) | ||
| 2593 | : (ch == 'c' | ||
| 2594 | ? @selector(copy:) | ||
| 2595 | : (ch == 'v' | ||
| 2596 | ? @selector(paste:) | ||
| 2597 | : @selector(selectAll:)))) | ||
| 2598 | to:nil from:panel]; | ||
| 2599 | ret = YES; | ||
| 2600 | } | ||
| 2601 | default: | ||
| 2602 | // Send all control keys, as the text field supports C-a, C-f, C-e | ||
| 2603 | // C-b and more. | ||
| 2604 | if ([theEvent modifierFlags] & NSControlKeyMask) | ||
| 2605 | { | ||
| 2606 | [panel sendEvent: theEvent]; | ||
| 2607 | ret = YES; | ||
| 2608 | } | ||
| 2609 | break; | ||
| 2610 | } | ||
| 2611 | } | ||
| 2612 | |||
| 2613 | |||
| 2614 | return ret; | ||
| 2615 | } | ||
| 2547 | 2616 | ||
| 2548 | @implementation EmacsSavePanel | 2617 | @implementation EmacsSavePanel |
| 2549 | #ifdef NS_IMPL_COCOA | 2618 | #ifdef NS_IMPL_COCOA |
| @@ -2572,6 +2641,14 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 2572 | { | 2641 | { |
| 2573 | return ns_directory_from_panel (self); | 2642 | return ns_directory_from_panel (self); |
| 2574 | } | 2643 | } |
| 2644 | |||
| 2645 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent | ||
| 2646 | { | ||
| 2647 | BOOL ret = handlePanelKeys (self, theEvent); | ||
| 2648 | if (! ret) | ||
| 2649 | ret = [super performKeyEquivalent:theEvent]; | ||
| 2650 | return ret; | ||
| 2651 | } | ||
| 2575 | @end | 2652 | @end |
| 2576 | 2653 | ||
| 2577 | 2654 | ||
| @@ -2609,7 +2686,14 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 2609 | { | 2686 | { |
| 2610 | return ns_directory_from_panel (self); | 2687 | return ns_directory_from_panel (self); |
| 2611 | } | 2688 | } |
| 2612 | 2689 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent | |
| 2690 | { | ||
| 2691 | // NSOpenPanel inherits NSSavePanel, so passing self is OK. | ||
| 2692 | BOOL ret = handlePanelKeys (self, theEvent); | ||
| 2693 | if (! ret) | ||
| 2694 | ret = [super performKeyEquivalent:theEvent]; | ||
| 2695 | return ret; | ||
| 2696 | } | ||
| 2613 | @end | 2697 | @end |
| 2614 | 2698 | ||
| 2615 | 2699 | ||
diff --git a/src/systime.h b/src/systime.h index da495b9064b..c3bc00c1479 100644 --- a/src/systime.h +++ b/src/systime.h | |||
| @@ -143,7 +143,7 @@ EMACS_TIME_TO_DOUBLE (EMACS_TIME t) | |||
| 143 | 143 | ||
| 144 | /* defined in sysdep.c */ | 144 | /* defined in sysdep.c */ |
| 145 | extern int set_file_times (int, const char *, EMACS_TIME, EMACS_TIME); | 145 | extern int set_file_times (int, const char *, EMACS_TIME, EMACS_TIME); |
| 146 | extern struct timeval make_timeval (EMACS_TIME); | 146 | extern struct timeval make_timeval (EMACS_TIME) ATTRIBUTE_CONST; |
| 147 | 147 | ||
| 148 | /* defined in keyboard.c */ | 148 | /* defined in keyboard.c */ |
| 149 | extern void set_waiting_for_input (EMACS_TIME *); | 149 | extern void set_waiting_for_input (EMACS_TIME *); |