* Re: I want to make C-d works in two ways.
[not found] <55f24183-4134-4748-b9d1-b3864afd39b2@x24g2000pro.googlegroups.com>
@ 2010-07-24 21:14 ` Andreas Politz
2010-07-26 8:17 ` Elena
2010-07-25 6:59 ` David Kastrup
1 sibling, 1 reply; 7+ messages in thread
From: Andreas Politz @ 2010-07-24 21:14 UTC (permalink / raw)
To: help-gnu-emacs
Jeongtae Roh <basil83@gmail.com> writes:
> Hi.
>
> I tried to find out a solution by myself, but failed.
>
> I hope C-d do "kill-region" command when I selected words or
> sentences.
>
> Now it works only as "delete-forward-character", even if I activate a
> region.
>
> So I studied the original code of CUA mode, because it has a function
> like this:
>
> ;; Only when the region is currently active (and highlighted since
> ;; transient-mark-mode is used), the C-x and C-c keys will work as CUA
> ;; keys
> ;; C-x -> cut
> ;; C-c -> copy
> ;; When the region is not active, C-x and C-c works as prefix keys!
>
> Can anybody tell me what should I do?
>
>
> -- Jeongtae
That's easy. Use `use-region-p' to branch to the desired command and
`call-interactively' for not having to bother about the arguments.
(defun kill-region/delete-forward-character ()
(interactive)
(call-interactively (if (use-region-p)
'kill-region
'delete-char)))
-ap
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: I want to make C-d works in two ways.
[not found] <55f24183-4134-4748-b9d1-b3864afd39b2@x24g2000pro.googlegroups.com>
2010-07-24 21:14 ` I want to make C-d works in two ways Andreas Politz
@ 2010-07-25 6:59 ` David Kastrup
2011-03-09 23:50 ` Brendan Halpin
1 sibling, 1 reply; 7+ messages in thread
From: David Kastrup @ 2010-07-25 6:59 UTC (permalink / raw)
To: help-gnu-emacs
Jeongtae Roh <basil83@gmail.com> writes:
> I tried to find out a solution by myself, but failed.
>
> I hope C-d do "kill-region" command when I selected words or
> sentences.
>
That's default in the development version:
delete-active-region is a variable defined in `simple.el'.
Its value is t
Documentation:
Whether single-char deletion commands delete an active region.
This has an effect only if Transient Mark mode is enabled, and
affects `delete-forward-char' and `delete-backward-char', though
not `delete-char'.
If the value is the symbol `kill', the active region is killed
instead of deleted.
You can customize this variable.
This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.
--
David Kastrup
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: I want to make C-d works in two ways.
2010-07-24 21:14 ` I want to make C-d works in two ways Andreas Politz
@ 2010-07-26 8:17 ` Elena
2010-07-26 9:24 ` Andreas Politz
0 siblings, 1 reply; 7+ messages in thread
From: Elena @ 2010-07-26 8:17 UTC (permalink / raw)
To: help-gnu-emacs
On Jul 24, 9:14 pm, Andreas Politz <poli...@fh-trier.de> wrote:
> That's easy. Use `use-region-p' to branch to the desired command and
> `call-interactively' for not having to bother about the arguments.
Thank you very much, Andreas.
Is this the recommended way to write commands which act on the region?
Until now, I was just using `region-active-p'.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: I want to make C-d works in two ways.
2010-07-26 8:17 ` Elena
@ 2010-07-26 9:24 ` Andreas Politz
2010-07-26 13:07 ` TheFlyingDutchman
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Politz @ 2010-07-26 9:24 UTC (permalink / raw)
To: help-gnu-emacs
Elena <egarrulo@gmail.com> writes:
> On Jul 24, 9:14 pm, Andreas Politz <poli...@fh-trier.de> wrote:
>> That's easy. Use `use-region-p' to branch to the desired command and
>> `call-interactively' for not having to bother about the arguments.
>
> Thank you very much, Andreas.
>
> Is this the recommended way to write commands which act on the region?
> Until now, I was just using `region-active-p'.
Take a look at the function doc and it'll tell you the difference.
-ap
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: I want to make C-d works in two ways.
2010-07-26 9:24 ` Andreas Politz
@ 2010-07-26 13:07 ` TheFlyingDutchman
0 siblings, 0 replies; 7+ messages in thread
From: TheFlyingDutchman @ 2010-07-26 13:07 UTC (permalink / raw)
To: help-gnu-emacs
On Jul 26, 2:24 am, Andreas Politz <poli...@fh-trier.de> wrote:
> Elena <egarr...@gmail.com> writes:
> > On Jul 24, 9:14 pm, Andreas Politz <poli...@fh-trier.de> wrote:
> >> That's easy. Use `use-region-p' to branch to the desired command and
> >> `call-interactively' for not having to bother about the arguments.
>
> > Thank you very much, Andreas.
>
> > Is this the recommended way to write commands which act on the region?
> > Until now, I was just using `region-active-p'.
>
> Take a look at the function doc and it'll tell you the difference.
>
> -ap
It there a way to determine what version of Emacs a function first hit
the scene?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: I want to make C-d works in two ways.
2010-07-25 6:59 ` David Kastrup
@ 2011-03-09 23:50 ` Brendan Halpin
2011-03-10 1:38 ` Richard Riley
0 siblings, 1 reply; 7+ messages in thread
From: Brendan Halpin @ 2011-03-09 23:50 UTC (permalink / raw)
To: help-gnu-emacs
On Sun, Jul 25 2010, David Kastrup wrote:
> delete-active-region is a variable defined in `simple.el'.
> Its value is t
>
> Documentation:
> Whether single-char deletion commands delete an active region.
> This has an effect only if Transient Mark mode is enabled, and
> affects `delete-forward-char' and `delete-backward-char', though
> not `delete-char'.
>
> If the value is the symbol `kill', the active region is killed
> instead of deleted.
I've just discovered this and I hate it!
I reckon I'll just have to (setq delete-active-region nil) and
<flame-bait>live with being marginalised by all the new kids who want
Emacs to be more like Windows</flamebait>.
Brendan
--
Brendan Halpin, Department of Sociology, University of Limerick, Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F1-009 x 3147
mailto:brendan.halpin@ul.ie http://www.ul.ie/sociology/brendan.halpin.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: I want to make C-d works in two ways.
2011-03-09 23:50 ` Brendan Halpin
@ 2011-03-10 1:38 ` Richard Riley
0 siblings, 0 replies; 7+ messages in thread
From: Richard Riley @ 2011-03-10 1:38 UTC (permalink / raw)
To: help-gnu-emacs
brendan.halpin@ul.ie (Brendan Halpin) writes:
> On Sun, Jul 25 2010, David Kastrup wrote:
>
>> delete-active-region is a variable defined in `simple.el'.
>> Its value is t
>>
>> Documentation:
>> Whether single-char deletion commands delete an active region.
>> This has an effect only if Transient Mark mode is enabled, and
>> affects `delete-forward-char' and `delete-backward-char', though
>> not `delete-char'.
>>
>> If the value is the symbol `kill', the active region is killed
>> instead of deleted.
>
> I've just discovered this and I hate it!
>
> I reckon I'll just have to (setq delete-active-region nil) and
> <flame-bait>live with being marginalised by all the new kids who want
> Emacs to be more like Windows</flamebait>.
>
It makes far more sense for the same commands to work on a region as
they do on a char "out of the box" in my opinion. Regardless of whether
you use Windows or not. If I hilite a region its to operate on it. And
delete is an operation. Still, the wonders of emacs customisations mean
that old curmudgeons can have their way too ;)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-10 1:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <55f24183-4134-4748-b9d1-b3864afd39b2@x24g2000pro.googlegroups.com>
2010-07-24 21:14 ` I want to make C-d works in two ways Andreas Politz
2010-07-26 8:17 ` Elena
2010-07-26 9:24 ` Andreas Politz
2010-07-26 13:07 ` TheFlyingDutchman
2010-07-25 6:59 ` David Kastrup
2011-03-09 23:50 ` Brendan Halpin
2011-03-10 1:38 ` Richard Riley
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.