Skip to content

Commit

Permalink
Partial commit of lesson-5-2
Browse files Browse the repository at this point in the history
  • Loading branch information
hypernumbers committed Jan 9, 2011
1 parent 3f5e4ce commit f890f26
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=================================
Lesson 5-2 - Working With Buffers
=================================
=====================================
Lesson 5-2 - Working With Buffers (1)
=====================================

------------
Introduction
Expand Down Expand Up @@ -38,7 +38,6 @@ Create a new file called ``omarmenu.el`` in the directory ``~/.emacs.d/omars-dir
| ``(provide 'omarmenu)``


Then open your ``.emacs`` file in your home directory add the following lines - You might want to delete everything that is in it first:

| ``(add-to-list 'load-path "~/.emacs.d/omars-dir")``
Expand All @@ -60,11 +59,26 @@ Click on the menu-item *Count* and the message should print in the modeline.

What we will do in this and subsequent lessons is fill in the *empty function* *Count* until it can count the words in the current buffer.

---------------------
Maninpulating Buffers
---------------------
----------------------
Examining Our Function
----------------------

We are going to use a lot of Emacs functions to write our function `omar-count` so we need to learn how to look up their documentation.

Let's start by examining our own function. We will use the built-in Emacs function `describe-function`. It can be called in the usual way:

*[M]-x* `describe-function` and then enter `omar-count` into the modeline. You should see something like this:

.. image :: /images/emacs-using-describe-function.png
Lets add a proper function definition for our function. Edit `omarmenu.el`:

| ``(defun omar-count ()``
| ``(interactive)``
| ``"This function will count the number of words in the current buffer"``
| ``(message "When we have finished this will count the number of words in the current buffer"))``
To see this help string in action you will need to either select the menu item *Emacs-Lisp -> Evaluate Buffer* or close and re-open emacs.

---------------------
What You Have Learned
Expand Down
Binary file added images/emacs-using-describe-function.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ Learn eLisp For Emacs
:maxdepth: 1

contents/lesson-5-1-elisp-in-files
contents/lesson-5-2-working-with-buffers
contents/lesson-5-2-working-with-buffers-1

0 comments on commit f890f26

Please sign in to comment.