From: Joakim Hove <hove@bccs.no>
Subject: Re: Why adding this write-file-hook makes save-buffer not work anymore!??
Date: Fri, 29 Aug 2003 10:24:05 +0200 [thread overview]
Message-ID: <4yhe40vplm.fsf@skjellgran.ii.uib.no> (raw)
In-Reply-To: bf23f78f.0308281846.20b33caf@posting.google.com
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 /
\--------------------------------------------------------------------/
next prev parent reply other threads:[~2003-08-29 8:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-28 19:14 Why adding this write-file-hook makes save-buffer not work anymore!?? Christian Seberino
2003-08-28 20:06 ` Kai Großjohann
2003-08-29 2:46 ` Christian Seberino
2003-08-29 8:24 ` Joakim Hove [this message]
2003-08-31 11:50 ` Alan Mackenzie
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4yhe40vplm.fsf@skjellgran.ii.uib.no \
--to=hove@bccs.no \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).