unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Killing punctuation chars enclosed with delimiters via backward-kill-word
@ 2013-08-06 10:29 Dmitry Cherkassov
  2013-08-06 14:46 ` Doug Lewan
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Cherkassov @ 2013-08-06 10:29 UTC (permalink / raw)
  To: help-gnu-emacs

Hi list. Here is my question.

Suppose this text:

int variable;
[
 ^
 |
 +- Pressing M-h here will erase ``variable;''. I don't like this behavior.

Is there a functionality to kill only punctuation char if it is enclosed by
delimiters or newlines?

More examples:

int array [
          ^
          |
          + - Pressing M-h here kills ``array'' as well

int array []
            ^
            |
            + - Pressing M-h here kills ``array'' as well


         + - pressing M-d Here kills ``int''
         |
         V
int array [];
int val;


Any ideas?

Could this be resolved by hacking syntax-table? Or we should rewrite
``backward-kill-ford'' and ``kill-word'' functions?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Killing punctuation chars enclosed with delimiters via backward-kill-word
  2013-08-06 10:29 Dmitry Cherkassov
@ 2013-08-06 14:46 ` Doug Lewan
  0 siblings, 0 replies; 4+ messages in thread
From: Doug Lewan @ 2013-08-06 14:46 UTC (permalink / raw)
  To: Dmitry Cherkassov, help-gnu-emacs@gnu.org

Dmitry,

M-d invokes delete-word. The deletion is based on word-syntax.

You could write an different command using `skip-syntax-forward' and map the new command to M-d.

`backward-kill-word' will have the same issue.

(FYI M-h runs mark-paragraph for me. I'm using emacs 24.3.)

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

These are my principles and if you don't like them... well, I have others. - Groucho Marx

-----Original Message-----
From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On Behalf Of Dmitry Cherkassov
Sent: Tuesday, 2013 August 06 06:29
To: help-gnu-emacs@gnu.org
Subject: Killing punctuation chars enclosed with delimiters via backward-kill-word

Hi list. Here is my question.

Suppose this text:

int variable;
[
 ^
 |
 +- Pressing M-h here will erase ``variable;''. I don't like this behavior.

Is there a functionality to kill only punctuation char if it is enclosed by
delimiters or newlines?

More examples:

int array [
          ^
          |
          + - Pressing M-h here kills ``array'' as well

int array []
            ^
            |
            + - Pressing M-h here kills ``array'' as well


         + - pressing M-d Here kills ``int''
         |
         V
int array [];
int val;


Any ideas?

Could this be resolved by hacking syntax-table? Or we should rewrite
``backward-kill-ford'' and ``kill-word'' functions?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Killing punctuation chars enclosed with delimiters via backward-kill-word
       [not found] <5200c216.b461700a.2b09.24b9@mx.google.com>
@ 2013-08-07 22:18 ` Dmitry Cherkassov
       [not found] ` <mailman.2696.1375913926.12400.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Cherkassov @ 2013-08-07 22:18 UTC (permalink / raw)
  To: help-gnu-emacs

In case anybody is interested:

I've rewritten those two kill-words functions, as Doug advised, to
follow my desired behaviour.

https://github.com/4DA/emacs-stuff/blob/master/smart-kill.el


-- 
With best regards,
Dmitry



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Killing punctuation chars enclosed with delimiters via backward-kill-word
       [not found] ` <mailman.2696.1375913926.12400.help-gnu-emacs@gnu.org>
@ 2013-08-13 16:17   ` Jim Diamond
  0 siblings, 0 replies; 4+ messages in thread
From: Jim Diamond @ 2013-08-13 16:17 UTC (permalink / raw)
  To: help-gnu-emacs

On 2013-08-07 at 19:18 ADT, Dmitry Cherkassov <dcherkassov@gmail.com> wrote:
> In case anybody is interested:
>
> I've rewritten those two kill-words functions, as Doug advised, to
> follow my desired behaviour.
>
> https://github.com/4DA/emacs-stuff/blob/master/smart-kill.el

You might consider changing the comments at the top of the file
("mode-cycle"?!) to match the code :-)

Cheers


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-13 16:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5200c216.b461700a.2b09.24b9@mx.google.com>
2013-08-07 22:18 ` Killing punctuation chars enclosed with delimiters via backward-kill-word Dmitry Cherkassov
     [not found] ` <mailman.2696.1375913926.12400.help-gnu-emacs@gnu.org>
2013-08-13 16:17   ` Jim Diamond
2013-08-06 10:29 Dmitry Cherkassov
2013-08-06 14:46 ` Doug Lewan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).