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

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

Re: Newbie Conditional Problem


From: Friedrich Dominicus
Subject: Re: Newbie Conditional Problem
Date: 18 Jan 2003 07:27:45 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Native Windows TTY Support)

"CarlC" <carlc@snowbd.com> writes:

> "Friedrich Dominicus" <frido@q-software-solutions.com> wrote in message
> 87ptqvokj8.fsf@fbigm.here">news:87ptqvokj8.fsf@fbigm.here...
> > I guess current-line is wrong the documentation for windows start
> >
> > gives `window-start' is a built-in function
> > (window-start BUFFER &optional WHICH-FRAMES WHICH-DEVICES) and the -1
> > is probably wrong too.
> >
> > I can't see how if fits. Try this
> > (defun current-line ()
> >   "Return the vertical position of point within the current buffer."
> >    (+ (count-lines (point-min) (point))
> >       (if (= (current-column) 0) 1 0)))
> 
> I copied the current-line function out of a manual. 
Anyway given the given documentation does it not make sense. The other
error you had was pointed out in other mail

          (let ((line (current-line)))
            (forward-word 1)
                    (if (> (current-line) line) ((goto-line line)
                                                ^ this is too much
        (end-of-line))))
I even do not understand what you want. Do you want to go to the end
of the following line? End of the current line? 

let us try to understand your code

(let ((line (current-line)))  ;; this give you a simple number with my
current-line (if that is what you want)
        (forward-word 1) moves forward onw word from point
        (if (> (current-line) line) ;; if we moved one line down
           ;; assuming you meant
        (progn (goto-line line) (end-of-line))))
        ;; this means go back one line (back to the line you started from

But what does it give you? It makes no sense. The code just moves you
to the end of the current line that is simply to call (end-of-line)
not more

So what do you want to do? 

Do you want to go ot the end of a specified line? Then do
(defun goto-end-of-line (lineno)
        (interactive "NWhich line should I go? ")
        (goto-line lineno)
        (end-of-line))

Do you want to simply get the line number you are in?
(defun which-line-am-I-in ()
        (interactive)
        (message (format "You are in line %d" (current-line))))

We just can help you if we know what you want to do. So if you have
programming problem than
a) show us your code
b) tell us what you expect it to do
c) tell us what's actually happening

Just then will we be able to give a suggestion.

Regards
Friedrich



reply via email to

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