From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.tangents Subject: RE: 2016-04-18 Emacs News Date: Mon, 18 Apr 2016 09:19:43 -0700 (PDT) Message-ID: <29224df4-fa4c-48d7-b5f5-9b366bbd8bdc@default> References: <87wpnvymvt.fsf@sachachua.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1460996416 27750 80.91.229.3 (18 Apr 2016 16:20:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Apr 2016 16:20:16 +0000 (UTC) To: Sacha Chua , emacs-tangents@gnu.org Original-X-From: emacs-tangents-bounces+get-emacs-tangents=m.gmane.org@gnu.org Mon Apr 18 18:20:01 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 1asBu4-0002mO-HY for get-emacs-tangents@m.gmane.org; Mon, 18 Apr 2016 18:20:00 +0200 Original-Received: from localhost ([::1]:40621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asBu3-00060B-Id for get-emacs-tangents@m.gmane.org; Mon, 18 Apr 2016 12:19:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asBty-0005yK-1O for emacs-tangents@gnu.org; Mon, 18 Apr 2016 12:19:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asBts-0003La-TB for emacs-tangents@gnu.org; Mon, 18 Apr 2016 12:19:53 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:35185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asBts-0003IR-Kg for emacs-tangents@gnu.org; Mon, 18 Apr 2016 12:19:48 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u3IGJj9I013407 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Apr 2016 16:19:46 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u3IGJj9w012901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Apr 2016 16:19:45 GMT Original-Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u3IGJitF023653; Mon, 18 Apr 2016 16:19:44 GMT In-Reply-To: <87wpnvymvt.fsf@sachachua.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6744.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:119 Archived-At: > 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. (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) =3D> (list a x "asdf" 6) Should be =3D> (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) '<) =3D> (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 ")=3D> "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 ")=3D> 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)=3D> 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.