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: 17 Jan 2003 16:36:43 +0100 Organization: Q Software Solutions GmbH Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87ptqvokj8.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 1042817736 22400 80.91.224.249 (17 Jan 2003 15:35:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 17 Jan 2003 15:35:36 +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 18ZYWq-0005oj-00 for ; Fri, 17 Jan 2003 16:35:32 +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 18ZYWk-00009p-02 for gnu-help-gnu-emacs@m.gmane.org; Fri, 17 Jan 2003 10:35:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!news.tele.dk!news.tele.dk!small.news.tele.dk!news100.image.dk!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: 34 Original-X-Trace: news.t-online.com 1042817550 02 12732 TctHE4GbSvAx9R 030117 15:32:30 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:109079 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:5607 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5607 "CarlC" writes: > Hi. > > I have written my first elisp function. (pause for roar of crowd). I am > getting an error while trying to process my first conditional and debug is > not helping me. This is for emacs 21.2.1. > > (let ((line (current-line))) > (forward-word 1) > (if (> (current-line) line) ((goto-line line) (end-of-line)))) > ... > (defun current-line () > "Return the vertical position of point..." > (+ (count-lines (window-start) (point)) > (if (= (current-column) 0) 1 0) > -1)) 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. Documentation: ans search all devices. 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))) Regards Friedrich