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

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

Re: Property for treating a string as a single character when deleting


From: Emanuel Berg
Subject: Re: Property for treating a string as a single character when deleting
Date: Mon, 11 Aug 2014 23:29:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Tom <adatgyujto@gmail.com> writes:

> Is there a property or some other way to treat a
> string as a single character? I know I can add the
> intangible property and then cursor movements jumps
> over the string like its a single character. Is there
> a property for making the string behave like this for
> deletion too? So, for example, when I backspace at
> the rightmost character of the string then the whole
> string is deleted at once like it's a single
> character.

You mean like `backward-kill-word', which I have (and
probably you to) at M-DEL - do you want this encoded in
the text so that you don't have to hit Meta, just DEL?
Is that really worth doing? And for what mode? If this
is what you want to do, and you really want it, I think
you would have to locally rebind the DEL key to a
defun; the defun will then do `backward-word', then
`thing-at-point' (or some other combo to that extent),
then examine the properties, and determine if your
special mark is there, if so, the whole thing would be
deleted, if not, the DEL would just do
delete-backward-char as usual. Or, if you don't insist
on the "property method", you could have DEL react to
the char to be deleted - if it is a string delimiter,
search for the corresponding delimiter - if there is a
hit, ... and so on. This all seem like a lot of work
for a really slim gain - and I'm not even sure there is
a gain, because perhaps you'll start "deleting" other
things that way, and expect the whole thing to be
killed, only it won't. I can only speak (for) my mind,
and that would be confused by this. M-DEL is such a
close and comfortable and ingrained way - why not just
use it?

-- 
underground experts united


reply via email to

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