* remove all the whitespace characters from the cursor to the next symbol
@ 2010-03-15 14:43 alex_sv
2010-03-15 22:14 ` B. T. Raven
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: alex_sv @ 2010-03-15 14:43 UTC (permalink / raw)
To: help-gnu-emacs
Hi all!
Could you please clarify - is it possible to remove all the whitespace
characters including newline from the current cursor position to the
next meaningful symbol using one command?
I mean if our buffer's content is as follows:
texttexttext{cursor}___
_
___text
where '_' means space character, is it possible to press some known
key sequence to transform the given above to the following form:
texttexttext{cursor}text
Thanks in advance!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: remove all the whitespace characters from the cursor to the next symbol
2010-03-15 14:43 remove all the whitespace characters from the cursor to the next symbol alex_sv
@ 2010-03-15 22:14 ` B. T. Raven
2010-03-16 1:59 ` despen
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: B. T. Raven @ 2010-03-15 22:14 UTC (permalink / raw)
To: help-gnu-emacs
alex_sv wrote:
> Hi all!
>
> Could you please clarify - is it possible to remove all the whitespace
> characters including newline from the current cursor position to the
> next meaningful symbol using one command?
>
> I mean if our buffer's content is as follows:
>
> texttexttext{cursor}___
> _
> ___text
>
> where '_' means space character, is it possible to press some known
> key sequence to transform the given above to the following form:
>
> texttexttext{cursor}text
>
> Thanks in advance!
Replace regular expression might work:
C-M-%
[_C-qC-j]+ Ret
Ret
where _ is space.
You also might me able to use
\s-
(whitespace syntax)
but I couldn't get it to work.
Ed
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: remove all the whitespace characters from the cursor to the next symbol
2010-03-15 14:43 remove all the whitespace characters from the cursor to the next symbol alex_sv
2010-03-15 22:14 ` B. T. Raven
@ 2010-03-16 1:59 ` despen
2010-03-16 2:56 ` Scott Frazer
2010-05-07 3:34 ` Kevin Rodgers
3 siblings, 0 replies; 8+ messages in thread
From: despen @ 2010-03-16 1:59 UTC (permalink / raw)
To: help-gnu-emacs
alex_sv <avshabanov@gmail.com> writes:
> Hi all!
>
> Could you please clarify - is it possible to remove all the whitespace
> characters including newline from the current cursor position to the
> next meaningful symbol using one command?
>
> I mean if our buffer's content is as follows:
>
> texttexttext{cursor}___
> _
> ___text
>
> where '_' means space character, is it possible to press some known
> key sequence to transform the given above to the following form:
>
> texttexttext{cursor}text
Seems to me regular expressions would be too much typing,
I'd go for:
M-z t t
But this seemed to work:
M-% [ space ^q ^j ] * ret ret y
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: remove all the whitespace characters from the cursor to the next symbol
2010-03-15 14:43 remove all the whitespace characters from the cursor to the next symbol alex_sv
2010-03-15 22:14 ` B. T. Raven
2010-03-16 1:59 ` despen
@ 2010-03-16 2:56 ` Scott Frazer
2010-03-16 9:58 ` alex_sv
2010-05-07 3:34 ` Kevin Rodgers
3 siblings, 1 reply; 8+ messages in thread
From: Scott Frazer @ 2010-03-16 2:56 UTC (permalink / raw)
To: help-gnu-emacs
On Mar 15, 10:43 am, alex_sv <avshaba...@gmail.com> wrote:
> Hi all!
>
> Could you please clarify - is it possible to remove all the whitespace
> characters including newline from the current cursor position to the
> next meaningful symbol using one command?
>
> I mean if our buffer's content is as follows:
>
> texttexttext{cursor}___
> _
> ___text
>
> where '_' means space character, is it possible to press some known
> key sequence to transform the given above to the following form:
>
> texttexttext{cursor}text
>
> Thanks in advance!
(defun my-delete-whitespace-forward ()
(interactive)
(delete-region (point) (progn (skip-chars-forward " \t\n")
(point))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: remove all the whitespace characters from the cursor to the next symbol
2010-03-16 2:56 ` Scott Frazer
@ 2010-03-16 9:58 ` alex_sv
0 siblings, 0 replies; 8+ messages in thread
From: alex_sv @ 2010-03-16 9:58 UTC (permalink / raw)
To: help-gnu-emacs
On Mar 16, 5:56 am, Scott Frazer <frazer.sc...@gmail.com> wrote:
> On Mar 15, 10:43 am, alex_sv <avshaba...@gmail.com> wrote:
>
>
>
> > Hi all!
>
> > Could you please clarify - is it possible to remove all the whitespace
> > characters including newline from the current cursor position to the
> > next meaningful symbol using one command?
>
> > I mean if our buffer's content is as follows:
>
> > texttexttext{cursor}___
> > _
> > ___text
>
> > where '_' means space character, is it possible to press some known
> > key sequence to transform the given above to the following form:
>
> > texttexttext{cursor}text
>
> > Thanks in advance!
>
> (defun my-delete-whitespace-forward ()
> (interactive)
> (delete-region (point) (progn (skip-chars-forward " \t\n")
> (point))))
Thank you, this works fine!
I didn't wrote the function because I thought this would be a
reinvention of some known feature I am not aware of.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: remove all the whitespace characters from the cursor to the next symbol
2010-03-15 14:43 remove all the whitespace characters from the cursor to the next symbol alex_sv
` (2 preceding siblings ...)
2010-03-16 2:56 ` Scott Frazer
@ 2010-05-07 3:34 ` Kevin Rodgers
2010-05-07 15:48 ` Sivaram Neelakantan
3 siblings, 1 reply; 8+ messages in thread
From: Kevin Rodgers @ 2010-05-07 3:34 UTC (permalink / raw)
To: help-gnu-emacs
alex_sv wrote:
> Hi all!
>
> Could you please clarify - is it possible to remove all the whitespace
> characters including newline from the current cursor position to the
> next meaningful symbol using one command?
>
> I mean if our buffer's content is as follows:
>
> texttexttext{cursor}___
> _
> ___text
>
> where '_' means space character, is it possible to press some known
> key sequence to transform the given above to the following form:
>
> texttexttext{cursor}text
;; This is copied from delete-horizontal-space, with
;; skip-chars-forward/backward " \t" replaced by
;; skip-syntax-forward/forward " ":
(defun delete-whitespace (&optional backward-only)
"Delete all characters around point with whitespace syntax.
If BACKWARD-ONLY is non-nil, only delete them before point."
(interactive "*P")
(let ((orig-pos (point)))
(delete-region
(if backward-only
orig-pos
(progn
(skip-syntax-forward " ")
(constrain-to-field nil orig-pos t)))
(progn
(skip-syntax-backward " ")
(constrain-to-field nil orig-pos)))))
;; Now bind it to a convenient key:
(global-set-key "\C-cw" 'delete-whitespace)
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: remove all the whitespace characters from the cursor to the next symbol
2010-05-07 3:34 ` Kevin Rodgers
@ 2010-05-07 15:48 ` Sivaram Neelakantan
0 siblings, 0 replies; 8+ messages in thread
From: Sivaram Neelakantan @ 2010-05-07 15:48 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, May 07 2010,Kevin Rodgers wrote:
[snipped 9 lines]
>> texttexttext{cursor}___
>> _
>> ___text
>>
>> where '_' means space character, is it possible to press some known
>> key sequence to transform the given above to the following form:
>>
>> texttexttext{cursor}text
>
[snipped 22 lines]
There's also this
M-SPC runs the command just-one-space, which is an interactive
compiled Lisp function in `simple.el'.
It is bound to M-SPC.
(just-one-space &optional n)
Delete all spaces and tabs around point, leaving one space (or n spaces).
Of course it doesn't handle the \n+spaces case.
sivaram
--
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.30.1273247412.2075.help-gnu-emacs@gnu.org>]
* Re: remove all the whitespace characters from the cursor to the next symbol
[not found] <mailman.30.1273247412.2075.help-gnu-emacs@gnu.org>
@ 2010-05-07 18:52 ` David Rogoff
0 siblings, 0 replies; 8+ messages in thread
From: David Rogoff @ 2010-05-07 18:52 UTC (permalink / raw)
To: help-gnu-emacs
On 2010-05-07 09:18:13 -0700, Sivaram Neelakantan said:
> On Fri, May 07 2010,Kevin Rodgers wrote:
>
>
> [snipped 9 lines]
>
>>> texttexttext{cursor}___
>>> _
>>> ___text
>>>
>>> where '_' means space character, is it possible to press some known
>>> key sequence to transform the given above to the following form:
>>>
>>> texttexttext{cursor}text
>>
>
> [snipped 22 lines]
>
> There's also this
> M-SPC runs the command just-one-space, which is an interactive
Cooll - didn't know that one!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-05-07 18:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-15 14:43 remove all the whitespace characters from the cursor to the next symbol alex_sv
2010-03-15 22:14 ` B. T. Raven
2010-03-16 1:59 ` despen
2010-03-16 2:56 ` Scott Frazer
2010-03-16 9:58 ` alex_sv
2010-05-07 3:34 ` Kevin Rodgers
2010-05-07 15:48 ` Sivaram Neelakantan
[not found] <mailman.30.1273247412.2075.help-gnu-emacs@gnu.org>
2010-05-07 18:52 ` David Rogoff
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).