From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WJtaJRsqr2GjjgAAgWs5BA (envelope-from ) for ; Tue, 07 Dec 2021 10:32:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id cPM5IRsqr2HQdwAAbx9fmQ (envelope-from ) for ; Tue, 07 Dec 2021 09:32:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E15EC3BB7E for ; Tue, 7 Dec 2021 10:32:10 +0100 (CET) Received: from localhost ([::1]:46170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muWpV-000765-0G for larch@yhetil.org; Tue, 07 Dec 2021 04:32:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muWo9-00073M-2G for emacs-orgmode@gnu.org; Tue, 07 Dec 2021 04:30:45 -0500 Received: from mail.mojserwer.eu ([195.110.48.8]:48718) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muWo6-00005b-8E for emacs-orgmode@gnu.org; Tue, 07 Dec 2021 04:30:44 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id E3683E6FFF; Tue, 7 Dec 2021 10:30:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EriVALa3ZlN5; Tue, 7 Dec 2021 10:30:25 +0100 (CET) Received: from localhost (178235147228.dynamic-3-poz-k-0-1-0.vectranet.pl [178.235.147.228]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 6A1BDE61F6; Tue, 7 Dec 2021 10:30:25 +0100 (CET) References: <5b93e27d-df22-3799-7b35-3078472a5154@gmail.com> <875ys1ba9n.fsf@gmail.com> User-agent: mu4e 1.1.0; emacs 28.0.50 From: Marcin Borkowski To: Tim Cross Subject: Re: From macros to elisp programming? In-reply-to: <875ys1ba9n.fsf@gmail.com> Date: Tue, 07 Dec 2021 10:30:17 +0100 Message-ID: <877dcgn4nq.fsf@mbork.pl> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=195.110.48.8; envelope-from=mbork@mbork.pl; helo=mail.mojserwer.eu X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638869531; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=4zaJK/YAcvLuHWsrhIYB+OlVbbpitjKjdWjqos7KlPg=; b=mZK0e3RyFM8+ZjXeQMcLisRbzoD39i9UgYbYoiJtKYPHh3QauKOl5pRiZPyCzbavXyrZVP ZX9lauKHLRsmwTU5bEcEHh3SIhEmxZnV1bVLYASW6TTjxWhCuI2aDlzJ+myYnfgqlIvpVd txzXO21bvz/YkyaKdDiCvREyP+QyhOoIUt7F/U+gS2G8mWD5vm5e8brWxl8Zmwt4N+PGwS SkYdQDd1BfB61dol+tncNheE62fwHRoxJexc5DkPkAqFlNKfw3FCVNK6XMQNgLgk+q9HhO qc1NgWFPu9Nm/2APM6pmRR4OQgnTu0grCBC/2VtvB2rOIrZj6n4WprmTvknHKQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638869531; a=rsa-sha256; cv=none; b=cHFGD8E9AXXxGeW78kBB5drS+5TwBRJNlAHGj0hoUkMPMceKBdFJSJDB5N6QAHbFckodRQ AfNxprA1FjyYDZ/MGnTpLeHe7ldZh1Mo8hyjlzPASCQfbp414PdzeXKuV0Wx1dI7pQog3N UWsopnluUoPuZIbKrH7BssC1RojjXV8AIIw1GbUfOXEwpTHweVPTv/6dpHz3K0j5XUA/Ap zLFTJb73SxDCFSZ4I+485DMk5lERZivW53qHyW80/y6Yj7F6931lzRD1gZnHfaQHORw1dv d8x/db5uC+oKRPSybnXkWewehfB7ZISBC4LL5tSBc3T5zKt7ykZ4s+ggSR+rdg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.04 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E15EC3BB7E X-Spam-Score: -2.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2aWLPza0BrVV On 2021-12-06, at 23:10, Tim Cross wrote: > It is difficult to recommend resources as a lot depends on your own > experience, what level you want to dive into and what you want to be > able to do. There is a big difference in knowing enough emacs lisp to > tweak your Emacs configuration and knowing enough emacs lisp to write > the next great package. The good news is that there are some great free > resources out there, so the main investment will be in time. +1 > If you have not yet read it, a good starting point is Mastering Emacs by > Mickey Petersen https://www.masteringemacs.org/ Agreed, though AFAIR it doesn't talk about coding in Elisp, only /using/ Emacs. > There is also an Introduction to Emacs Lisp, which is part of the GNU > Emacs distribution. I second that. It is a great book for beginners. > For getting to understand lisp programming at a much deeper level, there > are some excellent resources out there, many of which are free. The > trick is to not limit yourself to searching just for Emacs lisp. Emacs > lisp is a dialect of lisp - a domain specific language for an editor if > you like. Most of the concepts associated with lisp are applicable to > emacs lisp. almost any resource teaching lisp will teach you things > applicable to emacs lisp. Therefore, if you really want to learn how to > program in emacs lisp, search for resources on learning to program in > lisp. On the other hand, Elisp has quite a few quirks which make it stand out. These mare mainly related to the fact that Emacs is a text editor and not an interpreter for a general-purpose language. Things like point, windows, buffers, using buffers to process text (as opposed to strings in 99% langauges), buffer-local variables, advice system... > There is a somewhat famous book called 'The Structure and Interpretation > of Computer Programs" (SCIP), which is based on a course in computer > science taught at MIT. It is an excellent book. Even better, videos from > the course are also available on-line. While the focus is on > programming, it uses a lisp dialect to demonstrate the core principals, > which it makes very clear. A must watch for anyone really keen to > understand programming. +100. Those videos are great (the book is more in-depth, though). > Another great book about lisp which is also freely available is Paul > Graham's 'On Lisp', which I think gives a pretty good overview of the > power and flexibility of lisp and functional programming. Yes, though it it way more advanced - I probably wouldn't give it to a beginner. > A book which I really like and which I think really shows off the power > of lisp macros is Doug Hoyte's "Let over Lambda". Not only does this book > show the wonderful power and possibilities of macros, it also shows some > of the dangers and pitfalls. However, it is pretty hard core computer > science focused and can take some effort to really digest. Also, one can go a really long way /without/ macros. I'd argue that the main reason a beginning Elisper should learn the basics of (Elisp) macros is to be able to (roughly) understand what is going on when s/he sees them in other people's code. > If you really want to learn emacs lisp, there is really only one route > you can take - sit down and start using it to write simple programs to > solve some basic problems. Maybe you would like to automate some of what > you do or maybe you would like to modify how Emacs does something or > maybe you want to create a new command to do something. Open a new > window and start trying to implement your idea. You will run into road > blocks and you will often be frustrated, but eventually the penny will > drop. The other big advantage is that when you run into problems, you > will have concrete issues which you can take to a forum for help. It is > much easier for people to help with something concrete than something > more vague or conceptual. The only real way to learn is to do - if you > want to learn emacs lisp, you need to use emacs lisp to solve > problems. Again, very solid advice. Though for some people at least some guidance may be valuable. One example would be "Writing GNU Emacs Extensions" by Bob Glickstein. It is fairly old, but from what I heard most of it should be still relevant. Word of caution: I'm not sure I'd agree with Glickstein's selection of topics. For example, he writes about writing major modes or autoloading. The former is IMO not very useful unless you are doing something /extremely/ atypical. The latter is very advanced (and not really essential for 99.99% or even 100% use-cases), and by the time the learner /needs/ it, s/he will be advanced enough to learn it from the GNU Emacs Lisp Reference Manual anyway. Speaking of which, it also an excellent resource not to be overlooked - and it comes with Emacs itself. Another thing I'd like to add here is that asking on this list is usually a good idea. I learned a lot (and I'm still learning a lot) just by reading emails here. Other resources I'd mention are: - Emacs source code (though it is very complicated in some places...) - source code of various packages - Emacs blogs (https://planet.emacslife.com/) Best, -- Marcin Borkowski http://mbork.pl