unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* just-one-space
@ 2007-03-23 16:00 Paul Pogonyshev
  2007-03-23 16:10 ` just-one-space Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Pogonyshev @ 2007-03-23 16:00 UTC (permalink / raw)
  To: emacs-devel

Hi,

Would it be a good enhancement if that function could also optionally
delete newlines around point, based on a customizable variable?  Same
could also apply to `delete-horizontal-space', probably, but its name
insists on current behaviour.

Paul


2007-03-23  Paul Pogonyshev  <pogonyshev@gmx.net>

	* simple.el (just-one-space-also-eat-newlines): New custom option.
	(just-one-space): Also delete newlines if
	`just-one-space-also-eat-newlines' is non-nil.


--- simple.el	23 Mar 2007 17:53:23 +0200	1.852
+++ simple.el	23 Mar 2007 17:58:09 +0200	
@@ -719,11 +719,17 @@ If BACKWARD-ONLY is non-nil, only delete
        (skip-chars-backward " \t")
        (constrain-to-field nil orig-pos)))))
 
+(defcustom just-one-space-also-eat-newlines nil
+  "If non-nil, `just-one-space' also deletes newlines, not only horizontal space."
+  :type 'boolean
+  :group 'kill
+  :version "22.1")
+
 (defun just-one-space (&optional n)
   "Delete all spaces and tabs around point, leaving one space (or N spaces)."
   (interactive "*p")
   (let ((orig-pos (point)))
-    (skip-chars-backward " \t")
+    (skip-chars-backward (if just-one-space-also-eat-newlines " \t\n\r" " \t"))
     (constrain-to-field nil orig-pos)
     (dotimes (i (or n 1))
       (if (= (following-char) ?\s)
@@ -732,7 +738,7 @@ If BACKWARD-ONLY is non-nil, only delete
     (delete-region
      (point)
      (progn
-       (skip-chars-forward " \t")
+       (skip-chars-forward (if just-one-space-also-eat-newlines " \t\n\r" " \t"))
        (constrain-to-field nil orig-pos t)))))
  
 (defun beginning-of-buffer (&optional arg)

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

* Re: just-one-space
  2007-03-23 16:00 just-one-space Paul Pogonyshev
@ 2007-03-23 16:10 ` Andreas Schwab
  2007-03-23 16:30   ` just-one-space Paul Pogonyshev
  2007-03-23 23:15 ` just-one-space Paul Pogonyshev
  2007-03-24 14:50 ` just-one-space Eli Zaretskii
  2 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2007-03-23 16:10 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: emacs-devel

Paul Pogonyshev <pogonyshev@gmx.net> writes:

> Would it be a good enhancement if that function could also optionally
> delete newlines around point, based on a customizable variable?  Same
> could also apply to `delete-horizontal-space', probably, but its name
> insists on current behaviour.

There is also C-x C-o (delete-blank-lines).

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: just-one-space
  2007-03-23 16:10 ` just-one-space Andreas Schwab
@ 2007-03-23 16:30   ` Paul Pogonyshev
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Pogonyshev @ 2007-03-23 16:30 UTC (permalink / raw)
  To: emacs-devel; +Cc: Andreas Schwab

Andreas Schwab wrote:
> Paul Pogonyshev <pogonyshev@gmx.net> writes:
> 
> > Would it be a good enhancement if that function could also optionally
> > delete newlines around point, based on a customizable variable?  Same
> > could also apply to `delete-horizontal-space', probably, but its name
> > insists on current behaviour.
> 
> There is also C-x C-o (delete-blank-lines).

But it is sure a little different from what I want.

Paul

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

* Re: just-one-space
  2007-03-23 16:00 just-one-space Paul Pogonyshev
  2007-03-23 16:10 ` just-one-space Andreas Schwab
@ 2007-03-23 23:15 ` Paul Pogonyshev
  2007-03-24 14:50 ` just-one-space Eli Zaretskii
  2 siblings, 0 replies; 5+ messages in thread
From: Paul Pogonyshev @ 2007-03-23 23:15 UTC (permalink / raw)
  To: emacs-devel

I wrote:
> Would it be a good enhancement if that function could also optionally
> delete newlines around point, based on a customizable variable?  Same
> could also apply to `delete-horizontal-space', probably, but its name
> insists on current behaviour.

Probably not that good, since it spoils M-/ M-SPC M-/ ... sequence.

Paul

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

* Re: just-one-space
  2007-03-23 16:00 just-one-space Paul Pogonyshev
  2007-03-23 16:10 ` just-one-space Andreas Schwab
  2007-03-23 23:15 ` just-one-space Paul Pogonyshev
@ 2007-03-24 14:50 ` Eli Zaretskii
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2007-03-24 14:50 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: emacs-devel

> From: Paul Pogonyshev <pogonyshev@gmx.net>
> Date: Fri, 23 Mar 2007 18:00:30 +0200
> 
> Would it be a good enhancement if that function could also optionally
> delete newlines around point, based on a customizable variable?

Maybe it would, but please don't suggest enhancements until after the
release.

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

end of thread, other threads:[~2007-03-24 14:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-23 16:00 just-one-space Paul Pogonyshev
2007-03-23 16:10 ` just-one-space Andreas Schwab
2007-03-23 16:30   ` just-one-space Paul Pogonyshev
2007-03-23 23:15 ` just-one-space Paul Pogonyshev
2007-03-24 14:50 ` just-one-space Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).