From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Proper use of function form Date: Sun, 26 Apr 2020 16:43:46 -0800 Message-ID: References: <87h7x5kd2u.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="120546"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 27 02:44:16 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jSrse-000VG6-Ce for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 02:44:16 +0200 Original-Received: from localhost ([::1]:49464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSrsd-0002XC-C5 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 26 Apr 2020 20:44:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52528) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSrsF-0002X5-VP for help-gnu-emacs@gnu.org; Sun, 26 Apr 2020 20:43:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSrsE-000251-QJ for help-gnu-emacs@gnu.org; Sun, 26 Apr 2020 20:43:51 -0400 Original-Received: from gateway31.websitewelcome.com ([192.185.143.39]:32840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jSrsE-0001oL-62 for help-gnu-emacs@gnu.org; Sun, 26 Apr 2020 20:43:50 -0400 Original-Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 50C5623730A for ; Sun, 26 Apr 2020 19:43:48 -0500 (CDT) Original-Received: from host2075.hostmonster.com ([67.20.113.97]) by cmsmtp with SMTP id SrsBj7920VQh0SrsCjFCC1; Sun, 26 Apr 2020 19:43:48 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tj49.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version :Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eoODYjTR7TOVTu/sr/X7LKzFNYnawdk5vyxLRDCD2Bs=; b=QIR92Hycb+tGC+HQZ7s7g8MPrR 2oMHnYVbmSGTHbeRXaZoh4UefxMuLxE/4//BnWLxOLhPDgj2xIMRGqmDMv51gZ7cPUtfkaX8A9k6N nKa9CcuXq/PEJgCvG5+k6fsjs; Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:43632 helo=[192.168.1.6]) by host2075.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1jSrsB-002f3u-MC for help-gnu-emacs@gnu.org; Sun, 26 Apr 2020 18:43:47 -0600 In-Reply-To: <87h7x5kd2u.fsf@web.de> Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2075.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - akwebsoft.com X-BWhitelist: no X-Source-IP: 64.4.232.191 X-Source-L: No X-Exim-ID: 1jSrsB-002f3u-MC X-Source-Sender: tjohnson.mtaonline.net ([192.168.1.6]) [64.4.232.191]:43632 X-Source-Auth: tim@tj49.com X-Email-Count: 1 X-Source-Cap: bW9sZG92YXM7bW9sZG92YXM7aG9zdDIwNzUuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: neutral client-ip=192.185.143.39; envelope-from=tim@akwebsoft.com; helo=gateway31.websitewelcome.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/26 20:43:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 192.185.143.39 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122948 Archived-At: On 4/26/20 4:05 PM, Michael Heerdegen wrote: > Tim Johnson writes: > >> Would it be better to change (nth (+ ndx 1) mylist) to >> (function (nth > (+ ndx 1) mylist)) ? > No: > > "Like `quote', but preferred for objects which are functions. > In byte compilation, `function' causes its argument to be handled by > the byte compiler. `quote' cannot do that." > > "(nth > (+ ndx 1) mylist)" is not a function - it is an > expression that will evaluate to a function. Since `function' acts like > `quote', using this special form would prevent that evaluation, so it > won't work. > > The underlying problem is that your expression is evaluated at > run-time. Useful for the compiler would only be a function name known > at compile time. If you know the function name at compile time, you > don't want to eval it at run time, so you want to `quote' anyway. > > So what can you do? Since we don't have a multiple-define-key function, > you can just stay with your loop as is - there is nothing wrong with > that, but you'll not get compiler warnings like "unknown function". You > can also use a macro that would expand to a sequence of `define-key' > calls at compile time. Or construct the whole keymap at compile time, > using list functions (or `backquote'). But that's rather uncommon. > Most people just write the key definition calls out or just don't care - > even in the Emacs sources. Thanks Michael. I will leave will enough alone. cheers -- Tim tj49.com