* list of elisp primitives ? @ 2019-12-22 2:59 Jean-Christophe Helary 2019-12-22 3:21 ` Eduardo Ochs 2019-12-22 19:21 ` Marcin Borkowski 0 siblings, 2 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-22 2:59 UTC (permalink / raw) To: Emacs developers Is there a list of elisp primitive functions defined in C somewhere ? I was thinking that because of the sheer amount of functions in the elisp reference, it might be much easier to start programming with the primitives to understand how elisp works at its core, and then climb the ladder when need arises... Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-22 2:59 list of elisp primitives ? Jean-Christophe Helary @ 2019-12-22 3:21 ` Eduardo Ochs 2019-12-22 3:43 ` Jean-Christophe Helary 2019-12-22 19:21 ` Marcin Borkowski 1 sibling, 1 reply; 17+ messages in thread From: Eduardo Ochs @ 2019-12-22 3:21 UTC (permalink / raw) To: Jean-Christophe Helary; +Cc: Emacs developers [-- Attachment #1: Type: text/plain, Size: 867 bytes --] Try this: (defun fboundp-and-subrp (symbol) (and (fboundp symbol) (subrp (symbol-function symbol)))) (setq my-primitives (apropos-internal "^.*$" 'fboundp-and-subrp)) (defun my-describe (symbol) (format "(describe-function '%S)\n" symbol)) (insert (mapconcat 'my-describe my-primitives "")) On Sun, 22 Dec 2019 at 00:01, Jean-Christophe Helary < jean.christophe.helary@traduction-libre.org> wrote: > Is there a list of elisp primitive functions defined in C somewhere ? > > I was thinking that because of the sheer amount of functions in the elisp > reference, it might be much easier to start programming with the primitives > to understand how elisp works at its core, and then climb the ladder when > need arises... > > > > Jean-Christophe Helary > ----------------------------------------------- > http://mac4translators.blogspot.com @brandelune > > > > [-- Attachment #2: Type: text/html, Size: 1393 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-22 3:21 ` Eduardo Ochs @ 2019-12-22 3:43 ` Jean-Christophe Helary [not found] ` <CADs++6hB7ZKnEWOZ=XOGdA=W_CacCE2=354ARfNFtWvStaCF3g@mail.gmail.com> 2019-12-22 14:56 ` Óscar Fuentes 0 siblings, 2 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-22 3:43 UTC (permalink / raw) To: Emacs developers Thank you Eduardo. That's 1290 functions... The reference seems to have 1608 functions and 294 commands, so those primitives are not even a "useful subset" of emacs lisp functions... I guess that was a naïve idea. So I'll just have to go through the reference and try to find myself a minimaly useful subset (which is what the Intro should be about, btw.) > On Dec 22, 2019, at 12:21, Eduardo Ochs <eduardoochs@gmail.com> wrote: > > Try this: > > (defun fboundp-and-subrp (symbol) > (and (fboundp symbol) (subrp (symbol-function symbol)))) > > (setq my-primitives (apropos-internal "^.*$" 'fboundp-and-subrp)) > > (defun my-describe (symbol) (format "(describe-function '%S)\n" symbol)) > > (insert (mapconcat 'my-describe my-primitives "")) > > > On Sun, 22 Dec 2019 at 00:01, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > Is there a list of elisp primitive functions defined in C somewhere ? > > I was thinking that because of the sheer amount of functions in the elisp reference, it might be much easier to start programming with the primitives to understand how elisp works at its core, and then climb the ladder when need arises... > > > > Jean-Christophe Helary > ----------------------------------------------- > http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <CADs++6hB7ZKnEWOZ=XOGdA=W_CacCE2=354ARfNFtWvStaCF3g@mail.gmail.com>]
* Re: list of elisp primitives ? [not found] ` <CADs++6hB7ZKnEWOZ=XOGdA=W_CacCE2=354ARfNFtWvStaCF3g@mail.gmail.com> @ 2019-12-22 4:14 ` Jean-Christophe Helary [not found] ` <CADs++6j+niJy3hvrTEJ-LrqcitFuffX=1Duca7pU30a8qfh_zg@mail.gmail.com> ` (2 more replies) 0 siblings, 3 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-22 4:14 UTC (permalink / raw) To: Emacs developers What I'm trying to do is this: > I was thinking that because of the sheer amount of functions in the elisp reference, it might be much easier to start programming with the primitives to understand how elisp works at its core, and then climb the ladder when need arises... i.e. trying to find a limited subset of functions that one can use to program in elisp and do non-trivial things but that do not involve searching the reference at all times. I'm thinking like in standard learners dictionaries, there are clear indications, like asterisks, that tell the learner whether the word is basic (generally about 2000 words) or intermediate (about 4000 words). People who know the basic words can get by and express most of what they need to express in daily life. For ex, it is estimated that there are about 140k words in French, but daily use only requires 1k. Let's lower the number of passively known words to 40k, that's 50 functions in Elisp... JC > On Dec 22, 2019, at 12:52, Eduardo Ochs <eduardoochs@gmail.com> wrote: > > Hi Jean-Christophe, > What are you trying to do? > If you'd like to discuss by IRC in #emacs at Freenode I'm edrx there... > [[]], E. > > > On Sun, 22 Dec 2019 at 00:44, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > Thank you Eduardo. > > That's 1290 functions... > > The reference seems to have 1608 functions and 294 commands, so those primitives are not even a "useful subset" of emacs lisp functions... > > I guess that was a naïve idea. So I'll just have to go through the reference and try to find myself a minimaly useful subset (which is what the Intro should be about, btw.) > > > On Dec 22, 2019, at 12:21, Eduardo Ochs <eduardoochs@gmail.com> wrote: > > > > Try this: > > > > (defun fboundp-and-subrp (symbol) > > (and (fboundp symbol) (subrp (symbol-function symbol)))) > > > > (setq my-primitives (apropos-internal "^.*$" 'fboundp-and-subrp)) > > > > (defun my-describe (symbol) (format "(describe-function '%S)\n" symbol)) > > > > (insert (mapconcat 'my-describe my-primitives "")) > > > > > > On Sun, 22 Dec 2019 at 00:01, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > > Is there a list of elisp primitive functions defined in C somewhere ? > > > > I was thinking that because of the sheer amount of functions in the elisp reference, it might be much easier to start programming with the primitives to understand how elisp works at its core, and then climb the ladder when need arises... > > > > > > > > Jean-Christophe Helary > > ----------------------------------------------- > > http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <CADs++6j+niJy3hvrTEJ-LrqcitFuffX=1Duca7pU30a8qfh_zg@mail.gmail.com>]
* Re: list of elisp primitives ? [not found] ` <CADs++6j+niJy3hvrTEJ-LrqcitFuffX=1Duca7pU30a8qfh_zg@mail.gmail.com> @ 2019-12-22 4:38 ` Jean-Christophe Helary 0 siblings, 0 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-22 4:38 UTC (permalink / raw) To: Emacs developers > On Dec 22, 2019, at 13:30, Eduardo Ochs <eduardoochs@gmail.com> wrote: > > Ok... > > I don't think I can help, then... > > I've been teaching Emacs to lots of newbies lately, but my approach is > exactly the opposite of that - I prefer to suppose that their memory > is very bad and that they have very little focus, and I start by > teaching them how to create sexp hyperlinks to everything that they > find interesting in the info manual, in the elisp source, in manpages, > in PDFs, and in several other kinds of places... here are four links > to my approach if you'd like to take a look: Thank you, that's very interesting. But I think that's not so different from what I'm looking for. You still need to teach learners a few basic skills and for that they do use their memory. I'm thinking about 20-40 basic functions in elisp. JC > > http://angg.twu.net/eev-intros/find-here-links-intro.html > http://angg.twu.net/emacsconf2019.html > http://angg.twu.net/eev-intros/find-emacs-keys-intro.html > http://angg.twu.net/eev-intros/find-eev-quick-intro.html > > [[]], > Eduardo Ochs > http://angg.twu.net/#eev > > > On Sun, 22 Dec 2019 at 01:15, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > What I'm trying to do is this: > > > I was thinking that because of the sheer amount of functions in the elisp reference, it might be much easier to start programming with the primitives to understand how elisp works at its core, and then climb the ladder when need arises... > > i.e. trying to find a limited subset of functions that one can use to program in elisp and do non-trivial things but that do not involve searching the reference at all times. > > I'm thinking like in standard learners dictionaries, there are clear indications, like asterisks, that tell the learner whether the word is basic (generally about 2000 words) or intermediate (about 4000 words). > > People who know the basic words can get by and express most of what they need to express in daily life. > > For ex, it is estimated that there are about 140k words in French, but daily use only requires 1k. Let's lower the number of passively known words to 40k, that's 50 functions in Elisp... > > JC > > > On Dec 22, 2019, at 12:52, Eduardo Ochs <eduardoochs@gmail.com> wrote: > > > > Hi Jean-Christophe, > > What are you trying to do? > > If you'd like to discuss by IRC in #emacs at Freenode I'm edrx there... > > [[]], E. > > > > > > On Sun, 22 Dec 2019 at 00:44, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > > Thank you Eduardo. > > > > That's 1290 functions... > > > > The reference seems to have 1608 functions and 294 commands, so those primitives are not even a "useful subset" of emacs lisp functions... > > > > I guess that was a naïve idea. So I'll just have to go through the reference and try to find myself a minimaly useful subset (which is what the Intro should be about, btw.) > > > > > On Dec 22, 2019, at 12:21, Eduardo Ochs <eduardoochs@gmail.com> wrote: > > > > > > Try this: > > > > > > (defun fboundp-and-subrp (symbol) > > > (and (fboundp symbol) (subrp (symbol-function symbol)))) > > > > > > (setq my-primitives (apropos-internal "^.*$" 'fboundp-and-subrp)) > > > > > > (defun my-describe (symbol) (format "(describe-function '%S)\n" symbol)) > > > > > > (insert (mapconcat 'my-describe my-primitives "")) > > > > > > > > > On Sun, 22 Dec 2019 at 00:01, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > > > Is there a list of elisp primitive functions defined in C somewhere ? > > > > > > I was thinking that because of the sheer amount of functions in the elisp reference, it might be much easier to start programming with the primitives to understand how elisp works at its core, and then climb the ladder when need arises... > > > > > > > > > > > > Jean-Christophe Helary > > > ----------------------------------------------- > > > http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-22 4:14 ` Jean-Christophe Helary [not found] ` <CADs++6j+niJy3hvrTEJ-LrqcitFuffX=1Duca7pU30a8qfh_zg@mail.gmail.com> @ 2019-12-22 15:01 ` Stephen Berman 2019-12-22 17:31 ` Drew Adams 2 siblings, 0 replies; 17+ messages in thread From: Stephen Berman @ 2019-12-22 15:01 UTC (permalink / raw) To: Jean-Christophe Helary; +Cc: Emacs developers On Sun, 22 Dec 2019 13:14:41 +0900 Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > What I'm trying to do is this: > >> I was thinking that because of the sheer amount of functions in the elisp >> reference, it might be much easier to start programming with the primitives >> to understand how elisp works at its core, and then climb the ladder when >> need arises... > > i.e. trying to find a limited subset of functions that one can use to program > in elisp and do non-trivial things but that do not involve searching the > reference at all times. > > I'm thinking like in standard learners dictionaries, there are clear > indications, like asterisks, that tell the learner whether the word is basic > (generally about 2000 words) or intermediate (about 4000 words). > > People who know the basic words can get by and express most of what they need > to express in daily life. > > For ex, it is estimated that there are about 140k words in French, but daily > use only requires 1k. Let's lower the number of passively known words to 40k, > that's 50 functions in Elisp... One way to come up with a list of "basic Elisp" functions is to compare the usage frequencies in individual Elisp libraries; the most frequently used functions in a reasonable number of libraries are likely to be the most basic. Here's a little hack to get a quick rough estimate for a single file or buffer of Lisp code (to get a really accurate count would take quite a bit more effort, which has probably already been done, but I'm not aware of it): (defun srb-count-lisp-funs (&optional buffer) "Display a frequency table of Lisp functions in BUFFER. Called interactively with a prefix argument, use the current buffer, otherwise, prompt for a file, visit it and use its buffer." (interactive "P") (let ((fnh (make-hash-table :test 'equal)) ;; FIXME: false positives with let, funargs, alists, ... (flh (lambda (h) (save-excursion (save-restriction (goto-char (point-min)) (while (search-forward "(" nil t) (let ((sym (symbol-at-point))) (when sym (puthash sym (1+ (gethash sym h 0)) h)))))))) (bname (buffer-name)) fnl) (if buffer (funcall flh fnh) (with-temp-buffer (let ((file (read-file-name "File: "))) (insert-file-contents file) (funcall flh fnh) (setq bname (file-name-nondirectory file))))) (maphash (lambda (key val) (setq fnl (append fnl (list (cons key val))))) fnh) (setq fnl (sort fnl (lambda (a b) (> (cdr a) (cdr b))))) (with-current-buffer (generate-new-buffer (concat "fn freqs (" bname ")")) (dolist (e fnl) (insert (symbol-name (car e)) ": " (number-to-string (cdr e)) "\n")) (view-buffer (current-buffer))))) Steve Berman ^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: list of elisp primitives ? 2019-12-22 4:14 ` Jean-Christophe Helary [not found] ` <CADs++6j+niJy3hvrTEJ-LrqcitFuffX=1Duca7pU30a8qfh_zg@mail.gmail.com> 2019-12-22 15:01 ` Stephen Berman @ 2019-12-22 17:31 ` Drew Adams 2019-12-26 17:39 ` Jean-Christophe Helary 2 siblings, 1 reply; 17+ messages in thread From: Drew Adams @ 2019-12-22 17:31 UTC (permalink / raw) To: Jean-Christophe Helary, Emacs developers > I'm trying ... to find a limited subset of > functions that one can use to program in elisp ^^^^^^^^^^^^^^^^ > and do non-trivial things but that do not ^^^^^^^^^^^^^^^^^^^^^ > involve searching the reference at all times. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ That's not what a list of subrs gives you, at all. A subr is just a function coded in C, not in Lisp. Likewise, for other things, such as variables, that might be defined in C. The choice of whether to implement something in C has nothing to do with, and is no guide for, ease in learning or how often something is used in typical Elisp code. And why do you think you need to search the reference at all times? > I'm thinking like in standard learners > dictionaries, there are clear indications, like > asterisks, that tell the learner whether the > word is basic (generally about 2000 words) or > intermediate (about 4000 words). > > People who know the basic words can get by and > express most of what they need to express in daily life. Again, "basic" for a language learner has nothing to do with how a given language construct is implemented - in the case of Elisp, whether the construct is implemented in C or Lisp. Nothing at all. --- IMO, the biggest aid to learning Elisp is trying to _do_ (program) something in Lisp. Learning by doing. Yes, different people learn differently. But study combined with practice, in one form or another, is pretty much the golden rule. In the context of trying to do something with Elisp, the biggest aid, in addition to doc (which is not limited to the manual), is the source code. Using what exists, to do more, is really what it's about. Free source code is a learner's friend, at whatever level of learning. And in that context, the apropos commands or, better, a good completion system, can really help. They help, in particular, because Elisp constructs generally have names with relatively consistent components. If you don't have substring or regexp completion, and you don't have progressive completion (match multiple patterns, in any order), then at least use apropos. --- In my experience, the frequency of "needing" to look something up in the Elisp reference is not really greater when a beginner or a veteran. As one witness, I've been using Elisp and the reference for decades, and my use of the latter, in terms of frequency, has been pretty much constant over time. I might study different parts of it at different times, and I might return to certain parts. But it's not the case that I looked stuff up in the reference more when I was new to Emacs or Elisp. That said, early on I did sit down sometimes and just read through the manuals. But I doubt that most users proceed like that. (I do that with any product, especially one that has good doc.) And in any case, that was not looking something up; it was reading - for education and enjoyment. If it helped learning then I imagine that was mainly in the area of grasping concepts and finding out what's available. I'll also mention that I already knew Common Lisp before coming to Emacs. And in that case too, I sat down and read CLTL, cover to cover. Likewise, other Lisp dialects at the time. But learning to _use_ "basics" and non-basics of the languages came mostly by doing, not reading. --- Beyond subrs not helping to identify a list of "basic" building blocks for learners, coming up with any such list of constructs (ignoring where they're implemented) is problematic, IMO. What's basic for Lisp programming, in terms of the _most commonly used_ constructs, could be determined by counting (e.g. the distributed source code). But that information wouldn't get you very far, I think. It might help more to know the frequency of use _within each particular "area"_ of Emacs use - buffers, windows, frames, overlays, chars, font-lock, keymaps, syntax tables, etc. The Elisp manual already gives you a general idea of such frequency or relative importance, by the fact that only a subset of existing constructs (function, vars, etc.) are covered in the reference. But even then, a particular use case might call for frequent use of constructs that aren't prominent, or even present, in the manual. Letting doing lead look-up is, again, the best approach. The manual can't know what you're trying to do in any particular case; it has to be a compromise, intended to fit most use cases and most users. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-22 17:31 ` Drew Adams @ 2019-12-26 17:39 ` Jean-Christophe Helary 2019-12-26 18:00 ` arthur miller ` (3 more replies) 0 siblings, 4 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-26 17:39 UTC (permalink / raw) To: Emacs developers > On Dec 23, 2019, at 2:31, Drew Adams <drew.adams@oracle.com> wrote: > >> I'm trying ... to find a limited subset of >> functions that one can use to program in elisp > ^^^^^^^^^^^^^^^^ >> and do non-trivial things but that do not > ^^^^^^^^^^^^^^^^^^^^^ >> involve searching the reference at all times. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > That's not what a list of subrs gives you, at all. > A subr is just a function coded in C, not in Lisp. > Likewise, for other things, such as variables, > that might be defined in C. > > The choice of whether to implement something in C > has nothing to do with, and is no guide for, ease > in learning or how often something is used in > typical Elisp code. I'm not suggesting that implementing lisp functions in C is related to ease of learning or anything. My idea, which may be wrong, is that lisp code uses building blocks to provide more advanced functions and that the most basic blocks are lisp functions implemented in C. Hence, knowing the building blocks (or a few dozen useful ones) can give a clearer idea of what to do with elisp in general. Mind you, I too am trying to find my way around and it's not easy. My pet peeve is "discoverability" and for now despite the info/doc integration, I'm still very much struggling. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: list of elisp primitives ? 2019-12-26 17:39 ` Jean-Christophe Helary @ 2019-12-26 18:00 ` arthur miller 2019-12-26 18:09 ` Drew Adams ` (2 subsequent siblings) 3 siblings, 0 replies; 17+ messages in thread From: arthur miller @ 2019-12-26 18:00 UTC (permalink / raw) To: Jean-Christophe Helary, Emacs developers [-- Attachment #1: Type: text/plain, Size: 3111 bytes --] I think you are thinking from the wrong end. As a consult I had opportunity to work with all kind of languages I never thought I would work with and of which I had no idea what APIs where available or what was idiomatic coding. Anyway my approach was always to think in general programming terms of repetition, conditional, aggregations etc. I would then lookup what I needed to find out details of syntax and exposed libraries. I believe programming, and any programming language is best learned by doing. Especially when you already know how machine works and have knowledge of algorithms, data structures and program organization. If you have seen thevlegendaru K&R C book, then that is a bitwhat I mean. I don't think picking up some small subset of API and giving it to people and telling them to make something with it is the necessary the best approach. Probably to show them basics on small exercises and teach them how to lookup information they need further. Yes it takes time to lookup stuff, but that is the nature of the thing. If we make an analogy with Lego bricks, then yes one can see library functions as bricks to be combined, but just as Lego bricks, and everything else in life, one has to know what one wants to make before one starts to build it, otherwise it will just be random mess. Skickat från min Samsung Galaxy-smartphone. -------- Originalmeddelande -------- Från: Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> Datum: 2019-12-26 18:39 (GMT+01:00) Till: Emacs developers <emacs-devel@gnu.org> Ämne: Re: list of elisp primitives ? > On Dec 23, 2019, at 2:31, Drew Adams <drew.adams@oracle.com> wrote: > >> I'm trying ... to find a limited subset of >> functions that one can use to program in elisp > ^^^^^^^^^^^^^^^^ >> and do non-trivial things but that do not > ^^^^^^^^^^^^^^^^^^^^^ >> involve searching the reference at all times. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > That's not what a list of subrs gives you, at all. > A subr is just a function coded in C, not in Lisp. > Likewise, for other things, such as variables, > that might be defined in C. > > The choice of whether to implement something in C > has nothing to do with, and is no guide for, ease > in learning or how often something is used in > typical Elisp code. I'm not suggesting that implementing lisp functions in C is related to ease of learning or anything. My idea, which may be wrong, is that lisp code uses building blocks to provide more advanced functions and that the most basic blocks are lisp functions implemented in C. Hence, knowing the building blocks (or a few dozen useful ones) can give a clearer idea of what to do with elisp in general. Mind you, I too am trying to find my way around and it's not easy. My pet peeve is "discoverability" and for now despite the info/doc integration, I'm still very much struggling. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune [-- Attachment #2: Type: text/html, Size: 4657 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: list of elisp primitives ? 2019-12-26 17:39 ` Jean-Christophe Helary 2019-12-26 18:00 ` arthur miller @ 2019-12-26 18:09 ` Drew Adams 2019-12-26 18:22 ` Jean-Christophe Helary 2019-12-26 18:33 ` Stefan Monnier 2019-12-26 21:17 ` Eduardo Ochs 3 siblings, 1 reply; 17+ messages in thread From: Drew Adams @ 2019-12-26 18:09 UTC (permalink / raw) To: Jean-Christophe Helary, Emacs developers > I'm not suggesting that implementing lisp functions > in C is related to ease of learning or anything. > > My idea, which may be wrong, is that lisp code uses > building blocks to provide more advanced functions > and that the most basic blocks are lisp functions > implemented in C. Don't confuse building blocks for implementing Lisp in C with building blocks for defining Lisp in Lisp, which I suspect is really what you're after: a set of primitive Lisp constructs that can be used to define the rest of the language. > Hence, knowing the building blocks (or a few dozen > useful ones) can give a clearer idea of what to do > with elisp in general. There are various alternative subsets of Lisp constructs that can be used to do this. If `cond' is a primitive then you can implement `if', and vice versa, for example. A Lisp definition of `eval' might get you started: https://igor.io/2013/04/03/sexpr-meta-eval.html As Marcin pointed out, the search term you want, when looking for info about this, is "metacircular interpreter". ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-26 18:09 ` Drew Adams @ 2019-12-26 18:22 ` Jean-Christophe Helary 0 siblings, 0 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-26 18:22 UTC (permalink / raw) To: Emacs developers > On Dec 27, 2019, at 3:09, Drew Adams <drew.adams@oracle.com> wrote: > > Don't confuse building blocks for implementing Lisp > in C with building blocks for defining Lisp in Lisp, > which I suspect is really what you're after: a set > of primitive Lisp constructs that can be used to > define the rest of the language. Well, I really don't want to redefine the language. I just want to do simple file i/o and error handling etc. without having to worry about "and you can also do this and that by using that function and by setting this variable you can also do that" which is what the elisp reference is full of. In my attempt at inserting an xml block into a RSS feed, I was presented with a number of different ways to do that, none corresponding to the functions I'd have picked by reading the reference. Same for error handling (and without help from the list I'd be stuck between sentences trying to make sense of the reference). I'm fine with "there is more than one way to do it", but sometimes the subtle differences don't make much sense. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-26 17:39 ` Jean-Christophe Helary 2019-12-26 18:00 ` arthur miller 2019-12-26 18:09 ` Drew Adams @ 2019-12-26 18:33 ` Stefan Monnier 2019-12-26 21:17 ` Eduardo Ochs 3 siblings, 0 replies; 17+ messages in thread From: Stefan Monnier @ 2019-12-26 18:33 UTC (permalink / raw) To: Jean-Christophe Helary; +Cc: Emacs developers > Hence, knowing the building blocks (or a few dozen useful ones) can give > a clearer idea of what to do with elisp in general. I fully agree in theory. But it's quite difficult to know what those few blocks should be in general. To some extent the Elisp Intro provides this for the "general Elisp" context, but as soon as you get to writing real Elisp code, it's not "general" any more and you get into details specific to various packages and features (syntax-table, buffers, files, font-lock, indentation, ...). I think the best solution is to find humans to help you find the answers your questions. We also provide reference material for those cases where human help is not available or not sufficient, but it's hard to make such info work the way you describe for "all" the possible interests of the reader. Stefan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-26 17:39 ` Jean-Christophe Helary ` (2 preceding siblings ...) 2019-12-26 18:33 ` Stefan Monnier @ 2019-12-26 21:17 ` Eduardo Ochs 2019-12-27 0:21 ` Jean-Christophe Helary 3 siblings, 1 reply; 17+ messages in thread From: Eduardo Ochs @ 2019-12-26 21:17 UTC (permalink / raw) To: Jean-Christophe Helary; +Cc: Emacs developers Hi Jean-Christophe, On Thu, 26 Dec 2019 at 14:40, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > > Mind you, I too am trying to find my way around and it's not easy. > My pet peeve is "discoverability" and for now despite the info/doc > integration, I'm still very much struggling. Emacs _tries_ to be an "high-discoverability environment"... if you are trying to discover things but you feel that you are still struggling then I think that at the very least we need to show you our favourite tools and listen to your feedback... I am the author of this package: http://elpa.gnu.org/packages/eev.html http://angg.twu.net/#eev and one of my favourite parts of it is its "eev-ish" variant of Emacs's `C-h f'. If you type `C-h f' with the point on the name of a function - for example, on: kill-buffer you get a temporary buffer called "*Help*" that lots of information and some hyperlinks - but if you copy these hyperlinks to other buffers they won't work. If you type `M-h M-f' on the "format" above with eev-mode on you will get a tempory read-write buffer with these sexps: # (find-efunction-links 'kill-buffer) # (eek "M-h M-f kill-buffer") # (find-eev-quick-intro "4.2. `find-ekey-links' and friends") # (find-efunctiondescr 'kill-buffer) # (find-efunction 'kill-buffer) # (find-efunctionpp 'kill-buffer) # (find-efunctiond 'kill-buffer) # (Info-goto-emacs-command-node 'kill-buffer) # (find-enode "Command Index" "* kill-buffer:") # (find-elnode "Index" "* kill-buffer:") # (where-is 'kill-buffer) # (symbol-file 'kill-buffer 'defun) # (find-fline (symbol-file 'kill-buffer 'defun)) # (find-epp (assoc (symbol-file 'kill-buffer 'defun) load-history)) # (find-estring (mapconcat 'identity (mapcar 'car load-history) "\n")) # (find-estring (documentation 'kill-buffer)) # (find-estring (documentation 'kill-buffer t)) # (describe-function 'kill-buffer) This may look daunting at first but all these sexps are safe to play with and if you copy them to your notes they will still work as elisp hyperlinks - they are plain text without text properties, they don't use things like these: (info "(elisp)Buttons") The idea behind this is: we _usually_ don't need to learn elisp functions in depth, and neither memorize things - if we learn how to navigate the code and docs and how to copy elisp hyperlinks to our notes then we can learn a lot about Emacs _superficially_ as we browse it by curiosity... and then if and when we want to learn something in more depth - to create our own extensions, say - we will already have some familiarity with the territory, and lots of links to things that we found interesting at the other times we've been there. I would love to see other people's suggestions. In the last months I learned several help keys that I don't know that existed, and - hint, hint! - I really hope that at some point someone will give pointers on how to learn edebug, or things similar to it... edebug and friends look like great tools for understanding convoluted code in elisp. Cheers =), Eduardo Ochs, "who lives in a cave with its walls covered by sexps". http://angg.twu.net/#eev http://angg.twu.net/emacsconf2019.html P.S.: ah, before I forget: http://angg.twu.net/eev-intros/find-here-links-intro.html (It mentions several recent features.) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-26 21:17 ` Eduardo Ochs @ 2019-12-27 0:21 ` Jean-Christophe Helary 0 siblings, 0 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-27 0:21 UTC (permalink / raw) To: Emacs developers Eduardo, I saw that you had a video on EmacsConf2019, I downloaded them all so I'll be spending time on your eev package I guess. What you describe here (more so than in your other message) is very interesting. For C-h I use the Helpful package that shows more things in a better way. Thank you again. JC > On Dec 27, 2019, at 6:17, Eduardo Ochs <eduardoochs@gmail.com> wrote: > > Hi Jean-Christophe, > > On Thu, 26 Dec 2019 at 14:40, Jean-Christophe Helary > <jean.christophe.helary@traduction-libre.org> wrote: >> >> Mind you, I too am trying to find my way around and it's not easy. >> My pet peeve is "discoverability" and for now despite the info/doc >> integration, I'm still very much struggling. > > Emacs _tries_ to be an "high-discoverability environment"... if you > are trying to discover things but you feel that you are still > struggling then I think that at the very least we need to show you our > favourite tools and listen to your feedback... > > I am the author of this package: > > http://elpa.gnu.org/packages/eev.html > http://angg.twu.net/#eev > > and one of my favourite parts of it is its "eev-ish" variant of > Emacs's `C-h f'. If you type `C-h f' with the point on the name of a > function - for example, on: > > kill-buffer > > you get a temporary buffer called "*Help*" that lots of information > and some hyperlinks - but if you copy these hyperlinks to other > buffers they won't work. > > If you type `M-h M-f' on the "format" above with eev-mode on you will > get a tempory read-write buffer with these sexps: > > > # (find-efunction-links 'kill-buffer) > # (eek "M-h M-f kill-buffer") > # (find-eev-quick-intro "4.2. `find-ekey-links' and friends") > > # (find-efunctiondescr 'kill-buffer) > # (find-efunction 'kill-buffer) > # (find-efunctionpp 'kill-buffer) > # (find-efunctiond 'kill-buffer) > > # (Info-goto-emacs-command-node 'kill-buffer) > # (find-enode "Command Index" "* kill-buffer:") > # (find-elnode "Index" "* kill-buffer:") > > # (where-is 'kill-buffer) > # (symbol-file 'kill-buffer 'defun) > # (find-fline (symbol-file 'kill-buffer 'defun)) > # (find-epp (assoc (symbol-file 'kill-buffer 'defun) load-history)) > # (find-estring (mapconcat 'identity (mapcar 'car load-history) "\n")) > # (find-estring (documentation 'kill-buffer)) > # (find-estring (documentation 'kill-buffer t)) > # (describe-function 'kill-buffer) > > > This may look daunting at first but all these sexps are safe to play > with and if you copy them to your notes they will still work as elisp > hyperlinks - they are plain text without text properties, they don't > use things like these: > > (info "(elisp)Buttons") > > The idea behind this is: we _usually_ don't need to learn elisp > functions in depth, and neither memorize things - if we learn how to > navigate the code and docs and how to copy elisp hyperlinks to our > notes then we can learn a lot about Emacs _superficially_ as we browse > it by curiosity... and then if and when we want to learn something in > more depth - to create our own extensions, say - we will already have > some familiarity with the territory, and lots of links to things that > we found interesting at the other times we've been there. > > I would love to see other people's suggestions. In the last months I > learned several help keys that I don't know that existed, and - hint, > hint! - I really hope that at some point someone will give pointers on > how to learn edebug, or things similar to it... edebug and friends > look like great tools for understanding convoluted code in elisp. > > Cheers =), > Eduardo Ochs, "who lives in a cave with its walls covered by sexps". > http://angg.twu.net/#eev > http://angg.twu.net/emacsconf2019.html > > > P.S.: ah, before I forget: > http://angg.twu.net/eev-intros/find-here-links-intro.html > (It mentions several recent features.) > Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-22 3:43 ` Jean-Christophe Helary [not found] ` <CADs++6hB7ZKnEWOZ=XOGdA=W_CacCE2=354ARfNFtWvStaCF3g@mail.gmail.com> @ 2019-12-22 14:56 ` Óscar Fuentes 2019-12-22 22:34 ` Jean-Christophe Helary 1 sibling, 1 reply; 17+ messages in thread From: Óscar Fuentes @ 2019-12-22 14:56 UTC (permalink / raw) To: emacs-devel Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> writes: > That's 1290 functions... > > The reference seems to have 1608 functions and 294 commands, so those > primitives are not even a "useful subset" of emacs lisp functions... > > I guess that was a naïve idea. So I'll just have to go through the > reference and try to find myself a minimaly useful subset (which is > what the Intro should be about, btw.) The Elisp manual describes the most relevant functions for each topic. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-22 14:56 ` Óscar Fuentes @ 2019-12-22 22:34 ` Jean-Christophe Helary 0 siblings, 0 replies; 17+ messages in thread From: Jean-Christophe Helary @ 2019-12-22 22:34 UTC (permalink / raw) To: Emacs developers > On Dec 22, 2019, at 23:56, Óscar Fuentes <ofv@wanadoo.es> wrote: > > Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> > writes: > >> That's 1290 functions... >> >> The reference seems to have 1608 functions and 294 commands, so those >> primitives are not even a "useful subset" of emacs lisp functions... >> >> I guess that was a naïve idea. So I'll just have to go through the >> reference and try to find myself a minimaly useful subset (which is >> what the Intro should be about, btw.) > > The Elisp manual describes the most relevant functions for each topic. Which is not a minimally useful subset. Also, the description is not always reader-friendly. Cf. my earlier comment about `unwind-protect' and the way it's described in the reference. Even after reading the docstrings I can't understand the description. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: list of elisp primitives ? 2019-12-22 2:59 list of elisp primitives ? Jean-Christophe Helary 2019-12-22 3:21 ` Eduardo Ochs @ 2019-12-22 19:21 ` Marcin Borkowski 1 sibling, 0 replies; 17+ messages in thread From: Marcin Borkowski @ 2019-12-22 19:21 UTC (permalink / raw) To: Jean-Christophe Helary; +Cc: Emacs developers On 2019-12-22, at 03:59, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote: > Is there a list of elisp primitive functions defined in C somewhere ? > > I was thinking that because of the sheer amount of functions in the elisp reference, it might be much easier to start programming with the primitives to understand how elisp works at its core, and then climb the ladder when need arises... When you have a reasonable list of "basic functions" (as others said, "primitives" might not be the best choice), what could be an interesting exercise would be writing a metacircular Elisp interpreter. Best, -- Marcin Borkowski http://mbork.pl ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2019-12-27 0:21 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-12-22 2:59 list of elisp primitives ? Jean-Christophe Helary 2019-12-22 3:21 ` Eduardo Ochs 2019-12-22 3:43 ` Jean-Christophe Helary [not found] ` <CADs++6hB7ZKnEWOZ=XOGdA=W_CacCE2=354ARfNFtWvStaCF3g@mail.gmail.com> 2019-12-22 4:14 ` Jean-Christophe Helary [not found] ` <CADs++6j+niJy3hvrTEJ-LrqcitFuffX=1Duca7pU30a8qfh_zg@mail.gmail.com> 2019-12-22 4:38 ` Jean-Christophe Helary 2019-12-22 15:01 ` Stephen Berman 2019-12-22 17:31 ` Drew Adams 2019-12-26 17:39 ` Jean-Christophe Helary 2019-12-26 18:00 ` arthur miller 2019-12-26 18:09 ` Drew Adams 2019-12-26 18:22 ` Jean-Christophe Helary 2019-12-26 18:33 ` Stefan Monnier 2019-12-26 21:17 ` Eduardo Ochs 2019-12-27 0:21 ` Jean-Christophe Helary 2019-12-22 14:56 ` Óscar Fuentes 2019-12-22 22:34 ` Jean-Christophe Helary 2019-12-22 19:21 ` Marcin Borkowski
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.