help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get skills in elisp ?


From: Andreas Röhler
Subject: Re: How to get skills in elisp ?
Date: Mon, 25 May 2009 13:50:44 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

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
>
>   





reply via email to

[Prev in Thread] Current Thread [Next in Thread]