From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sacha Chua Newsgroups: gmane.emacs.tangents Subject: Re: 2016-04-18 Emacs News Date: Mon, 18 Apr 2016 12:48:58 -0400 Message-ID: <87potmzwud.fsf@sachachua.com> References: <87wpnvymvt.fsf@sachachua.com> <29224df4-fa4c-48d7-b5f5-9b366bbd8bdc@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1460998161 24397 80.91.229.3 (18 Apr 2016 16:49:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Apr 2016 16:49:21 +0000 (UTC) Cc: emacs-tangents@gnu.org To: Drew Adams , fincherdotorg@gmail.com Original-X-From: emacs-tangents-bounces+get-emacs-tangents=m.gmane.org@gnu.org Mon Apr 18 18:49:13 2016 Return-path: Envelope-to: get-emacs-tangents@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1asCML-00070I-27 for get-emacs-tangents@m.gmane.org; Mon, 18 Apr 2016 18:49:13 +0200 Original-Received: from localhost ([::1]:41870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asCMK-00014h-Hf for get-emacs-tangents@m.gmane.org; Mon, 18 Apr 2016 12:49:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asCMD-0000x0-RX for emacs-tangents@gnu.org; Mon, 18 Apr 2016 12:49:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asCMA-0001gT-Dm for emacs-tangents@gnu.org; Mon, 18 Apr 2016 12:49:05 -0400 Original-Received: from mail-ig0-x230.google.com ([2607:f8b0:4001:c05::230]:36102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asCM9-0001em-Vx for emacs-tangents@gnu.org; Mon, 18 Apr 2016 12:49:02 -0400 Original-Received: by mail-ig0-x230.google.com with SMTP id f1so77925472igr.1 for ; Mon, 18 Apr 2016 09:49:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sachachua-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=4/N8c3qx4tdY+g4OUthHUWOfNfhfCieOBN+Eq896ivs=; b=Dj2GB9mRmFB2KiNztJ2HmZwC/Yci2x0+oQAmsMCBxthyg/cz5inqOUXv6EPLowAZuA cgm+avf1i5HjuGeMlp22lwTUcGSFE721Wom6Z8K9dVr2o57LY74oMw7SCoaA2eb+RkLv MiUuqCwAdMHGqt5XLnYJFQPLACBe3jYonneoSQmvLvqcgGNSH4+24LDndwyn6SgU0A0W hjslHQAwSushxGD1mzLN1wFBtxl1LJ3WjHg6Rm2YlVAPbPTXEtnpI7x8J8cquBRd0Wq7 P+UrnryQz4Kkcgd/RwOKy9XqVsFI/qLD6B57LuUHHU/QE8UccMYAswuwPDMl002LQGG7 dDjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=4/N8c3qx4tdY+g4OUthHUWOfNfhfCieOBN+Eq896ivs=; b=iBGLCtOA0eSkq+qDhLe+FmJyfSMl3mhjuV4d2dv1f4pk9wOCo6bnnQ4Eko+EoSCujX Xf3RLMr1C56JTDYRUcEntGcQjrBJKgxboQI50L30LPScOTx0AVY++da2sLgO+bm/bEYp VVUnUJmRLrFEOaNMrmi7h+Vttmp8jiiIgqjZu16SzBqcmFHma/Ap5608SrpRQBsxhd1u BbRtA5S+DpSd68dfzP25RSqmAkZvbWee8by6FGXjHyzeh886snTiFXvIywST2WpaK6AT 0e/GvOug95Kk4T+nocd7pRGpvgAS0LDEwGY35EoZQaDdis/cNVEwrjPTsl8+P6ZheV1u +Kwg== X-Gm-Message-State: AOPr4FURYESa7Mgr26iiIwuPlSIclrW3FqQESKtEsqwUI2N2Gt9Xjhhq0ltyWKNg2tmmKA== X-Received: by 10.50.111.72 with SMTP id ig8mr20669626igb.46.1460998140493; Mon, 18 Apr 2016 09:49:00 -0700 (PDT) Original-Received: from sacha-kubuntu (76-10-135-88.dsl.teksavvy.com. [76.10.135.88]) by smtp.gmail.com with ESMTPSA id k1sm33293695igg.16.2016.04.18.09.48.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Apr 2016 09:48:59 -0700 (PDT) Original-Received: from sacha-kubuntu.local.sachachua.com (localhost [127.0.0.1]) by sacha-kubuntu (Postfix) with ESMTPS id A00BB4AA259; Mon, 18 Apr 2016 12:48:58 -0400 (EDT) In-Reply-To: <29224df4-fa4c-48d7-b5f5-9b366bbd8bdc@default> (Drew Adams's message of "Mon, 18 Apr 2016 09:19:43 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c05::230 X-BeenThere: emacs-tangents@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-tangents-bounces+get-emacs-tangents=m.gmane.org@gnu.org Original-Sender: "Emacs-tangents" Xref: news.gmane.org gmane.emacs.tangents:120 Archived-At: Drew Adams writes: >> A nice and clear summary of Emacs Lisp (Reddit) >> http://www.fincher.org/tips/Languages/Emacs.shtml > Hm. It's generally good to see such summaries. But > this one is not as nice and clear as it might be, IMO. > It is also somewhat out of date. Thanks for the detailed feedback, Drew! I'm looping in the author here so that the tutorial can be updated - see Drew's notes below. https://www.reddit.com/r/emacs/comments/4f7q0f/a_nice_and_clear_summary_of_emacs_lisp/ also has more comments. > (set 'fname "Mitch") > > Not a great example of what `set' is used for. If this > were a common use case then we would need only `setq'. > > (setq fname "Mitch") > > Doesn't bring much attention to the fact that the second > arg is evaluated and its value is used. IOW, something > like a string, which is self-quoting, is not the best > thing to show in such an example. > > (list 'a 'x "asdf" 6) => (list a x "asdf" 6) > > Should be => (a x "asdf" 6) - no "list". But even that > would not bring much attention to the fact that each arg > is evaluated. > > (sort '(5 3 9 27) '<) => (3 5 9 27) > > Well yes, but, especially if introducing this to newbies, > the destructive nature of `sort' is really important to > point out. > > (concat "I " "went to " "the woods ")=> "I went to the woods " > > Might be good to use some arguments that are characters > and lists of chars - especially characters. > > (length "I went to the woods ")=> 20 > > Yes, but `string-width' is typically more appropriate for > strings (and there is `string-bytes'). A more typical > `length' use case would be with a list or a vector. > > (aref s i) > returns the ith char (0 based) > (aref "abcd" 2)=> 99 > > It's not about counting characters. `aref' is for any > array, not just a string. Same for `aset' description. > > Section "Logical functions (and, or, not, eq)" does not > say what constitutes a "true" or a "false" value. In > particular, it does not say that non-nil is treated as > true by most predicates (including `and', `or', and `not'). > > "equal takes two args and tests if the values are equal" > > Doesn't say what it means for two values to be "equal". > > Section "Function Template" is really a command-definition > template. > > "Commands and functions can also have hooks. These are > created using 'defadvice'." > > Kind of. But they are not called "hooks" in Emacs (e.g. > in the doc). And `defadvice' is now deprecated, in favor > of the new advice system. > > `let': "uninitialized variables may also be used... This > creates temporary variables "c" and "d", but assigns no > value." > > That is wrong - vars `c' and `d' are bound to nil. > > "let* ;; forces sequential execution" > > No, sequential (i.e., dependent) bindings. Execution of > the body of `let' is also sequential. > > "if the documentation string begins with a "*", the variable > is user definable with the M-xset-variable command" > > No. This behavior was (unfortunately, IMO) removed long ago. > > Introducing `reduce', regexps, and macros is too advanced, > and too unexplained, for this high-level intro. It can > erroneously give the impression of authority or expertise. > > It might be different if (a) these things were actually > described/explained here and (b) there was not so much > that is wrong or misleading in the basic stuff presented. > > "defunst - defunst works like defun but "inlines" the function. > Works like "Inline" in C++." > > No. `defunst' does not exist in Emacs Lisp. `defsubst' > was presumably meant. > > `interactive': "r - the hilighted region" > > No; it is the region, active (highlighted) or not. > > `C-h a' is not `command-apropos' but `apropos-command'. > > `C-h C-k' is not `Info-goto-emacs-key-command-node'. > > `E-!' should be `M-!' (or `ESC !'). > > The link to the W3 web browser is broken. And `eww' might > be a better choice now (?). > > The commands bound to `C-x (', `C-x )', and `C-x e' have been > different for years now (kmacro was introduced in Emacs 22!). > > In sum, again, it's good that people post such summaries, but > they can also be harmful/misleading. If they are posted to > a community place such as Emacs Wiki then they at least have > a better chance of getting corrected and updated. > > And I really recommend _asking Emacs_ itself, including the > manuals. There is a good intro manual to learning Emacs Lisp > that comes with Emacs.