From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Friedrich Dominicus Newsgroups: gmane.emacs.help Subject: Re: Newbie Conditional Problem Date: 18 Jan 2003 07:27:45 +0100 Organization: Q Software Solutions GmbH Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <873cnr7z1a.fsf@fbigm.here> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042871166 6260 80.91.224.249 (18 Jan 2003 06:26:06 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 18 Jan 2003 06:26:06 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18ZmQd-0001cn-00 for ; Sat, 18 Jan 2003 07:26:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18ZmQU-0007Xn-0C for gnu-help-gnu-emacs@m.gmane.org; Sat, 18 Jan 2003 01:25:54 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!feed.news.nacamar.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 66 Original-X-Trace: news.t-online.com 1042871011 04 14776 HfMHE8mbStHaVt 030118 06:23:31 Original-X-Complaints-To: abuse@t-online.com X-Sender: 320004655587-0001@t-dialin.net User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Native Windows TTY Support) Original-Xref: shelby.stanford.edu gnu.emacs.help:109113 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5640 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5640 "CarlC" writes: > "Friedrich Dominicus" 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