unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* why not allow an argument to just-one-space?
@ 2003-04-08  1:16 Dan Jacobson
  2005-01-09  0:41 ` Dan Jacobson
       [not found] ` <mailman.12025.1105312659.27204.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Jacobson @ 2003-04-08  1:16 UTC (permalink / raw)


Why not allow an argument to just-one-space, so it can be just two
spaces, etc.?

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

* Re: why not allow an argument to just-one-space?
  2003-04-08  1:16 why not allow an argument to just-one-space? Dan Jacobson
@ 2005-01-09  0:41 ` Dan Jacobson
       [not found]   ` <E1Co69A-0000S5-Sn@fencepost.gnu.org>
       [not found] ` <mailman.12025.1105312659.27204.bug-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Jacobson @ 2005-01-09  0:41 UTC (permalink / raw)


1 year, 39 weeks  ago "Dan" == Dan Jacobson writes:
Dan> Why not allow an argument to just-one-space, so it can be just two
Dan> spaces, etc.?

Brilliant idea. I'll second that. Why, just today I wanted four
spaces.  Don't suppose this one is a priority for the globe trotting
authors.  Especially if somebody then posts some 'advice', blurring
the urge for a permanent enhancement.

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

* Re: why not allow an argument to just-one-space?
       [not found] ` <mailman.12025.1105312659.27204.bug-gnu-emacs@gnu.org>
@ 2005-01-10  0:07   ` Francis Litterio
  2005-01-10 18:24   ` Kevin Rodgers
  1 sibling, 0 replies; 5+ messages in thread
From: Francis Litterio @ 2005-01-10  0:07 UTC (permalink / raw)


Dan Jacobson wrote:

> 1 year, 39 weeks  ago "Dan" == Dan Jacobson writes:
> Dan> Why not allow an argument to just-one-space, so it can be just two
> Dan> spaces, etc.?
>
> Brilliant idea. I'll second that. Why, just today I wanted four
> spaces.  Don't suppose this one is a priority for the globe trotting
> authors.  Especially if somebody then posts some 'advice', blurring
> the urge for a permanent enhancement.

But won't the name, just-one-space, then be confusing?

Perhaps you want this:

(defun just-n-spaces (count)
  "..."
  (interactive "p")
  (just-one-space)
  (if (integerp count)
      (insert (make-string (1- count) 32))))

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

* Re: why not allow an argument to just-one-space?
       [not found] ` <mailman.12025.1105312659.27204.bug-gnu-emacs@gnu.org>
  2005-01-10  0:07   ` Francis Litterio
@ 2005-01-10 18:24   ` Kevin Rodgers
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2005-01-10 18:24 UTC (permalink / raw)


Dan Jacobson wrote:
> 1 year, 39 weeks  ago "Dan" == Dan Jacobson writes:
> Dan> Why not allow an argument to just-one-space, so it can be just two
> Dan> spaces, etc.?
> 
> Brilliant idea. I'll second that. Why, just today I wanted four
> spaces.  Don't suppose this one is a priority for the globe trotting
> authors.  Especially if somebody then posts some 'advice', blurring
> the urge for a permanent enhancement.

DIY:

(defadvice just-one-space (after prefix-arg (&optional n) activate)
   "With a prefix arg, leave that many spaces."
   (interactive "p")
   (when (> n 1)
     (insert (make-string (1- n) ?\ ))))

-- 
Kevin Rodgers

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

* Re: why not allow an argument to just-one-space?
       [not found]   ` <E1Co69A-0000S5-Sn@fencepost.gnu.org>
@ 2005-01-12 23:29     ` Dan Jacobson
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Jacobson @ 2005-01-12 23:29 UTC (permalink / raw)


OK
>>>>> "rms" == Richard Stallman <rms@gnu.org> writes:

rms> Does this do the job well?
rms> (defun just-one-space (n)
rms>   "Delete all spaces and tabs around point, leaving one space (or N spaces)."
rms>   (interactive "*p")
rms>   (let ((orig-pos (point)))
rms>     (skip-chars-backward " \t")
rms>     (constrain-to-field nil orig-pos)
rms>     (dotimes (i n)
rms>       (if (= (following-char) ?\ )
rms> 	  (forward-char 1)
rms> 	(insert ?\ )))
rms>     (delete-region
rms>      (point)
rms>      (progn
rms>        (skip-chars-forward " \t")
rms>        (constrain-to-field nil orig-pos t)))))

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

end of thread, other threads:[~2005-01-12 23:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-08  1:16 why not allow an argument to just-one-space? Dan Jacobson
2005-01-09  0:41 ` Dan Jacobson
     [not found]   ` <E1Co69A-0000S5-Sn@fencepost.gnu.org>
2005-01-12 23:29     ` Dan Jacobson
     [not found] ` <mailman.12025.1105312659.27204.bug-gnu-emacs@gnu.org>
2005-01-10  0:07   ` Francis Litterio
2005-01-10 18:24   ` Kevin Rodgers

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