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

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

Re: compile-command customisation


From: Daniel Wright
Subject: Re: compile-command customisation
Date: Thu, 24 Feb 2005 10:19:50 +0100

Thien-Thi Nguyen <ttn@glug.org> writes:
>Daniel Wright <daniel.d.wright@gmail.com> writes:
>
>> how it could be done better :)
>
>some standard tips:
>
>(if CONDITION (progn EXP ...))
>=> (when CONDITION EXP ...)
>
>(unless CONDITION (progn EXP ...))
>=> (unless CONDITION EXP ...)
>
>you can lift `file-name-sans-extension', like so:
>
>(... (file-name-sans-extension file)
>... (file-name-sans-extension file) ...)
>=> (let ((fn-noext (file-name-sans-extension file)))
>    (... fn-noext
>     ... fn-noext ...))
>
>generally, these transforms do not change your algorithm,
>so it is only better in the sense that it is more easy to
>read.  improving the algorithm is your sack of joy to haul.

Thanks for the help! It really does make it a lot easier to read. It
seemed necessary to use "let*" so that file-noext gets evaluated
correctly:

...
(let* ((count 0) (file (file-name-nondirectory buffer-file-name))
     (file-noext (file-name-sans-extension file)))
...

After reading the reply from Kevin Rodgers, I'll leave the improvement
of this algorithm: I'm sure there are plenty of others to improve.. ;)

Thanks again!
Daniel



reply via email to

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