* How to get skills in elisp ?
@ 2009-05-25 7:30 Francis Moreau
2009-05-25 8:17 ` Drew Adams
` (3 more replies)
0 siblings, 4 replies; 18+ messages in thread
From: Francis Moreau @ 2009-05-25 7:30 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I finally took time to start learning elisp hence nobody can call me
an dumb emacs user ;)
I started by reading the info files containing the Gnu Emacs Lisp
Reference Manual although I haven't read it entirely.
But now I got the main picture of the language but I would need some
practice since the reference manual lack of examples before I feel
confortable enough to start writing my own elisp scripts.
Could anybody give me some direction at that point ?
Also I would like to know how people debug their scripts ? Are there
any tricks ? For now I just write some forms and evaluate them with 'C-
j'.
Thanks
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: How to get skills in elisp ?
2009-05-25 7:30 How to get skills in elisp ? Francis Moreau
@ 2009-05-25 8:17 ` Drew Adams
[not found] ` <mailman.7753.1243239425.31690.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
3 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-05-25 8:17 UTC (permalink / raw)
To: 'Francis Moreau', help-gnu-emacs
> I finally took time to start learning elisp hence nobody can call me
> an dumb emacs user ;)
>
> I started by reading the info files containing the Gnu Emacs Lisp
> Reference Manual although I haven't read it entirely.
>
> But now I got the main picture of the language but I would need some
> practice since the reference manual lack of examples before I feel
> confortable enough to start writing my own elisp scripts.
>
> Could anybody give me some direction at that point ?
Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
Introduction' in the Info menu. The manual title is actually "An Introduction to
Programming in Emacs Lisp". It's just what you're looking for.
When you want to code something, search (`grep') the existing Emacs-Lisp source
code for terms that are pertinent. You can often find code that is similar to
what you want to do. This is the way to learn about writing code to change to a
different buffer, select a different window, display a buffer, search for text,
replace text, and so on - see how the Emacs developers do it.
> Also I would like to know how people debug their scripts ? Are there
> any tricks ? For now I just write some forms and evaluate
> them with 'C-j'.
`C-j' evaluates in the *scratch* buffer. I personally don't use *scratch* much.
I prefer to create an Emacs-Lisp buffer/file, e.g. foo.el, and work in that,
then throw it away. (My fingers can't think of `C-j' as anything other than
`newline-and-indent'.)
See also `M-:', `eval-region', and `C-x C-e'. See `debug-on-entry'. Put
`(debug)' in your code if you want to debug part of a function. Make a function
interactive temporarily, to make it easier to call (`M-x', with completion, vs
`M-:'). Comment out sections of code using `C-u M-x comment-region' (I bind
`comment-region' to `C-x C-;').
Ask questions here. Visit Emacs Wiki (http://www.emacswiki.org/). Have fun!
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
[not found] ` <mailman.7753.1243239425.31690.help-gnu-emacs@gnu.org>
@ 2009-05-25 9:15 ` Francis Moreau
2009-05-25 10:22 ` Pascal J. Bourguignon
` (4 more replies)
0 siblings, 5 replies; 18+ messages in thread
From: Francis Moreau @ 2009-05-25 9:15 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
[thanks for answering]
On May 25, 10:17 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>
> Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
> Introduction' in the Info menu. The manual title is actually "An Introduction to
> Programming in Emacs Lisp". It's just what you're looking for.
Ok, I did have a look to this but it starts by;
"This is an `Introduction to Programming in Emacs Lisp', for people
who are not programmers."
so since I'm a programmer (well I try to be ;) I just skiped the
document.
>
> When you want to code something, search (`grep') the existing Emacs-Lisp source
> code for terms that are pertinent. You can often find code that is similar to
> what you want to do. This is the way to learn about writing code to change to a
> different buffer, select a different window, display a buffer, search for text,
> replace text, and so on - see how the Emacs developers do it.
yeah that's a good idea.
Is there any way to jump into a function definition (for example by
using tags) when asking for help on this function (C-h f) ?
>
> > Also I would like to know how people debug their scripts ? Are there
> > any tricks ? For now I just write some forms and evaluate
> > them with 'C-j'.
>
> `C-j' evaluates in the *scratch* buffer. I personally don't use *scratch* much.
> I prefer to create an Emacs-Lisp buffer/file, e.g. foo.el, and work in that,
> then throw it away. (My fingers can't think of `C-j' as anything other than
> `newline-and-indent'.)
>
> See also `M-:', `eval-region', and `C-x C-e'. See `debug-on-entry'. Put
> `(debug)' in your code if you want to debug part of a function. Make a function
> interactive temporarily, to make it easier to call (`M-x', with completion, vs
> `M-:'). Comment out sections of code using `C-u M-x comment-region' (I bind
> `comment-region' to `C-x C-;').
>
Ok I'll do, thanks for the tips.
> Ask questions here. Visit Emacs Wiki (http://www.emacswiki.org/). Have fun!
thanks
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 7:30 How to get skills in elisp ? Francis Moreau
2009-05-25 8:17 ` Drew Adams
[not found] ` <mailman.7753.1243239425.31690.help-gnu-emacs@gnu.org>
@ 2009-05-25 10:04 ` Tassilo Horn
2009-05-25 11:01 ` Pascal J. Bourguignon
3 siblings, 0 replies; 18+ messages in thread
From: Tassilo Horn @ 2009-05-25 10:04 UTC (permalink / raw)
To: help-gnu-emacs
Francis Moreau <francis.moro@gmail.com> writes:
Hi Francis,
> But now I got the main picture of the language but I would need some
> practice since the reference manual lack of examples before I feel
> confortable enough to start writing my own elisp scripts.
>
> Could anybody give me some direction at that point ?
As always in learning (programming) languages. Pick some elisp lib that
you use and try to understand how it works by looking at its code. Then
try to extend it if a functionality you'd love to have is not included.
> Also I would like to know how people debug their scripts? Are there
> any tricks?
For debugging the edebug facility is what you're looking for.
,----[ (info "(elisp)Edebug") ]
| Edebug is a source-level debugger for Emacs Lisp programs with which
| you can:
|
| * Step through evaluation, stopping before and after each expression.
|
| * Set conditional or unconditional breakpoints.
| [...]
`----
> For now I just write some forms and evaluate them with 'C-j'.
That's one possibility. Another good way is using a REPL. Have a look
at IELM (M-x ielm RET).
Bye,
Tassilo
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 9:15 ` Francis Moreau
@ 2009-05-25 10:22 ` Pascal J. Bourguignon
2009-05-25 11:50 ` Andreas Röhler
` (3 subsequent siblings)
4 siblings, 0 replies; 18+ messages in thread
From: Pascal J. Bourguignon @ 2009-05-25 10:22 UTC (permalink / raw)
To: help-gnu-emacs
Francis Moreau <francis.moro@gmail.com> writes:
> Hello,
>
> [thanks for answering]
>
> On May 25, 10:17 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>>
>> Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
>> Introduction' in the Info menu. The manual title is actually "An Introduction to
>> Programming in Emacs Lisp". It's just what you're looking for.
>
> Ok, I did have a look to this but it starts by;
>
> "This is an `Introduction to Programming in Emacs Lisp', for people
> who are not programmers."
>
> so since I'm a programmer (well I try to be ;) I just skiped the
> document.
>
If you are a programmer (or try to be) then you should know how to
learn a programming language, no?
Go read that introduction!
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 7:30 How to get skills in elisp ? Francis Moreau
` (2 preceding siblings ...)
2009-05-25 10:04 ` Tassilo Horn
@ 2009-05-25 11:01 ` Pascal J. Bourguignon
2009-05-25 12:03 ` Andreas Röhler
2009-05-27 13:05 ` Thien-Thi Nguyen
3 siblings, 2 replies; 18+ messages in thread
From: Pascal J. Bourguignon @ 2009-05-25 11:01 UTC (permalink / raw)
To: help-gnu-emacs
Francis Moreau <francis.moro@gmail.com> writes:
> Hello,
>
> I finally took time to start learning elisp hence nobody can call me
> an dumb emacs user ;)
>
> I started by reading the info files containing the Gnu Emacs Lisp
> Reference Manual although I haven't read it entirely.
>
> But now I got the main picture of the language but I would need some
> practice since the reference manual lack of examples before I feel
> confortable enough to start writing my own elisp scripts.
>
> Could anybody give me some direction at that point ?
If you know an emacs key stroke, you can know what command it's bound
to with: C-h k <key-stroke>
In the help window you will usually have a link to the _source_ of the
command. (You can click on it, or use TAB to move the cursor on it
and type RET).
Some functions are implemented in C, so you may get some C source.
Not very interesting (these are the primitives of emacs lisp). Try
another command.
If you know the name of a function, you can get its help page with:
C-h f <function-name> RET When you are browsing some emacs lisp
source, you can also have the cursor positionned on a function name
and type C-h f RET.
> Also I would like to know how people debug their scripts ? Are there
> any tricks ?
We don't debug, our functions are perfect the first time.
The trick is bottom-up programming.
> For now I just write some forms and evaluate them with 'C-j'.
Yes, that's what you should do.
For example, assuming you want to implement a function to capitalize
each word in the selection, you could do:
(let ((start 2137) (end 2248)) ; these numbers I got then using M-: (point)
(buffer-substring start end))
C-u C-x C-e ; is what I type to get the result inserted in the buffer.
; Also C-x C-e works in any more, contrarily to C-j.
-->
#("For example, assuming you want to implement a function to capitalize
each word in the selection, you could do:
" 0 68 (justification left fontified t) 68 69 (fontified t justification left) 69 107 (justification left fontified t) 107 111 (justification left fontified t)) ; This is a string with properties.
(let ((start 2137) (end 2248))
(split-string C-h f (buffer-substring start end)) ; after typing a function name, C-h f RET gives the help
^^^^^^^^^^^^^^^^^^
(let ((start 2137) (end 2248))
(split-string (buffer-substring start end)))
-->
(#("For" 0 3 (fontified t justification left)) #("example," 0 8 (fontified t justification left)) #("assuming" 0 8 (fontified t justification left)) #("you" 0 3 (fontified t justification left)) #("want" 0 4 (fontified t justification left)) #("to" 0 2 (fontified t justification left)) #("implement" 0 9 (fontified t justification left)) #("a" 0 1 (fontified t justification left)) #("function" 0 8 (fontified t justification left)) #("to" 0 2 (fontified t justification left)) #("capitalize" 0 10 (fontified t justification left)) #("each" 0 4 (fontified t justification left)) #("word" 0 4 (fontified t justification left)) #("in" 0 2 (fontified t justification left)) #("the" 0 3 (fontified t justification left)) #("selection," 0 10 (fontified t justification left)) #("you" 0 3 (fontified t jus
tification left)) #("could" 0 5 (fontified t justification left)) #("do:" 0 3 (fontified t justification left)))
(let ((start 2137) (end 2248))
(dolist (word (split-string (buffer-substring start end)))
(insert (capitalize word) " ")))
For Example, Assuming You Want To Implement A Function To Capitalize Each Word In The Selection, You Could Do:
--> nil
(let ((start 2137) (end 2248))
(let ((text (buffer-substring start end)))
(delete-region start end)
(goto-char start)
(dolist (word (split-string text))
(insert (capitalize word) " "))))
C-x C-e (it works, check between characters 2137 and 2248).
(defun my-capitalize-region (start end)
(interactive "r")
(let ((text (buffer-substring start end)))
(delete-region start end)
(goto-char start)
(dolist (word (split-string text))
(insert (capitalize word) " "))))
Toto Foo Bar Titi Quux
Select the above lowercase words, M-x my-capitalize-region RET it
works, no debugging.
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 9:15 ` Francis Moreau
2009-05-25 10:22 ` Pascal J. Bourguignon
@ 2009-05-25 11:50 ` Andreas Röhler
2009-05-25 12:42 ` Richard Riley
` (2 subsequent siblings)
4 siblings, 0 replies; 18+ messages in thread
From: Andreas Röhler @ 2009-05-25 11:50 UTC (permalink / raw)
To: Francis Moreau; +Cc: help-gnu-emacs
Francis Moreau wrote:
> Hello,
>
> [thanks for answering]
>
> On May 25, 10:17 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>
>> Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
>> Introduction' in the Info menu. The manual title is actually "An Introduction to
>> Programming in Emacs Lisp". It's just what you're looking for.
>>
>
> Ok, I did have a look to this but it starts by;
>
> "This is an `Introduction to Programming in Emacs Lisp', for people
> who are not programmers."
>
> so since I'm a programmer (well I try to be ;) I just skiped the
> document.
>
>
>> When you want to code something, search (`grep') the existing Emacs-Lisp source
>> code for terms that are pertinent. You can often find code that is similar to
>> what you want to do. This is the way to learn about writing code to change to a
>> different buffer, select a different window, display a buffer, search for text,
>> replace text, and so on - see how the Emacs developers do it.
>>
>
> yeah that's a good idea.
>
> Is there any way to jump into a function definition (for example by
> using tags) when asking for help on this function (C-h f) ?
>
>
After C-h f, while info is displayed in other-buffer, I use this
(defun jump-to-form ()
(interactive)
(if (featurep 'xemacs)
(progn
(forward-char 1)
(let ((name (symbol-atpt))
(file (progn (search-forward "\"" nil t 1)(filename-atpt))))
(forward-char 1)
(help-find-source-or-scroll-up (point))
(switch-to-buffer (current-buffer))
(kill-new name)
(search-forward name)))
(other-window 1)
(forward-button 1)
(find-file-at-point)))
with key f12
(global-set-key [(f12)] 'jump-to-form)
BTW XEmacs user need
thing-at-point-utils.el from
https://code.launchpad.net/s-x-emacs-werkstatt/
to use this.
>>> Also I would like to know how people debug their scripts ? Are there
>>> any tricks ? For now I just write some forms and evaluate
>>> them with 'C-j'.
>>>
>> `C-j' evaluates in the *scratch* buffer. I personally don't use *scratch* much.
>> I prefer to create an Emacs-Lisp buffer/file, e.g. foo.el, and work in that,
>> then throw it away. (My fingers can't think of `C-j' as anything other than
>> `newline-and-indent'.)
>>
>> See also `M-:', `eval-region', and `C-x C-e'. See `debug-on-entry'. Put
>> `(debug)' in your code if you want to debug part of a function. Make a function
>> interactive temporarily, to make it easier to call (`M-x', with completion, vs
>> `M-:'). Comment out sections of code using `C-u M-x comment-region' (I bind
>> `comment-region' to `C-x C-;').
>>
>>
>
> Ok I'll do, thanks for the tips.
>
>
>> Ask questions here. Visit Emacs Wiki (http://www.emacswiki.org/). Have fun!
>>
>
> thanks
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 11:01 ` Pascal J. Bourguignon
@ 2009-05-25 12:03 ` Andreas Röhler
2009-05-27 13:05 ` Thien-Thi Nguyen
1 sibling, 0 replies; 18+ messages in thread
From: Andreas Röhler @ 2009-05-25 12:03 UTC (permalink / raw)
To: Pascal J. Bourguignon; +Cc: help-gnu-emacs
Pascal J. Bourguignon wrote:
> Francis Moreau <francis.moro@gmail.com> writes:
>
>
>> Hello,
>>
>> I finally took time to start learning elisp hence nobody can call me
>> an dumb emacs user ;)
>>
>> I started by reading the info files containing the Gnu Emacs Lisp
>> Reference Manual although I haven't read it entirely.
>>
>> But now I got the main picture of the language but I would need some
>> practice since the reference manual lack of examples before I feel
>> confortable enough to start writing my own elisp scripts.
>>
>> Could anybody give me some direction at that point ?
>>
>
> If you know an emacs key stroke, you can know what command it's bound
> to with: C-h k <key-stroke>
>
>
> In the help window you will usually have a link to the _source_ of the
> command. (You can click on it, or use TAB to move the cursor on it
> and type RET).
>
> Some functions are implemented in C, so you may get some C source.
> Not very interesting (these are the primitives of emacs lisp). Try
> another command.
>
> If you know the name of a function, you can get its help page with:
> C-h f <function-name> RET When you are browsing some emacs lisp
> source, you can also have the cursor positionned on a function name
> and type C-h f RET.
>
>
>
>
>> Also I would like to know how people debug their scripts ? Are there
>> any tricks ?
>>
>
> We don't debug, our functions are perfect the first time.
>
Well, after seven days or so god stopped programming because it was fine. :)
For all children born before that day however, M-x edebug-defun might be
an option.
Cheers
> The trick is bottom-up programming.
>
>
>
>> For now I just write some forms and evaluate them with 'C-j'.
>>
>
> Yes, that's what you should do.
>
> For example, assuming you want to implement a function to capitalize
> each word in the selection, you could do:
>
> (let ((start 2137) (end 2248)) ; these numbers I got then using M-: (point)
> (buffer-substring start end))
> C-u C-x C-e ; is what I type to get the result inserted in the buffer.
> ; Also C-x C-e works in any more, contrarily to C-j.
> -->
> #("For example, assuming you want to implement a function to capitalize
> each word in the selection, you could do:
> " 0 68 (justification left fontified t) 68 69 (fontified t justification left) 69 107 (justification left fontified t) 107 111 (justification left fontified t)) ; This is a string with properties.
>
> (let ((start 2137) (end 2248))
> (split-string C-h f (buffer-substring start end)) ; after typing a function name, C-h f RET gives the help
> ^^^^^^^^^^^^^^^^^^
>
> (let ((start 2137) (end 2248))
> (split-string (buffer-substring start end)))
> -->
> (#("For" 0 3 (fontified t justification left)) #("example," 0 8 (fontified t justification left)) #("assuming" 0 8 (fontified t justification left)) #("you" 0 3 (fontified t justification left)) #("want" 0 4 (fontified t justification left)) #("to" 0 2 (fontified t justification left)) #("implement" 0 9 (fontified t justification left)) #("a" 0 1 (fontified t justification left)) #("function" 0 8 (fontified t justification left)) #("to" 0 2 (fontified t justification left)) #("capitalize" 0 10 (fontified t justification left)) #("each" 0 4 (fontified t justification left)) #("word" 0 4 (fontified t justification left)) #("in" 0 2 (fontified t justification left)) #("the" 0 3 (fontified t justification left)) #("selection," 0 10 (fontified t justification left)) #("you" 0 3 (fontified t justification left)) #("could" 0 5 (fontified t justification left)) #("do:" 0 3 (fontified t justification left)))
>
> (let ((start 2137) (end 2248))
> (dolist (word (split-string (buffer-substring start end)))
> (insert (capitalize word) " ")))
>
> For Example, Assuming You Want To Implement A Function To Capitalize Each Word In The Selection, You Could Do:
> --> nil
>
> (let ((start 2137) (end 2248))
> (let ((text (buffer-substring start end)))
> (delete-region start end)
> (goto-char start)
> (dolist (word (split-string text))
> (insert (capitalize word) " "))))
>
> C-x C-e (it works, check between characters 2137 and 2248).
>
> (defun my-capitalize-region (start end)
> (interactive "r")
> (let ((text (buffer-substring start end)))
> (delete-region start end)
> (goto-char start)
> (dolist (word (split-string text))
> (insert (capitalize word) " "))))
>
>
> Toto Foo Bar Titi Quux
>
> Select the above lowercase words, M-x my-capitalize-region RET it
> works, no debugging.
>
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 9:15 ` Francis Moreau
2009-05-25 10:22 ` Pascal J. Bourguignon
2009-05-25 11:50 ` Andreas Röhler
@ 2009-05-25 12:42 ` Richard Riley
2009-05-25 13:51 ` Pascal J. Bourguignon
2009-05-26 7:58 ` Francis Moreau
2009-05-25 17:11 ` Drew Adams
[not found] ` <mailman.7774.1243271469.31690.help-gnu-emacs@gnu.org>
4 siblings, 2 replies; 18+ messages in thread
From: Richard Riley @ 2009-05-25 12:42 UTC (permalink / raw)
To: help-gnu-emacs
Francis Moreau <francis.moro@gmail.com> writes:
> Hello,
>
> [thanks for answering]
>
> On May 25, 10:17 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>>
>> Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
>> Introduction' in the Info menu. The manual title is actually "An Introduction to
>> Programming in Emacs Lisp". It's just what you're looking for.
>
> Ok, I did have a look to this but it starts by;
>
> "This is an `Introduction to Programming in Emacs Lisp', for people
> who are not programmers."
>
> so since I'm a programmer (well I try to be ;) I just skiped the
> document.
I recommend Xah Lee's tutorial. It's well written and easy to find
"snippets" to perform certain tasks. The just start adding some key
bindings etc to your editor yourself to perform certain tasks.
http://xahlee.org/emacs/elisp.html
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 12:42 ` Richard Riley
@ 2009-05-25 13:51 ` Pascal J. Bourguignon
2009-05-25 14:18 ` Richard Riley
2009-05-26 7:58 ` Francis Moreau
1 sibling, 1 reply; 18+ messages in thread
From: Pascal J. Bourguignon @ 2009-05-25 13:51 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@googlemail.com> writes:
> Francis Moreau <francis.moro@gmail.com> writes:
>
>> Hello,
>>
>> [thanks for answering]
>>
>> On May 25, 10:17 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>>>
>>> Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
>>> Introduction' in the Info menu. The manual title is actually "An Introduction to
>>> Programming in Emacs Lisp". It's just what you're looking for.
>>
>> Ok, I did have a look to this but it starts by;
>>
>> "This is an `Introduction to Programming in Emacs Lisp', for people
>> who are not programmers."
>>
>> so since I'm a programmer (well I try to be ;) I just skiped the
>> document.
>
> I recommend Xah Lee's tutorial. It's well written and easy to find
> "snippets" to perform certain tasks. The just start adding some key
> bindings etc to your editor yourself to perform certain tasks.
>
> http://xahlee.org/emacs/elisp.html
Beware of Xah Lee, he's a kook. I didn't check that document, it
might be worth something, but what he posts in general (eg. in c.l.l)
is bullshit.
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 13:51 ` Pascal J. Bourguignon
@ 2009-05-25 14:18 ` Richard Riley
0 siblings, 0 replies; 18+ messages in thread
From: Richard Riley @ 2009-05-25 14:18 UTC (permalink / raw)
To: help-gnu-emacs
pjb@informatimago.com (Pascal J. Bourguignon) writes:
> Richard Riley <rileyrgdev@googlemail.com> writes:
>
>> Francis Moreau <francis.moro@gmail.com> writes:
>>
>>> Hello,
>>>
>>> [thanks for answering]
>>>
>>> On May 25, 10:17 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>>>>
>>>> Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
>>>> Introduction' in the Info menu. The manual title is actually "An Introduction to
>>>> Programming in Emacs Lisp". It's just what you're looking for.
>>>
>>> Ok, I did have a look to this but it starts by;
>>>
>>> "This is an `Introduction to Programming in Emacs Lisp', for people
>>> who are not programmers."
>>>
>>> so since I'm a programmer (well I try to be ;) I just skiped the
>>> document.
>>
>> I recommend Xah Lee's tutorial. It's well written and easy to find
>> "snippets" to perform certain tasks. The just start adding some key
>> bindings etc to your editor yourself to perform certain tasks.
>>
>> http://xahlee.org/emacs/elisp.html
>
> Beware of Xah Lee, he's a kook. I didn't check that document, it
> might be worth something, but what he posts in general (eg. in c.l.l)
> is bullshit.
All to their own. I've seen he can be contentious but I found his
tutorial much more helpful than an rtfm in general.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: How to get skills in elisp ?
2009-05-25 9:15 ` Francis Moreau
` (2 preceding siblings ...)
2009-05-25 12:42 ` Richard Riley
@ 2009-05-25 17:11 ` Drew Adams
[not found] ` <mailman.7774.1243271469.31690.help-gnu-emacs@gnu.org>
4 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-05-25 17:11 UTC (permalink / raw)
To: 'Francis Moreau', help-gnu-emacs
> > Yes, take a look at the manual (in Info, `C-h i') called `Emacs Lisp
> > Introduction' in the Info menu. The manual title is
> > actually "An Introduction to
> > Programming in Emacs Lisp". It's just what you're looking for.
>
> Ok, I did have a look to this but it starts by;
>
> "This is an `Introduction to Programming in Emacs Lisp', for people
> who are not programmers."
>
> so since I'm a programmer (well I try to be ;) I just skiped the
> document.
;-) !!!
That was probably written to avoid scaring away non-programmers.
It really should say something like "for non-programmers and programmers who are
not necessarily familiar with Lisp. Really, it's for anyyone interested in Emacs
Lisp.
> Is there any way to jump into a function definition (for example by
> using tags) when asking for help on this function (C-h f) ?
After `C-h f' (or `C-h v' for variables), you should see a link to the defining
source file near the beginning of the help text. Examples:
eval-defun is an interactive compiled Lisp function in `lisp-mode.el'.
forward-char is an interactive built-in function in `C source code'.
The text `lisp-mode.el' and the text `C source code' are links - click them to
go to the definitions of functions `eval-defun' and `forward-char'. You will not
be able to do the latter if you don't have a copy of the C source code (in
directory `src' under your Emacs installation directory). To see the former, you
will likewise need a copy of the Lisp source code file, in this case
`lisp-mode.el'.
You should always make sure you have a copy of all of the Lisp source code files
for the libraries that you use. It's an invaluable help to consult the source
code. If you have only the byte-compiled files (*.elc instead of *.el), then go
to gnu.org and pick up the source files now.
Yes, you can also use a tags file. For that, you will need to create the tags
file. Consult the doc or Emacs Wiki for more info. Once you have a tags file,
you can easily get to any function etc. definitions. This is an alternative to
using `C-h f' and then following the link to the defining code.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
[not found] ` <mailman.7774.1243271469.31690.help-gnu-emacs@gnu.org>
@ 2009-05-25 19:41 ` Francis Moreau
2009-05-25 20:52 ` Drew Adams
0 siblings, 1 reply; 18+ messages in thread
From: Francis Moreau @ 2009-05-25 19:41 UTC (permalink / raw)
To: help-gnu-emacs
On May 25, 7:11 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
>
> That was probably written to avoid scaring away non-programmers.
>
> It really should say something like "for non-programmers and programmers who are
> not necessarily familiar with Lisp. Really, it's for anyyone interested in Emacs
> Lisp.
Yes definitely.
I started to read it and although some parts could be more straight
forward, it's really usefull for programmers too.
>
> > Is there any way to jump into a function definition (for example by
> > using tags) when asking for help on this function (C-h f) ?
>
> After `C-h f' (or `C-h v' for variables), you should see a link to the defining
> source file near the beginning of the help text. Examples:
>
> eval-defun is an interactive compiled Lisp function in `lisp-mode.el'.
>
> forward-char is an interactive built-in function in `C source code'.
>
> The text `lisp-mode.el' and the text `C source code' are links - click them to
> go to the definitions of functions `eval-defun' and `forward-char'. You will not
> be able to do the latter if you don't have a copy of the C source code (in
> directory `src' under your Emacs installation directory). To see the former, you
> will likewise need a copy of the Lisp source code file, in this case
> `lisp-mode.el'.
Yes I tried that but it didn't work since I did not have elisp source
code. Now I installed it and it works as expected.
Really usefull.
>
> You should always make sure you have a copy of all of the Lisp source code files
> for the libraries that you use. It's an invaluable help to consult the source
> code. If you have only the byte-compiled files (*.elc instead of *.el), then go
> to gnu.org and pick up the source files now.
>
Agreed.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: How to get skills in elisp ?
2009-05-25 19:41 ` Francis Moreau
@ 2009-05-25 20:52 ` Drew Adams
0 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-05-25 20:52 UTC (permalink / raw)
To: 'Francis Moreau', help-gnu-emacs
> > You should always make sure you have a copy of all of the
> > Lisp source code files for the libraries that you use.
> > It's an invaluable help to consult the source
> > code. If you have only the byte-compiled files (*.elc
> > instead of *.el), then go to gnu.org and pick up the
> > source files now.
>
> Agreed.
FWIW, I personally think that it should not be possible (or at least not too
easy) to download just the byte-compiled files. Better to encourage people
("enhanced encouragement techniques"?) to download the *.el files also. They can
always throw them away afterward, if they like. ;-)
I suspect that providing a tar/zip with only byte-compiled files is a holdover
from the days when people used dial-up modems.
No flames please. I'm sure there is a case to be made for a trimmed-down
download (e.g. to a cell phone ;-)). I just think we should find ways to
encourage users, especially newbies, to download the whole shebang instead.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 12:42 ` Richard Riley
2009-05-25 13:51 ` Pascal J. Bourguignon
@ 2009-05-26 7:58 ` Francis Moreau
1 sibling, 0 replies; 18+ messages in thread
From: Francis Moreau @ 2009-05-26 7:58 UTC (permalink / raw)
To: help-gnu-emacs
On 25 mai, 14:42, Richard Riley <rileyrg...@googlemail.com> wrote:
>
> I recommend Xah Lee's tutorial. It's well written and easy to find
> "snippets" to perform certain tasks. The just start adding some key
> bindings etc to your editor yourself to perform certain tasks.
>
> http://xahlee.org/emacs/elisp.html
Looks interesting for practising elisp.
I'll look into it once I will finish the "An Introduction to
Programming in Emacs Lisp" document,
Thanks for the pointer.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to get skills in elisp ?
2009-05-25 11:01 ` Pascal J. Bourguignon
2009-05-25 12:03 ` Andreas Röhler
@ 2009-05-27 13:05 ` Thien-Thi Nguyen
1 sibling, 0 replies; 18+ messages in thread
From: Thien-Thi Nguyen @ 2009-05-27 13:05 UTC (permalink / raw)
To: help-gnu-emacs
() pjb@informatimago.com (Pascal J. Bourguignon)
() Mon, 25 May 2009 13:01:23 +0200
We don't debug, our functions are perfect the first time.
The trick is bottom-up programming.
Well, that's just the first part of the trick.
The rest is.... wait for it....
wait for it....
writing the function definitions to disk
(so that they are available after the Next Time Around).
Sorry, a wizardly detail not to be loosed upon noobies, i know...
thi
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: How to get skills in elisp ?
@ 2009-05-28 7:09 Benjamin Badgley
2009-05-28 15:55 ` Drew Adams
0 siblings, 1 reply; 18+ messages in thread
From: Benjamin Badgley @ 2009-05-28 7:09 UTC (permalink / raw)
To: help-gnu-emacs
Not flaming Drew, only stating fact. I still use a dial up with a serial
modem. It's okay for our needs presently. Rather, it needs to be.
That aside, I have been delving into the lovely world of load path.
Seems I've gotten a rather long group listing for a load path. Any ideas
on how to wrangle it back down to perhaps two or so directories? Not
sure where to go to set it for Emacs itself. My dot emacs file evaluates
out the long path listing.
I want to finish hacking the dot emacs and then byte compile it, set a
new dot emacs up.
;;; Included in the new dot emacs
(require 'emacs-source.elc)
That will cut down load time. If I keep the original dot emacs then, I
can add / subtract and recompile as needed. Besides that it'll save
running into evaluation errors when it loads a simple one or two line
dot emacs file.
However, that darn load path issue bugs me. And I may be taking the long
way home. Please let me if that's the case, it's how I learn. But no
need to indulge stupidity either, if you can offer some help, pointers
please do.
So far my favorite line of code is the one below.
(setq inhibit-startup-message t)
And I also enjoy:
(add-to-list 'load-path
"/usr/share/emacs/site-lisp/emacs-goodies-el/color-theme.el")
(require 'color-theme)
(eval-after-load "color-theme-wheat"
(progn (color-theme-hober))
As for finding useful documentation, I find myself doing a C-h i a lot.
It helped get me started on hacking the dot emacs file. I stumbled over
the Emacs FAQ via the C-h i key-chord. With auto decompress on in Emacs
you can read compressed info files just swell. I bet it would also work
on those pesky compressed man pages, too. ;)
Well, I ought to be scooting along. Need to break tomorrow, do some
writing instead of coding. Nitol, run it slow. :)
;;; Ben
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: How to get skills in elisp ?
2009-05-28 7:09 Benjamin Badgley
@ 2009-05-28 15:55 ` Drew Adams
0 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-05-28 15:55 UTC (permalink / raw)
To: 'Benjamin Badgley', help-gnu-emacs
> Seems I've gotten a rather long group listing for a load
> path. Any ideas on how to wrangle it back down to perhaps
> two or so directories?
Put the code you need in just those two or so directories. ;-)
Just what is the problem you have with a long `load-path'?
> Not sure where to go to set it for Emacs itself. My dot emacs
> file evaluates out the long path listing.
Dunno what you mean ("for Emacs itself"=?, "evaluates out"=?).
Set your `load-path' in your init file (.emacs) or in some file that you load
from your init file.
> I want to finish hacking the dot emacs and then byte compile
> it, set a new dot emacs up.
> ;;; Included in the new dot emacs
> (require 'emacs-source.elc)
Yes, that's fine. But use just (require 'emacs-source). And you will need to put
(provide 'emacs-source) somewhere in emacs-source.el.
But don't bother to byte-compile your init file (.emacs). Keep it short and
sweet. Let it load other stuff (e.g. emacs-source.elc) that loads other stuff.
The other stuff can be byte-compiled.
> However, that darn load path issue bugs me.
I don't understand what the issue is. What's wrong with the path being long?
> (add-to-list 'load-path
> "/usr/share/emacs/site-lisp/emacs-goodies-el/color-theme.el")
Just use /usr/share/emacs/site-lisp/emacs-goodies-el - no need to mention any
individual files you want to load. Assuming the order of directories in your
`load-path' is what you want, you should be able to just have directories there.
`load-path' tells Emacs where to look. `load-library', `load', `load-file', and
`require' tell Emacs which libraries to load. It will look for them by
consulting `load-path'.
HTH.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2009-05-28 15:55 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 7:30 How to get skills in elisp ? Francis Moreau
2009-05-25 8:17 ` Drew Adams
[not found] ` <mailman.7753.1243239425.31690.help-gnu-emacs@gnu.org>
2009-05-25 9:15 ` Francis Moreau
2009-05-25 10:22 ` Pascal J. Bourguignon
2009-05-25 11:50 ` Andreas Röhler
2009-05-25 12:42 ` Richard Riley
2009-05-25 13:51 ` Pascal J. Bourguignon
2009-05-25 14:18 ` Richard Riley
2009-05-26 7:58 ` Francis Moreau
2009-05-25 17:11 ` Drew Adams
[not found] ` <mailman.7774.1243271469.31690.help-gnu-emacs@gnu.org>
2009-05-25 19:41 ` Francis Moreau
2009-05-25 20:52 ` Drew Adams
2009-05-25 10:04 ` Tassilo Horn
2009-05-25 11:01 ` Pascal J. Bourguignon
2009-05-25 12:03 ` Andreas Röhler
2009-05-27 13:05 ` Thien-Thi Nguyen
-- strict thread matches above, loose matches on Subject: below --
2009-05-28 7:09 Benjamin Badgley
2009-05-28 15:55 ` Drew Adams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).