all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: using flyspell-region from another function
Date: Tue, 15 Jun 2021 03:19:57 +0200	[thread overview]
Message-ID: <87mtrr3ow2.fsf@zoho.eu> (raw)
In-Reply-To: ea-mime-60c7fbff-3ab-2802e8b5@www-7.mailo.com

henri-biard wrote:

> Have written a function that calls "flyspell-region".

But that already exists...?

> Naturally this needs the BEG and END of the region to be
> passed. How should I call flyspell-region, meaning, what
> should I pass to it ?

It can look like this:

(defun sort-second-field (beg end)
  (interactive "r")
  (sort-fields 2 beg end) )
(defalias 's2f #'sort-second-field)

You can also make it more generic, for example this which is
DWIM interactively (region if region, 0->point if not), and
from Lisp with args beg->end, and from Lisp w/o args the whole
buffer! so 4 ways to invoke!

(defun count-chars (&optional beg end)
  (interactive
   (if (use-region-p)
       (list (region-beginning) (region-end))
     (list (point-min) (point)) ))
  (message "%d" (- (or end (point-max))
                   (or beg (point-min)) )))

http://user.it.uu.se/~embe8573/emacs-init/sort-incal.el
https://dataswamp.org/~incal/emacs-init/count.el

-- 
underground experts united
https://dataswamp.org/~incal




  reply	other threads:[~2021-06-15  1:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  1:01 using flyspell-region from another function henri-biard
2021-06-15  1:19 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2021-06-15  1:32   ` henri-biard
2021-06-15  6:58     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-15 12:18       ` henri-biard
2021-06-15 14:42         ` Emanuel Berg via Users list for the GNU Emacs text editor

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=87mtrr3ow2.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /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.