Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
15fff01d
Commit
15fff01d
authored
Dec 29, 2001
by
Richard M. Stallman
Browse files
(silly_event_symbol_error): New subrtn, from Fdefine_key.
Handle modifier bits. Correct typo in error message.
parent
71cf5fa0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
5 deletions
+54
-5
src/ChangeLog
src/ChangeLog
+5
-0
src/keymap.c
src/keymap.c
+49
-5
No files found.
src/ChangeLog
View file @
15fff01d
2001-12-29 Richard M. Stallman <rms@gnu.org>
* keymap.c (silly_event_symbol_error): New subrtn, from Fdefine_key.
Handle modifier bits. Correct typo in error message.
2001-12-28 Richard M. Stallman <rms@gnu.org>
* abbrev.c: Use the plist of an abbrev for multiple params if nec.
...
...
src/keymap.c
View file @
15fff01d
...
...
@@ -115,6 +115,7 @@ static void describe_translation P_ ((Lisp_Object, Lisp_Object));
static
void
describe_map
P_
((
Lisp_Object
,
Lisp_Object
,
void
(
*
)
P_
((
Lisp_Object
,
Lisp_Object
)),
int
,
Lisp_Object
,
Lisp_Object
*
,
int
));
static
void
silly_event_symbol_error
P_
((
Lisp_Object
));
/* Keymap object support - constructors and predicates. */
...
...
@@ -1011,11 +1012,8 @@ the front of KEYMAP. */)
if
(
CONSP
(
c
)
&&
lucid_event_type_list_p
(
c
))
c
=
Fevent_convert_list
(
c
);
if
(
SYMBOLP
(
c
)
&&
!
NILP
(
Fassoc
(
Fsymbol_name
(
c
),
exclude_keys
)))
error
(
"To bind the key %s, use; use
\"
%s
\"
, not [%s]"
,
XSYMBOL
(
c
)
->
name
->
data
,
XSTRING
(
XCDR
(
Fassoc
(
Fsymbol_name
(
c
),
exclude_keys
)))
->
data
,
XSYMBOL
(
c
)
->
name
->
data
);
if
(
SYMBOLP
(
c
))
silly_event_symbol_error
(
c
);
if
(
INTEGERP
(
c
)
&&
(
XINT
(
c
)
&
meta_bit
)
...
...
@@ -1156,6 +1154,52 @@ append_key (key_sequence, key)
return
Fvconcat
(
2
,
args
);
}
/* Given a event type C which is a symbol,
signal an error if is a mistake such as RET or M-RET or C-DEL, etc. */
static
void
silly_event_symbol_error
(
c
)
Lisp_Object
c
;
{
Lisp_Object
parsed
,
base
,
name
,
assoc
;
int
modifiers
;
parsed
=
parse_modifiers
(
c
);
modifiers
=
(
int
)
XUINT
(
XCAR
(
XCDR
(
parsed
)));
base
=
XCAR
(
parsed
);
name
=
Fsymbol_name
(
base
);
/* This alist includes elements such as ("RET" . "\\r"). */
assoc
=
Fassoc
(
name
,
exclude_keys
);
if
(
!
NILP
(
assoc
))
{
char
new_mods
[
sizeof
(
"
\\
A-
\\
C-
\\
H-
\\
M-
\\
S-
\\
s-"
)];
char
*
p
=
new_mods
;
Lisp_Object
keystring
;
if
(
modifiers
&
alt_modifier
)
{
*
p
++
=
'\\'
;
*
p
++
=
'A'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
ctrl_modifier
)
{
*
p
++
=
'\\'
;
*
p
++
=
'C'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
hyper_modifier
)
{
*
p
++
=
'\\'
;
*
p
++
=
'H'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
meta_modifier
)
{
*
p
++
=
'\\'
;
*
p
++
=
'M'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
shift_modifier
)
{
*
p
++
=
'\\'
;
*
p
++
=
'S'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
super_modifier
)
{
*
p
++
=
'\\'
;
*
p
++
=
's'
;
*
p
++
=
'-'
;
}
*
p
=
0
;
c
=
reorder_modifiers
(
c
);
keystring
=
concat2
(
build_string
(
new_mods
),
XCDR
(
assoc
));
error
((
modifiers
&
~
meta_modifier
?
"To bind the key %s, use [?%s], not [%s]"
:
"To bind the key %s, use
\"
%s
\"
, not [%s]"
),
XSYMBOL
(
c
)
->
name
->
data
,
XSTRING
(
keystring
)
->
data
,
XSYMBOL
(
c
)
->
name
->
data
);
}
}
/* Global, local, and minor mode keymap stuff. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment