all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: "Harald Jörg" <haj@posteo.de>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Deleting a word using keybinding
Date: Thu, 15 Oct 2020 22:59:29 +0200	[thread overview]
Message-ID: <trinity-017b053f-8a8a-4018-92b8-7a7e75edd9e3-1602795569703@3c-app-mailcom-bs01> (raw)
In-Reply-To: <a79abbfe-f796-ad21-a7a6-ca6acb063a65@posteo.de>


     I want it to behave as C-<delete>, except that I want to delete the
   current word if
   the cursor happens to be within a word.
   For instance,  consider the following sentence. I want that
   if the cursor point in on the character w of the word Brown,
   the word Brown is also deleted, rather than deleting the word fromw
   onwards.
   The Brown Fox Jumped a Fence
   I also would like that when there are multiple space, I first delete
   the spaces
   and leave just one space rather than deleting the next word.



   Sent: Thursday, October 15, 2020 at 10:25 PM
   From: "Harald Jörg" <haj@posteo.de>
   To: "Christopher Dimech" <dimech@gmx.com>
   Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
   Subject: Re: Deleting a word using keybinding
   On 10/15/20 8:44 PM, Christopher Dimech wrote:
   > I have updated my function to kill words forward so that even if I am
   > in the middle of a word that word will be killed. I also consider
   that
   > if there are multiple spaces, I delete just the spaces spaces but not
   > next word.
   This isn't exactly what the function does: If there are two or more
   spaces between words, then only spaces to the right of point are
   deleted.
   Also, when you delete _all_ spaces, you merge two words into one. This
   is the cause for your observation:
   > I am finding a problem however when deleting part of a sentence by
   > contiuing to press C--<delete> because when the point happens to be
   > between two words, I end up with the two words stuck together (the
   > previous and thn forward), which deletes the two words when I hit
   > C-<delete> again.
   It really pays off when you spend the effort to write down how you
   want the function to behave in all relevant situations. It is good
   practice to have a docstring for your command anyway, and you might
   detect contradictory requirements before you start writing the
   function.
   If point is before a whitespace character, you could either do
   nothing, or delete the previous, or delete the following word, all of
   them make some sense. Deleting whitespace seems somewhat unrelated.
   There still are cases where your function does not what you seem to
   expect: If the text in the buffer is "foo bar", and point is before
   the "a" in "bar", then executing M-x kill-spacword kills "foo".
   --
   Cheers,
   haj


  reply	other threads:[~2020-10-15 20:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 10:26 Deleting a word using keybinding Christopher Dimech
2020-10-15 11:10 ` Jeremie Juste
2020-10-15 11:20 ` Harald Jörg
2020-10-15 16:44   ` Christopher Dimech
2020-10-15 18:44   ` Christopher Dimech
2020-10-15 20:25     ` Harald Jörg
2020-10-15 20:59       ` Christopher Dimech [this message]
2020-10-15 21:06         ` Thien-Thi Nguyen
2020-10-15 21:14           ` Christopher Dimech
2020-10-15 21:22             ` Christopher Dimech
2020-10-15 21:27               ` Drew Adams
2020-10-15 21:48                 ` Christopher Dimech
2020-10-15 21:24             ` Stephen Berman
2020-10-15 11:34 ` Stephen Berman
2020-10-15 13:48 ` Stefan Monnier

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=trinity-017b053f-8a8a-4018-92b8-7a7e75edd9e3-1602795569703@3c-app-mailcom-bs01 \
    --to=dimech@gmx.com \
    --cc=haj@posteo.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.