[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
using flyspell-region from another function
From: |
henri-biard |
Subject: |
using flyspell-region from another function |
Date: |
Tue, 15 Jun 2021 03:32:54 +0200 (CEST) |
>> henri-biard wrote:
> > Have written a function that calls "flyspell-region".
> But that already exists...?
Because I want to use a single function for spelling, rather than having to
call ispell, aspell,
flyspell directly.
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: 15/06/2021 03:19:57 Europe/Paris
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