unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: critique: my-first-function
Date: Mon, 13 Jun 2016 03:08:47 +0200	[thread overview]
Message-ID: <867fdtki8w.fsf@student.uu.se> (raw)
In-Reply-To: 20160612183901.e51dc7f75549ed99cfd47363@speakeasy.net

"James K. Lowden" <jklowden@speakeasy.net>
writes:

> (defun open-tall-frames ()
>   "Open two tall frames."
>   (interactive)
>   (let ( (frame-parameters 
> 	  '((width . 80)
> 	    (height . 60)
> 	    (minibuffer . t)
> 	    (window-system . x)))
> 	 (frame1 (make-frame frame-parameters))
> 	 (frame2 (make-frame frame-parameters))
> 	 )
>   (set-frame-position frame1 -1 0)
>   (set-frame-position frame2 (- (frame-pixel-width frame1)) 0)
> ))

`let' should be `let*' since "frame-parameters"
are used inside the same `let'.

Some more subjective views:

As for style, I think you can align the
data items (lines 5-8).

Instead of "frame1" "frame2", name them after
some property.

And, on line 13, there is a computation, which
I would name and put in the `let' clause as
well. So you set up all data there, and then
only have execution below the `let' - makes it
look good.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 48 Blogomatic articles -                   




  parent reply	other threads:[~2016-06-13  1:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12 22:39 critique: my-first-function James K. Lowden
2016-06-13  1:04 ` Stefan Monnier
2016-06-13  1:08 ` Emanuel Berg [this message]
     [not found] ` <mailman.1403.1465780144.1216.help-gnu-emacs@gnu.org>
2016-06-15  1:47   ` James K. Lowden
2016-06-15  4:43     ` Drew Adams

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=867fdtki8w.fsf@student.uu.se \
    --to=embe8573@student.uu.se \
    --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).