summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c17
-rw-r--r--src/lread.c20
-rw-r--r--src/process.c18
-rw-r--r--src/xfns.c2
4 files changed, 36 insertions, 21 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 79dce15a812..e405ed8c827 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2216,10 +2216,12 @@ push_key_description (EMACS_INT ch, char *p)
DEFUN ("single-key-description", Fsingle_key_description,
Ssingle_key_description, 1, 2, 0,
- doc: /* Return a pretty description of command character KEY.
+ doc: /* Return a pretty description of a character event KEY.
Control characters turn into C-whatever, etc.
Optional argument NO-ANGLES non-nil means don't put angle brackets
-around function keys and event symbols. */)
+around function keys and event symbols.
+
+See `text-char-description' for describing character codes. */)
(Lisp_Object key, Lisp_Object no_angles)
{
USE_SAFE_ALLOCA;
@@ -2293,11 +2295,12 @@ push_text_char_description (register unsigned int c, register char *p)
/* This function cannot GC. */
DEFUN ("text-char-description", Ftext_char_description, Stext_char_description, 1, 1, 0,
- doc: /* Return a pretty description of file-character CHARACTER.
-Control characters turn into "^char", etc. This differs from
-`single-key-description' which turns them into "C-char".
-Also, this function recognizes the 2**7 bit as the Meta character,
-whereas `single-key-description' uses the 2**27 bit for Meta.
+ doc: /* Return the description of CHARACTER in standard Emacs notation.
+CHARACTER must be a valid character code that passes the `characterp' test.
+Control characters turn into "^char", the 2**7 bit is treated as Meta, etc.
+This differs from `single-key-description' which accepts character events,
+and thus doesn't enforce the `characterp' condition, turns control
+characters into "C-char", and uses the 2**27 bit for Meta.
See Info node `(elisp)Describing Characters' for examples. */)
(Lisp_Object character)
{
diff --git a/src/lread.c b/src/lread.c
index e43929a8c6a..73e38d89954 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -741,10 +741,14 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
}
DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0,
- doc: /* Read a character from the command input (keyboard or macro).
+ doc: /* Read a character event from the command input (keyboard or macro).
It is returned as a number.
-If the character has modifiers, they are resolved and reflected to the
-character code if possible (e.g. C-SPC -> 0).
+If the event has modifiers, they are resolved and reflected in the
+returned character code if possible (e.g. C-SPC yields 0 and C-a yields 97).
+If some of the modifiers cannot be reflected in the character code, the
+returned value will include those modifiers, and will not be a valid
+character code: it will fail the `characterp' test. Use `event-basic-type'
+to recover the character code with the modifiers removed.
If the user generates an event which is not a character (i.e. a mouse
click or function key event), `read-char' signals an error. As an
@@ -791,10 +795,14 @@ floating-point value. */)
}
DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0,
- doc: /* Read a character from the command input (keyboard or macro).
+ doc: /* Read a character event from the command input (keyboard or macro).
It is returned as a number. Non-character events are ignored.
-If the character has modifiers, they are resolved and reflected to the
-character code if possible (e.g. C-SPC -> 0).
+If the event has modifiers, they are resolved and reflected in the
+returned character code if possible (e.g. C-SPC yields 0 and C-a yields 97).
+If some of the modifiers cannot be reflected in the character code, the
+returned value will include those modifiers, and will not be a valid
+character code: it will fail the `characterp' test. Use `event-basic-type'
+to recover the character code with the modifiers removed.
If the optional argument PROMPT is non-nil, display that as a prompt.
If the optional argument INHERIT-INPUT-METHOD is non-nil and some
diff --git a/src/process.c b/src/process.c
index ebaaf33e57f..4d96e469767 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3331,11 +3331,9 @@ static void
connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
Lisp_Object use_external_socket_p)
{
- ptrdiff_t count = SPECPDL_INDEX ();
int s = -1, outch, inch;
int xerrno = 0;
int family;
- struct sockaddr *sa = NULL;
int ret;
ptrdiff_t addrlen UNINIT;
struct Lisp_Process *p = XPROCESS (proc);
@@ -3354,6 +3352,11 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
/* Do this in case we never enter the while-loop below. */
s = -1;
+ struct sockaddr *sa = NULL;
+ ptrdiff_t count = SPECPDL_INDEX ();
+ record_unwind_protect_nothing ();
+ ptrdiff_t count1 = SPECPDL_INDEX ();
+
while (!NILP (addrinfos))
{
Lisp_Object addrinfo = XCAR (addrinfos);
@@ -3366,9 +3369,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
#endif
addrlen = get_lisp_to_sockaddr_size (ip_address, &family);
- if (sa)
- free (sa);
- sa = xmalloc (addrlen);
+ sa = xrealloc (sa, addrlen);
+ set_unwind_protect_ptr (count, xfree, sa);
conv_lisp_to_sockaddr (family, ip_address, sa, addrlen);
s = socket_to_use;
@@ -3530,7 +3532,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
#endif /* !WINDOWSNT */
/* Discard the unwind protect closing S. */
- specpdl_ptr = specpdl + count;
+ specpdl_ptr = specpdl + count1;
emacs_close (s);
s = -1;
if (0 <= socket_to_use)
@@ -3601,6 +3603,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
Lisp_Object data = get_file_errno_data (err, contact, xerrno);
pset_status (p, list2 (Fcar (data), Fcdr (data)));
+ unbind_to (count, Qnil);
return;
}
@@ -3620,7 +3623,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
p->outfd = outch;
/* Discard the unwind protect for closing S, if any. */
- specpdl_ptr = specpdl + count;
+ specpdl_ptr = specpdl + count1;
if (p->is_server && p->socktype != SOCK_DGRAM)
pset_status (p, Qlisten);
@@ -3681,6 +3684,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
}
#endif
+ unbind_to (count, Qnil);
}
/* Create a network stream/datagram client/server process. Treated
diff --git a/src/xfns.c b/src/xfns.c
index e19fcff9b05..c4cf59d9b27 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5075,7 +5075,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
int menu_bar_height = 0, menu_bar_width = 0;
int tool_bar_height = 0, tool_bar_width = 0;
- if (FRAME_INITIAL_P (f) || !FRAME_X_P (f))
+ if (FRAME_INITIAL_P (f) || !FRAME_X_P (f) || !FRAME_OUTER_WINDOW (f))
return Qnil;
block_input ();