0

I'm looking for a command that behaves similiar to fixup-whitespace, but I want it to also remove line breaks between objects around point.

  • Does delete-indentation do what you are looking for? – Drew Aug 7 '17 at 13:49
  • Yes, but it only deletes one empty line. – bertfred Aug 8 '17 at 10:11
0

It's not perfect but this is more or less what I was looking for

(defun fixup-line-breaks ()
  (interactive)
  (let ((pos (point)))
    (delete-region
     (progn
       (skip-chars-forward "[^\s\t\n]")
       (constrain-to-field nil pos t))
     (progn
       (re-search-backward "[^\s\t\n]")
       (forward-char)
       (constrain-to-field nil pos)))
    (insert "\n")
    (indent-for-tab-command)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.