* introduction to lisp
@ 2017-06-17 19:28 Jude DaShiell
2017-06-18 10:03 ` Emanuel Berg
0 siblings, 1 reply; 12+ messages in thread
From: Jude DaShiell @ 2017-06-17 19:28 UTC (permalink / raw)
To: help-gnu-emacs
This material might be useful for lisp and those writing buster.js code.
It might also be somewhat incorrect too.
http://cjohansen.no/
--
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-17 19:28 introduction to lisp Jude DaShiell
@ 2017-06-18 10:03 ` Emanuel Berg
2017-06-20 0:10 ` John Ankarström
0 siblings, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2017-06-18 10:03 UTC (permalink / raw)
To: help-gnu-emacs
Jude DaShiell wrote:
> This material might be useful for lisp and
> those writing buster.js code. It might also be
> somewhat incorrect too.
>
> http://cjohansen.no/
A very ambitious article/project!
Here is the direct link:
http://cjohansen.no/an-introduction-to-elisp/
Try byte-compiling the code! It will tell you
some things to improve, I think. But I don't
know since I get an error on line 24:
(void-variable open-paren-pairs-count) in cond
When the byte-compiler is silent and the
program works there is a fair chance the
program is good.
Code style - consider replacing 'if X' with
`when' and 'if not X' with `unless' when there
isn't a second branch. Then there is no need
for explicit `progn's.
Also I would write
(global-set-key (kbd "C-c C-d") 'buster-disable-test)
like this:
(global-set-key "\C-c\C-d" #'buster-disable-test)
Keep it up!
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-18 10:03 ` Emanuel Berg
@ 2017-06-20 0:10 ` John Ankarström
2017-06-20 0:25 ` Kaushal Modi
0 siblings, 1 reply; 12+ messages in thread
From: John Ankarström @ 2017-06-20 0:10 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg <moasen@zoho.com> writes:
> Also I would write
>
> (global-set-key (kbd "C-c C-d") 'buster-disable-test)
>
> like this:
>
> (global-set-key "\C-c\C-d" #'buster-disable-test)
I'm 100% with you on everything else you said, but I personally
prefer the `kbd' notation. It's clearer and easier to understand,
because it's consistent with how Emacs itself displays key
bindings for the user (through `describe-key').
I do agree that #' is better than ' for functions :-)
- John
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-20 0:10 ` John Ankarström
@ 2017-06-20 0:25 ` Kaushal Modi
2017-06-20 4:59 ` Emanuel Berg
0 siblings, 1 reply; 12+ messages in thread
From: Kaushal Modi @ 2017-06-20 0:25 UTC (permalink / raw)
To: John Ankarström, help-gnu-emacs
On Mon, Jun 19, 2017, 8:14 PM John Ankarström <john@ankarstrom.se> wrote:
> Emanuel Berg <moasen@zoho.com> writes:
>
> > Also I would write
> >
> > (global-set-key (kbd "C-c C-d") 'buster-disable-test)
> >
> > like this:
> >
> > (global-set-key "\C-c\C-d" #'buster-disable-test)
>
> I'm 100% with you on everything else you said, but I personally
> prefer the `kbd' notation. It's clearer and easier to understand,
> because it's consistent with how Emacs itself displays key
> bindings for the user (through `describe-key').
>
+1. It's simply type what you see.
Example:
- How do I bind F1?
- Do C-h k F1.. Realize that emacs shows that as <f1>
- Simply wrap that with (kbd "...") and you have (kbd "<f1>")
- Put that in the global-set-key or define-key form.
I do agree that #' is better than ' for functions :-)
>
+1
> --
Kaushal Modi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-20 0:25 ` Kaushal Modi
@ 2017-06-20 4:59 ` Emanuel Berg
2017-06-20 8:42 ` tomas
2017-06-20 12:29 ` introduction to lisp Kaushal Modi
0 siblings, 2 replies; 12+ messages in thread
From: Emanuel Berg @ 2017-06-20 4:59 UTC (permalink / raw)
To: help-gnu-emacs
Kaushal Modi wrote:
> Example: - How do I bind F1? - Do C-h k F1..
> Realize that emacs shows that as <f1> -
> Simply wrap that with (kbd "...") and you
> have (kbd "<f1>") - Put that in the
> global-set-key or define-key form.
But that evaluates to [f1], so then why not
(global-set-key [f1]
(lambda () (interactive) (message "Formula 1")) )
?
Actually the only case I have against `kbd' is
that it is more bulky and longer to type...
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-20 4:59 ` Emanuel Berg
@ 2017-06-20 8:42 ` tomas
2017-06-20 9:04 ` Emanuel Berg
2017-06-25 7:34 ` Narendra Joshi
2017-06-20 12:29 ` introduction to lisp Kaushal Modi
1 sibling, 2 replies; 12+ messages in thread
From: tomas @ 2017-06-20 8:42 UTC (permalink / raw)
To: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, Jun 20, 2017 at 06:59:14AM +0200, Emanuel Berg wrote:
> Kaushal Modi wrote:
>
> > Example: - How do I bind F1? - Do C-h k F1..
> > Realize that emacs shows that as <f1> -
> > Simply wrap that with (kbd "...") and you
> > have (kbd "<f1>") - Put that in the
> > global-set-key or define-key form.
>
> But that evaluates to [f1], so then why not
>
> (global-set-key [f1]
> (lambda () (interactive) (message "Formula 1")) )
But that evaluates to
(global-set-key [f1] #[nil "ÀÁ!" [message "Formula 1"] 2 nil nil])
(I just asked byte-compile to tell me that). So why not write that
right away?
Of course, that was a bit tongue-in-cheek ;-P
What I mean: sometimes it makes sense to let people go the
extra ten meters to meet the computer (mainly because there's
an interesting spot to meet [1]), sometimes it makes sense
to let the computer do the walk, perhaps because the spot to
meet is pretty boring (personally, I find conventions to name
keys pretty boring, to be honest).
Which is which depends, of course, on Things :)
[1] as is the case with lambda calculus and The Lisps.
Giving up on traditional infix arithmetic may feel
awkward at first, but tends to bring some kind of
Enlightenment upon (some of) us. Then we get high
and all worked up and try to convince others and
they look at us with those strange looks ;-D
Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAllI4A8ACgkQBcgs9XrR2kYAYwCeJOvUx7eh/rWAwKtRy5RzhjFX
FLEAniZYfQlEGmVL6IPBfuN5QKx4EyvY
=RO1E
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-20 8:42 ` tomas
@ 2017-06-20 9:04 ` Emanuel Berg
2017-06-20 10:41 ` tomas
2017-06-25 7:34 ` Narendra Joshi
1 sibling, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2017-06-20 9:04 UTC (permalink / raw)
To: help-gnu-emacs
> What I mean: sometimes it makes sense to let
> people go the extra ten meters to meet the
> computer (mainly because there's an
> interesting spot to meet [1]), sometimes it
> makes sense to let the computer do the walk,
> perhaps because the spot to meet is pretty
> boring (personally, I find conventions to
> name keys pretty boring, to be honest).
>
> Which is which depends, of course, on Things
> :)
>
> [1] as is the case with lambda calculus and
> The Lisps. Giving up on traditional infix
> arithmetic may feel awkward at first, but
> tends to bring some kind of Enlightenment
> upon (some of) us. Then we get high and all
> worked up and try to convince others and they
> look at us with those strange looks ;-D
Hey, what's the secret? The only time *I'm*
this open-minded is when I take acid and then
I don't even care about computers anymore!
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-20 9:04 ` Emanuel Berg
@ 2017-06-20 10:41 ` tomas
0 siblings, 0 replies; 12+ messages in thread
From: tomas @ 2017-06-20 10:41 UTC (permalink / raw)
To: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, Jun 20, 2017 at 11:04:35AM +0200, Emanuel Berg wrote:
[...]
> > look at us with those strange looks ;-D
>
> Hey, what's the secret? The only time *I'm*
> this open-minded is when I take acid and then
> I don't even care about computers anymore!
Must be the onset of senility. I wish it were
some weed, then I could take more of it. So
I'm just forced to wait :-/
Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAllI++EACgkQBcgs9XrR2kaglwCeIBfW43MlMLtXrwRefbbtBqdx
o08AmwaWIv9+X1ILX2l+k5QR8qhu+/hx
=9AOw
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-20 8:42 ` tomas
2017-06-20 9:04 ` Emanuel Berg
@ 2017-06-25 7:34 ` Narendra Joshi
2017-06-25 10:08 ` Footnotes [was: introduction to lisp] tomas
1 sibling, 1 reply; 12+ messages in thread
From: Narendra Joshi @ 2017-06-25 7:34 UTC (permalink / raw)
To: tomas; +Cc: help-gnu-emacs
<tomas@tuxteam.de> writes:
> On Tue, Jun 20, 2017 at 06:59:14AM +0200, Emanuel Berg wrote:
>> Kaushal Modi wrote:
>>
>> > Example: - How do I bind F1? - Do C-h k F1..
>> > Realize that emacs shows that as <f1> -
>> > Simply wrap that with (kbd "...") and you
>> > have (kbd "<f1>") - Put that in the
>> > global-set-key or define-key form.
>>
>> But that evaluates to [f1], so then why not
>>
>> (global-set-key [f1]
>> (lambda () (interactive) (message "Formula 1")) )
>
> But that evaluates to
>
> (global-set-key [f1] #[nil "ÀÁ!" [message "Formula 1"] 2 nil nil])
>
> (I just asked byte-compile to tell me that). So why not write that
> right away?
>
> Of course, that was a bit tongue-in-cheek ;-P
>
> What I mean: sometimes it makes sense to let people go the
> extra ten meters to meet the computer (mainly because there's
> an interesting spot to meet [1]), sometimes it makes sense
What do you use for footnotes? [An unrelated question]
> to let the computer do the walk, perhaps because the spot to
> meet is pretty boring (personally, I find conventions to name
> keys pretty boring, to be honest).
>
> Which is which depends, of course, on Things :)
>
> [1] as is the case with lambda calculus and The Lisps.
> Giving up on traditional infix arithmetic may feel
> awkward at first, but tends to bring some kind of
> Enlightenment upon (some of) us. Then we get high
> and all worked up and try to convince others and
> they look at us with those strange looks ;-D
>
> Cheers
> -- tomás
>
--
Narendra Joshi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Footnotes [was: introduction to lisp]
2017-06-25 7:34 ` Narendra Joshi
@ 2017-06-25 10:08 ` tomas
0 siblings, 0 replies; 12+ messages in thread
From: tomas @ 2017-06-25 10:08 UTC (permalink / raw)
To: Narendra Joshi; +Cc: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, Jun 25, 2017 at 01:04:35PM +0530, Narendra Joshi wrote:
> <tomas@tuxteam.de> writes:
[unrelated stuff]
> What do you use for footnotes? [An unrelated question]
I'm sorry to disappoint you -- my footnotes are (so far) pedestrian.
Boring, I know :)
In bigger texts they tend to be org-mode, though.
Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAllPi5QACgkQBcgs9XrR2kbnKgCeO2a0RdWBcCdgFh2GRdv8LfkC
bPwAn0wfIuoEWNsV6XRlQ0j3nxLQY/5/
=Dhm2
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: introduction to lisp
2017-06-20 4:59 ` Emanuel Berg
2017-06-20 8:42 ` tomas
@ 2017-06-20 12:29 ` Kaushal Modi
2017-06-20 12:57 ` Emanuel Berg
1 sibling, 1 reply; 12+ messages in thread
From: Kaushal Modi @ 2017-06-20 12:29 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, Jun 20, 2017 at 1:00 AM Emanuel Berg <moasen@zoho.com> wrote:
> But that evaluates to [f1], so then why not
>
> (global-set-key [f1]
> (lambda () (interactive) (message "Formula 1")) )
>
> ?
>
Not sure if that's a joke. Again, as I said, this approach is simply "what
is see is what you type"; with just kbd wrapped around. If you see <f1>,
the binding notation is (kbd "<f1>"), if you see C-c C-d, (kbd "C-c C-d"),
if you see <M-return>, (kbd "<M-return>"), and so on.
> Actually the only case I have against `kbd' is
> that it is more bulky and longer to type...
>
The value is not having to think if certain chars need to be escaped or
having to spend time doing one more eval to find the correct string.
--
Kaushal Modi
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-06-25 10:08 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-17 19:28 introduction to lisp Jude DaShiell
2017-06-18 10:03 ` Emanuel Berg
2017-06-20 0:10 ` John Ankarström
2017-06-20 0:25 ` Kaushal Modi
2017-06-20 4:59 ` Emanuel Berg
2017-06-20 8:42 ` tomas
2017-06-20 9:04 ` Emanuel Berg
2017-06-20 10:41 ` tomas
2017-06-25 7:34 ` Narendra Joshi
2017-06-25 10:08 ` Footnotes [was: introduction to lisp] tomas
2017-06-20 12:29 ` introduction to lisp Kaushal Modi
2017-06-20 12:57 ` Emanuel Berg
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.