From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joakim Hove Newsgroups: gmane.emacs.help Subject: Re: Why adding this write-file-hook makes save-buffer not work anymore!?? Date: Fri, 29 Aug 2003 10:24:05 +0200 Organization: University of Bergen Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <4yhe40vplm.fsf@skjellgran.ii.uib.no> References: <84isohfsx0.fsf@slowfox.is.informatik.uni-duisburg.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1062146258 4825 80.91.224.253 (29 Aug 2003 08:37:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Aug 2003 08:37:38 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 29 10:37:36 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19sel8-0005OE-00 for ; Fri, 29 Aug 2003 10:37:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19sefR-0002Lp-1H for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Aug 2003 04:31:37 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!washdc3-snh1.gtei.net!news.gtei.net!ngpeer.news.aol.com!newsfeed1!bredband!uio.no!nntp.uib.no!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: skjellgran.ii.uib.no Original-X-Trace: toralf.uib.no 1062145445 90956 129.177.20.52 (29 Aug 2003 08:24:05 GMT) Original-X-Complaints-To: abuse@uib.no Original-NNTP-Posting-Date: 29 Aug 2003 08:24:05 GMT User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:TvOSYsFyP4MWWTzoygycTd/Zw4Q= Original-Xref: shelby.stanford.edu gnu.emacs.help:116243 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:12161 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12161 seberino@spawar.navy.mil (Christian Seberino) writes: > Thanks for your help. What makes my function return non-nil > and how do I make it return nil??? The last evaluated statement of your function is the return value, i.e. in your function the return value is the result of: (goto-char original-pos) The documentation of (goto-char ) does not say, but the little test function: (defun testit () (interactive) (message "Point-max: %s" (goto-char (point-max))) (sleep-for 5) (message "Point-min: %s" (goto-char (point-min))) (sleep-for 5)) quickly reveals that (goto-char ) returns the value of the point it has moved to (at least when it succeeds), i.e. the value of original-pos in your case. >> > (defun cs-delete-trailing-whitespace() (interactive) >> > (delete-trailing-whitespace) >> > (let ((original-pos (point))) >> > (goto-char (point-max)) >> > (delete-blank-lines) >> > (goto-char original-pos))) To return 'nil just change the last lines: ;; snip (goto-char original-pos) 'nil)) HTH - Joakim -- /--------------------------------------------------------------------\ / Joakim Hove / hove@bccs.no / (55 5) 84076 | \ | Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 | | CMU | 5231 Paradis | \ Thormøhlensgt.55, 5020 Bergen. | 55 91 28 18 / \--------------------------------------------------------------------/