From f780d632f2047ccf07208081aa477882ef4ecc2a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 26 Apr 2013 12:31:09 -0700 Subject: Port better to AIX. * configure.ac (CFLAGS): Append -O if the user did not specify CFLAGS, we did not already infer an optimization option, and -O works. AIX xlc needs -O, otherwise garbage collection doesn't work. * src/lisp.h (ENUM_BF) [__IBMC__]: Make it 'unsigned int' here, too, to pacify AIX xlc. Fixes: debbugs:14258 --- src/ChangeLog | 6 ++++++ src/lisp.h | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 99e2c3d9a84..9ae5c29ab72 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-04-26 Paul Eggert + + Port better to AIX (Bug#14258). + * lisp.h (ENUM_BF) [__IBMC__]: Make it 'unsigned int' here, too, + to pacify AIX xlc. + 2013-04-24 Kenichi Handa * coding.c (decode_coding_iso_2022): When an invalid escape 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 }; #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) -/* Stolen from GDB. The only known compiler that doesn't support - enums in bitfields is MSVC. */ -#ifdef _MSC_VER +/* Idea stolen from GDB. MSVC doesn't support enums in bitfields, + and xlc complains vociferously about them. */ +#if defined _MSC_VER || defined __IBMC__ #define ENUM_BF(TYPE) unsigned int #else #define ENUM_BF(TYPE) enum TYPE -- cgit v1.2.1 From 8bd722db81bcb303d6945b800c7ccb615a5474a5 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Sat, 27 Apr 2013 22:32:24 +0900 Subject: font.c (font_open_entity): Always open a font of manageable size. --- src/ChangeLog | 5 +++++ src/font.c | 21 +++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 99e2c3d9a84..5dd113775d9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-04-27 Kenichi Handa + + * font.c (font_open_entity): Always open a font of manageable + size. + 2013-04-24 Kenichi Handa * coding.c (decode_coding_iso_2022): When an invalid escape 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) struct font_driver_list *driver_list; Lisp_Object objlist, size, val, font_object; struct font *font; - int min_width, height; + int min_width, height, psize; eassert (FONT_ENTITY_P (entity)); size = AREF (entity, FONT_SIZE_INDEX); @@ -2846,12 +2846,19 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) } } - font_object = driver_list->driver->open (f, entity, pixel_size); - if (!NILP (font_object)) - ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); + /* We always open a font of manageable size; i.e non-zero average + width and height. */ + for (psize = pixel_size; ; psize++) + { + font_object = driver_list->driver->open (f, entity, psize); + if (NILP (font_object)) + return Qnil; + font = XFONT_OBJECT (font_object); + if (font->average_width > 0 && font->height > 0) + break; + } + ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); FONT_ADD_LOG ("open", entity, font_object); - if (NILP (font_object)) - return Qnil; ASET (entity, FONT_OBJLIST_INDEX, Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); @@ -3118,6 +3125,8 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); pixel_size = POINT_TO_PIXEL (pt / 10, FRAME_RES_Y (f)); + if (pixel_size < 1) + pixel_size = 1; } ASET (work, FONT_SIZE_INDEX, Qnil); foundry[0] = AREF (work, FONT_FOUNDRY_INDEX); -- cgit v1.2.1 From b8dd59f747ffd09a7fa4df2e36924f435ee61a90 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 27 Apr 2013 08:34:28 -0700 Subject: * systime.h (make_timeval): Declare as 'const'. --- src/ChangeLog | 4 ++++ src/systime.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d649c1bcdbc..b7fd539f540 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2013-04-27 Paul Eggert + + * systime.h (make_timeval): Declare as 'const'. + 2013-04-27 Kenichi Handa * font.c (font_open_entity): Always open a font of manageable 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) /* defined in sysdep.c */ extern int set_file_times (int, const char *, EMACS_TIME, EMACS_TIME); -extern struct timeval make_timeval (EMACS_TIME); +extern struct timeval make_timeval (EMACS_TIME) ATTRIBUTE_CONST; /* defined in keyboard.c */ extern void set_waiting_for_input (EMACS_TIME *); -- cgit v1.2.1 From 0208ede7abd03f6945fd3b6c18e7d089096b2d79 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 28 Apr 2013 00:12:17 +0300 Subject: * src/callint.c (Fcall_interactively): Call `Qread_number' for interactive code letter `n' instead of using duplicate code. * lisp/subr.el (read-number): Doc fix about using it by interactive code letter `n'. Fixes: debbugs:14254 --- src/ChangeLog | 6 ++++++ src/callint.c | 26 +++----------------------- 2 files changed, 9 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b7fd539f540..c9d458c3479 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-04-27 Juri Linkov + + * callint.c (Fcall_interactively): Call `Qread_number' for + interactive code letter `n' instead of using duplicate code. + (Bug#14254) + 2013-04-27 Paul Eggert * systime.h (make_timeval): Declare as 'const'. 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; static Lisp_Object Qenable_recursive_minibuffers; static Lisp_Object Qhandle_shift_selection; +static Lisp_Object Qread_number; Lisp_Object Qmouse_leave_buffer_hook; @@ -683,29 +684,7 @@ invoke it. If KEYS is omitted or nil, the return value of if (!NILP (prefix_arg)) goto have_prefix_arg; case 'n': /* Read number from minibuffer. */ - { - bool first = 1; - do - { - Lisp_Object str; - if (! first) - { - message1 ("Please enter a number."); - sit_for (make_number (1), 0, 0); - } - first = 0; - - str = Fread_from_minibuffer (callint_message, - Qnil, Qnil, Qnil, Qnil, Qnil, - Qnil); - if (! STRINGP (str) || SCHARS (str) == 0) - args[i] = Qnil; - else - args[i] = Fread (str); - } - while (! NUMBERP (args[i])); - } - visargs[i] = args[i]; + args[i] = call1 (Qread_number, callint_message); break; case 'P': /* Prefix arg in raw form. Does no I/O. */ @@ -903,6 +882,7 @@ syms_of_callint (void) DEFSYM (Qminus, "-"); DEFSYM (Qplus, "+"); DEFSYM (Qhandle_shift_selection, "handle-shift-selection"); + DEFSYM (Qread_number, "read-number"); DEFSYM (Qcall_interactively, "call-interactively"); DEFSYM (Qcommand_debug_status, "command-debug-status"); DEFSYM (Qenable_recursive_minibuffers, "enable-recursive-minibuffers"); -- cgit v1.2.1 From edbdcec0a296f1cab2ffcced455e9a04c0408509 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 28 Apr 2013 11:55:20 +0200 Subject: * nsfns.m (handlePanelKeys): New function. (EmacsOpenPanel:performKeyEquivalent:) (EmacsSavePanel:performKeyEquivalent:): Call handlePanelKeys to handle arrows/function/control and copy/paste keys. Fixes: debbugs:14296 --- src/ChangeLog | 7 +++++ src/nsfns.m | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c9d458c3479..84aa50f7047 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-04-28 Jan Djärv + + * nsfns.m (handlePanelKeys): New function. + (EmacsOpenPanel:performKeyEquivalent:) + (EmacsSavePanel:performKeyEquivalent:): Call handlePanelKeys to handle + arrows/function/control and copy/paste keys (Bug#14296). + 2013-04-27 Juri Linkov * callint.c (Fcall_interactively): Call `Qread_number' for diff --git a/src/nsfns.m b/src/nsfns.m index a483f847dec..0d6d0e72835 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1477,7 +1477,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) [panel setCanChooseFiles: YES]; } - block_input (); + block_input (); #if defined (NS_IMPL_COCOA) && \ MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 if (! NILP (mustmatch) || ! NILP (dir_only_p)) @@ -2544,6 +2544,75 @@ Value is t if tooltip was open, nil otherwise. */) ========================================================================== */ +/* + Handle arrow/function/control keys and copy/paste/cut in file dialogs. + Return YES if handeled, NO if not. + */ +static BOOL +handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) +{ + NSString *s; + int i; + BOOL ret = NO; + + if ([theEvent type] != NSKeyDown) return NO; + s = [theEvent characters]; + + for (i = 0; i < [s length]; ++i) + { + int ch = (int) [s characterAtIndex: i]; + switch (ch) + { + case NSHomeFunctionKey: + case NSDownArrowFunctionKey: + case NSUpArrowFunctionKey: + case NSLeftArrowFunctionKey: + case NSRightArrowFunctionKey: + case NSPageUpFunctionKey: + case NSPageDownFunctionKey: + case NSEndFunctionKey: + [panel sendEvent: theEvent]; + ret = YES; + break; + /* As we don't have the standard key commands for + copy/paste/cut/select-all in our edit menu, we must handle + them here. TODO: handle Emacs key bindings for copy/cut/select-all + here, paste works, because we have that in our Edit menu. + I.e. refactor out code in nsterm.m, keyDown: to figure out the + correct modifier. + */ + case 'x': // Cut + case 'c': // Copy + case 'v': // Paste + case 'a': // Select all + if ([theEvent modifierFlags] & NSCommandKeyMask) + { + [NSApp sendAction: + (ch == 'x' + ? @selector(cut:) + : (ch == 'c' + ? @selector(copy:) + : (ch == 'v' + ? @selector(paste:) + : @selector(selectAll:)))) + to:nil from:panel]; + ret = YES; + } + default: + // Send all control keys, as the text field supports C-a, C-f, C-e + // C-b and more. + if ([theEvent modifierFlags] & NSControlKeyMask) + { + [panel sendEvent: theEvent]; + ret = YES; + } + break; + } + } + + + return ret; +} @implementation EmacsSavePanel #ifdef NS_IMPL_COCOA @@ -2572,6 +2641,14 @@ Value is t if tooltip was open, nil otherwise. */) { return ns_directory_from_panel (self); } + +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent +{ + BOOL ret = handlePanelKeys (self, theEvent); + if (! ret) + ret = [super performKeyEquivalent:theEvent]; + return ret; +} @end @@ -2609,7 +2686,14 @@ Value is t if tooltip was open, nil otherwise. */) { return ns_directory_from_panel (self); } - +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent +{ + // NSOpenPanel inherits NSSavePanel, so passing self is OK. + BOOL ret = handlePanelKeys (self, theEvent); + if (! ret) + ret = [super performKeyEquivalent:theEvent]; + return ret; +} @end -- cgit v1.2.1 From ad60824ef15e8c4fd4718f92eca8759cabcec035 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sun, 28 Apr 2013 09:11:16 -0400 Subject: * dispextern.h (struct face): Move enum face_underline_type earlier so that bitfields can be in the same word. --- src/ChangeLog | 5 +++++ src/dispextern.h | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 84aa50f7047..5fa2404a243 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-04-28 Dan Nicolaescu + + * dispextern.h (struct face): Move enum face_underline_type + earlier so that bitfields can be in the same word. + 2013-04-28 Jan Djärv * nsfns.m (handlePanelKeys): New function. 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 shadow colors derived from the background color of the face. */ enum face_box_type box; + /* Style of underlining. */ + enum face_underline_type underline_type; + /* If `box' above specifies a 3D type, 1 means use box_color for drawing shadows. */ unsigned use_box_color_for_shadows_p : 1; - /* Style of underlining. */ - enum face_underline_type underline_type; - /* Non-zero if text in this face should be underlined, overlined, strike-through or have a box drawn around it. */ unsigned underline_p : 1; -- cgit v1.2.1 From 9e63b4a53403840acf3d759d8ac16475c12562e2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 28 Apr 2013 21:21:01 +0300 Subject: Fix bug #14287 with decoding EOL by *-dos coding systems. src/coding.c (decode_coding_gap): Don't remove the character before a newline unless it's a CR character. --- src/ChangeLog | 5 +++++ src/coding.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5fa2404a243..2e9e19fd547 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-04-28 Eli Zaretskii + + * coding.c (decode_coding_gap): Don't remove the character before + a newline unless it's a CR character. (Bug#14287) + 2013-04-28 Dan Nicolaescu * dispextern.h (struct face): Move enum face_underline_type 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, while (src_beg < src) { *--dst = *--src; - if (*src == '\n') + if (*src == '\n' && src > src_beg && src[-1] == '\r') src--; } diff = dst - src; -- cgit v1.2.1 From 0fb0a4f376b5f19010055ebaf4f6bc24eca4fe28 Mon Sep 17 00:00:00 2001 From: David Reitter Date: Wed, 1 May 2013 00:02:19 -0700 Subject: * src/nsfns.m (ns_tooltip): Initialize. --- src/ChangeLog | 4 ++++ src/nsfns.m | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2e9e19fd547..4245a1f0256 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2013-05-01 David Reitter + + * nsfns.m (ns_tooltip): Initialize. + 2013-04-28 Eli Zaretskii * coding.c (decode_coding_gap): Don't remove the character before diff --git a/src/nsfns.m b/src/nsfns.m index 0d6d0e72835..0d9ebe0ef50 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -88,7 +88,7 @@ Lisp_Object Qfontsize; /* hack for OS X file panels */ char panelOK = 0; -EmacsTooltip *ns_tooltip; +EmacsTooltip *ns_tooltip = nil; /* Need forward declaration here to preserve organizational integrity of file */ Lisp_Object Fx_open_connection (Lisp_Object, Lisp_Object, Lisp_Object); -- cgit v1.2.1