From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.help Subject: Re: Proper use of function form Date: Sun, 26 Apr 2020 20:48:37 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="10853"; mail-complaints-to="usenet@ciao.gmane.io" Cc: MLEmacs To: Tim Johnson Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 27 02:49:17 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 1jSrxV-0002jc-CY for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 02:49:17 +0200 Original-Received: from localhost ([::1]:49550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSrxU-00047Q-Cl for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 26 Apr 2020 20:49:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52848) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSrxA-000459-3C for Help-gnu-emacs@gnu.org; Sun, 26 Apr 2020 20:48:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSrx9-0002zi-JH for Help-gnu-emacs@gnu.org; Sun, 26 Apr 2020 20:48:55 -0400 Original-Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]:44860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jSrx9-0002yE-6j for Help-gnu-emacs@gnu.org; Sun, 26 Apr 2020 20:48:55 -0400 Original-Received: by mail-ot1-x332.google.com with SMTP id j4so23466196otr.11 for ; Sun, 26 Apr 2020 17:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8CF5ZIi9e8BbvDyJVnFTGhzU0lMQlk6GRNpst3ducME=; b=KNlFGmNVoZ0CPXXHacICHBmaoH/H1dSXbAW+SwHcS0dSk3QBKNuc2Ztjui9QRRLg9F U6IrIByhRtOJpp4Z+mWiub9/QdGNCEYNuLEr6Bub8EJr1zj4/OzZCkUCf/QLSioXDFx3 nL4ESGEfSUk/sYbGkeTUUy0DyzX8axm4LWFDJRxpUY2DyVMKDT/0ovDAmqgIqk1hM0p7 4f/LsNRe4F2Ib0y2v3p/2gR8CNACAvvdn9laceCMcpPPjnezC6USVp7LYc7uR7ExI8hG D2XhkWF7CFtkeWqyZeQMyyV9jQQOKcvq+gXKJiR/wg5MUskwgB5LFoXSshvhVc0bWybq iaiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8CF5ZIi9e8BbvDyJVnFTGhzU0lMQlk6GRNpst3ducME=; b=IHUv85zoHigBiKtBvDJQdMm9qVZvsgT+Y5clfAv39L1lJ+j0nB38RQs47IaCpuVThF fZsowlct/brTMexLW/dY3vppAHz52fM/etrHxfFEGkIZOhRxsvy8zs3m5mnQk8xyWODA xNKEg6yluy8jILC2txMKbadsMcsIVmDBNtxVgT81zOI0h0ZuPhzIO8WL7HsSZUdwSNZc b5CwX6YvYMNjuDvxBeiIwjxRW3itbw1KYfQbXPD3KGC0hNumGAy6RzymAahEK8izQ662 ZfVSIc7v+CeuI7SomfXkaqbHt6IiOEgUHJKkzdxakksLgZBEVh1RP7FybpCT/dlNWuRE 0+cA== X-Gm-Message-State: AGi0Pub451xbOxR7N7UP0GrqMPyUI9e0cZK9gBS1BONmNWxaC5Jv7UJZ AZjCveCQKTOMiE4WA0c8XqyWIE55ueqzREJBvcqevQ== X-Google-Smtp-Source: APiQypJ8mOegVys+gt5kPyUsmMjcyS69+xBF9gTgmQjTRUytGieKopcys5qZmZpTpcjopQrzx+pH//XpMDu8SgocnAc= X-Received: by 2002:aca:ad87:: with SMTP id w129mr13578683oie.173.1587948533272; Sun, 26 Apr 2020 17:48:53 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=npostavs@gmail.com; helo=mail-ot1-x332.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::332 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:122949 Archived-At: On Sun, 26 Apr 2020 at 19:27, Tim Johnson wrote: > (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)) ? No, you would put the function in the `my-keypairs' initializer: (setq my-keypairs `("h" ,#'my-h-func "g" ,#'my-g-func "f" ,#'my-func)) I usually don't bother sharp-quoting in lists of functions though.