From: Alp Aker <alptekin.aker@gmail.com>
To: "B. T. Raven" <btraven@nihilo.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Word count in Emacs
Date: Fri, 14 Sep 2012 15:28:55 -0400 [thread overview]
Message-ID: <CACxch4o0oQfrUEMh9_NJK=Bpa55x4hjb+KvfByfmx3VnZaYjBg@mail.gmail.com> (raw)
In-Reply-To: <k2vr4c01o2b@news6.newsguy.com>
> Can anyone give me a clue why the following doesn't print a number in
> the mini-buffer or to the *Messages* buffer?:
>
> (defun count-words (start end) ;; alias wce
> "Print number of words in the region."
> (interactive "r")
> (save-excursion
> (save-restriction
> (narrow-to-region start end)
> (goto-char (point-min))
> (count-matches "\\sw+"))))
As you've defined it, the function returns a number, but it's not the
case that the return value of an interactive command is automatically
echoed in the mini-buffer. Compare:
(defun count-words (start end) ;; alias wce
"Print number of words in the region."
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
(message (number-to-string (count-matches "\\sw+"))))))
next prev parent reply other threads:[~2012-09-14 19:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-14 17:55 Word count in Emacs B. T. Raven
2012-09-14 18:14 ` Jambunathan K
2012-09-14 19:28 ` Alp Aker [this message]
[not found] ` <mailman.8893.1347650994.855.help-gnu-emacs@gnu.org>
2012-09-15 23:11 ` B. T. Raven
[not found] ` <mailman.8880.1347646427.855.help-gnu-emacs@gnu.org>
2012-09-15 23:23 ` B. T. Raven
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACxch4o0oQfrUEMh9_NJK=Bpa55x4hjb+KvfByfmx3VnZaYjBg@mail.gmail.com' \
--to=alptekin.aker@gmail.com \
--cc=btraven@nihilo.net \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.