* ispell and flyspell
@ 2021-01-02 12:26 wael-zwaiter
2021-01-02 14:27 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: wael-zwaiter @ 2021-01-02 12:26 UTC (permalink / raw
To: Help Gnu Emacs
Writing prose in texinfo, I wonder how best to use ispell and flyspell. Should I
use both modes together or should I concentrate primarily on one rather than the
other?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 12:26 ispell and flyspell wael-zwaiter
@ 2021-01-02 14:27 ` Eli Zaretskii
2021-01-02 15:35 ` wael-zwaiter
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-01-02 14:27 UTC (permalink / raw
To: help-gnu-emacs
> From: wael-zwaiter@gmx.com
> Date: Sat, 2 Jan 2021 13:26:34 +0100
>
> Writing prose in texinfo, I wonder how best to use ispell and flyspell. Should I
> use both modes together or should I concentrate primarily on one rather than the
> other?
I'd suggest to turn on flyspell-mode, it will highlight the spelling
mistakes as you type.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 14:27 ` Eli Zaretskii
@ 2021-01-02 15:35 ` wael-zwaiter
2021-01-02 16:23 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: wael-zwaiter @ 2021-01-02 15:35 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
Have written the following function, but (ispell-region) is failing.
How can I make option 2 call (ispell-region) on the current paragraph.
Basically, option 1 will check the current word, option 2 will check the current
paragraph, and option 3 will check the whole buffer.
(defvar spelt-state nil)
(defun spelt ()
"Corrects the spelling of text."
(interactive)
(pcase spelt-state
(1 (flyspell-mode 0)
(ispell-word)
(message "%s" "Spell: Word")
(setq spelt-state 2))
(2 (ispell-region)
(message "%s" "Spell: Region")
(setq spelt-state 3))
(3 (ispell-buffer)
(message "%s" "Spell: Buffer")
(setq spelt-state 0))
(_ (flyspell-mode)
(setq spelt-state 1))) )
(global-unset-key (kbd "M-v"))
(global-set-key (kbd "M-v") 'spelt)
> Sent: Saturday, January 02, 2021 at 7:57 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: ispell and flyspell
>
> > From: wael-zwaiter@gmx.com
> > Date: Sat, 2 Jan 2021 13:26:34 +0100
> >
> > Writing prose in texinfo, I wonder how best to use ispell and flyspell. Should I
> > use both modes together or should I concentrate primarily on one rather than the
> > other?
>
> I'd suggest to turn on flyspell-mode, it will highlight the spelling
> mistakes as you type.
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 15:35 ` wael-zwaiter
@ 2021-01-02 16:23 ` Eli Zaretskii
2021-01-02 16:34 ` wael-zwaiter
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-01-02 16:23 UTC (permalink / raw
To: help-gnu-emacs
> From: wael-zwaiter@gmx.com
> Cc: help-gnu-emacs@gnu.org
> Date: Sat, 2 Jan 2021 16:35:35 +0100
>
> Have written the following function, but (ispell-region) is failing.
> How can I make option 2 call (ispell-region) on the current paragraph.
> [...]
> (2 (ispell-region)
When you call a function, it is highly recommended to consult its doc
string, so you see what arguments it requires and what is the meaning
of each argument. You _must_ supply the mandatory arguments, they
cannot be omitted when calling from Lisp.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 16:23 ` Eli Zaretskii
@ 2021-01-02 16:34 ` wael-zwaiter
2021-01-02 16:44 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: wael-zwaiter @ 2021-01-02 16:34 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
> Sent: Saturday, January 02, 2021 at 9:53 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: ispell and flyspell
>
> > From: wael-zwaiter@gmx.com
> > Cc: help-gnu-emacs@gnu.org
> > Date: Sat, 2 Jan 2021 16:35:35 +0100
> >
> > Have written the following function, but (ispell-region) is failing.
> > How can I make option 2 call (ispell-region) on the current paragraph.
> > [...]
> > (2 (ispell-region)
>
> When you call a function, it is highly recommended to consult its doc
> string, so you see what arguments it requires and what is the meaning
> of each argument. You _must_ supply the mandatory arguments, they
> cannot be omitted when calling from Lisp.
I know, but aw unsure what commands to use for the arguments to get
the beginning and end of the paragraph.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 16:34 ` wael-zwaiter
@ 2021-01-02 16:44 ` Eli Zaretskii
2021-01-02 16:57 ` wael-zwaiter
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-01-02 16:44 UTC (permalink / raw
To: help-gnu-emacs
> From: wael-zwaiter@gmx.com
> Cc: help-gnu-emacs@gnu.org
> Date: Sat, 2 Jan 2021 17:34:12 +0100
>
> > > (2 (ispell-region)
> >
> > When you call a function, it is highly recommended to consult its doc
> > string, so you see what arguments it requires and what is the meaning
> > of each argument. You _must_ supply the mandatory arguments, they
> > cannot be omitted when calling from Lisp.
>
> I know, but aw unsure what commands to use for the arguments to get
> the beginning and end of the paragraph.
"M-x apropos RET paragraph RET" is your friend.
In this case, I suggest using start-of-paragraph-text and
end-of-paragraph-text.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 16:44 ` Eli Zaretskii
@ 2021-01-02 16:57 ` wael-zwaiter
2021-01-02 17:11 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: wael-zwaiter @ 2021-01-02 16:57 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
Have now made this code. Would start-of-paragraph-text and
end-of-paragraph-text work better?.
(defun spelt-paragraph ()
(interactive)
(let ((prg-bounds (bounds-of-thing-at-point 'paragraph)))
(when prg-bounds
(let ( (beg (point))
(end (cdr prg-bounds)))
(ispell-region beg end)))))
> Sent: Saturday, January 02, 2021 at 10:14 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: ispell and flyspell
>
> > From: wael-zwaiter@gmx.com
> > Cc: help-gnu-emacs@gnu.org
> > Date: Sat, 2 Jan 2021 17:34:12 +0100
> >
> > > > (2 (ispell-region)
> > >
> > > When you call a function, it is highly recommended to consult its doc
> > > string, so you see what arguments it requires and what is the meaning
> > > of each argument. You _must_ supply the mandatory arguments, they
> > > cannot be omitted when calling from Lisp.
> >
> > I know, but aw unsure what commands to use for the arguments to get
> > the beginning and end of the paragraph.
>
> "M-x apropos RET paragraph RET" is your friend.
>
> In this case, I suggest using start-of-paragraph-text and
> end-of-paragraph-text.
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 16:57 ` wael-zwaiter
@ 2021-01-02 17:11 ` Eli Zaretskii
2021-01-02 17:21 ` wael-zwaiter
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-01-02 17:11 UTC (permalink / raw
To: help-gnu-emacs
> From: wael-zwaiter@gmx.com
> Cc: help-gnu-emacs@gnu.org
> Date: Sat, 2 Jan 2021 17:57:53 +0100
>
> Have now made this code. Would start-of-paragraph-text and
> end-of-paragraph-text work better?.
AFAIR, it will do the same, just without extra level of indirection.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 17:11 ` Eli Zaretskii
@ 2021-01-02 17:21 ` wael-zwaiter
2021-01-02 17:47 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: wael-zwaiter @ 2021-01-02 17:21 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
I am having a problem with this variation
(defun spelt-paragr ()
"TODO"
(interactive)
(ispell-region (start-of-paragraph-text) (end-of-paragraph-text)))
> Sent: Saturday, January 02, 2021 at 10:41 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: ispell and flyspell
>
> > From: wael-zwaiter@gmx.com
> > Cc: help-gnu-emacs@gnu.org
> > Date: Sat, 2 Jan 2021 17:57:53 +0100
> >
> > Have now made this code. Would start-of-paragraph-text and
> > end-of-paragraph-text work better?.
>
> AFAIR, it will do the same, just without extra level of indirection.
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 17:21 ` wael-zwaiter
@ 2021-01-02 17:47 ` Eli Zaretskii
2021-01-02 17:52 ` wael-zwaiter
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-01-02 17:47 UTC (permalink / raw
To: help-gnu-emacs
> From: wael-zwaiter@gmx.com
> Cc: help-gnu-emacs@gnu.org
> Date: Sat, 2 Jan 2021 18:21:55 +0100
>
> I am having a problem with this variation
>
> (defun spelt-paragr ()
> "TODO"
> (interactive)
> (ispell-region (start-of-paragraph-text) (end-of-paragraph-text)))
Did you read the doc strings of these functions?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 17:47 ` Eli Zaretskii
@ 2021-01-02 17:52 ` wael-zwaiter
2021-01-02 17:53 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: wael-zwaiter @ 2021-01-02 17:52 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
They do a move. Which makes it not so clear why you suggested them. I could
get the position using (point). But I would need some assistance to complete
my function.
> Sent: Saturday, January 02, 2021 at 11:17 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: ispell and flyspell
>
> > From: wael-zwaiter@gmx.com
> > Cc: help-gnu-emacs@gnu.org
> > Date: Sat, 2 Jan 2021 18:21:55 +0100
> >
> > I am having a problem with this variation
> >
> > (defun spelt-paragr ()
> > "TODO"
> > (interactive)
> > (ispell-region (start-of-paragraph-text) (end-of-paragraph-text)))
>
> Did you read the doc strings of these functions?
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 17:52 ` wael-zwaiter
@ 2021-01-02 17:53 ` Eli Zaretskii
2021-01-02 17:57 ` wael-zwaiter
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-01-02 17:53 UTC (permalink / raw
To: help-gnu-emacs
> From: wael-zwaiter@gmx.com
> Cc: help-gnu-emacs@gnu.org
> Date: Sat, 2 Jan 2021 18:52:42 +0100
>
> They do a move. Which makes it not so clear why you suggested them. I could
> get the position using (point). But I would need some assistance to complete
> my function.
The usual paradigm is
(save-excursion (start-of-paragraph-text) (point))
and the same with end-of-paragraph-text.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ispell and flyspell
2021-01-02 17:53 ` Eli Zaretskii
@ 2021-01-02 17:57 ` wael-zwaiter
0 siblings, 0 replies; 13+ messages in thread
From: wael-zwaiter @ 2021-01-02 17:57 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
> Sent: Saturday, January 02, 2021 at 11:23 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: ispell and flyspell
>
> > From: wael-zwaiter@gmx.com
> > Cc: help-gnu-emacs@gnu.org
> > Date: Sat, 2 Jan 2021 18:52:42 +0100
> >
> > They do a move. Which makes it not so clear why you suggested them. I could
> > get the position using (point). But I would need some assistance to complete
> > my function.
>
> The usual paradigm is
>
> (save-excursion (start-of-paragraph-text) (point))
I like the use of save-excursion and see things quite straightforward.
>
> and the same with end-of-paragraph-text.
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-01-02 17:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-02 12:26 ispell and flyspell wael-zwaiter
2021-01-02 14:27 ` Eli Zaretskii
2021-01-02 15:35 ` wael-zwaiter
2021-01-02 16:23 ` Eli Zaretskii
2021-01-02 16:34 ` wael-zwaiter
2021-01-02 16:44 ` Eli Zaretskii
2021-01-02 16:57 ` wael-zwaiter
2021-01-02 17:11 ` Eli Zaretskii
2021-01-02 17:21 ` wael-zwaiter
2021-01-02 17:47 ` Eli Zaretskii
2021-01-02 17:52 ` wael-zwaiter
2021-01-02 17:53 ` Eli Zaretskii
2021-01-02 17:57 ` wael-zwaiter
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.