aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sainty2019-10-22 01:01:28 +1300
committerPhil Sainty2019-11-15 00:39:12 +1300
commit90290745d74b18f8a824ea90fe6c6bf5110d716d (patch)
tree53054ada2e17f434c75411c2d6fc3e0ff7e2d8be
parent75875cac2100544f7c1192fc37ea23fbe9db12d7 (diff)
downloademacs-90290745d74b18f8a824ea90fe6c6bf5110d716d.tar.gz
emacs-90290745d74b18f8a824ea90fe6c6bf5110d716d.zip
; Documentation and spelling
* lisp/so-long.el: Documentation fixes. For the purposes of consistency, this reverts some of the changes made in commit 41ba8231ef072571e1a6feabc15d113e5cf57556, including one which had introduced inconsistent spelling. ispell configuration and LocalWords have been added such that `ispell-buffer' should find no misspellings for this library. * test/lisp/so-long-tests/spelling-tests.el (so-long-spelling): New test to check the spelling using `ispell-buffer'.
-rw-r--r--lisp/so-long.el54
-rw-r--r--test/lisp/so-long-tests/spelling-tests.el69
2 files changed, 106 insertions, 17 deletions
diff --git a/lisp/so-long.el b/lisp/so-long.el
index b5eb1242156..8d9b0dc0627 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -325,7 +325,7 @@
325 325
326;; * Caveats 326;; * Caveats
327;; --------- 327;; ---------
328;; The variables affecting the automated behavior of this library (such as 328;; The variables affecting the automated behaviour of this library (such as
329;; `so-long-action') can be used as file- or dir-local values in Emacs 26+, but 329;; `so-long-action') can be used as file- or dir-local values in Emacs 26+, but
330;; not in previous versions of Emacs. This is on account of improvements made 330;; not in previous versions of Emacs. This is on account of improvements made
331;; to `normal-mode' in 26.1, which altered the execution order with respect to 331;; to `normal-mode' in 26.1, which altered the execution order with respect to
@@ -413,7 +413,7 @@ Has no effect if `global-so-long-mode' is not enabled.")
413 "Non-nil while `set-auto-mode' is executing.") 413 "Non-nil while `set-auto-mode' is executing.")
414 414
415(defvar so-long--hack-local-variables-no-mode nil ; internal use 415(defvar so-long--hack-local-variables-no-mode nil ; internal use
416 "Non-nil to prevent `hack-local-variables' applying a 'mode' variable.") 416 "Non-nil to prevent `hack-local-variables' applying a `mode' variable.")
417 417
418(defvar-local so-long--inhibited nil ; internal use 418(defvar-local so-long--inhibited nil ; internal use
419 "When non-nil, prevents the `set-auto-mode' advice from calling `so-long'.") 419 "When non-nil, prevents the `set-auto-mode' advice from calling `so-long'.")
@@ -654,7 +654,7 @@ an example."
654;; `provided-mode-derived-p' was added in 26.1 654;; `provided-mode-derived-p' was added in 26.1
655(unless (fboundp 'provided-mode-derived-p) 655(unless (fboundp 'provided-mode-derived-p)
656 (defun provided-mode-derived-p (mode &rest modes) 656 (defun provided-mode-derived-p (mode &rest modes)
657 "Return non-nil if MODE is derived from one of MODES. 657 "Non-nil if MODE is derived from one of MODES.
658Uses the `derived-mode-parent' property of the symbol to trace backwards. 658Uses the `derived-mode-parent' property of the symbol to trace backwards.
659If you just want to check `major-mode', use `derived-mode-p'." 659If you just want to check `major-mode', use `derived-mode-p'."
660 (while (and (not (memq mode modes)) 660 (while (and (not (memq mode modes))
@@ -707,7 +707,7 @@ was established."
707 "List of buffer-local minor modes to explicitly disable. 707 "List of buffer-local minor modes to explicitly disable.
708 708
709The ones which were originally enabled in the buffer are disabled by calling 709The ones which were originally enabled in the buffer are disabled by calling
710them with the numeric argument 0. Unknown modes, and modes which were were not 710them with the numeric argument 0. Unknown modes, and modes which were not
711enabled, are ignored. 711enabled, are ignored.
712 712
713This happens after any globalized minor modes have acted, so that buffer-local 713This happens after any globalized minor modes have acted, so that buffer-local
@@ -742,8 +742,8 @@ If `so-long-revert' is subsequently invoked, then the variables are restored
742to their original states. 742to their original states.
743 743
744The combination of `line-move-visual' (enabled) and `truncate-lines' (disabled) 744The combination of `line-move-visual' (enabled) and `truncate-lines' (disabled)
745is important for avoiding performance hits when moving vertically between 745is important for maximising responsiveness when moving vertically within an
746excessively long lines, as otherwise the full length of the line may need to be 746extremely long line, as otherwise the full length of the line may need to be
747scanned to find the next position." 747scanned to find the next position."
748 :type '(alist :key-type (variable :tag "Variable") 748 :type '(alist :key-type (variable :tag "Variable")
749 :value-type (sexp :tag "Value")) 749 :value-type (sexp :tag "Value"))
@@ -1174,11 +1174,11 @@ enabled, and `so-long-predicate' has detected that the file contains long lines.
1174Many Emacs modes struggle with buffers which contain excessively long lines, 1174Many Emacs modes struggle with buffers which contain excessively long lines,
1175and may consequently cause unacceptable performance issues. 1175and may consequently cause unacceptable performance issues.
1176 1176
1177This is commonly on account of \"minified\" code (i.e., code compacted 1177This is commonly on account of \"minified\" code (i.e. code that has been
1178into the smallest file size possible, which often entails removing newlines 1178compacted into the smallest file size possible, which often entails removing
1179should they not be strictly necessary). These kinds of files are typically 1179newlines should they not be strictly necessary). These kinds of files are
1180not intended to be edited, so not providing the usual editing mode in these 1180typically not intended to be edited, so not providing the usual editing mode
1181cases will rarely be an issue. 1181in these cases will rarely be an issue.
1182 1182
1183This major mode disables any active minor modes listed in `so-long-minor-modes' 1183This major mode disables any active minor modes listed in `so-long-minor-modes'
1184for the current buffer, and buffer-local values are assigned to variables in 1184for the current buffer, and buffer-local values are assigned to variables in
@@ -1189,7 +1189,7 @@ values), despite potential performance issues, type \\[so-long-revert].
1189 1189
1190Use \\[so-long-commentary] for more information. 1190Use \\[so-long-commentary] for more information.
1191 1191
1192Use \\[so-long-customize] to configure the behavior." 1192Use \\[so-long-customize] to configure the behaviour."
1193 ;; Housekeeping. `so-long-mode' might be invoked directly rather than via 1193 ;; Housekeeping. `so-long-mode' might be invoked directly rather than via
1194 ;; `so-long', so replicate the necessary behaviours. We could use this same 1194 ;; `so-long', so replicate the necessary behaviours. We could use this same
1195 ;; test in `so-long-after-change-major-mode' to run `so-long-hook', but that's 1195 ;; test in `so-long-after-change-major-mode' to run `so-long-hook', but that's
@@ -1344,7 +1344,7 @@ This is the `so-long-revert-function' for `so-long-mode'."
1344 1344
1345A buffer-local \"downgrade\" from `so-long-mode' to `so-long-minor-mode'. 1345A buffer-local \"downgrade\" from `so-long-mode' to `so-long-minor-mode'.
1346 1346
1347When `so-long-function' is set to `so-long-mode', then we change it to to 1347When `so-long-function' is set to `so-long-mode', then we change it to
1348`turn-on-so-long-minor-mode' instead -- retaining the file-local major 1348`turn-on-so-long-minor-mode' instead -- retaining the file-local major
1349mode, but still doing everything else that `so-long-mode' would have done. 1349mode, but still doing everything else that `so-long-mode' would have done.
1350`so-long-revert-function' is likewise updated. 1350`so-long-revert-function' is likewise updated.
@@ -1379,7 +1379,7 @@ and cannot be conveniently intercepted, so we are forced to replicate it here.
1379 1379
1380This special-case code will ultimately be removed from Emacs, as it exists to 1380This special-case code will ultimately be removed from Emacs, as it exists to
1381deal with a deprecated feature; but until then we need to replicate it in order 1381deal with a deprecated feature; but until then we need to replicate it in order
1382to inhibit our own behavior in the presence of a header comment `mode' 1382to inhibit our own behaviour in the presence of a header comment `mode'
1383declaration. 1383declaration.
1384 1384
1385If a file-local mode is detected in the header comment, then we call the 1385If a file-local mode is detected in the header comment, then we call the
@@ -1626,9 +1626,9 @@ Equivalent to calling (global-so-long-mode 0)"
1626Many Emacs modes struggle with buffers which contain excessively long lines, 1626Many Emacs modes struggle with buffers which contain excessively long lines,
1627and may consequently cause unacceptable performance issues. 1627and may consequently cause unacceptable performance issues.
1628 1628
1629This is commonly on account of \"minified\" code (i.e., code compacted into the 1629This is commonly on account of \"minified\" code (i.e. code that has been
1630smallest file size possible, which often entails removing newlines should they 1630compacted into the smallest file size possible, which often entails removing
1631not be strictly necessary). 1631newlines should they not be strictly necessary).
1632 1632
1633When such files are detected by `so-long-predicate', we invoke the selected 1633When such files are detected by `so-long-predicate', we invoke the selected
1634`so-long-action' to mitigate potential performance problems in the buffer. 1634`so-long-action' to mitigate potential performance problems in the buffer.
@@ -1695,14 +1695,34 @@ or call the function `global-so-long-mode'.")
1695 (global-so-long-mode 0) 1695 (global-so-long-mode 0)
1696 nil) 1696 nil)
1697 1697
1698
1698(provide 'so-long) 1699(provide 'so-long)
1699 1700
1700;; Local Variables: 1701;; Local Variables:
1701;; emacs-lisp-docstring-fill-column: 80 1702;; emacs-lisp-docstring-fill-column: 80
1702;; fill-column: 80 1703;; fill-column: 80
1703;; indent-tabs-mode: nil 1704;; indent-tabs-mode: nil
1705;; ispell-check-comments: exclusive
1706;; ispell-local-dictionary: "british"
1704;; End: 1707;; End:
1705 1708
1709;; This library is extensively documented in British English, contrary to the
1710;; preference for American English in Emacs. I hope the benefits of the library
1711;; will outweigh any discontent you may experience regarding the spelling (or
1712;; that you find the spelling to be an agreeable bonus). Certain standard Emacs
1713;; terminology, and text quoted from elsewhere in Emacs, retains its original
1714;; spelling. The following LocalWords should result in no misspellings from
1715;; M-x ispell-buffer (using aspell).
1716
1717; LocalWords: LocalWords british ispell aspell hunspell emacs elisp el init dir
1718; LocalWords: customize customized customizing Customization globalized amongst
1719; LocalWords: initialized profiler boolean minified pre redisplay config keymap
1720; LocalWords: noerror selectable mapc sgml nxml hl flydiff defs arg Phil Sainty
1721; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un cXXXr
1722; LocalWords: docstring auf wiedersehen longlines alist autoload Refactored Inc
1723; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS mitigations EmacsWiki eval
1724; LocalWords: setq rx filename filenames
1725
1706;; So long, farewell, auf wiedersehen, goodbye 1726;; So long, farewell, auf wiedersehen, goodbye
1707;; You have to go, this code is minified 1727;; You have to go, this code is minified
1708;; Goodbye! 1728;; Goodbye!
diff --git a/test/lisp/so-long-tests/spelling-tests.el b/test/lisp/so-long-tests/spelling-tests.el
new file mode 100644
index 00000000000..d5bae1ef0ce
--- /dev/null
+++ b/test/lisp/so-long-tests/spelling-tests.el
@@ -0,0 +1,69 @@
1;;; spelling-tests.el --- Test suite for so-long.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; Author: Phil Sainty <psainty@orcon.net.nz>
6;; Keywords: convenience
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Code:
24
25(require 'ert)
26(require 'ispell)
27(require 'cl-lib)
28
29;; This test is tagged as :unstable on the basis that there may be
30;; inconsistencies between spell-checking facilities on different
31;; systems, which may cause the test to be unreliable in practice.
32;; As such the Emacs test Makefile will skip it by default, but you
33;; can run it manually with:
34;;
35;; make lisp/so-long-tests/spelling-tests SELECTOR=t
36
37;; Only define the test if spell-checking is possible.
38(when (and ispell-program-name
39 (executable-find ispell-program-name)
40 (condition-case ()
41 (progn (ispell-check-version) t)
42 (error nil))
43 (member "british" (ispell-valid-dictionary-list)))
44 (ert-deftest so-long-spelling ()
45 "Check the spelling in the source code."
46 :tags '(:unstable) ;; It works for me, but I'm not sure about others.
47 ;; There could be different "british" dictionaries yielding different
48 ;; results, for instance.
49 ;;
50 ;; The Emacs test Makefile's use of HOME=/nonexistent triggers an error
51 ;; when starting the inferior ispell process, so we set HOME to a valid
52 ;; (but empty) temporary directory for this test.
53 (let* ((tmpdir (make-temp-file "so-long." :dir ".ispell"))
54 (process-environment (cons (format "HOME=%s" tmpdir)
55 process-environment))
56 (find-spelling-mistake
57 (unwind-protect
58 (cl-letf (((symbol-function 'ispell-command-loop)
59 (lambda (_miss _guess word _start _end)
60 (message "Unrecognised word: %s." word)
61 (throw 'mistake t))))
62 (catch 'mistake
63 (find-library "so-long")
64 (ispell-buffer)
65 nil))
66 (delete-directory tmpdir))))
67 (should (not find-spelling-mistake)))))
68
69;;; spelling-tests.el ends here