GNU bug report logs - #15821
a better M-SPC

Previous Next

Package: emacs;

Reported by: toomas <at> rosin.ee

Date: Wed, 6 Nov 2013 17:36:01 UTC

Severity: wishlist

Tags: wontfix

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15821 in the body.
You can then email your comments to 15821 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15821; Package emacs. (Wed, 06 Nov 2013 17:36:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to toomas <at> rosin.ee:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 06 Nov 2013 17:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Toomas Rosin <toomas <at> rosin.ee>
To: bug-gnu-emacs <at> gnu.org
Subject: a better M-SPC
Date: Wed, 06 Nov 2013 11:36:55 +0200
Hello,

I hope this is the right place for the following suggestion.

My version of M-SPC is an improvement over the original Emacs one in two respects: it operates both horizontally and vertically, and it takes a numeric argument.  See the docstring for details.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun adjust-space-2d (&optional arg)
  "Adjust horizontal or vertical whitespace.

On a non-empty blank line, leave exactly ARG spaces on it (without
ARG, make it empty).

On an empty line, delete all blank lines above and below it, leaving
ARG empty lines.  When there is no ARG, the default is to leave no
empty lines at the beginning or the end of the buffer or at a single
blank line, and leave one empty line elsewhere.

At the beginning or end of a non-blank line, delete all leading
resp. trailing whitespace, leaving ARG (by default, zero) spaces.

Elsewhere, insert and/or delete blanks, leaving ARG spaces (by
default, one space)."
  
  (interactive "*P")
  (let ((num (if arg (prefix-numeric-value arg)))
        (pos (point)))
    (cond
     ;;; Empty line at the beginning of the buffer.
     ((and (bobp) (looking-at "$"))
      (delete-blank-lines)
      (if (looking-at "[ \t]*$") (kill-line))
      (when num (open-line num)))
     ;;; Empty line elsewhere.
     ((save-excursion (beginning-of-line) (looking-at "$"))
      (delete-blank-lines)
      (when num (delete-blank-lines) (open-line num)))
     ;;; Beginning of line.
     ((save-excursion (skip-chars-backward " \t") (bolp))
      (beginning-of-line)
      (while (looking-at "[ \t]") (delete-char 1))
      (when num (insert (make-string num ? )) (beginning-of-line)))
     ;;; End of line.
     ((save-excursion (skip-chars-forward " \t") (eolp))
      (skip-chars-backward " \t")
      (while (not (eolp)) (delete-char 1))
      (when num (insert (make-string num ? ))))
     ;;; Anywhere else.
     (t
      (just-one-space)
      (when num (delete-char -1) (insert (make-string num ? )))))))

