buffers NOT to spellcheck

View: New views
3 Messages — Rating Filter:   Alert me  

buffers NOT to spellcheck

by Nathaniel Cunningham :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've implemented (in the spelling branch) a menu option to enable spellchecking automatically for All Modes, Text Modes, or No Modes.  There is an issue here that I think deserves a bit of discussion, and I'd like to get some feedback before rolling this into the master branch.

Even when we say we're spellchecking buffers in "All Modes", I think it's fair to exclude buffers like *Messages*, *completions*, *shell*, etc, in addition to the more ephemeral buffers whose names start with a space.  I've included a hook in the "All Modes" spellchecking functions to prevent turning on flyspell-mode in a given buffer, and I wonder what the default list of buffers (or modes or buffer-name regexps) should be for that prevention.

It seems we shouldn't just check for *asterisk* names, since *scratch* should not be excluded from spellchecking; perhaps other major modes use asterisks for buffer names where spellchecking might be desirable.  (what about e.g. Mail modes and ERC?  I don't have any experience with mail or messaging through emacs.)

Right now, I have "All modes" spellchecking ignoring only
- buffers whose names begin with a space and are not visiting a file
- read-only buffers

Any other recommendations?  We don't want this inhibition to confuse users, so we should keep the list of non-checked buffers to a conservative list of those users really won't want to check.  (n.b. regardless of the "mode" setting, spellchecking can still be turned on or off via menu for any buffer.)

-- Nathaniel

_______________________________________________
Aquamacs-devel mailing list
Aquamacs-devel@...
http://lists.aquamacs.org/mailman/listinfo.cgi/aquamacs-devel

Re: buffers NOT to spellcheck

by davidswelt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

maybe exclude buffers for which `special-display-p' returns non-nil?

(derived-mode-p &rest MODES)

Also, you want to exclude all "special" modes.  From the Emacs manual:

> If this mode is appropriate only for specially-prepared text, then  
> the major mode command symbol should have a property named mode-
> class with value special, put on as follows:
>
>           (put 'funny-mode 'mode-class 'special)
>
> This tells Emacs that new buffers created while the current buffer  
> is in Funny mode should not inherit Funny mode, in case default-
> major-mode is nil. Modes such as Dired, Rmail, and Buffer List use  
> this feature.

http://www.gnu.org/software/emacs/manual/html_node/elisp/Major-Mode-Conventions.html

There could be further buffers, such as the ones marked as *internal  
buffers*.

What you want to absolutely avoid is turning it on in every buffer  
that is created internally (e.g., temporary buffers, but also all  
sorts of comint/process output buffers) and everything that the user  
is never going to get to see.  Otherwise you'll slow things down  
everywhere (and cause problems).

- D


--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and  
support the Aquamacs Project!



On Nov 2, 2009, at 3:51 PM, Nathaniel Cunningham wrote:

> I've implemented (in the spelling branch) a menu option to enable  
> spellchecking automatically for All Modes, Text Modes, or No Modes.  
> There is an issue here that I think deserves a bit of discussion,  
> and I'd like to get some feedback before rolling this into the  
> master branch.
>
> Even when we say we're spellchecking buffers in "All Modes", I think  
> it's fair to exclude buffers like *Messages*, *completions*,  
> *shell*, etc, in addition to the more ephemeral buffers whose names  
> start with a space.  I've included a hook in the "All Modes"  
> spellchecking functions to prevent turning on flyspell-mode in a  
> given buffer, and I wonder what the default list of buffers (or  
> modes or buffer-name regexps) should be for that prevention.
>
> It seems we shouldn't just check for *asterisk* names, since  
> *scratch* should not be excluded from spellchecking; perhaps other  
> major modes use asterisks for buffer names where spellchecking might  
> be desirable.  (what about e.g. Mail modes and ERC?  I don't have  
> any experience with mail or messaging through emacs.)
>
> Right now, I have "All modes" spellchecking ignoring only
> - buffers whose names begin with a space and are not visiting a file
> - read-only buffers
>
> Any other recommendations?  We don't want this inhibition to confuse  
> users, so we should keep the list of non-checked buffers to a  
> conservative list of those users really won't want to check.  (n.b.  
> regardless of the "mode" setting, spellchecking can still be turned  
> on or off via menu for any buffer.)
>
> -- Nathaniel
> _______________________________________________
> Aquamacs-devel mailing list
> Aquamacs-devel@...
> http://lists.aquamacs.org/mailman/listinfo.cgi/aquamacs-devel

_______________________________________________
Aquamacs-devel mailing list
Aquamacs-devel@...
http://lists.aquamacs.org/mailman/listinfo.cgi/aquamacs-devel

Re: buffers NOT to spellcheck

by Nathaniel Cunningham :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, Nov 3, 2009 at 9:16 PM, David Reitter <david.reitter@...> wrote:
maybe exclude buffers for which `special-display-p' returns non-nil?

That sounds reasonable as a default; takes care of help buffers and the like.  (However, "special display" does not necessarily imply text a user won't want to edit/spellcheck, since it usually means to display in a dedicated frame.  Users up to editing special-display-regexp should be able to handle the requisite customizations, though, if needed.)
 

Also, you want to exclude all "special" modes.  From the Emacs manual:


Thanks for pointing this out.  Takes care of *Completions*, *shell*, *info*, and many others.


There could be further buffers, such as the ones marked as *internal buffers*.

I don't think we want to go so far as to avoid spellchecking in all *internal buffers* -- but if *scratch* is the only example of such a buffer that should be checked, that could be made a special case.
 

What you want to absolutely avoid is turning it on in every buffer that is created internally (e.g., temporary buffers, but also all sorts of comint/process output buffers) and everything that the user is never going to get to see.  Otherwise you'll slow things down everywhere (and cause problems).

I think this will be taken care of by skipping fundamental-mode -- spellchecking "All Modes" is done via define-global-minor-mode, which does not detect newly created buffers in fundamental-mode.  Also, by explicitly skipping buffers whose name starts with a space (when not visiting a file), we avoid these: "Buffers that are ephemeral and generally uninteresting to the user have names starting with a space, so that the list-buffers and buffer-menu commands don't mention them. A name starting with space also initially disables recording undo information."

I think I'll stick with this list of buffers to skip spellchecking, then:
- buffers whose name starts with a space, if not visiting a file
- buffers with `special' mode-class
- buffers satisfying special-display-regexp

read-only buffers are another option, but the read-only status can be changed mid-session; I'll consider adding that later if the list above doesn't take care of the needs.  I think I'll also create a customization list of buffer names in which to skip global spellchecking, so users can easily add buffers to skip

--Nathaniel

_______________________________________________
Aquamacs-devel mailing list
Aquamacs-devel@...
http://lists.aquamacs.org/mailman/listinfo.cgi/aquamacs-devel