all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Friedrich Dominicus <frido@q-software-solutions.com>
Subject: Re: Newbie Conditional Problem
Date: 18 Jan 2003 07:27:45 +0100	[thread overview]
Message-ID: <873cnr7z1a.fsf@fbigm.here> (raw)
In-Reply-To: MUVV9.42830$aG4.2474711@twister.austin.rr.com

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

> "Friedrich Dominicus" <frido@q-software-solutions.com> wrote in message
> 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	other threads:[~2003-01-18  6:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-17 15:19 Newbie Conditional Problem CarlC
2003-01-17 15:36 ` Friedrich Dominicus
2003-01-17 16:09   ` CarlC
2003-01-18  6:27     ` Friedrich Dominicus [this message]
2003-01-18 13:35       ` Johan Bockgård
2003-01-18 16:59         ` Friedrich Dominicus
2003-01-18 13:48       ` Christopher J. White
2003-01-18 17:03         ` Friedrich Dominicus
2003-01-17 16:19 ` Brendan Halpin
     [not found] ` <x54r87zrdo.fsf@lola.goethe.zz>
2003-01-17 16:46   ` CarlC
2003-01-17 16:52     ` David Kastrup
2003-01-17 17:24       ` CarlC
2003-01-17 17:42 ` Stefan Monnier <foo@acm.com>
2003-01-18 17:36 ` Kai Großjohann

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=873cnr7z1a.fsf@fbigm.here \
    --to=frido@q-software-solutions.com \
    /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.