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

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

Re: How come I keep getting nil on point-max?


From: Tim X
Subject: Re: How come I keep getting nil on point-max?
Date: Sun, 29 Apr 2007 16:46:18 +1000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

grocery_stocker <address@hidden> writes:

> On Apr 28, 11:42 am, Ralf Angeli <address@hidden> wrote:
>> * grocery stocker (2007-04-28) writes:
>>
>> > However, when I do
>> > (let (start (point-max)))
>>
>> > I get:
>> > nil
>>
>> > And when I do
>> > (let (start (point-max))
>> >         (message "The value is: %d" start))
>>
>> (let ((start (point-max))) ...
>>
>> --
>
> Okay, one last question. When I modify let to do the following:
> (let ((start (point-min))
>          ((end (point-max)))
>
> I get the following:
> Debugger entered--Lisp error: (invalid-function (end (point-max)))
>   ((end (point-max)))
>   eval(((end (point-max))))
>   eval-last-sexp-1(nil)
>   eval-last-sexp(nil)
> * call-interactively(eval-last-sexp)
>
> I don't get this. I thought I could assign multiple variables to let.
>

I think you need to use better indentation and re-read the elisp manual a bit
as your getting the syntax wrong. 

,----[ C-h f let RET ]
| let is a special form in `C source code'.
| (let VARLIST BODY...)
| 
| Bind variables according to VARLIST then eval BODY.
| The value of the last form in BODY is returned.
| Each element of VARLIST is a symbol (which is bound to nil)
| or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).
| All the VALUEFORMs are evalled before any symbols are bound.
| 
| [back]
`----

so you need

(let (varlist) body)

(let (start end) 
  (message "The start is %d and end is %d" start end))

but you want to assign values when the variables are created, so you need

(let ((start (point-min))
      (end (point-max)))
  (message "The start is %d and the end is %d" start end))

HTH

Tim

-- 
tcross (at) rapttech dot com dot au


reply via email to

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