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

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

Re: can a command specify overwrite selection behavior?


From: Xah Lee
Subject: Re: can a command specify overwrite selection behavior?
Date: Sat, 25 Dec 2010 18:20:12 -0800 (PST)
User-agent: G2/1.0

> > Hope this helps, Ilya
>
> Hope it helped you.  I have my doubts that it helped anyone else.

lol. funny. I see a flamewar brewing, and am getting into the fray
here by participating.

I think both Drew and Llya or even me adds good points in the
discussion.

The way i see this is a bug is in the sense that the purpose of delete-
selection property seems to be thwarted by specific way how emacs
works. Namely, the final effect is that it makes a distinction on
whether the command is invoked by M-x or by a hotkey.

so, i tend to see this is not a desired behavior (call it “bug” or
“feature” or “design” or whatnot).

but overall i guess this is trivial? It would be fruitful if someone
do a survey on how many functions actually use the delete-selection
property, or if some emacs oldbie can tell us that property's history.
Am guessing, these days, if elisp programer want the behavior of
deleting existing text selection in commands they write, a reliable
and easy and explicit way is simply to put in the code

  (when (region-active-p)
    (delete-region (region-beginning) (region-end) )
    )

instead of relying on delete-region property. I think elisp function
property is rather esoteric (e.g. it is not a feature in most langs,
and i don't think it is that much widely known or used in elisp) I
think i learned about it when diddling with cua-mode around 2007. The
fact i learned it i think introduced more trouble, because otherwise
i'd put the explicit code above and i wouldn't have posted this or the
bug report. (does anyone know a list of all built-in lisp properties?
(havn't spend any effort to search the manual...))

i think a good question is: from a core emacs developer's point of
view (such as Richard Stallman, or perhaps Drew Adamns and Llya Z. who
designed the system or know the core system well), would you advice to
actually make use of the delete-selection proprety or just use the
explicit code above?

 Xah



reply via email to

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