[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using flyspell-region from another function
From: |
Emanuel Berg |
Subject: |
Re: using flyspell-region from another function |
Date: |
Tue, 15 Jun 2021 03:19:57 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
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