unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
To: help-gnu-emacs@gnu.org
Subject: refactoring tool
Date: Sat, 02 Oct 2010 16:59:04 +0200	[thread overview]
Message-ID: <4CA748B8.3020403@online.de> (raw)


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	other threads:[~2010-10-02 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-02 14:59 Andreas Röhler [this message]
     [not found] <mailman.18382.1134003534.20277.help-gnu-emacs@gnu.org>
2005-12-08  9:09 ` refactoring tool Anselm Helbig
2005-12-08 13:51   ` Lennart Borgman
2005-12-08 14:10 ` PT
2005-12-09  9:05 ` Alan Mackenzie
2005-12-09 15:35   ` Ian Zimmerman
2005-12-10  2:18 ` Aquila Deus
2005-12-10 20:47   ` rob wahoo
  -- strict thread matches above, loose matches on Subject: below --
2005-12-08  0:58 Pedro Sa da Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CA748B8.3020403@online.de \
    --to=andreas.roehler@online.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).