summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-05-01 20:47:50 +0300
committerEli Zaretskii <eliz@gnu.org>2013-05-01 20:47:50 +0300
commitb1cb82edff21abfefd68af18370dddfd8cc1fec0 (patch)
treefd8d8a1e1d99af024b52158a471457fc796238bc /src
parent10f81f3ac90f98160f611787e20dcad96bb500e9 (diff)
parent2640d52e4e7873e41b0f0f1144177f84c345917e (diff)
downloademacs-b1cb82edff21abfefd68af18370dddfd8cc1fec0.tar.gz
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog41
-rw-r--r--src/callint.c26
-rw-r--r--src/coding.c2
-rw-r--r--src/dispextern.h6
-rw-r--r--src/font.c21
-rw-r--r--src/lisp.h6
-rw-r--r--src/nsfns.m90
-rw-r--r--src/systime.h2
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 @@
+2013-05-01 David Reitter <david.reitter@gmail.com>
+
+ * nsfns.m (ns_tooltip): Initialize.
+
+2013-04-28 Eli Zaretskii <eliz@gnu.org>
+
+ * 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 <dann@gnu.org>
+
+ * 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 <jan.h.d@swipnet.se>
+
+ * 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 <juri@jurta.org>
+
+ * callint.c (Fcall_interactively): Call `Qread_number' for
+ interactive code letter `n' instead of using duplicate code.
+ (Bug#14254)
+
+2013-04-27 Paul Eggert <eggert@cs.ucla.edu>
+
+ * systime.h (make_timeval): Declare as 'const'.
+
+2013-04-27 Kenichi Handa <handa@gnu.org>
+
+ * font.c (font_open_entity): Always open a font of manageable
+ size.
+
+2013-04-26 Paul Eggert <eggert@cs.ucla.edu>
+ 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 <handa@gnu.org>
* 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;
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");
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;
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;
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);
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
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;
/* 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);
@@ -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
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 *);