branch: elpa/spell-fu commit 3caf7047ea8373b5f26b99e8b73e5da55df46a70 Author: Campbell Barton <ideasma...@gmail.com> Commit: Campbell Barton <ideasma...@gmail.com>
Rename functions & variables that used a global- prefix Use `spell-fu-global-*` instead, details in changelog. --- changelog.rst | 4 +++- readme.rst | 14 +++++++------- spell-fu.el | 25 +++++++++++++++---------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/changelog.rst b/changelog.rst index beadb919c1..751655d85a 100644 --- a/changelog.rst +++ b/changelog.rst @@ -3,7 +3,9 @@ Change Log ########## -- In development. +- Version 0.4 (2023-01-06) + - Rename ``global-spell-fu-mode`` to ``spell-fu-global-mode``, + ``global-spell-fu-ignore-buffer`` to ``spell-fu-global-ignore-buffer``. - Add ``spell-fu-debug`` variable, to support debugging why dictionaries are not loading. - Add ``spell-fu-reset`` to re-generate cache. - Fix #31, failure to detect updated personal dictionary when it's a symlink. diff --git a/readme.rst b/readme.rst index 8f5a4856c7..c32aaea08c 100644 --- a/readme.rst +++ b/readme.rst @@ -32,7 +32,7 @@ You may enable this globally which has the following defaults. .. code-block:: elisp (use-package spell-fu) - (global-spell-fu-mode) + (spell-fu-global-mode) Or you may wish to configure this per-mode, e.g: @@ -96,8 +96,8 @@ Global Settings ``spell-fu-incorrect-face`` (red, underline) The font to use for the spell checking overlay. -``global-spell-fu-ignore-modes`` nil - A list of modes that won't enable spell-checking from ``global-spell-fu-mode``. +``spell-fu-global-ignore-modes`` nil + A list of modes that won't enable spell-checking from ``spell-fu-global-mode``. ``spell-fu-debug`` nil Enable to see additional messages which may help to debug failure to initialize dictionaries. @@ -128,8 +128,8 @@ You may wish to set these values differently based on the current major-mode. Note that you may wish to add faces to this list if keywords or commands are marked as being spelled incorrectly. In this case, the face used by these commands may be added to this list so as to skip them. -``global-spell-fu-ignore-buffer`` - When not ``nil``, the buffer won't enable spell-checking from ``global-spell-fu-mode``. +``spell-fu-global-ignore-buffer`` + When not ``nil``, the buffer won't enable spell-checking from ``spell-fu-global-mode``. This may also be a function that takes a single buffer argument, where returning ``nil`` will enable spell-checking, anything else will not. @@ -139,9 +139,9 @@ You may wish to set these values differently based on the current major-mode. .. code-block:: elisp (setq spell-fu-ignore-modes (list 'org-mode)) - (setq global-spell-fu-ignore-buffer (lambda (buf) (buffer-local-value 'buffer-read-only buf))) + (setq spell-fu-global-ignore-buffer (lambda (buf) (buffer-local-value 'buffer-read-only buf))) - (global-spell-fu-mode) + (spell-fu-global-mode) Buffer Local Words diff --git a/spell-fu.el b/spell-fu.el index 94e17390f0..1ad4520792 100644 --- a/spell-fu.el +++ b/spell-fu.el @@ -21,15 +21,15 @@ ;; Write the following code to your .emacs file: ;; ;; (require 'spell-fu) -;; (global-spell-fu-mode) +;; (spell-fu-global-mode) ;; ;; Or with `use-package': ;; ;; (use-package spell-fu) -;; (global-spell-fu-mode) +;; (spell-fu-global-mode) ;; ;; If you prefer to enable this per-mode, you may do so using -;; mode hooks instead of calling `global-spell-fu-mode'. +;; mode hooks instead of calling `spell-fu-global-mode'. ;; The following example enables this for org-mode: ;; ;; (add-hook 'org-mode-hook @@ -51,7 +51,6 @@ ;; For `string-blank-p'. (require 'subr-x) - ;; --------------------------------------------------------------------------- ;; Custom Variables @@ -84,7 +83,12 @@ Call `spell-fu-buffer-session-localwords-refresh' after run-time modifications." ;;;###autoload (put 'spell-fu-buffer-session-localwords 'safe-local-variable #'spell-fu-list-of-strings-p) -(defvar-local global-spell-fu-ignore-buffer nil +(define-obsolete-variable-alias + 'global-spell-fu-ignore-buffer + 'spell-fu-global-ignore-buffer + "0.4") + +(defvar-local spell-fu-global-ignore-buffer nil "When non-nil, the global mode will not be enabled for this buffer. This variable can also be a predicate function, in which case it'll be called with one parameter (the buffer in question), and @@ -157,7 +161,6 @@ Notes: - You may explicitly mark a range as incorrect using `spell-fu-mark-incorrect' which takes the range to mark as arguments.") - ;; --------------------------------------------------------------------------- ;; Internal Variables @@ -1716,18 +1719,20 @@ Argument DICT-FILE is the absolute path to the dictionary." ;; Not explicitly ignored. (not (memq major-mode spell-fu-ignore-modes)) ;; Optionally check if a function is used. - (or (null global-spell-fu-ignore-buffer) + (or (null spell-fu-global-ignore-buffer) (cond - ((functionp global-spell-fu-ignore-buffer) - (not (funcall global-spell-fu-ignore-buffer (current-buffer)))) + ((functionp spell-fu-global-ignore-buffer) + (not (funcall spell-fu-global-ignore-buffer (current-buffer)))) (t nil)))) (spell-fu-mode 1))) ;;;###autoload -(define-globalized-minor-mode global-spell-fu-mode +(define-globalized-minor-mode spell-fu-global-mode spell-fu-mode spell-fu--mode-turn-on) +(define-obsolete-function-alias 'global-spell-fu-mode #'spell-fu-global-mode "0.4") + (provide 'spell-fu) ;;; spell-fu.el ends here