[Top][All Lists]

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

Emacs Lisp coding style question

From: Thorsten Jolitz
Subject: Emacs Lisp coding style question
Date: Wed, 02 Jul 2014 14:47:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi List, 

sometimes I wondered about the following coding style question, so I
decided to do it in public:

Often functions do a lot of work to gather some data and then do a
rather simple action with the gathered data:

#+begin_src emacs-lisp
  (defun foo ()
    (let* ((x (create-x))
          (y (create-y))
          (z (create-z x y))
          (u (create-u z))
          (v (create-v))
          (w (create-w u v)))
      (simple-action w)))

Thats the way I would do it, and I find it easy to write, read and

But (without being able to give concrete examples right now) I noticed
that advanced Lispers tend to call this 'C-style', consider the let
bindings unnessesary since the local vars are only used once, and
prefer this style:

#+begin_src emacs-lisp
  (defun foo ()
       (create-z (create-x) (create-y)))

This looks more 'lispy' and might have a slight performance
advantage. But when the 'create-xyz' expressions grow in size the
whole thing might start to look very complicated and it becomes hard to
recognize that its just about `simple-action' with some gathered

What would be the recommended style for Emacs Lisp, or is this just a
matter of taste?


reply via email to

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