~swflint/public-inbox

time-block-command: Fix spelling in macro name: advise->advice & add alias for old name v1 PROPOSED

~meliache: 2
 Fix spelling in macro name: advise->advice & add alias for old name
 Improve indentation in readme

 3 files changed, 9 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~swflint/public-inbox/patches/34566/mbox | git am -3
Learn more about email & git

[PATCH time-block-command 1/2] Fix spelling in macro name: advise->advice & add alias for old name Export this patch

From: Michael Eliachevitch <m.eliachevitch@posteo.de>

---
 README.md     | 2 +-
 time-block.el | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 50b16c4..141a15c 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ commands when blocked.  Overall, the arguments for `group`,
following example.

```elisp
(time-block-advise my/elfeed-block-advice 'elfeed workday "You have decided not to check news currently."
(time-block-advice my/elfeed-block-advice 'elfeed workday "You have decided not to check news currently."
                                                          "You have decided not to check news currently.\nStill start elfeed?")
```

diff --git a/time-block.el b/time-block.el
index fd52345..70ce1c8 100644
--- a/time-block.el
+++ b/time-block.el
@@ -180,7 +180,7 @@ BODY is the body of the code.  This should include an
             (message ,block-message)
           ,@body)))))

(defmacro time-block-advise (advice-name command group block-message &optional override-prompt)
(defmacro time-block-advice (advice-name command group block-message &optional override-prompt)
  "Define `:around' advice for COMMAND called ADVICE-NAME.

Use BLOCK-MESSAGE to notify user if run is currently blocked by
@@ -200,6 +200,10 @@ if blocking should be overridden."
             (apply orig args))))
       (advice-add ,command :around #',advice-name))))

;; alias for backwards compatibility
(defalias 'time-block-advise #'time-block-advice)

(provide 'time-block)


;;; time-block.el ends here
-- 
2.34.2
~> From: Michael Eliachevitch <m.eliachevitch@posteo.de> ---
    ~> README.md | 2 +- time-block.el | 6 +++++- 2 files changed, 6
    ~> insertions(+), 2 deletions(-)

    ~> diff --git a/README.md b/README.md index 50b16c4..141a15c 100644
    ~> --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ commands when
    ~> blocked.  Overall, the arguments for `group`, following example.
 
    ~>  ```elisp -(time-block-advise my/elfeed-block-advice 'elfeed
    ~> workday "You have decided not to check news currently."
    ~> +(time-block-advice my/elfeed-block-advice 'elfeed workday "You
    ~> have decided not to check news currently."  "You have decided not
    ~> to check news currently.\nStill start elfeed?")  ```
 
    ~> diff --git a/time-block.el b/time-block.el index fd52345..70ce1c8
    ~> 100644 --- a/time-block.el +++ b/time-block.el @@ -180,7 +180,7
    ~> @@ BODY is the body of the code.  This should include an (message
    ~> ,block-message) ,@body)))))
 
    ~> -(defmacro time-block-advise (advice-name command group
    ~> block-message &optional override-prompt) +(defmacro
    ~> time-block-advice (advice-name command group block-message
    ~> &optional override-prompt) "Define `:around' advice for COMMAND
    ~> called ADVICE-NAME.
 
    ~>  Use BLOCK-MESSAGE to notify user if run is currently blocked by
    ~> @@ -200,6 +200,10 @@ if blocking should be overridden."  (apply
    ~> orig args)))) (advice-add ,command :around #',advice-name))))
 
    ~> +;; alias for backwards compatibility +(defalias
    ~> 'time-block-advise #'time-block-advice) + (provide 'time-block)

Instead of using `defalias`, because it's a something done for
compatibility, use `make-obsolete` so a warning is issued when the old
version is used.
 
    ~> + ;;; time-block.el ends here --

    ~> 2.34.2

Sam
I'm a little confused as to the reason for this.  I used
`time-block-advise` because that's what the macro does, it advises the
function, though it does also define advice.

Sam

[PATCH time-block-command 2/2] Improve indentation in readme Export this patch

From: Michael Eliachevitch <m.eliachevitch@posteo.de>

The original code snippet was not indentet how emacs indents the code for me.
Plus, it was just very wide, requiring horizontal scrolling on a narrow monitor.
---
 README.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 141a15c..0b502a4 100644
--- a/README.md
+++ b/README.md
@@ -57,8 +57,9 @@ commands when blocked.  Overall, the arguments for `group`,
following example.

```elisp
(time-block-advice my/elfeed-block-advice 'elfeed workday "You have decided not to check news currently."
                                                          "You have decided not to check news currently.\nStill start elfeed?")
(time-block-advice my/elfeed-block-advice 'elfeed workday
                   "You have decided not to check news currently."
                   "You have decided not to check news currently.\nStill start elfeed?")
```

## Errors and Bugs
-- 
2.34.2