From: bojohan+news@dd.chalmers.se (Johan Bockgård)
Subject: Re: undo custom delete
Date: Wed, 05 Oct 2005 19:49:09 +0200 [thread overview]
Message-ID: <yoijhdbvyhuy.fsf@linus003.dd.chalmers.se> (raw)
In-Reply-To: 1128530820.718199.143450@g49g2000cwa.googlegroups.com
"Shug Boabby" <Shug.Boabby@gmail.com> writes:
> how can i get the first element from the list, and once i have it
> test which type it is, reference it's components and delete it from
> the list if need be.
All of this is thoroughly explained in the "Emacs Lisp Reference
Manual".
Lists are constructed from "cons cells".
The expression
(cons 1 (cons 2 (cons 3 nil)))
builds the list
(1 2 3)
which can also be represented as
(1 . (2 . (3 . nil))).
`car' picks out the left half (the "car") of a pair / the first
element of a list
`cdr' picks out the right half (the "cdr") of a pair / the rest
of a list
(car '(1 2 3)) => 1
(car '(1 . (2 . (3 . nil)))) => 1 ; this is exactly the same as above
(car '("text" . position)) => "text"
(cdr '("text" . position)) => position
`stringp' is used to test an object for being a string.
(stringp "text") => t
(stringp 0) => nil
Maybe you should start with "Introduction to Programming in Emacs
Lisp", http://www.gnu.org/software/emacs/emacs-lisp-intro/
If you use the CVS version of emacs then the Emacs manual, Elisp
manual, and Elisp Intro manual are all included.
You can use `M-x ielm RET' to practice evaluating simple Lisp
expressions:
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (+ 1 2)
3
ELISP> (list 'a 'b 'c)
(a b c)
ELISP> (cons 'a 'b)
(a . b)
You can use C-x C-e (eval-last-sexp) to evaluate Lisp expressions
anywhere.
> it doesn't seem to record the operation that was performed
Correct. Only changes to the text are recorded, not which command was
used.
--
Johan Bockgård
prev parent reply other threads:[~2005-10-05 17:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-04 16:03 undo custom delete Shug Boabby
2005-10-04 17:29 ` rgb
2005-10-05 9:08 ` Shug Boabby
2005-10-05 14:23 ` rgb
2005-10-05 14:36 ` Shug Boabby
2005-10-05 15:17 ` Johan Bockgård
2005-10-05 16:47 ` Shug Boabby
2005-10-05 17:49 ` Johan Bockgård [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yoijhdbvyhuy.fsf@linus003.dd.chalmers.se \
--to=bojohan+news@dd.chalmers.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.