From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Narendra Joshi Newsgroups: gmane.emacs.help Subject: Re: Quoted function in `define-key' Date: Mon, 06 Feb 2017 00:39:18 +0530 Message-ID: <87bmug8nfl.fsf@vicarie.i-did-not-set--mail-host-address--so-tickle-me> References: <874m0a6ywa.fsf@vicarie.i-did-not-set--mail-host-address--so-tickle-me> <874m0ap3ex.fsf@drachen> <87efzedmlk.fsf@vicarie.i-did-not-set--mail-host-address--so-tickle-me> <87zii1dg17.fsf@drachen> <87fujt7xsv.fsf@vicarie.i-did-not-set--mail-host-address--so-tickle-me> <8760korbkj.fsf@drachen> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486321547 1446 195.159.176.226 (5 Feb 2017 19:05:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 5 Feb 2017 19:05:47 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Narendra Joshi , help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 05 20:05:42 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 1caS83-0008Q3-Dq for geh-help-gnu-emacs@m.gmane.org; Sun, 05 Feb 2017 20:05:39 +0100 Original-Received: from localhost ([::1]:44175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caS85-0004k2-UA for geh-help-gnu-emacs@m.gmane.org; Sun, 05 Feb 2017 14:05:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caS7Z-0004hg-Rj for help-gnu-emacs@gnu.org; Sun, 05 Feb 2017 14:05:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1caS7W-0002pc-OV for help-gnu-emacs@gnu.org; Sun, 05 Feb 2017 14:05:09 -0500 Original-Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:34153) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1caS7W-0002nd-K4 for help-gnu-emacs@gnu.org; Sun, 05 Feb 2017 14:05:06 -0500 Original-Received: by mail-pg0-x244.google.com with SMTP id v184so7022176pgv.1 for ; Sun, 05 Feb 2017 11:05:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=G1Usp2wunxrAG9o5UaqkJZD2oNydI52SoS+eXOCSAlI=; b=WHWT+XI3GMQ2uRpLN168W9iPaJdpP3RWZy2yaEkkxAAPLgCy+E+ANENW13qyeDRA69 Jt4znNMr5zoo4wki+Y1ooTr46hOYPyeuzvy+ic5MEmvQWGA6cYxpbJ8ovj3ljZA7tEt1 j58m+lfzJJIcjdGTpKQwALuRbnD8ctDj9ToF4H9z+r4QrXbMZCWvWYy5slqX+sUA3adG oZF6PPUhLplXHmjvn9TbQMzB5b0mQcvETfIVGqsmdgTSjGYxrKGiHma9wJYYzNjkCbBx h5cY/UKuxHWgei2TQNucXd5fYyBpB1aJKq3hVujokLOvaDVIEnwIgkfdx86HoolAlzqB eAiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=G1Usp2wunxrAG9o5UaqkJZD2oNydI52SoS+eXOCSAlI=; b=btq5ewEmU8yvYFxBlo25xIHWGRq60NjoQmOC+Ou8VUjoRNU2hqty4UzQ2nZL/Qdo9w zrGDchFP64OAWI3kZ4uID8wDmGre7fi6Li85vL/Nr+wDz4qAkyktIbfz5z2+CfgIzmbw Me4RVsBCy1KaG6H9GymtT1Qpnc6R8OTPpYISw56ei+5Bkxm7+64ii7EeNDuJxmJrRqO1 4ANmyzbIQgK9VKlTR5s0mXiHwR5AXDQpc3Ir8McZfj7p6EiJBpnbLZR4bFEcy8zsJ7L0 MQ/rCYFHWvIiL0VacnYS16l0HxS5awZghzzWFIYLATWhKeJVa/9jWUKIKCQiPFeYLnNI mWew== X-Gm-Message-State: AIkVDXL3DOdBuXt/RQRT5hLIdMnOpRKj/is3qVavIxiEKG9Y6JyI9wB1Br11ISpPhvkkbA== X-Received: by 10.98.201.135 with SMTP id l7mr8935428pfk.67.1486321505330; Sun, 05 Feb 2017 11:05:05 -0800 (PST) Original-Received: from vicarie ([182.70.84.252]) by smtp.gmail.com with ESMTPSA id x2sm82832332pfa.71.2017.02.05.11.05.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Feb 2017 11:05:04 -0800 (PST) X-Google-Original-From: Narendra Joshi In-Reply-To: <8760korbkj.fsf@drachen> (Michael Heerdegen's message of "Sun, 05 Feb 2017 14:50:36 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 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:112254 Archived-At: Michael Heerdegen writes: > (info "(elisp) Symbol Components") How did you insert this link to info? > > >> What does the byte compiler do with this information? I am just >> curious about this. > > When you sharp quote a lambda expression, the compiler knows that this > lambda list is supposed to be called as a function, and will byte > compile it. The evaluator might turn it into a closure when lexical > binding is used. > > In elisp, the `lambda' macro comes with implicit function quoting (see > its definition), so you can just omit it. > > But OTOH, it's an error to `quote' lambdas like > > '(lambda () body...) > > because it will prevent byte compilation or closure creation and make > Stefan angry. :) > Obviously for `function' quoted symbols there is not much to do, but the > byte compiler can determine whether that function is defined/ will be > defined at run time, so it can warn you about typos as an extra service. > > For example, you get a compiler warning when compiling > > (define-key my-map [key] #'make-frame-cmomand) > > but not for > > (define-key my-map [key] 'make-frame-cmomand) > >> If this is recommended, I would also start quoting my functions as >> #'my-function. > > Yes, it's a good idea. Thanks! This is very informative. -- Narendra Joshi