From: Joe K. <jo...@zi...> - 2003-03-23 18:48:47
|
On Sun, 2003-03-23 at 07:51, Michael A. Shulman wrote: > On Sun, Mar 02, 2003 at 04:39:10PM -0800, Joe Kelsey wrote: > > I also found and fixed a bug in skeleton.el which prevented it from > > moving to the _ position after insertion. > > I could swear that it used to move to the _ position in Emacs 20. > That's so weird. > > But the documentation for skeleton-insert now says "After termination, > point will be positioned at the first occurrence of _ or @ or at the > end of the inserted text," so it's clear that the skeleton developers > are not unaware of this bug, if they consider it a bug. In my book, > it's definitely a bug since that is the point of having the _ position > as opposed to the @ positions. > > Did you submit your patch and get it approved, i.e. is this something > we need to work around, or can we tell people to use a newer version > of skeleton? And either way, where can I get a copy of your patch for > myself? Well, I *thought* I sent the bug in, but I may have had some problem interacting with the newsgroup stuff at the time... Now that I go back and revisit the bug, I am no longer as certain about the solution. The problem is that there are two completely different ways of using skeletons. In the way that mmm-mode uses them, they are simple insertion of text, leaving the point at an interesting place afterwards. The other way of using skeletons is with a set of regions which you want to wrap the skeleton around. This is a rather complex notion, and it took me a little while to get my head around the notion, but it basically involves two incompatible uses of the _ character. When used in a simple insertion skeleton, it only makes sense to have a single _ in your skeleton, to mark the _interesting_ point. When used with a set of regions, each occurrence of _ marks a place to signify a change in regions meaning that you skip over the next region on the stack and resume skeleton insertion after that region. In addition, the @ marks the elements pushed onto a special stack of other interesting points, made available after skeleton processing. If nothing else, the first @ encountered also marks the same interesting point as _ in a non-region skeleton. My idea was to unconditionally make _ in a non-region insertion always mark an interesting point. This falls apart if you have a skeleton with multiple _ used in non-region mode. In this case, you want the first _ to be the interesting point, but then there is competition between @ and _ for which gets to be the first interesting point, and then my solution requires more than just changing (or skeleton-point (setq skeleton-point (point)) in the _ processing. For comparison, the @ processing includes the line (unless skeleton-point (setq skeleton-point (point))) I would have to add another condition to the _ processing to distinguish between having the @ or _ setting skeleton-point. That is something that would require feedback from the maintainers. All of this processing occurs in skeleton-internal-1 in lisp/skeleton.el. I suppose I should try again to submit a bug report. /Joe |