help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Help with keybinding to delete between {}


From: Xah Lee
Subject: Re: Help with keybinding to delete between {}
Date: Thu, 13 Dec 2007 02:39:13 -0800 (PST)
User-agent: G2/1.0

Google Groups diddles with my unicode chars.

The unadulterated code can be found here:
http://xahlee.org/emacs/elisp_examples.html

--------------

am not sure what's the prob with google. Don't know if they are still
experimenting with unicode chars in posts or what. I often use U+00AB
and U+00BB (french double angle quotes, here: <<>>). But starting about
2007-09, google groups either deletes them, or replace them with <<
and >>, or botched the replacement lopsided. (and this transformation
apparantly took place before it is posted, so it's distributed to all
other places, not just a displaying issue on goople groups) This week
i also noticed that they replace my bullet char "*" by a asterisk "*".

i'll be using one of the chinese quotations "「」『』〈〉《》" for posting i
think. For the bullet i might use a start "★" or heart "♥".

  Xah
  xah@xahlee.org
∑ http://xahlee.org/

On Dec 12, 7:59 pm, Mike Mattie <codermat...@gmail.com> wrote:
> On Thu, 6 Dec 2007 09:14:12 -0800 (PST)
>
>
>
> Xah Lee <x...@xahlee.org> wrote:
> > for some reason my code in the previous post is completely non-
> > functional. (i swear i used it for few months. Perhaps when i put on
> > the website i got smart and edited it "for the better" without
> > testing)
>
> > Here's the correct version:
>
> > (defun delete-enclosed-text ()
> >   "Delete texts between any pair of delimiters.
> > Note: if you have nested matching pairs, the cursor
> > should be inside the inner most one. Else it gets confused.
> > This code should to be fixed in the future."
> >   (interactive)
> >   (save-excursion
> >     (let (p1 p2)
> >       (skip-chars-backward "^(<["<<") (setq p1 (point))
> >       (skip-chars-forward "^)>]">>") (setq p2 (point))
> >       (delete-region p1 p2)
> >     )
> >   )
> > )
>
> I don't this this can be right. on a single line it has three string 
> quotation characters.
>
> (defun delete-enclosed-text ()
>    "Delete texts between any pair of delimiters.
>  Note: if you have nested matching pairs, the cursor
>  should be inside the inner most one. Else it gets confused.
>  This code should to be fixed in the future."
>    (interactive)
>   (skip-chars-forward "^)>>")
>   (delete-backward-char (skip-chars-backward "^(<<")))
>
> this version doesn't change the mark so I dropped the save-excursion. It is 
> not quite right because
> it does not handle nested sexp at all. I don't understand the elisp flavor of 
> regex yet, so it's
> probably an easy fix.



reply via email to

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