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

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

Refactoring?


From: Andreas Roehler
Subject: Refactoring?
Date: Fri, 06 Oct 2006 17:12:37 +0200
User-agent: Thunderbird 1.5.0.4 (X11/20060516)


Hi,

after finishing the following function I remarked, I
could reuse the inner parts easier, while addressing
them separate. (Just an example anyway...)

(defun alpha-numb-count (start end)
 "Counts alphabetical signs and numbers"
 (interactive "r*")
 (count-matches "[a-z-A-ZäöüÄÖÜß]" start end)
 (count-matches "[0-9]" start end))

Looking for a procedure, which would result in the following
(Numbers just for decoration here):

(1)
(defun alpha-numb-count_1 (start end)
 "Counts alphabetical signs and numbers"
 (interactive "r*")
 (count-matches "[a-z-A-ZäöüÄÖÜß]" start end))

(2)
(defun alpha-numb-count_2 (start end)
 "Counts alphabetical signs and numbers"
 (interactive "r*")
 (count-matches "[0-9]" start end))

Which later would be written:

(defun alpha-count (start end)
 "Counts alphabetical signs and numbers"
 (interactive "r*")
 (count-matches "[a-z-A-ZäöüÄÖÜß]" start end))

(defun numb-count (start end)
 "Counts alphabetical signs and numbers"
 (interactive "r*")
 (count-matches "[0-9]" start end))

Am I right, it's called refactoring otherwise?

Is there such a thing for Emacs-Lisp?


Thanks

__
Andreas Roehler





reply via email to

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