Giter VIP home page Giter VIP logo

flycheck-aspell's Introduction

Emacs spell check using Aspell

GitHub License GitHub Workflow Status flycheck-aspell on MELPA flymake-aspell on MELPA

flycheck-aspell in action

The flycheck-aspell and flymake-aspell packages add support for spell checking to Flycheck and Flymake using the GNU Aspell application.

Installation

Thanks to Sam Kleinman and Chris Rayner both flycheck-aspell and flymake-aspell can now be found on MELPA. Install them using your preferred package installation method.

Usage

Both packages will use your ispell settings, in particular ispell-dictionary and ispell-local-dictionary if they are set. This means you can use ispell-change-dictionary to set your preferred language on a per-buffer basis. Here are some recommended base ispell settings.

(setq ispell-dictionary "your_default_dictionary")
(setq ispell-program-name "aspell")
(setq ispell-silently-savep t)

Guides on how to configure both packages can be found in the following separate files:

General differences to flyspell-mode

Emacs already contains a mode for spell checking called flyspell-mode. It works by spell-checking words as you type, which allows for constant performance with arbitrarily large files, but also comes with a number of disadvantages. In particular, it cannot highlight misspelled words that have not been near the cursor in your current editing session. Accessing a list of all misspelled words is also impossible. Lastly, because flyspell-mode has to run code on every keystroke, it can often cause noticeable input delay and stuttering.

In contrast, flycheck-aspell and flymake-aspell asynchronously run Aspell in the background and extract a list of all misspelled words in the full document. This ensures a list of misspelled words is always available, which can be accessed with e.g. flymake-show-diagnostics-buffer or flycheck-list-errors. However, this also means that spell checking performance will slow down approximately linearly with the number of spelling errors. If your file is particularly large it might take a few seconds for new misspelled words to be highlighted. Note that this should never affect editing experience as no additional code is run on user input.

License

These Emacs packages are distributed under the terms of the GPL-3.0-or-later license, meaning the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Copyright notices are included with all individual files of source code.

flycheck-aspell's People

Contributors

gcman avatar jcs090218 avatar leotaku avatar tychoish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flycheck-aspell's Issues

Check for spelling mistakes in the comments of source code.

flyspell has a mode for prog-mode, flyspell-prog-mode. It'd be great flycheck-aspell came with a flymake-diagnostic-function for prog-mode.

A concrete example.

Steps to reproduce

With (flymake-aspell-setup), write the following code:

package main

// I can't spell hipopopopoatmus.
func main() {

}

Expected

"hipopopopoatmus" should be the only flymake diagnostic.

Actual

"hipopopopoatmus" and "func" are displayed as flymake diagnostics.

This is a false positive, because "func" is a valid Go keyword.

Workaround

(add-hook 'prog-mode-hook 'flyspell-prog-mode)

Describe how to deal with different languages

