HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Supply malloc and alloc_size attributes for extern allocators.
[bpt/emacs.git]
/
src
/
keyboard.c
diff --git
a/src/keyboard.c
b/src/keyboard.c
index
0fcea38
..
26afc02
100644
(file)
--- a/
src/keyboard.c
+++ b/
src/keyboard.c
@@
-1,7
+1,6
@@
/* Keyboard and mouse input; editor command loop.
/* Keyboard and mouse input; editor command loop.
-Copyright (C) 1985-1989, 1993-1997, 1999-2013 Free Software Foundation,
-Inc.
+Copyright (C) 1985-1989, 1993-1997, 1999-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
This file is part of GNU Emacs.
@@
-21,6
+20,7
@@
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "sysstdio.h"
#include <config.h>
#include "sysstdio.h"
+#include <sys/stat.h>
#include "lisp.h"
#include "termchar.h"
#include "lisp.h"
#include "termchar.h"
@@
-228,7
+228,7
@@
static Lisp_Object Qbackward_char;
Lisp_Object Qundefined;
static Lisp_Object Qtimer_event_handler;
Lisp_Object Qundefined;
static Lisp_Object Qtimer_event_handler;
-/*
read_key_sequence
stores here the command definition of the
+/*
`read_key_sequence'
stores here the command definition of the
key sequence that it reads. */
static Lisp_Object read_key_sequence_cmd;
static Lisp_Object read_key_sequence_remapped;
key sequence that it reads. */
static Lisp_Object read_key_sequence_cmd;
static Lisp_Object read_key_sequence_remapped;
@@
-347,6
+347,7
@@
static Lisp_Object Qmodifier_cache;
/* Symbols to use for parts of windows. */
Lisp_Object Qmode_line;
Lisp_Object Qvertical_line;
/* Symbols to use for parts of windows. */
Lisp_Object Qmode_line;
Lisp_Object Qvertical_line;
+Lisp_Object Qright_divider, Qbottom_divider;
static Lisp_Object Qvertical_scroll_bar;
Lisp_Object Qmenu_bar;
static Lisp_Object Qvertical_scroll_bar;
Lisp_Object Qmenu_bar;
@@
-806,9
+807,13
@@
force_auto_save_soon (void)
\f
DEFUN ("recursive-edit", Frecursive_edit, Srecursive_edit, 0, 0, "",
doc: /* Invoke the editor command loop recursively.
\f
DEFUN ("recursive-edit", Frecursive_edit, Srecursive_edit, 0, 0, "",
doc: /* Invoke the editor command loop recursively.
-To get out of the recursive edit, a command can do `(throw 'exit nil)';
-that tells this function to return.
-Alternatively, `(throw 'exit t)' makes this function signal an error.
+To get out of the recursive edit, a command can throw to `exit' -- for
+instance `(throw 'exit nil)'.
+If you throw a value other than t, `recursive-edit' returns normally
+to the function that called it. Throwing a t value causes
+`recursive-edit' to quit, so that control returns to the command loop
+one level up.
+
This function is called by the editor initialization to begin editing. */)
(void)
{
This function is called by the editor initialization to begin editing. */)
(void)
{
@@
-820,22
+825,25
@@
This function is called by the editor initialization to begin editing. */)
if (input_blocked_p ())
return Qnil;
if (input_blocked_p ())
return Qnil;
- command_loop_level++;
- update_mode_lines = 17;
-
- if (command_loop_level
+ if (command_loop_level >= 0
&& current_buffer != XBUFFER (XWINDOW (selected_window)->contents))
buffer = Fcurrent_buffer ();
else
buffer = Qnil;
&& current_buffer != XBUFFER (XWINDOW (selected_window)->contents))
buffer = Fcurrent_buffer ();
else
buffer = Qnil;
+ /* Don't do anything interesting between the increment and the
+ record_unwind_protect! Otherwise, we could get distracted and
+ never decrement the counter again. */
+ command_loop_level++;
+ update_mode_lines = 17;
+ record_unwind_protect (recursive_edit_unwind, buffer);
+
/* If we leave recursive_edit_1 below with a `throw' for instance,
like it is done in the splash screen display, we have to
make sure that we restore single_kboard as command_loop_1
would have done if it were left normally. */
if (command_loop_level > 0)
temporarily_switch_to_single_kboard (SELECTED_FRAME ());
/* If we leave recursive_edit_1 below with a `throw' for instance,
like it is done in the splash screen display, we have to
make sure that we restore single_kboard as command_loop_1
would have done if it were left normally. */
if (command_loop_level > 0)
temporarily_switch_to_single_kboard (SELECTED_FRAME ());
- record_unwind_protect (recursive_edit_unwind, buffer);
recursive_edit_1 ();
return unbind_to (count, Qnil);
recursive_edit_1 ();
return unbind_to (count, Qnil);
@@
-1441,7
+1449,7
@@
command_loop_1 (void)
Vthis_command_keys_shift_translated = Qnil;
/* Read next key sequence; i gets its length. */
Vthis_command_keys_shift_translated = Qnil;
/* Read next key sequence; i gets its length. */
- i = read_key_sequence (keybuf,
sizeof keybuf / sizeof keybuf[0]
,
+ i = read_key_sequence (keybuf,
ARRAYELTS (keybuf)
,
Qnil, 0, 1, 1, 0);
/* A filter may have run while we were reading the input. */
Qnil, 0, 1, 1, 0);
/* A filter may have run while we were reading the input. */
@@
-1689,7
+1697,7
@@
read_menu_command (void)
menus. */
specbind (Qecho_keystrokes, make_number (0));
menus. */
specbind (Qecho_keystrokes, make_number (0));
- i = read_key_sequence (keybuf,
sizeof keybuf / sizeof keybuf[0]
,
+ i = read_key_sequence (keybuf,
ARRAYELTS (keybuf)
,
Qnil, 0, 1, 1, 1);
unbind_to (count, Qnil);
Qnil, 0, 1, 1, 1);
unbind_to (count, Qnil);
@@
-1771,8
+1779,8
@@
adjust_point_for_property (ptrdiff_t last_pt, bool modified)
than skip both boundaries. However, this code
also stops anywhere in a non-sticky text-property,
which breaks (e.g.) Org mode. */
than skip both boundaries. However, this code
also stops anywhere in a non-sticky text-property,
which breaks (e.g.) Org mode. */
- && (val = get_pos_property (make_number (end),
- Qinvisible, Qnil),
+ && (val =
F
get_pos_property (make_number (end),
+
Qinvisible, Qnil),
TEXT_PROP_MEANS_INVISIBLE (val))
#endif
&& !NILP (val = get_char_property_and_overlay
TEXT_PROP_MEANS_INVISIBLE (val))
#endif
&& !NILP (val = get_char_property_and_overlay
@@
-1789,8
+1797,8
@@
adjust_point_for_property (ptrdiff_t last_pt, bool modified)
}
while (beg > BEGV
#if 0
}
while (beg > BEGV
#if 0
- && (val = get_pos_property (make_number (beg),
- Qinvisible, Qnil),
+ && (val =
F
get_pos_property (make_number (beg),
+
Qinvisible, Qnil),
TEXT_PROP_MEANS_INVISIBLE (val))
#endif
&& !NILP (val = get_char_property_and_overlay
TEXT_PROP_MEANS_INVISIBLE (val))
#endif
&& !NILP (val = get_char_property_and_overlay
@@
-1843,12
+1851,12
@@
adjust_point_for_property (ptrdiff_t last_pt, bool modified)
to the other end would mean moving backwards and thus
could lead to an infinite loop. */
;
to the other end would mean moving backwards and thus
could lead to an infinite loop. */
;
- else if (val = get_pos_property (make_number (PT),
- Qinvisible, Qnil),
+ else if (val =
F
get_pos_property (make_number (PT),
+
Qinvisible, Qnil),
TEXT_PROP_MEANS_INVISIBLE (val)
TEXT_PROP_MEANS_INVISIBLE (val)
- && (val = get_pos_property
- (make_number (PT == beg ? end : beg),
-
Qinvisible, Qnil
),
+ && (val =
(F
get_pos_property
+
(make_number (PT == beg ? end : beg),
+
Qinvisible, Qnil)
),
!TEXT_PROP_MEANS_INVISIBLE (val)))
(check_composition = check_display = 1,
SET_PT (PT == beg ? end : beg));
!TEXT_PROP_MEANS_INVISIBLE (val)))
(check_composition = check_display = 1,
SET_PT (PT == beg ? end : beg));
@@
-1953,10
+1961,7
@@
int poll_suppress_count;
static struct atimer *poll_timer;
static struct atimer *poll_timer;
-/* Poll for input, so that we catch a C-g if it comes in. This
- function is called from x_make_frame_visible, see comment
- there. */
-
+/* Poll for input, so that we catch a C-g if it comes in. */
void
poll_for_input_1 (void)
{
void
poll_for_input_1 (void)
{
@@
-1993,7
+1998,7
@@
start_polling (void)
been turned off in process.c. */
turn_on_atimers (1);
been turned off in process.c. */
turn_on_atimers (1);
- /* If poll timer doesn't exist,
are
we need one with
+ /* If poll timer doesn't exist,
or
we need one with
a different interval, start a new one. */
if (poll_timer == NULL
|| poll_timer->interval.tv_sec != polling_period)
a different interval, start a new one. */
if (poll_timer == NULL
|| poll_timer->interval.tv_sec != polling_period)
@@
-2086,7
+2091,7
@@
bind_polling_period (int n)
\f
/* Apply the control modifier to CHARACTER. */
\f
/* Apply the control modifier to CHARACTER. */
-#ifndef
WINDOWSNT
+#ifndef
HAVE_NTGUI
static
#endif
int
static
#endif
int
@@
-2297,8
+2302,10
@@
read_decoded_event_from_main_queue (struct timespec *end_time,
bool *used_mouse_menu)
{
#define MAX_ENCODED_BYTES 16
bool *used_mouse_menu)
{
#define MAX_ENCODED_BYTES 16
+#ifndef WINDOWSNT
Lisp_Object events[MAX_ENCODED_BYTES];
int n = 0;
Lisp_Object events[MAX_ENCODED_BYTES];
int n = 0;
+#endif
while (true)
{
Lisp_Object nextevt
while (true)
{
Lisp_Object nextevt
@@
-2375,7
+2382,7
@@
read_decoded_event_from_main_queue (struct timespec *end_time,
-2 means do neither.
1 means do both. */
-2 means do neither.
1 means do both. */
-/* The argument
s MAP is for menu prompting. MAP is a keymap
.
+/* The argument
MAP is a keymap for menu prompting
.
PREV_EVENT is the previous input event, or nil if we are reading
the first event of a key sequence (or not reading a key sequence).
PREV_EVENT is the previous input event, or nil if we are reading
the first event of a key sequence (or not reading a key sequence).
@@
-2889,8
+2896,12
@@
read_char (int commandflag, Lisp_Object map,
{
c = read_decoded_event_from_main_queue (end_time, local_getcjmp,
prev_event, used_mouse_menu);
{
c = read_decoded_event_from_main_queue (end_time, local_getcjmp,
prev_event, used_mouse_menu);
- if (end_time && timespec_cmp (*end_time, current_timespec ()) <= 0)
- goto exit;
+ if (NILP(c) && end_time &&
+ timespec_cmp (*end_time, current_timespec ()) <= 0)
+ {
+ goto exit;
+ }
+
if (EQ (c, make_number (-2)))
{
/* This is going to exit from read_char
if (EQ (c, make_number (-2)))
{
/* This is going to exit from read_char
@@
-3222,8
+3233,6
@@
read_char (int commandflag, Lisp_Object map,
RETURN_UNGCPRO (c);
}
RETURN_UNGCPRO (c);
}
-#ifdef HAVE_MENUS
-
/* Record a key that came from a mouse menu.
Record it for echoing, for this-command-keys, and so on. */
/* Record a key that came from a mouse menu.
Record it for echoing, for this-command-keys, and so on. */
@@
-3254,13
+3263,11
@@
record_menu_key (Lisp_Object c)
/* Record this character as part of the current key. */
add_command_key (c);
/* Record this character as part of the current key. */
add_command_key (c);
- /* Re-reading in the middle of a command */
+ /* Re-reading in the middle of a command
.
*/
last_input_event = c;
num_input_events++;
}
last_input_event = c;
num_input_events++;
}
-#endif /* HAVE_MENUS */
-
/* Return true if should recognize C as "the help character". */
static bool
/* Return true if should recognize C as "the help character". */
static bool
@@
-3826,7
+3833,7
@@
kbd_buffer_get_event (KBOARD **kbp,
}
#endif /* subprocesses */
}
#endif /* subprocesses */
-#if
ndef HAVE_DBUS /* We want to read D-Bus events in batch mode. */
+#if
!defined HAVE_DBUS && !defined USE_FILE_NOTIFY
if (noninteractive
/* In case we are running as a daemon, only do this before
detaching from the terminal. */
if (noninteractive
/* In case we are running as a daemon, only do this before
detaching from the terminal. */
@@
-3837,7
+3844,7
@@
kbd_buffer_get_event (KBOARD **kbp,
*kbp = current_kboard;
return obj;
}
*kbp = current_kboard;
return obj;
}
-#endif /* !
HAVE_DBUS
*/
+#endif /* !
defined HAVE_DBUS && !defined USE_FILE_NOTIFY
*/
/* Wait until there is input available. */
for (;;)
/* Wait until there is input available. */
for (;;)
@@
-5306,6
+5313,20
@@
make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
dy = yret = wy;
}
/* Nothing special for part == ON_SCROLL_BAR. */
dy = yret = wy;
}
/* Nothing special for part == ON_SCROLL_BAR. */
+ else if (part == ON_RIGHT_DIVIDER)
+ {
+ posn = Qright_divider;
+ width = WINDOW_RIGHT_DIVIDER_WIDTH (w);
+ dx = xret = wx;
+ dy = yret = wy;
+ }
+ else if (part == ON_BOTTOM_DIVIDER)
+ {
+ posn = Qbottom_divider;
+ width = WINDOW_BOTTOM_DIVIDER_WIDTH (w);
+ dx = xret = wx;
+ dy = yret = wy;
+ }
/* For clicks in the text area, fringes, or margins, call
buffer_posn_from_coords to extract TEXTPOS, the buffer
/* For clicks in the text area, fringes, or margins, call
buffer_posn_from_coords to extract TEXTPOS, the buffer
@@
-5460,14
+5481,13
@@
make_lispy_event (struct input_event *event)
case NON_ASCII_KEYSTROKE_EVENT:
button_down_time = 0;
case NON_ASCII_KEYSTROKE_EVENT:
button_down_time = 0;
- for (i = 0; i <
sizeof (lispy_accent_codes) / sizeof (int
); i++)
+ for (i = 0; i <
ARRAYELTS (lispy_accent_codes
); i++)
if (event->code == lispy_accent_codes[i])
return modify_event_symbol (i,
event->modifiers,
Qfunction_key, Qnil,
lispy_accent_keys, &accent_key_syms,
if (event->code == lispy_accent_codes[i])
return modify_event_symbol (i,
event->modifiers,
Qfunction_key, Qnil,
lispy_accent_keys, &accent_key_syms,
- (sizeof (lispy_accent_keys)
- / sizeof (lispy_accent_keys[0])));
+ ARRAYELTS (lispy_accent_keys));
#if 0
#ifdef XK_kana_A
#if 0
#ifdef XK_kana_A
@@
-5476,8
+5496,7
@@
make_lispy_event (struct input_event *event)
event->modifiers & ~shift_modifier,
Qfunction_key, Qnil,
lispy_kana_keys, &func_key_syms,
event->modifiers & ~shift_modifier,
Qfunction_key, Qnil,
lispy_kana_keys, &func_key_syms,
- (sizeof (lispy_kana_keys)
- / sizeof (lispy_kana_keys[0])));
+ ARRAYELTS (lispy_kana_keys));
#endif /* XK_kana_A */
#endif /* 0 */
#endif /* XK_kana_A */
#endif /* 0 */
@@
-5488,15
+5507,14
@@
make_lispy_event (struct input_event *event)
event->modifiers,
Qfunction_key, Qnil,
iso_lispy_function_keys, &func_key_syms,
event->modifiers,
Qfunction_key, Qnil,
iso_lispy_function_keys, &func_key_syms,
- (sizeof (iso_lispy_function_keys)
- / sizeof (iso_lispy_function_keys[0])));
+ ARRAYELTS (iso_lispy_function_keys));
#endif
/* Handle system-specific or unknown keysyms. */
if (event->code & (1 << 28)
|| event->code - FUNCTION_KEY_OFFSET < 0
|| (event->code - FUNCTION_KEY_OFFSET
#endif
/* Handle system-specific or unknown keysyms. */
if (event->code & (1 << 28)
|| event->code - FUNCTION_KEY_OFFSET < 0
|| (event->code - FUNCTION_KEY_OFFSET
- >=
sizeof lispy_function_keys / sizeof *lispy_function_keys
)
+ >=
ARRAYELTS (lispy_function_keys)
)
|| !lispy_function_keys[event->code - FUNCTION_KEY_OFFSET])
{
/* We need to use an alist rather than a vector as the cache
|| !lispy_function_keys[event->code - FUNCTION_KEY_OFFSET])
{
/* We need to use an alist rather than a vector as the cache
@@
-5515,20
+5533,17
@@
make_lispy_event (struct input_event *event)
event->modifiers,
Qfunction_key, Qnil,
lispy_function_keys, &func_key_syms,
event->modifiers,
Qfunction_key, Qnil,
lispy_function_keys, &func_key_syms,
- (sizeof (lispy_function_keys)
- / sizeof (lispy_function_keys[0])));
+ ARRAYELTS (lispy_function_keys));
#ifdef HAVE_NTGUI
case MULTIMEDIA_KEY_EVENT:
#ifdef HAVE_NTGUI
case MULTIMEDIA_KEY_EVENT:
- if (event->code < (sizeof (lispy_multimedia_keys)
- / sizeof (lispy_multimedia_keys[0]))
+ if (event->code < ARRAYELTS (lispy_multimedia_keys)
&& event->code > 0 && lispy_multimedia_keys[event->code])
{
return modify_event_symbol (event->code, event->modifiers,
Qfunction_key, Qnil,
lispy_multimedia_keys, &func_key_syms,
&& event->code > 0 && lispy_multimedia_keys[event->code])
{
return modify_event_symbol (event->code, event->modifiers,
Qfunction_key, Qnil,
lispy_multimedia_keys, &func_key_syms,
- (sizeof (lispy_multimedia_keys)
- / sizeof (lispy_multimedia_keys[0])));
+ ARRAYELTS (lispy_multimedia_keys));
}
return Qnil;
#endif
}
return Qnil;
#endif
@@
-6250,7
+6265,7
@@
static const char *const modifier_names[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, "alt", "super", "hyper", "shift", "control", "meta"
};
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, "alt", "super", "hyper", "shift", "control", "meta"
};
-#define NUM_MOD_NAMES
(sizeof (modifier_names) / sizeof (modifier_names[0])
)
+#define NUM_MOD_NAMES
ARRAYELTS (modifier_names
)
static Lisp_Object modifier_symbols;
static Lisp_Object modifier_symbols;
@@
-7105,7
+7120,12
@@
unblock_input_to (int level)
/* End critical section.
If doing signal-driven input, and a signal came in when input was
/* End critical section.
If doing signal-driven input, and a signal came in when input was
- blocked, reinvoke the signal handler now to deal with it. */
+ blocked, reinvoke the signal handler now to deal with it.
+
+ It will also process queued input, if it was not read before.
+ When a longer code sequence does not use block/unblock input
+ at all, the whole input gathered up to the next call to
+ unblock_input will be processed inside that call. */
void
unblock_input (void)
void
unblock_input (void)
@@
-7270,7
+7290,7
@@
store_user_signal_events (void)
}
\f
}
\f
-static void menu_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*);
+static void menu_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void
*);
static Lisp_Object menu_bar_one_keymap_changed_items;
/* These variables hold the vector under construction within
static Lisp_Object menu_bar_one_keymap_changed_items;
/* These variables hold the vector under construction within
@@
-7280,7
+7300,7
@@
static Lisp_Object menu_bar_items_vector;
static int menu_bar_items_index;
static int menu_bar_items_index;
-static const char
*
separator_names[] = {
+static const char
*
separator_names[] = {
"space",
"no-line",
"single-line",
"space",
"no-line",
"single-line",
@@
-7888,7
+7908,8
@@
static Lisp_Object QCrtl;
/* Function prototypes. */
static void init_tool_bar_items (Lisp_Object);
/* Function prototypes. */
static void init_tool_bar_items (Lisp_Object);
-static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*);
+static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object,
+ void *);
static bool parse_tool_bar_item (Lisp_Object, Lisp_Object);
static void append_tool_bar_item (void);
static bool parse_tool_bar_item (Lisp_Object, Lisp_Object);
static void append_tool_bar_item (void);
@@
-8359,7
+8380,6
@@
read_char_x_menu_prompt (Lisp_Object map,
if (! menu_prompting)
return Qnil;
if (! menu_prompting)
return Qnil;
-#ifdef HAVE_MENUS
/* If we got to this point via a mouse click,
use a real menu for mouse selection. */
if (EVENT_HAS_PARAMETERS (prev_event)
/* If we got to this point via a mouse click,
use a real menu for mouse selection. */
if (EVENT_HAS_PARAMETERS (prev_event)
@@
-8405,7
+8425,6
@@
read_char_x_menu_prompt (Lisp_Object map,
*used_mouse_menu = 1;
return value;
}
*used_mouse_menu = 1;
return value;
}
-#endif /* HAVE_MENUS */
return Qnil ;
}
return Qnil ;
}
@@
-9742,7
+9761,7
@@
read_key_sequence_vs (Lisp_Object prompt, Lisp_Object continue_echo,
memset (keybuf, 0, sizeof keybuf);
GCPRO1 (keybuf[0]);
memset (keybuf, 0, sizeof keybuf);
GCPRO1 (keybuf[0]);
- gcpro1.nvars =
(sizeof keybuf / sizeof (keybuf[0])
);
+ gcpro1.nvars =
ARRAYELTS (keybuf
);
if (NILP (continue_echo))
{
if (NILP (continue_echo))
{
@@
-9756,7
+9775,7
@@
read_key_sequence_vs (Lisp_Object prompt, Lisp_Object continue_echo,
cancel_hourglass ();
#endif
cancel_hourglass ();
#endif
- i = read_key_sequence (keybuf,
(sizeof keybuf / sizeof (keybuf[0])
),
+ i = read_key_sequence (keybuf,
ARRAYELTS (keybuf
),
prompt, ! NILP (dont_downcase_last),
! NILP (can_return_switch_frame), 0, 0);
prompt, ! NILP (dont_downcase_last),
! NILP (can_return_switch_frame), 0, 0);
@@
-10057,7
+10076,10
@@
DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1,
"FOpen dribble file: ",
doc: /* Start writing all keyboard characters to a dribble file called FILE.
If FILE is nil, close any open dribble file.
"FOpen dribble file: ",
doc: /* Start writing all keyboard characters to a dribble file called FILE.
If FILE is nil, close any open dribble file.
-The file will be closed when Emacs exits. */)
+The file will be closed when Emacs exits.
+
+Be aware that this records ALL characters you type!
+This may include sensitive information such as passwords. */)
(Lisp_Object file)
{
if (dribble)
(Lisp_Object file)
{
if (dribble)
@@
-10069,8
+10091,15
@@
The file will be closed when Emacs exits. */)
}
if (!NILP (file))
{
}
if (!NILP (file))
{
+ int fd;
+ Lisp_Object encfile;
+
file = Fexpand_file_name (file, Qnil);
file = Fexpand_file_name (file, Qnil);
- dribble = emacs_fopen (SSDATA (file), "w");
+ encfile = ENCODE_FILE (file);
+ fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600);
+ if (fd < 0 && errno == EEXIST && unlink (SSDATA (encfile)) == 0)
+ fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600);
+ dribble = fd < 0 ? 0 : fdopen (fd, "w");
if (dribble == 0)
report_file_error ("Opening dribble", file);
}
if (dribble == 0)
report_file_error ("Opening dribble", file);
}
@@
-10148,7
+10177,7
@@
On such systems, Emacs starts a subshell instead of suspending. */)
with a window system; but suspend should be disabled in that case. */
get_tty_size (fileno (CURTTY ()->input), &width, &height);
if (width != old_width || height != old_height)
with a window system; but suspend should be disabled in that case. */
get_tty_size (fileno (CURTTY ()->input), &width, &height);
if (width != old_width || height != old_height)
- change_frame_size (SELECTED_FRAME (),
height, width
, 0, 0, 0);
+ change_frame_size (SELECTED_FRAME (),
width, height, 0
, 0, 0, 0);
/* Run suspend-resume-hook. */
hook = intern ("suspend-resume-hook");
/* Run suspend-resume-hook. */
hook = intern ("suspend-resume-hook");
@@
-10281,6
+10310,9
@@
static void
handle_interrupt (bool in_signal_handler)
{
char c;
handle_interrupt (bool in_signal_handler)
{
char c;
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGINT);
cancel_echoing ();
cancel_echoing ();
@@
-10292,9
+10324,6
@@
handle_interrupt (bool in_signal_handler)
/* If SIGINT isn't blocked, don't let us be interrupted by
a SIGINT. It might be harmful due to non-reentrancy
in I/O functions. */
/* If SIGINT isn't blocked, don't let us be interrupted by
a SIGINT. It might be harmful due to non-reentrancy
in I/O functions. */
- sigset_t blocked;
- sigemptyset (&blocked);
- sigaddset (&blocked, SIGINT);
pthread_sigmask (SIG_BLOCK, &blocked, 0);
}
pthread_sigmask (SIG_BLOCK, &blocked, 0);
}
@@
-10379,7
+10408,7
@@
handle_interrupt (bool in_signal_handler)
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
immediate_quit = 0;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
immediate_quit = 0;
- pthread_sigmask (SIG_
SETMASK, &empty_mask
, 0);
+ pthread_sigmask (SIG_
UNBLOCK, &blocked
, 0);
saved = gl_state;
GCPRO4 (saved.object, saved.global_code,
saved.current_syntax_table, saved.old_prop);
saved = gl_state;
GCPRO4 (saved.object, saved.global_code,
saved.current_syntax_table, saved.old_prop);
@@
-10400,7
+10429,7
@@
handle_interrupt (bool in_signal_handler)
}
}
}
}
- pthread_sigmask (SIG_
SETMASK, &empty_mask
, 0);
+ pthread_sigmask (SIG_
UNBLOCK, &blocked
, 0);
/* TODO: The longjmp in this call throws the NS event loop integration off,
and it seems to do fine without this. Probably some attention
/* TODO: The longjmp in this call throws the NS event loop integration off,
and it seems to do fine without this. Probably some attention
@@
-10659,7
+10688,7
@@
The elements of this list correspond to the arguments of
}
XSETFASTINT (val[3], quit_char);
}
XSETFASTINT (val[3], quit_char);
- return Flist (
sizeof (val) / sizeof (val[0]
), val);
+ return Flist (
ARRAYELTS (val
), val);
}
DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0,
}
DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0,
@@
-10984,6
+11013,8
@@
syms_of_keyboard (void)
DEFSYM (Qvertical_line, "vertical-line");
DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar");
DEFSYM (Qmenu_bar, "menu-bar");
DEFSYM (Qvertical_line, "vertical-line");
DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar");
DEFSYM (Qmenu_bar, "menu-bar");
+ DEFSYM (Qright_divider, "right-divider");
+ DEFSYM (Qbottom_divider, "bottom-divider");
DEFSYM (Qmouse_fixup_help_message, "mouse-fixup-help-message");
DEFSYM (Qmouse_fixup_help_message, "mouse-fixup-help-message");
@@
-11025,7
+11056,7
@@
syms_of_keyboard (void)
{
int i;
{
int i;
- int len =
sizeof (head_table) / sizeof (head_table[0]
);
+ int len =
ARRAYELTS (head_table
);
for (i = 0; i < len; i++)
{
for (i = 0; i < len; i++)
{
@@
-11041,14
+11072,13
@@
syms_of_keyboard (void)
staticpro (&button_down_location);
mouse_syms = Fmake_vector (make_number (5), Qnil);
staticpro (&mouse_syms);
staticpro (&button_down_location);
mouse_syms = Fmake_vector (make_number (5), Qnil);
staticpro (&mouse_syms);
- wheel_syms = Fmake_vector (make_number (sizeof (lispy_wheel_names)
- / sizeof (lispy_wheel_names[0])),
+ wheel_syms = Fmake_vector (make_number (ARRAYELTS (lispy_wheel_names)),
Qnil);
staticpro (&wheel_syms);
{
int i;
Qnil);
staticpro (&wheel_syms);
{
int i;
- int len =
sizeof (modifier_names) / sizeof (modifier_names[0]
);
+ int len =
ARRAYELTS (modifier_names
);
modifier_symbols = Fmake_vector (make_number (len), Qnil);
for (i = 0; i < len; i++)
modifier_symbols = Fmake_vector (make_number (len), Qnil);
for (i = 0; i < len; i++)
@@
-11367,6
+11397,7
@@
and tests the value when the command returns.
Buffer modification stores t in this variable. */);
Vdeactivate_mark = Qnil;
DEFSYM (Qdeactivate_mark, "deactivate-mark");
Buffer modification stores t in this variable. */);
Vdeactivate_mark = Qnil;
DEFSYM (Qdeactivate_mark, "deactivate-mark");
+ Fmake_variable_buffer_local (Qdeactivate_mark);
DEFVAR_LISP ("pre-command-hook", Vpre_command_hook,
doc: /* Normal hook run before each command is executed.
DEFVAR_LISP ("pre-command-hook", Vpre_command_hook,
doc: /* Normal hook run before each command is executed.
@@
-11407,18
+11438,19
@@
tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */);
DEFVAR_KBOARD ("overriding-terminal-local-map",
Voverriding_terminal_local_map,
doc: /* Per-terminal keymap that takes precedence over all other keymaps.
DEFVAR_KBOARD ("overriding-terminal-local-map",
Voverriding_terminal_local_map,
doc: /* Per-terminal keymap that takes precedence over all other keymaps.
-
This variable is intended to let commands such as `universal-argument'
set up a different keymap for reading the next command.
`overriding-terminal-local-map' has a separate binding for each
This variable is intended to let commands such as `universal-argument'
set up a different keymap for reading the next command.
`overriding-terminal-local-map' has a separate binding for each
-terminal device.
-See Info node `(elisp)Multiple Terminals'. */);
+terminal device. See Info node `(elisp)Multiple Terminals'. */);
DEFVAR_LISP ("overriding-local-map", Voverriding_local_map,
DEFVAR_LISP ("overriding-local-map", Voverriding_local_map,
- doc: /* Keymap that overrides almost all other local keymaps.
-If this variable is non-nil, it is used as a keymap--replacing the
-buffer's local map, the minor mode keymaps, and char property keymaps. */);
+ doc: /* Keymap that replaces (overrides) local keymaps.
+If this variable is non-nil, Emacs looks up key bindings in this
+keymap INSTEAD OF the keymap char property, minor mode maps, and the
+buffer's local map. Hence, the only active keymaps would be
+`overriding-terminal-local-map', this keymap, and `global-keymap', in
+order of precedence. */);
Voverriding_local_map = Qnil;
DEFVAR_LISP ("overriding-local-map-menu-flag", Voverriding_local_map_menu_flag,
Voverriding_local_map = Qnil;
DEFVAR_LISP ("overriding-local-map-menu-flag", Voverriding_local_map_menu_flag,