help-gnu-emacs
[Top][All Lists]
Advanced

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

refactoring tool


From: Andreas Röhler
Subject: refactoring tool
Date: Sat, 02 Oct 2010 16:59:04 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6


Hi,

playing with some tests, the following function
--slightly shortened here-- came out:

(defun python-modes-beginning-of-block-or-clause-test (&optional arg)
  (interactive)
  ;; ...
  (let ((erg 1658))
    (set-buffer "python-modes-test")
  ;; ...
    (goto-char erg)
    (assert (eq 77 (- erg (setq erg (py-beginning-of-block-or-clause)))))
    (assert (eq 124 (- erg (setq erg (py-beginning-of-block-or-clause)))))
    (assert (eq 124 (- erg (setq erg (py-beginning-of-block-or-clause)))))
    (assert (eq 42 (- erg (setq erg (py-beginning-of-block-or-clause))))))
  (message "%s" "python-modes-beginning-of-block-or-clause-test passed!"))

As it's visible, the whole thing could be written much
shorter using a list '(77 124 124 42).

Would call this procedure of changing into a more effective
form refactoring.

Is there a tool for Emacs Lisp?

Thanks


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/





reply via email to

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