[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5485] Allow C-u ARG M-x COMMAND
From: |
Gavin D. Smith |
Subject: |
[5485] Allow C-u ARG M-x COMMAND |
Date: |
Wed, 23 Apr 2014 15:56:07 +0000 |
Revision: 5485
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5485
Author: gavin
Date: 2014-04-23 15:56:04 +0000 (Wed, 23 Apr 2014)
Log Message:
-----------
Allow C-u ARG M-x COMMAND
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/echo-area.c
trunk/info/session.c
trunk/info/session.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-04-23 12:32:00 UTC (rev 5484)
+++ trunk/ChangeLog 2014-04-23 15:56:04 UTC (rev 5485)
@@ -1,5 +1,15 @@
2014-04-23 Gavin Smith <address@hidden>
+ * info/session.c (ea_explicit_arg, ea_numeric_arg_sign)
+ (ea_numeric_arg): New variables.
+ (info_universal_argument, info_initialize_numeric_arg)
+ (info_numeric_arg_digit_loop, info_dispatch_on_key): Use new
+ variables if in echo area.
+ * echo-area.c (ea_delete, ea_rubout): Use ea_explicit_arg
+ instead of info_explicit_arg.
+
+2014-04-23 Gavin Smith <address@hidden>
+
* info/t/Init-test.inc: Set LC_ALL=C to avoid spurious test
failures in non-English locale.
Modified: trunk/info/echo-area.c
===================================================================
--- trunk/info/echo-area.c 2014-04-23 12:32:00 UTC (rev 5484)
+++ trunk/info/echo-area.c 2014-04-23 15:56:04 UTC (rev 5485)
@@ -408,7 +408,7 @@
if (input_line_point == input_line_end)
return;
- if (info_explicit_arg || count > 1)
+ if (ea_explicit_arg || count > 1)
{
int orig_point;
@@ -441,7 +441,7 @@
start = input_line_point;
ea_backward (window, count, key);
- if (info_explicit_arg || count > 1)
+ if (ea_explicit_arg || count > 1)
ea_kill_text (start, input_line_point);
else
ea_delete (window, count, key);
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-04-23 12:32:00 UTC (rev 5484)
+++ trunk/info/session.c 2014-04-23 15:56:04 UTC (rev 5485)
@@ -5093,9 +5093,16 @@
WINDOW *where;
where = active_window;
- (*InfoFunction(map[key].function))
- (active_window, info_numeric_arg * info_numeric_arg_sign, key);
+ if (!echo_area_is_active)
+ (*InfoFunction(map[key].function))
+ (active_window, info_numeric_arg * info_numeric_arg_sign,
+ key);
+ else
+ (*InfoFunction(map[key].function))
+ (active_window, ea_numeric_arg * ea_numeric_arg_sign,
+ key);
+
/* If we have input pending, then the last command was a prefix
command. Don't change the value of the last function vars.
Otherwise, remember the last command executed in the var
@@ -5154,6 +5161,12 @@
/* The value of the argument itself. */
int info_numeric_arg = 1;
+/* As above, but used when C-u is typed in the echo area to avoid
+ overwriting this information when "C-u ARG M-x" is typed. */
+int ea_explicit_arg = 0;
+int ea_numeric_arg_sign = 1;
+int ea_numeric_arg = 1;
+
/* Add the current digit to the argument in progress. */
DECLARE_INFO_COMMAND (info_add_digit_to_numeric_arg,
_("Add this digit to the current numeric argument"))
@@ -5167,7 +5180,11 @@
DECLARE_INFO_COMMAND (info_universal_argument,
_("Start (or multiply by 4) the current numeric
argument"))
{
- info_numeric_arg *= 4;
+ if (!echo_area_is_active)
+ info_numeric_arg *= 4;
+ else
+ ea_numeric_arg *= 4;
+
info_numeric_arg_digit_loop (window, 0, 0);
}
@@ -5175,8 +5192,16 @@
void
info_initialize_numeric_arg (void)
{
- info_numeric_arg = info_numeric_arg_sign = 1;
- info_explicit_arg = 0;
+ if (!echo_area_is_active)
+ {
+ info_numeric_arg = info_numeric_arg_sign = 1;
+ info_explicit_arg = 0;
+ }
+ else
+ {
+ ea_numeric_arg = ea_numeric_arg_sign = 1;
+ ea_explicit_arg = 0;
+ }
}
DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop,
@@ -5185,6 +5210,23 @@
unsigned char pure_key;
Keymap keymap = window->keymap;
+ int *which_numeric_arg, *which_numeric_arg_sign, *which_explicit_arg;
+
+ /* Process the right numeric argument. FIXME: Not necessarily the
+ nicest way of doing it. */
+ if (!echo_area_is_active)
+ {
+ which_explicit_arg = &info_explicit_arg;
+ which_numeric_arg_sign = &info_numeric_arg_sign;
+ which_numeric_arg = &info_numeric_arg;
+ }
+ else
+ {
+ which_explicit_arg = &ea_explicit_arg;
+ which_numeric_arg_sign = &ea_numeric_arg_sign;
+ which_numeric_arg = &ea_numeric_arg;
+ }
+
while (1)
{
if (key)
@@ -5218,7 +5260,7 @@
&& InfoFunction(keymap[key].function)
== (VFunction *) info_universal_argument)
{
- info_numeric_arg *= 4;
+ *which_numeric_arg *= 4;
key = 0;
continue;
}
@@ -5231,18 +5273,18 @@
if (isdigit (key))
{
- if (info_explicit_arg)
- info_numeric_arg = (info_numeric_arg * 10) + (key - '0');
+ if (*which_explicit_arg)
+ *which_numeric_arg = (*which_numeric_arg * 10) + (key - '0');
else
- info_numeric_arg = (key - '0');
- info_explicit_arg = 1;
+ *which_numeric_arg = (key - '0');
+ *which_explicit_arg = 1;
}
else
{
- if (key == '-' && !info_explicit_arg)
+ if (key == '-' && !*which_explicit_arg)
{
- info_numeric_arg_sign = -1;
- info_numeric_arg = 1;
+ *which_numeric_arg_sign = -1;
+ *which_numeric_arg = 1;
}
else
{
Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h 2014-04-23 12:32:00 UTC (rev 5484)
+++ trunk/info/session.h 2014-04-23 15:56:04 UTC (rev 5485)
@@ -220,8 +220,9 @@
extern void info_last_menu_item (WINDOW *window, int count, unsigned char key);
extern void info_visit_menu (WINDOW *window, int count, unsigned char key);
-/* Hacking numeric arguments. */
+/* Adding numeric arguments. */
extern int info_explicit_arg, info_numeric_arg, info_numeric_arg_sign;
+extern int ea_explicit_arg, ea_numeric_arg, ea_numeric_arg_sign;
extern void info_add_digit_to_numeric_arg (WINDOW *window, int count,
unsigned char key);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5485] Allow C-u ARG M-x COMMAND,
Gavin D. Smith <=