all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: I want to make C-d works in two ways.
Date: Sat, 24 Jul 2010 23:14:39 +0200	[thread overview]
Message-ID: <871vastwe8.fsf@fh-trier.de> (raw)
In-Reply-To: 55f24183-4134-4748-b9d1-b3864afd39b2@x24g2000pro.googlegroups.com

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


       reply	other threads:[~2010-07-24 21:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <55f24183-4134-4748-b9d1-b3864afd39b2@x24g2000pro.googlegroups.com>
2010-07-24 21:14 ` Andreas Politz [this message]
2010-07-26  8:17   ` I want to make C-d works in two ways 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871vastwe8.fsf@fh-trier.de \
    --to=politza@fh-trier.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.