Aspell can be called with a language flag (aspell --lang=de`) to tell it what language to look for.
It would be great if I could somehow tell flycheck-aspell which language to use in a given buffer.

I think aspell defaults to the current locale setting, but that might not be the right thing for each buffer.

How to config flycheck-aspell?

On Ubuntu 20.04, I've aspell installed:

$ aspell --version
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)

And I installed flycheck-aspell:

(use-package flycheck-aspell)

But how to activate it and let it fix the misspelled words automatically?

Regards,
HY

How does this package compare to flyspell?

Stock Emacs already has a package called "flyspell-mode". It is rather old and sometimes behaves weirdly, but I think it would still be nice to have a small introduction at the README, how flycheck-aspell is better.

Could that be added?

submit package to melpa

Would you be opposed to submitting this package (or packages?) to melpa?

I'm willing to submit the package on your behalf.

`flycheck-aspell--handle-and` errors on curly quotes

When checking a line with a curly quote (for example U+2019 or U+201D ) the call to string-match in flycheck-aspell--handle-and doesn't match the curly quotes because it checks for the word character class rather than the word syntax.

Changing wordchar to (syntax word) in the call to rx fixes this issue.

This issue also occurs in flymake-aspell--handle-and, flycheck-aspell--handle-hash, and flymake-aspell--handle-hash, and has the same fix.

Additionally, I think it might be worth opening a bug upstream since the elisp manual and the docstring of rx don't make the difference between (rx word) and (rx (syntax word)) clear at all.

flymake-aspell backend getting disabled ... any suggestion how to get this working?

I'm trying to get the flymake-aspell backend going on emacs 27.1, but I am unable to get it working and I am not sure what is going wrong. Having installed it and using the following blurb in my config:

(use-package flymake-aspell
  :hook
  (text-mode-hook . flymake-aspell-setup)
  (prog-mode-hook . flymake-aspell-setup))

(use-package flymake
  :hook
  (prog-mode-hook . flymake-mode)
  (text-mode-hook . flymake-mode))

I am getting the following error-message in the flymake log buffer in files that should be supported such as tex files.

Warning [flymake init.el]: Disabling backend flymake-aspell--check because (wrong-type-argument stringp nil)

If I only have the first config block flymake doesn't activate and I see no error message at all, so at a loss what goes wrong. Do you have any idea what is going wrong here?

autoloading cookies missing?

At the moment lazy loading flymake-aspell fails for me when adding flymake-aspell-setup to the text-mode-hook when byte-compiling; could you add the autoloading cookie

;;;###autoload

to the function to fix this?

error in required aspell version

The readme file states that the minimum required version of aspell is 0.68.8 which doesn't exist and should read 0.60.8 instead.

Args out of range processing markdown

Thanks for putting together this nice interface to allow spell checking with flycheck!

I edit a bunch of markdown documents, and hooked in your existing checker via:

   (add-to-list 'flycheck-checkers 'markdown-aspell-dynamic)

It mostly works fine, but I noticed that sometimes it gets the wrong positions for misspelt words.

Now I'm on ubuntu 20.04, it uses a version of aspell that has built-in support for markdown, so I thought using that might fix the problem....

 (flycheck-aspell-define-checker "new-markdown" "Markdown using aspell markdown filter"
   ("--add-filter" "url" "--add-filter" "markdown") (markdown-mode))
 (add-to-list 'flycheck-checkers 'new-markdown-aspell-dynamic)

However, when I use it, I get an error message like:

Error from syntax checker new-markdown-aspell-dynamic: Args out of range: "    mkdir ./venv", 79, nil

(where " mkdir ./venv" is the entire contents of a line in the markdown file, but it is inside a preformatted block being ignored by aspell, the actual occurrence of "venv" being complained about is further down, on a much longer line). I don't think the inherent problem here is the new aspell mode, it looks like the spellcheck result parsing is getting out of sync with where the actual occurrences are.

flymake-aspell-setup results in void variable flymake-diagnostic-functions

Hi,

I'm on emacs 28.2 with the the latest flymake-aspell[1] from MELPA. I set up init.el per the doc[2].

When I run (flymake-aspell-setup), I get the following error:

funcall-interactively: Symbol’s value as variable is void: flymake-diagnostic-functions

Below is a back trace. Please let me know if any additional data is needed or if I've borked something on my end. :\

Thank you!

Debugger entered--Lisp error: (void-variable flymake-diagnostic-functions)
  flymake-aspell-setup()
  funcall-interactively(flymake-aspell-setup)
  apply(funcall-interactively flymake-aspell-setup nil)
  repeat-complex-command(1)
  funcall-interactively(repeat-complex-command 1)
  call-interactively(repeat-complex-command nil nil)
  command-execute(repeat-complex-command)

References

  1. Version - flymake-aspell-20221025.1844
  2. init.el settings:
(setq ispell-dictionary "en_US")
(setq ispell-program-name "aspell")
(setq ispell-silently-savep t)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.