[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ?\_ patch

From: Kim F. Storm
Subject: Re: ?\_ patch
Date: 07 Feb 2003 11:42:00 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

>     So I suggest that ?\s is a space unless the `s' is immediately followed
>     by `-' (e.g. ?\s-a) in which case it has the usual meaning as a super
>     modifier.
>     In strings, "\s" should also mean a space unless it is following by
>     a `-' (as in "\s-a") which should produce an error as it does now.
> I have a bad feeling about this complication in strings, because it would
> mean introducing a feature that doesn't always work the way people
> would expect it to work.

I agree.

Here's what the Elisp manual says:

   Strings cannot hold characters that have the hyper, super or alt
   modifiers; ...

Since there is definitely NO code today which relies on being able to
specify a super modifier like "\s-a" in a string (emacs will barf with
an "Invalid modifier in string" error if you try), we could simply
define \s to ALWAYS give a space in a string.

Then \s will always work the way people expect!

> Perhaps we could introduce the \s feature only for character constants.
> In that particular context, there is no ambiguity.

If we remove the (non-functional) special meaning of \s in strings as
suggested above, there's no ambiguity for strings either.

Here is a modified patch:

Index: lread.c
RCS file: /cvsroot/emacs/emacs/src/lread.c,v
retrieving revision 1.305
diff -c -r1.305 lread.c
*** lread.c     4 Feb 2003 14:03:12 -0000       1.305
--- lread.c     7 Feb 2003 09:39:46 -0000
*** 1697,1705 ****
        return c | alt_modifier;
      case 's':
        c = READCHAR;
!       if (c != '-')
!       error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
        c = read_escape (readcharfun, 0, byterep);
--- 1697,1709 ----
        return c | alt_modifier;
      case 's':
+       if (stringp)
+       return ' ';
        c = READCHAR;
!       if (c != '-') {
!       UNREAD (c);
!       return ' ';
!       }
        c = READCHAR;
        if (c == '\\')
        c = read_escape (readcharfun, 0, byterep);

BTW, why is `backslash space' ignored in a string?
        "\ " => ""

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]