From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Why eev has a weird elisp tutorial and how to use it
Date: Fri, 28 Jan 2022 03:49:32 +0100 [thread overview]
Message-ID: <8735l8poar.fsf@zoho.eu> (raw)
In-Reply-To: CADs++6gq8ZFz5vrfJBk4r4skUyN=bwiCPznsCqzz4ReBFKo0Qg@mail.gmail.com
And this video is - hopefully - a first step to make my
tutorial less mysterious. So: that's it. That's what
i wanted to show. Bye! =) [1]
Yeah, that was a verbose and informal intro from a personal
POV if there ever was one - and except for the thing I already
mentioned, that people should learn to read code first, where
I disagree 100%, from my POV but also in general - but except
for that, all's cool obviously, but ...
Where is the actual Elisp intro? :O
There's no transcript of that?
That's the one, if one only has one, that one should have!
My own POV is rather different, I think. TBH I don't remember
ever having a problem with Elisp at the early stages actually
... a cheat sheet (crib sheet) with all the basic stuff
(meaning a lot since there is a lot) and on top of that
a cookbook of more advanced, but still common methods and
situations - this OTOH can be commented, tho briefly - those
two documents would have perhaps speeded up early effort.
"Methods and situations" would include small demos and
skeleton code with concepts such as DWIM, closures, stuff like
that, the more Lispy stuff. Nothing a beginner can't handle if
presented right.
Example DWIM:
;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;; https://dataswamp.org/~incal/emacs-init/dwim.el
;; DWIM interface
(defun test-dwim (&optional beg end)
(interactive (when (use-region-p)
(list (region-beginning) (region-end)) ))
(let ((bg (or beg (point-min))) ; or just (point) here
(ed (or end (point-max))) )
(list bg ed) ; code here
))
;; test the interface
(when nil
(save-excursion
(set-mark 10)
(goto-char 500)
(call-interactively #'test-dwim) ) ; (10 500)
(call-interactively #'test-dwim) ; ( 1 1163)
(test-dwim 30 90) ; (30 90)
(test-dwim) ; ( 1 1163)
)
;; example function
(defun count-chars (&optional beg end)
(interactive (when (use-region-p)
(list (region-beginning) (region-end)) ))
(let*((bg (or beg (point-min)))
(ed (or end (point-max)))
(diff (- ed bg)) )
(prog1
diff
(message "%d" diff) )))
;; test the example function
;; (call-interactively #'count-chars) ; 1162
;; (count-chars) ; 1162
;; (count-chars 10 40) ; 30
;; (+ 1111 (count-chars)) ; 2273
[1] http://angg.twu.net/find-elisp-intro.html
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2022-01-28 2:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 16:06 Why eev has a weird elisp tutorial and how to use it Eduardo Ochs
2022-01-27 18:06 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-28 2:49 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2022-01-28 3:56 ` Eduardo Ochs
2022-01-28 5:22 ` Emanuel Berg via Users list for the GNU Emacs text editor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8735l8poar.fsf@zoho.eu \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.