[ESS] fixing spaces in function arguments

Sebastian P. Luque spluque at gmail.com
Thu Mar 1 02:39:35 CET 2007


Hi,

I like to follow the convention of no spaces around "=" in argument
specifications.  I often receive code that doesn't follow this, so I
thought one of the ess-fix-* functions might take care of that.  But
unfortunately not, so stealing from ess-fix-miscellaneous (which actually
does the opposite), I did:


(defun ess-fix-EQ-spaces (&optional from verbose)
  "Remove spaces around equal sign from current \\[point] or FROM.
VERBOSE shows message in minibuffer for replacements."
  (interactive "d\nP")
  (save-excursion
    (goto-char from)
    (ess-rep-regexp "[ \t]+=[ \t]+" "=" nil nil verbose)))


It works nicely in the few cases I've tried, but I haven't completely
understood what I'm doing with ess-rep-regexp, so would appreciate any
comments, gotchas, improvements, etc. you may have.  Thanks.


Cheers,

-- 
Seb




More information about the ESS-help mailing list