From: Alan M. <ac...@mu...> - 2004-04-10 14:28:47
|
On Fri, 9 Apr 2004, Martin Stjernholm wrote: >Alan Mackenzie <ac...@mu...> wrote: >> However, If point is just after the \ of and escaped newline, c-b-s-c >> doesn't move. The immediate reason for this is the following line of >> code near the beginning of the function: >> (let ((start (point))) >> ;; When we got newline terminated comments, forward-comment in all >> ;; supported emacsen so far will stop at eol of each line not >> ;; ending with a comment when moving backwards. This corrects for >> ;; that, and at the same time handles line continuations. >> (while (progn >> (skip-chars-backward " \t\n\r\f\v") >> (and (looking-at "[\n\r]") >> (eq (char-before) ?\\) >> (< (point) start))) ; <=============================== >> (backward-char)) >> I don't understand why this check, (< (point) start), is done. Is there >> any reason for it, or could I simply delete it? >There's a design-wise reason for it, namely that the backslash and the >newline both are considered to make up the syntactic whitespace, and >you have to stand after and not in the middle of it to jump over it. >It's the same thing as newline ended comments. There you also need to >be at the beginning of the next line to skip past it; if you're at the >end of the same line you're considered to be within the comment. I don't think the analogy quite holds. One has a sequence of characters which look like whitespace from the beginning, they look like whitespace from the end, yet looking backwards at them from the middle they don't look like whitespace. It seems like a conjuring trick, where you only see an object if you look at it from exactly the right (wrong?) place. Surely the \<EOL> combination should either definitely be whitespace or definitely not be whitespace, I think. I wish I could be sure. ;-( >As for a practical reason, I don't really know. It seems unlikely that >removing that extra check will actually break any code right now, but >I'm not sure of that. >What's the situation where it's causing problems? Keeping the design >consistent is a bit nice for its own sake, but if it's causing >headaches for you, it might be best to change it anyway. One does an M-a (`c-beginning-of-statement') from after the \ in an \<EOL> pair. It gets stuck at the \ in c-backward-single-comment. It wouldn't be difficult to check for \<EOL> at the places where c-backward-single-comment is called, but it doesn't feel like the Right Way to do it. -- Alan. |