From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: How can I write this function better? Date: Tue, 14 Mar 2017 13:44:33 +0100 Message-ID: <877f3s9gem.fsf@jane> References: <87zigprm7q.fsf@cocaine.ninja> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489495508 28376 195.159.176.226 (14 Mar 2017 12:45:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 14 Mar 2017 12:45:08 +0000 (UTC) User-Agent: mu4e 0.9.19; emacs 26.0.50 Cc: help-gnu-emacs@gnu.org To: user Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 14 13:45:01 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnlov-00067h-Cq for geh-help-gnu-emacs@m.gmane.org; Tue, 14 Mar 2017 13:44:57 +0100 Original-Received: from localhost ([::1]:58554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnlp1-00035Q-Ae for geh-help-gnu-emacs@m.gmane.org; Tue, 14 Mar 2017 08:45:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnlny-0002d0-9N for help-gnu-emacs@gnu.org; Tue, 14 Mar 2017 08:43:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnlnv-0001HJ-7P for help-gnu-emacs@gnu.org; Tue, 14 Mar 2017 08:43:58 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:51779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnlnv-0001H1-0E for help-gnu-emacs@gnu.org; Tue, 14 Mar 2017 08:43:55 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 8F86EE62B7; Tue, 14 Mar 2017 13:43:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2THLEhrojdKD; Tue, 14 Mar 2017 13:43:48 +0100 (CET) Original-Received: from localhost (unknown [150.254.75.71]) by mail.mojserwer.eu (Postfix) with ESMTPSA id A0529E6048; Tue, 14 Mar 2017 13:43:48 +0100 (CET) In-reply-to: <87zigprm7q.fsf@cocaine.ninja> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.110.48.8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112563 Archived-At: On 2017-03-13, at 20:49, user wrote: > Hello help-gnu-emacs, I'm looking for pointers with my luser-0x0 function. I'm > sure there are better ways I could write this. I'm not asking to have you > rewrite it for me, that'd be rude of me, but rather what I should to look at, > such as documentation or learning new constructs etc. I'm _very_ new to > programming and Lisp (learning Lisp and Forth as my first languages; quite > fun). An explanation, which I first wrote for myself, is below the code. > > Thanks. Quick comments off the top of my head (maybe completely wrong...) 1. No need to create one-use variables (there are probably various schools on that...). 2. I think there is no need for `apply', either. 3. Instead of the low-level-ish set-process-filter and start-process, why not use something much simpler like `call-process-shell-command'? Hth, -- Marcin Borkowski