[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Insert character pairs
From: |
Juri Linkov |
Subject: |
Re: Insert character pairs |
Date: |
Thu, 29 Apr 2004 14:00:32 +0300 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
Andreas Schwab <address@hidden> writes:
> Juri Linkov <address@hidden> writes:
>> (and parens-require-spaces
>> (not (bobp))
>> - (memq (char-syntax (preceding-char)) '(?w ?_ ?\) ))
>> + (memq (char-syntax (preceding-char)) (list ?w ?_ close))
>
> This won't work, the list contains syntax codes, not characters.
Actually, it does work for parentheses arguments, so it is
still backward compatible. But, of course, you are right that
it should be fixed, because it makes no sense for other characters
whose syntax character doesn't coincide with the character itself.
To fix it, it seems reasonable to check for character syntax of
arguments before inserting a space, i.e. insert a space
when character syntax of adjacent characters is the same,
(plus ?w and ?_, i.e. inside words as it was before):
- (memq (char-syntax (preceding-char)) '(?w ?_ ?\) ))
+ (memq (char-syntax (preceding-char)) (list ?w ?_ (char-syntax close)))
- (memq (char-syntax (following-char)) '(?w ?_ ?\( ))
+ (memq (char-syntax (following-char)) (list ?w ?_ (char-syntax open)))
--
Juri Linkov
http://www.jurta.org/emacs/