From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: henri-biard@francemel.fr Newsgroups: gmane.emacs.help Subject: using flyspell-region from another function Date: Tue, 15 Jun 2021 03:32:54 +0200 (CEST) Message-ID: References: <87mtrr3ow2.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20214"; mail-complaints-to="usenet@ciao.gmane.io" To: moasenwood@zoho.eu, help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 15 07:53:50 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lt21E-0004x8-Oo for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Jun 2021 07:53:48 +0200 Original-Received: from localhost ([::1]:50288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lt21D-00085U-Qp for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Jun 2021 01:53:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lt20l-00081z-7S for help-gnu-emacs@gnu.org; Tue, 15 Jun 2021 01:53:19 -0400 Original-Received: from msg-2.mailo.com ([213.182.54.12]:56760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lt20i-0007s9-2g for help-gnu-emacs@gnu.org; Tue, 15 Jun 2021 01:53:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=francemel.fr; s=mailo; t=1623720781; bh=fJPFI7aIgg8lmsQBAzP6c5BUHUlP6GuZmjiFnXzaV9Q=; h=X-EA-Auth:From:To:Date:Subject:MIME-Version:X-Mailer:Message-ID: In-Reply-To:Content-Type; b=cknl1GY01HnC7Pi2kaBKEeXEX8CRkvR/SL7U9pIlmaiBxm1MXhvIf5VmOz0ivnMqr i2+5UYjBheCAAXSxRhUatT/jbFuyvRs1X4A6y6lbTNeDj1rIJ9Hkj4+B3s19HpanUr aHXQ22Gj0bLuE+fAshiJ2Fud43Js/UCF5YnsFDq8= Original-Received: by www-7.mailo.com with http webmail; Tue, 15 Jun 2021 03:32:54 +0200 (CEST) X-EA-Auth: UAlqtteIOUZt/FsG0Xh9UgUZmH9A9HvWPGO5EhVR2JXkk9Cr0F0NBPxHzmU87QeBhrFNuIF0c5nOgMAQ2chBUg6wLwBTbErE X-Priority: 3 X-Mailer: COMS/EA21.01/r20210601 In-Reply-To: <87mtrr3ow2.fsf@zoho.eu> Received-SPF: pass client-ip=213.182.54.12; envelope-from=henri-biard@francemel.fr; helo=msg-2.mailo.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130856 Archived-At: >> 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 t= o call ispell, aspell, flyspell directly. From: Emanuel Berg via Users list for the GNU Emacs text editor 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 --=20 underground experts united https://dataswamp.org/~incal