🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98318

Re: fixup-whitespace at end of line

#98318
From: Joe Wells
Date: Sun, 13 Oct 1991 00:26
50 lines
2203 bytes
In article <9110102007.AA07087@bes.evi.com> andy@evi.COM (Andrew Dennison) writes:

   When the point is at the end of the line, I expect fixup-whitespace to
   eliminate all spaces. It leaves one. I have a fix:

   [....]

   Possible Fix:
   ------------------------------------------------------------------------
   ;; fix bug at EOL AOD 10/10/91
   (defun fixup-whitespace ()
     "MY Fixup white space between objects around point.
   Leave one space or none, according to the context."
     (interactive "*")
     (save-excursion
       (delete-horizontal-space)

       (if (or (looking-at "^\\|\\s)\\|$")
	       (save-excursion (forward-char -1)
			       (looking-at "\\s(\\|\\s'")
			       )
	       )
	   nil
	 (insert ?\ )
	 )
       )
     )
   ------------------------------------------------------------------------

I ran into the same problem; I don't remember the context but it was
really annoying.  My fix is the same as yours except that it doesn't use
`if':

    ;; Modification of version in simple.el
    ;; Fixed to delete white space at end of lines.
    (defun fixup-whitespace ()
      "Fixup white space between objects around point.
    Leave one space or none, according to the context."
      (interactive "*")
      (save-excursion
	(delete-horizontal-space)
	(or (looking-at "^\\|$\\|\\s)")
	    (save-excursion (forward-char -1)
			    (looking-at "\\s(\\|\\s'"))
	    (insert ?\ ))))

-- 
Later,

Joe Wells <jbw@cs.bu.edu>
Technical Details
Message-ID: <JBW.91Oct12202629@bigbird.bu.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!yale.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!bigbird.bu.edu!jbw
References: <9110102007.AA07087@bes.evi.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,c677b4b08ea8cebc
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-10-12 17:26:29 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!yale.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!bigbird.bu.edu!jbw
From: jbw@bigbird.bu.edu (Joe Wells)
Newsgroups: gnu.emacs.bug
Subject: Re: fixup-whitespace at end of line
Message-ID: <JBW.91Oct12202629@bigbird.bu.edu>
Date: 13 Oct 91 00:26:29 GMT
References: <9110102007.AA07087@bes.evi.com>
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: Boston University Computer Science Department
Lines: 50
Approved: bug-gnu-emacs@prep.ai.mit.edu