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: Mon, 27 Apr 2020 11:12:22 -0800 Message-ID: <9e707c54-047a-eb8a-1c56-e6c69734b11e@akwebsoft.com> References: <87pnbt2w03.fsf@ebih.ebihd> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="97882"; 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 21:12:50 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 1jT9BS-000PMJ-4r for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 21:12:50 +0200 Original-Received: from localhost ([::1]:59256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jT9BR-0003WI-6e for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 15:12:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42228) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jT9B6-0003Tj-7O for help-gnu-emacs@gnu.org; Mon, 27 Apr 2020 15:12:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jT9B5-0002zV-0z for help-gnu-emacs@gnu.org; Mon, 27 Apr 2020 15:12:27 -0400 Original-Received: from gateway34.websitewelcome.com ([192.185.148.196]:19721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jT9B4-0002zI-Bo for help-gnu-emacs@gnu.org; Mon, 27 Apr 2020 15:12:26 -0400 Original-Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 17CD3649872 for ; Mon, 27 Apr 2020 14:12:24 -0500 (CDT) Original-Received: from host2075.hostmonster.com ([67.20.113.97]) by cmsmtp with SMTP id T9B1jTSGK8vkBT9B1jDNQW; Mon, 27 Apr 2020 14:12:24 -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=7wOpvpLqgyfK4hPwFd1iyvwyrpL3IVvCXk8bgzA8xF0=; b=ouCf2KVqvq5BwB7Z4SE32HX0Ce z12g8fC6rbfYc45yrFpTRJHf6HDzszmdRhY73qbIfFj+8kXLk7rrW4jqVdrfXbojwoHM0Ty4rPMQ9 IVlJoruf0bzBEixKVz/IBni3N; Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:49194 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 1jT9B1-0010ue-Fk for help-gnu-emacs@gnu.org; Mon, 27 Apr 2020 13:12:23 -0600 In-Reply-To: <87pnbt2w03.fsf@ebih.ebihd> 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: 1jT9B1-0010ue-Fk X-Source-Sender: tjohnson.mtaonline.net ([192.168.1.6]) [64.4.232.191]:49194 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.148.196; envelope-from=tim@akwebsoft.com; helo=gateway34.websitewelcome.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/27 15:12:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 192.185.148.196 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:122956 Archived-At: On 4/27/20 12:06 AM, Emanuel Berg via Users list for the GNU Emacs text editor wrote: > Tim Johnson wrote: > >> Here is a key definition: >> >> (define-key jinja2-mode-map (kbd "C-c i") #'jinja2-insert-var) >> >> As I understand it, the sharp-quote (#') tells the >> compiler that jinja2-insert-var is meant to be >> a function > Yes, that's what happens. I don't know what the > byte-compiler does with that information tho, maybe it > is just a matter of it being able to warn you if that > function doesn't exist, since with the hash-quote, it > knows where to look specifically... > > But there is also the advantage of you being able to see > that something is, or supposed to be, a function. > > Perhaps font-lock could also be told to give it > a special color, e.g. `font-lock-function-name-face', if > desired - to increase seeing/reduce reading > even further. > >> The following quotation: >> >> "it is always good practice to sharp quote every >> symbol that is the name of a function, whether it's >> going into a mapcar, an apply, a funcall, or >> anything else." > Well, that's what I do and it always worked. But if you > seek a more scientific documentation and practical > HOWTO, surely this is documented in the official > manual(s)? > >> (setq my-keypairs '("h" my-h-func "g" my-g-func "f" my-f-func)) >> >> and using iteration to *programmatically* call >> define-key for multiple key definitions as in >> >> (define-key mymap                          ;; add to keymap >>     (kbd (concat ldr (nth ndx mylist)))    ;; sequence as in "g" >>     (nth (+ ndx 1) mylist))                ;; >> command as in my-g-func >> >> The form above is indeed a snippet from a defun that >> I have used for years >> >> Would it be better to change (nth (+ ndx 1) mylist) to >> (function (nth (+ ndx 1) mylist)) ? > But even if that had worked all the advantages mentioned > so far would be lost, right? > > Maybe you could initially instead of the quote use the > backquote/comma, or `list', with hash-quote? > Thanks Emanuel. Of course you know that it was your use of the sharp-quote in a response to an earlier question by me that prompted me to ask this latter question. I will play around with with subsequent advice when I have the time. cheers -- Tim tj49.com