emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/assess c6e666413a 21/95: Merge branch 'master' of githu


From: ELPA Syncer
Subject: [elpa] externals/assess c6e666413a 21/95: Merge branch 'master' of github.com:phillord/sisyphus
Date: Tue, 19 Jul 2022 15:57:30 -0400 (EDT)

branch: externals/assess
commit c6e666413aa6ed3c597c16348d4d396e4e4df48d
Merge: 1b01542ccd 238d9028e2
Author: Phillip Lord <phillip.lord@russet.org.uk>
Commit: Phillip Lord <phillip.lord@russet.org.uk>

    Merge branch 'master' of github.com:phillord/sisyphus
    
    Conflicts:
            sisyphus.el
            test/sisyphus-test.el
    
    Merge resulting from Christmas unison disaster.
---
 dev-resources/elisp-indented.el   |  5 +++++
 dev-resources/elisp-unindented.el |  5 +++++
 sisyphus.el                       | 36 +++++++++++++++++++++++++++---------
 test/sisyphus-test.el             |  4 ----
 4 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/dev-resources/elisp-indented.el b/dev-resources/elisp-indented.el
new file mode 100644
index 0000000000..faf0165354
--- /dev/null
+++ b/dev-resources/elisp-indented.el
@@ -0,0 +1,5 @@
+(
+ (
+  (
+   (
+    ))))
diff --git a/dev-resources/elisp-unindented.el 
b/dev-resources/elisp-unindented.el
new file mode 100644
index 0000000000..cb5bab9dc9
--- /dev/null
+++ b/dev-resources/elisp-unindented.el
@@ -0,0 +1,5 @@
+(
+(
+(
+(
+))))
\ No newline at end of file
diff --git a/sisyphus.el b/sisyphus.el
index 3c290dbf53..f110aabfce 100644
--- a/sisyphus.el
+++ b/sisyphus.el
@@ -426,7 +426,6 @@ See also `sisyphus-make-related-file'."
            (kill-buffer ,temp-buffer))))))
 ;; #+end_src
 
-
 ;; ** Indentation functions
 
 ;; There are two main ways to test indentation -- we can either take unindented
@@ -442,8 +441,10 @@ See also `sisyphus-make-related-file'."
 ;; We start with some functionality for making Emacs quiet while indenting.
 
 ;; #+begin_src emacs-lisp
-(defun sisyphus--indent-buffer ()
+(defun sisyphus--indent-buffer (&optional column)
   (cond
+   (column
+    (indent-region (point-min) (point-max) column))
    ;; if indent-region-function is set, use it, and hope that it is not
    ;; noisy.
    (indent-region-function
@@ -467,7 +468,10 @@ See also `sisyphus-make-related-file'."
   "Return non-nil if UNINDENTED indents in MODE to INDENTED.
 Both UNINDENTED and INDENTED can be any value usable by
 `sisyphus-to-string'. Indentation is performed using
-`indent-region'."
+`indent-region', which MODE should set up appropriately.
+
+See also `sisyphus-file-roundtrip-indentation=' for an
+alternative mechanism."
   (sisyphus=
    (sisyphus--indent-in-mode
     mode
@@ -475,6 +479,7 @@ Both UNINDENTED and INDENTED can be any value usable by
    indented))
 
 (defun sisyphus-explain-indentation= (mode unindented indented)
+  "Explanation function for `sisyphus-indentation='."
   (sisyphus-explain=
    (sisyphus--indent-in-mode
     mode
@@ -483,11 +488,10 @@ Both UNINDENTED and INDENTED can be any value usable by
 
 (put 'sisyphus-indentation= 'ert-explainer 'sisyphus-explain-indentation=)
 
-;; TODO -- this bit is noisy and we need to stop it being so
 (defun sisyphus--buffer-unindent (buffer)
   (with-current-buffer
       buffer
-    (indent-region (point-min) (point-max) nil)))
+    (sisyphus--indent-buffer 0)))
 
 (defun sisyphus--roundtrip-1 (comp mode indented)
   (with-temp-buffer
@@ -501,11 +505,20 @@ Both UNINDENTED and INDENTED can be any value usable by
              indented)))
 
 (defun sisyphus-roundtrip-indentation= (mode indented)
+  "Return t if in MODE, text in INDENTED is corrected indented.
+
+This is checked by unindenting the text, then reindenting it according
+to MODE.
+
+See also `sisyphus-indentation=' and
+`sisyphus-file-roundtrip-indentation=' for alternative
+mechanisms of checking indentation."
   (sisyphus--roundtrip-1
    #'sisyphus-indentation=
    mode indented))
 
 (defun sisyphus-explain-roundtrip-indentation= (mode indented)
+  "Explanation function for `sisyphus-roundtrip-indentation='."
   (sisyphus--roundtrip-1
    #'sisyphus-explain-indentation=
    mode indented))
@@ -525,20 +538,25 @@ Both UNINDENTED and INDENTED can be any value usable by
    file))
 
 (defun sisyphus-file-roundtrip-indentation= (file)
+  "Return t if text in FILE is indented correctly.
+
+FILE is copied with `sisyphus-make-related-file', so this
+function should be side-effect free whether or not FILE is
+already open. The file is opened with `find-file-noselect', so
+hooks associated with interactive visiting of a file should all
+be called, with the exception of directory local variables, as
+the copy of FILE will be in a different directory."
   (sisyphus--file-roundtrip-1
    #'sisyphus= file))
 
 (defun sisyphus-explain-file-roundtrip-indentation= (file)
+  "Explanation function for `sisyphus-file-roundtrip-indentation=."
   (sisyphus--file-roundtrip-1
    #'sisyphus-explain= file))
-;; #+end_src
 
-;; #+begin_src emacs-lisp
 (put 'sisyphus-file-roundtrip-indentation=
      'ert-explainer
      'sisyphus-explain-file-roundtrip-indentation=)
-;; #+end_src
-
 
 
 ;; ** Font-lock support functions
diff --git a/test/sisyphus-test.el b/test/sisyphus-test.el
index ce1de3cc7b..012ffcd3e9 100644
--- a/test/sisyphus-test.el
+++ b/test/sisyphus-test.el
@@ -85,7 +85,6 @@ This also tests the advice on string=."
        (sisyphus= "1" "2"))))))
 ;; #+end_src
 
-
 ;; ** To-String testing
 
 ;; #+begin_src emacs-lisp
@@ -328,7 +327,6 @@ This also tests the advice on string=."
         "hello"
         "goodbye"))))))
 
-
 (defvar sisyphus-dev-resources
   (relative-expand-file-name "../dev-resources/"))
 
@@ -369,7 +367,6 @@ This also tests the advice on string=."
    (sisyphus-file-roundtrip-indentation=
     sisyphus-dev-elisp-unindented)))
 
-
 (ert-deftest sisyphus-test-file-roundtrip-indentation-explain= ()
   (should
    (sisyphus-test--explanation
@@ -448,5 +445,4 @@ This also tests the advice on string=."
       (m-buffer-match buffer "defun"))
     'font-lock-keyword-face)))
 
-
 ;; #+end_src



reply via email to

[Prev in Thread] Current Thread [Next in Thread]