From: Paul Pogonyshev <pogonyshev@gmx.net>
To: emacs-devel@gnu.org
Subject: just-one-space
Date: Fri, 23 Mar 2007 18:00:30 +0200 [thread overview]
Message-ID: <200703231800.30770.pogonyshev@gmx.net> (raw)
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)
next reply other threads:[~2007-03-23 16:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-23 16:00 Paul Pogonyshev [this message]
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
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=200703231800.30770.pogonyshev@gmx.net \
--to=pogonyshev@gmx.net \
--cc=emacs-devel@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.