all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How come I keep getting nil on point-max?
@ 2007-04-28 18:31 grocery_stocker
  2007-04-28 18:42 ` Ralf Angeli
  2007-04-28 19:13 ` Denis Bueno
  0 siblings, 2 replies; 9+ messages in thread
From: grocery_stocker @ 2007-04-28 18:31 UTC (permalink / raw)
  To: help-gnu-emacs

When I go
(point-max)

I get:
672

In the emacs echo area.

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

I get
Debugger entered--Lisp error: (error "Format specifier doesn't match
argument t$
  message("The value is: %d" "nil")
  (let (start (point-max)) (message "The value is: %d" start))
  eval((let (start (point-max)) (message "The value is: %d" start)))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
* call-interactively(eval-last-sexp)



Chad

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 18:31 How come I keep getting nil on point-max? grocery_stocker
@ 2007-04-28 18:42 ` Ralf Angeli
  2007-04-28 18:52   ` grocery_stocker
  2007-04-28 19:00   ` grocery_stocker
  2007-04-28 19:13 ` Denis Bueno
  1 sibling, 2 replies; 9+ messages in thread
From: Ralf Angeli @ 2007-04-28 18:42 UTC (permalink / raw)
  To: help-gnu-emacs

* 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))) ...

-- 
Ralf

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 18:42 ` Ralf Angeli
@ 2007-04-28 18:52   ` grocery_stocker
  2007-04-28 19:03     ` Ralf Angeli
  2007-04-28 20:52     ` Pascal Bourguignon
  2007-04-28 19:00   ` grocery_stocker
  1 sibling, 2 replies; 9+ messages in thread
From: grocery_stocker @ 2007-04-28 18:52 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 28, 11:42 am, Ralf Angeli <dev.n...@caeruleus.net> 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, I did that, now when I go
(let ((start (point-min)) ((end (point-max)))
        (message "The value is: %d %d" start end ))


I get
Debugger entered--Lisp error: (invalid-function (start (point-min)))
  ((start (point-min)) ((end ...)) (message "The value is: %d %d"
start end))
  eval(((start (point-min)) ((end ...)) (message "The value is: %d %d"
start en$
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
* call-interactively(eval-last-sexp)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 18:42 ` Ralf Angeli
  2007-04-28 18:52   ` grocery_stocker
@ 2007-04-28 19:00   ` grocery_stocker
  2007-04-28 19:16     ` Joost Kremers
  2007-04-29  6:46     ` Tim X
  1 sibling, 2 replies; 9+ messages in thread
From: grocery_stocker @ 2007-04-28 19:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 28, 11:42 am, Ralf Angeli <dev.n...@caeruleus.net> 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.

Chad

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 18:52   ` grocery_stocker
@ 2007-04-28 19:03     ` Ralf Angeli
  2007-04-28 20:52     ` Pascal Bourguignon
  1 sibling, 0 replies; 9+ messages in thread
From: Ralf Angeli @ 2007-04-28 19:03 UTC (permalink / raw)
  To: help-gnu-emacs

* grocery stocker (2007-04-28) writes:

> Okay, I did that, now when I go
> (let ((start (point-min)) ((end (point-max)))
                            ^ Here is an erroneous parenthesis.

>         (message "The value is: %d %d" start end ))
>
>
> I get
> Debugger entered--Lisp error: (invalid-function (start (point-min)))

Assuming you read the documentation about `let', indentation should
give you a hint that there are imbalanced parens.  You might also want
to consider activating Show Paren mode by executing `M-x
customize-variable RET show-paren-mode RET' and customizing the value.

-- 
Ralf

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 18:31 How come I keep getting nil on point-max? grocery_stocker
  2007-04-28 18:42 ` Ralf Angeli
@ 2007-04-28 19:13 ` Denis Bueno
  1 sibling, 0 replies; 9+ messages in thread
From: Denis Bueno @ 2007-04-28 19:13 UTC (permalink / raw)
  To: grocery_stocker; +Cc: help-gnu-emacs

On 28 Apr 2007 11:31:07 -0700, grocery_stocker <cdalten@gmail.com> wrote:
> When I go
> (point-max)
>
> I get:
> 672
>
> In the emacs echo area.
>
> However, when I do
> (let (start (point-max)))

The syntax is:

(let ((start (point-max))) (message "The value is: %d" start))

Note the extra paren before `start'.

-Denis

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 19:00   ` grocery_stocker
@ 2007-04-28 19:16     ` Joost Kremers
  2007-04-29  6:46     ` Tim X
  1 sibling, 0 replies; 9+ messages in thread
From: Joost Kremers @ 2007-04-28 19:16 UTC (permalink / raw)
  To: help-gnu-emacs

grocery_stocker wrote:
> Okay, one last question. When I modify let to do the following:
> (let ((start (point-min))
>          ((end (point-max)))

[snip debug output]

> I don't get this. I thought I could assign multiple variables to let.

you can, if you do it correctly:

(let ((start (point-min))
      (end (point-max)))
  (message "Start: %d; End: %d" start end))

note the parentheses.

C-h i m Elisp RET m index RET m let RET


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 18:52   ` grocery_stocker
  2007-04-28 19:03     ` Ralf Angeli
@ 2007-04-28 20:52     ` Pascal Bourguignon
  1 sibling, 0 replies; 9+ messages in thread
From: Pascal Bourguignon @ 2007-04-28 20:52 UTC (permalink / raw)
  To: help-gnu-emacs

grocery_stocker <cdalten@gmail.com> writes:

> On Apr 28, 11:42 am, Ralf Angeli <dev.n...@caeruleus.net> 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, I did that, now when I go
> (let ((start (point-min)) ((end (point-max)))
>         (message "The value is: %d %d" start end ))

You should learn this: C-h f

Whenever you start typing (something ...
type C-h f

If you have the cursor just after something, then it should be
selected and you need to type just RET


So type:  ( l e t C-h f RET
and read!

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How come I keep getting nil on point-max?
  2007-04-28 19:00   ` grocery_stocker
  2007-04-28 19:16     ` Joost Kremers
@ 2007-04-29  6:46     ` Tim X
  1 sibling, 0 replies; 9+ messages in thread
From: Tim X @ 2007-04-29  6:46 UTC (permalink / raw)
  To: help-gnu-emacs

grocery_stocker <cdalten@gmail.com> writes:

> On Apr 28, 11:42 am, Ralf Angeli <dev.n...@caeruleus.net> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-04-29  6:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-28 18:31 How come I keep getting nil on point-max? grocery_stocker
2007-04-28 18:42 ` Ralf Angeli
2007-04-28 18:52   ` grocery_stocker
2007-04-28 19:03     ` Ralf Angeli
2007-04-28 20:52     ` Pascal Bourguignon
2007-04-28 19:00   ` grocery_stocker
2007-04-28 19:16     ` Joost Kremers
2007-04-29  6:46     ` Tim X
2007-04-28 19:13 ` Denis Bueno

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.