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

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

[nongnu] elpa/reformatter 48bcae5856 06/81: Doc fixes


From: ELPA Syncer
Subject: [nongnu] elpa/reformatter 48bcae5856 06/81: Doc fixes
Date: Tue, 5 Sep 2023 04:03:32 -0400 (EDT)

branch: elpa/reformatter
commit 48bcae58567cac257df92f44e9e1e5975a3eff5a
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>

    Doc fixes
    
    See #1
---
 README.md      | 20 +++++++++++++-------
 reformatter.el | 17 +++++++++++------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index ac5782a282..5bc7817490 100644
--- a/README.md
+++ b/README.md
@@ -13,14 +13,12 @@ In its initial release it supports only reformatters which 
can read
 from stdin and write to stdout, but a more versatile interface will
 be provided as development continues.
 
-As an example, let's define a reformat command that applies the
-"dhall format" command.  We'll assume that we've already defined a
+As an example, let's define a reformat command that applies the "dhall
+format" command.  We'll assume here that we've already defined a
 variable `dhall-command` which holds the string name or path of the
 dhall executable:
 
 ```el
-;;;###autoload (autoload 'dhall-format "current-file" nil t)
-;;;###autoload (autoload 'dhall-format-on-save-mode "current-file" nil t)
 (reformatter-define dhall-format
   :program dhall-command
   :args '("format")
@@ -29,8 +27,7 @@ dhall executable:
 
 The `reformatter-define` macro expands to code which generates both
 the `dhall-format` interactive command and a local minor mode called
-`dhall-format-on-save-mode`.  The example above includes autoloads
-which will be useful to library authors.
+`dhall-format-on-save-mode`.
 
 The generated minor mode allows idiomatic per-directory or per-file
 customisation, via the "modes" support baked into Emacs' file-local
@@ -40,12 +37,21 @@ above example might add the following to a project-specific
 
 ```el
 ((dhall-mode
-   (mode . dhall-format-on-save-mode)))
+   (mode . dhall-format-on-save)))
 ```
 
 See the documentation for `reformatter-define`, which provides a
 number of options for customising the generated code.
 
+Library authors might like to provide autoloads for the generated
+code, e.g.:
+
+```el
+;;;###autoload (autoload 'dhall-format "current-file" nil t)
+;;;###autoload (autoload 'dhall-format-on-save-mode "current-file" nil t)
+```
+
+
 ## Rationale
 
 I contribute to a number of Emacs programming language modes and
diff --git a/reformatter.el b/reformatter.el
index 61aa974285..d0fe2df679 100644
--- a/reformatter.el
+++ b/reformatter.el
@@ -33,20 +33,17 @@
 ;; be provided as development continues.
 
 ;; As an example, let's define a reformat command that applies the
-;; "dhall format" command.  We'll assume that we've already defined a
+;; "dhall format" command.  We'll assume here that we've already defined a
 ;; variable `dhall-command' which holds the string name or path of the
 ;; dhall executable:
 
-;;     ;;;###autoload (autoload 'dhall-format "current-file" nil t)
-;;     ;;;###autoload (autoload 'dhall-format-on-save-mode "current-file" nil 
t)
 ;;     (reformatter-define dhall-format
 ;;       :program dhall-command
 ;;       :args '("format"))
 
 ;; The `reformatter-define' macro expands to code which generates both
 ;; the `dhall-format' interactive command and a local minor mode
-;; called `dhall-format-on-save-mode'.  The example above includes
-;; autoloads which will be useful to library authors.
+;; called `dhall-format-on-save-mode'
 
 ;; The generated minor mode allows idiomatic per-directory or per-file
 ;; customisation, via the "modes" support baked into Emacs' file-local
@@ -55,11 +52,17 @@
 ;; .dir-locals.el file:
 
 ;;     ((dhall-mode
-;;       (mode . dhall-format-on-save-mode)))
+;;       (mode . dhall-format-on-save)))
 
 ;; See the documentation for `reformatter-define', which provides a
 ;; number of options for customising the generated code.
 
+;; Library authors might like to provide autoloads for the generated
+;; code, e.g.:
+
+;;     ;;;###autoload (autoload 'dhall-format "current-file" nil t)
+;;     ;;;###autoload (autoload 'dhall-format-on-save-mode "current-file" nil 
t)
+
 ;;; Code:
 (eval-when-compile
   (require 'cl-lib))
@@ -151,6 +154,8 @@ DISPLAY-ERRORS, shows a buffer if the formatting fails."
                  (if (eq retcode 0)
                      (progn
                        (insert-file-contents out-file nil nil nil t)
+                       ;; In future this might be made optional, or a 
user-provided
+                       ;; ":after" form could be inserted for execution
                        (whitespace-cleanup))
                    (if display-errors
                        (display-buffer error-buffer)



reply via email to

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