(global-set-key (kbd "M-SPC") 'adjust-space-2d)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Best regards,
T.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15821; Package emacs. (Sat, 16 Nov 2013 21:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 15821 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Toomas Rosin <toomas <at> rosin.ee>
Cc: 15821 <at> debbugs.gnu.org
Subject: Re: bug#15821: a better M-SPC
Date: Sat, 16 Nov 2013 16:42:24 -0500
> I hope this is the right place for the following suggestion.

It is.

> My version of M-SPC is an improvement over the original Emacs one in
> two respects: it operates both horizontally and vertically, and it
> takes a numeric argument.  See the docstring for details.

I don't myself use M-SPC much and have never used its numeric argument,
so I'd like to hear what other users have to say about your suggestion.

Reading your docstring, I see the following changes:
1- On a non-empty blank line, leave exactly ARG spaces on it (without
   ARG, make it empty).

2- On an empty line, delete all blank lines above and below it, leaving
   ARG empty lines.

3- At the beginning or end of a non-blank line, delete all leading
   resp. trailing whitespace, leaving ARG (by default, zero) spaces.

4- Don't treat a negative ARG as meaning to also delete newlines.

Point 4 sounds like an oversight (you don't yourself use that "negative
ARG" feature, so you didn't bother to implement it), right?

For points 1 to 3, the main issue I see with them is that some people
apparently tend to like M-SPC so much that they hit M-SPC when they just
want to insert a SPC (Richard mentioned doing that, recently), so
changing M-SPC so that it sometimes finishes with no space at point can
be an annoyance.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15821; Package emacs. (Tue, 21 Jan 2020 01:22:01 GMT) Full text and rfc822 format available.

Message #11 received at 15821 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Toomas Rosin <toomas <at> rosin.ee>, 15821 <at> debbugs.gnu.org
Subject: Re: bug#15821: a better M-SPC
Date: Tue, 21 Jan 2020 02:20:58 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> My version of M-SPC is an improvement over the original Emacs one in
>> two respects: it operates both horizontally and vertically, and it
>> takes a numeric argument.  See the docstring for details.
>
> I don't myself use M-SPC much and have never used its numeric argument,
> so I'd like to hear what other users have to say about your suggestion.

I'm a heavy user of `just-one-space' (M-SPC), so I will venture to
comment given the lack of replies over the years.  I will not comment
on the code, but only Stefan Monnier's summary of it, so apologies if
there's something that I've misunderstood.

I also want to say first thank you to Toomas for taking the time to
write up a suggestion aiming to improving Emacs.  As will be clear
below, I'm personally not too keen on this particular change, however.

Note first that the numeric argument is currently very easy to
understand: leave exactly ARG spaces.  Negative ARG means to leave
the absolute value of ARG spaces and delete empty lines.

> Reading your docstring, I see the following changes:
> 1- On a non-empty blank line, leave exactly ARG spaces on it (without
>    ARG, make it empty).

M-SPC has until now always left one space by default.  I think the
proposal would make for a very frustrating and confusing user
experience.  Changing it is also backwards incompatible.

> 2- On an empty line, delete all blank lines above and below it, leaving
>    ARG empty lines.

I don't see why we would want to change `just-one-space' to operate on
lines in this way.

I think it would make more sense to modify `delete-blank-lines' to
leave ARG empty lines with a prefix argument.  But that's a separate
feature request, in my opinion.

> 3- At the beginning or end of a non-blank line, delete all leading
>    resp. trailing whitespace, leaving ARG (by default, zero) spaces.

Same comment as above regarding zero spaces.

The rest is no change compared to what we have now, AFAICT.

> 4- Don't treat a negative ARG as meaning to also delete newlines.
>
> Point 4 sounds like an oversight (you don't yourself use that "negative
> ARG" feature, so you didn't bother to implement it), right?

I think one of the more useful aspects of M-SPC, that I personally use
all the time, and which we should most definitely keep.

> For points 1 to 3, the main issue I see with them is that some people
> apparently tend to like M-SPC so much that they hit M-SPC when they just
> want to insert a SPC (Richard mentioned doing that, recently), so
> changing M-SPC so that it sometimes finishes with no space at point can
> be an annoyance.

In summary, if I understand them correctly, I oppose the proposed
changes, which would in my opinion be a change for the worse.  They
would also be backwards compatible and almost certainly break existing
use patterns.  (I know they would for me.)

I therefore recommend to close this as wontfix.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15821; Package emacs. (Tue, 21 Jan 2020 09:25:02 GMT) Full text and rfc822 format available.

Message #14 received at 15821 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Toomas Rosin <toomas <at> rosin.ee>, 15821 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#15821: a better M-SPC
Date: Tue, 21 Jan 2020 10:24:18 +0100
On Jan 21 2020, Stefan Kangas wrote:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>> Reading your docstring, I see the following changes:
>> 1- On a non-empty blank line, leave exactly ARG spaces on it (without
>>    ARG, make it empty).
>
> M-SPC has until now always left one space by default.  I think the
> proposal would make for a very frustrating and confusing user
> experience.  Changing it is also backwards incompatible.

Given the name of the function, leaving no space when called without
prefix would be a contradiction.

There is also cycle-spacing.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15821; Package emacs. (Wed, 22 Jan 2020 03:14:02 GMT) Full text and rfc822 format available.

Message #17 received at 15821 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: toomas <at> rosin.ee, 15821 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#15821: a better M-SPC
Date: Tue, 21 Jan 2020 22:13:33 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I often use M-SPC with no argument; please do not change it.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15821; Package emacs. (Fri, 28 Feb 2020 23:22:01 GMT) Full text and rfc822 format available.

Message #20 received at 15821 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Toomas Rosin <toomas <at> rosin.ee>, 15821 <at> debbugs.gnu.org
Subject: Re: bug#15821: a better M-SPC
Date: Sat, 29 Feb 2020 00:21:35 +0100
tags 15821 wontfix
close 15821
thanks

Stefan Kangas <stefan <at> marxist.se> writes:

> In summary, if I understand them correctly, I oppose the proposed
> changes, which would in my opinion be a change for the worse.  They
> would also be backwards compatible and almost certainly break existing
> use patterns.  (I know they would for me.)
>
> I therefore recommend to close this as wontfix.

Andreas Schwab and RMS has expressed support for my proposal to not
changing anything here.  There also have been no further comments
within 5 weeks.  I'm consequently closing this bug now.

Best regards,
Stefan Kangas




Added tag(s) wontfix. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 28 Feb 2020 23:22:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 15821 <at> debbugs.gnu.org and toomas <at> rosin.ee Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 28 Feb 2020 23:22:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 28 Mar 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.