From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: about "forward-paragraph" in Intro to emacs lisp. Date: Mon, 27 Jul 2009 09:01:19 -0400 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1248702682 27798 80.91.229.12 (27 Jul 2009 13:51:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jul 2009 13:51:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 27 15:51:15 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MVQbf-0002Uf-2Z for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Jul 2009 15:51:11 +0200 Original-Received: from localhost ([127.0.0.1]:55766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MVQbe-0001ak-50 for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Jul 2009 09:51:10 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!feeder.eternal-september.org!eternal-september.org!news.eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 41 Original-X-Trace: news.eternal-september.org U2FsdGVkX18mC5rRV1LTPdEVnMNRPvUqFyTQxY7sWMiBNObqkEX3Fva2pP3UCJuhnxZp/5fo92EuCAUKDK6iHMFg8gK1UtMRAuMW5WdTZRtJqP1uMy9NQLyZ8Zkoshoh0LHqqtTAYa8= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Mon, 27 Jul 2009 13:08:21 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1/wAQpMHG6f/L2sr5xnT6aOf9sQBg0Yhr0= Cancel-Lock: sha1:NGsy20fZSV8Dgf7K9LtW/0FDXyw= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Mail-Copies-To: nobody Original-Xref: news.stanford.edu gnu.emacs.help:171245 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66431 Archived-At: In article , waterloo wrote: > I can not understand code of forward-paragraph in Intro to emacs lisp. > > On " The forward motion `while' loop " of 12.4 in Intro to emacs lisp. > ------------------------------- > ;; going forwards and not at the end of the buffer > (while (and (> arg 0) (not (eobp))) > > ;; between paragraphs > ;; Move forward over separator lines... > (while (and (not (eobp)) > (progn (move-to-left-margin) (not (eobp))) > (looking-at parsep)) > (forward-line 1)) > ;; This decrements the loop > (unless (eobp) (setq arg (1- arg))) > ;; ... and one more line. > (forward-line 1) > ----------------------------------------------------- > > Why need "(progn (move-to-left-margin) (not (eobp))) " ? You only want 'and' to check the value of (not (eobp)), you don't want it looking at the value of (move-to-left-margin). So you combine them with 'progn', which just returns the value of its last expression. (move-to-left-margin) is needed because the parsep regexp is expected to be found at the beginning of line. > Why need the last line " (forward-line 1) " ? Not sure about that one. I guess it wants to move to the beginning of the next paragraph, rather than the end of the current one. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***