emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to change just-one-space


From: Andreas Roehler
Subject: Re: Patch to change just-one-space
Date: Fri, 14 Aug 2009 14:19:00 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Deniz Dogan wrote:
> 2009/8/14 Stephen J. Turnbull <address@hidden>:
>> Deniz Dogan writes:
>>  > 2009/8/14 Juri Linkov <address@hidden>:
>>
>>  > > No, it's a controversial change.  Just imagine typing M-SPC at the end
>>  > > of the paragraph.
>>  >
>>  > That's exactly why I wrote this change, because that's how I use my
>>  > own version of M-SPC. I very rarely use the version that's in CVS now.
>>
>> I use the current definition a lot; usage patterns vary, it seems.
>>
>> In your typical use there are *no* non-newline spaces?
> 
> No, it is usually a combination of spaces and newlines, e.g. in:
> 
> <div>
>   <p>
>   c <a href="#">Hello</a>
>   </p>
> </div>
> 
> ...where point is at "c". Then I'd just merge the lines using M-SPC
> DEL or M-0 M-SPC. Then I would probably do it again:
> 
> <div>
>   <p><a href="#">Hello</a>c
>   </p>
> </div>
> 
> ...where point is at "c". The result:
> 
> <div>
>   <p><a href="#">Hello</a></p>
> </div>
> 
>> It seems to me that a more flexible and discoverable (and to you
>> equivalent, up to default keybindings) idea would be to define
>> `paragraph-join' and `paragraph-break', and bind the former to M-SPC.
> 
> Sounds interesting. So basically we would make `paragraph-join' the
> same as "my" version of `just-one-space'? Or did you have something
> different in mind?
> 


Hi,

I use a similar thing quite often and instead of
fixup-whitespace. Its a useful feature IMO.

Here original behaviour is available via arg.

(defun my-fixup-whitespace (&optional arg)
  "Fixup white space between objects around point.
Leave one space or none, according to the context.
With ARG, don't kill \\r\\n\\f"
  (interactive "*P")
  (save-excursion
    (if (eq 4 (prefix-numeric-value arg))
        (delete-horizontal-space)
      ;; 2007-11-28 address@hidden changed section start
      (unless (bolp)
        (skip-chars-backward " \t\r\n\f"))
      (let ((start (point)))
      (skip-chars-forward " \t\r\n\f")
      (delete-region start (point)))
    ;; 2007-11-28 address@hidden changed section end
    (if (or (looking-at "^\\|\\s)")
            (save-excursion (forward-char -1)
                            (looking-at "$\\|\\s(\\|\\s'")))
        nil
      (insert ? )))))

;;;;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]