[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/hook-helpers f1409ec 05/19: Updated README to include new
From: |
Ian Dunn |
Subject: |
[elpa] scratch/hook-helpers f1409ec 05/19: Updated README to include new usage. |
Date: |
Sun, 23 Apr 2017 12:50:39 -0400 (EDT) |
branch: scratch/hook-helpers
commit f1409ec376bc26d10cb0929dbd9a4d16615f2d79
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Updated README to include new usage.
---
README.org | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/README.org b/README.org
index 935fc25..e5c2216 100644
--- a/README.org
+++ b/README.org
@@ -51,7 +51,7 @@ But then if you want to modify the function, it's permanently
stuck on the after
Instead, hook-helpers can do the following:
#+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init
+(define-hook-helper after-init ()
(set-scroll-bar-mode nil))
#+END_SRC
@@ -63,7 +63,7 @@ Under the hood, ~define-hook-helper~ creates a new function,
called
~hook-helper--HOOK~.
#+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init
+(define-hook-helper after-init ()
(set-scroll-bar-mode nil))
#+END_SRC
@@ -71,14 +71,15 @@ The above creates the function ‘hook-helper--after-init’.
** "But doesn't that mean I can only use this once per hook?"
-I thought about that too, and devised a solution. ~define-hook-helper~
-accepts several keywords: name, append, and args. Append does exactly what it
-says on the tin: It appends the hook, passing the argument straight to
-~add-hook~. Name tacks a name onto the defined hook function. For instance,
-take the previous example:
+I thought about that too, and devised a solution. ~define-hook-helper~ accepts
+several keywords: name, suffix, and append. Append does exactly what it says
on
+the tin: It appends the hook, passing the argument straight to ~add-hook~.
+
+Name tacks a name onto the defined hook function. For instance, take the
+previous example:
#+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init
+(define-hook-helper after-init ()
:name env
(set-scroll-bar-mode nil))
#+END_SRC
@@ -87,19 +88,18 @@ This creates the function =hook-helper--after-init/env=,
thus allowing
anyone to use ~define-hook-helper~ as many times as they like, without fear
of name clobbering.
-The =args= keyword allows for hook functions that require arguments. Let's say
-you've got a hook like so:
+Arguments to the new function may also be specified. Let's say you've got a
+hook like so:
#+BEGIN_SRC emacs-lisp
-(define-hook-helper after-make-frame
- :args (frame)
+(define-hook-helper after-make-frame (frame)
:suffix "functions"
(set-frame-parameter frame 'alpha '(90 50)))
#+END_SRC
Also note the ~suffix~ keyword. This tells ~define-hook-helper~ to add the
helper to the variable ~after-make-frame-functions~ instead of
-~after-make-frame-hook~. The args keyword tells it to create a function with
+~after-make-frame-hook~. The arguments tells it to create a function with
one argument, ~frame~.
** Mode hooks
@@ -110,7 +110,7 @@ This macro will take the name of a mode (sans the word
'mode'), and runs
~define-hook-helper~.
#+BEGIN_SRC emacs-lisp
-(define-mode-hook-helper text
+(define-mode-hook-helper text ()
(visual-line-mode 1))
#+END_SRC
- [elpa] branch scratch/hook-helpers created (now 365d8de), Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 597fce1 03/19: Updated README to include savannah project link., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 7981caf 06/19: Removed docstring argument from `hook-helpers'., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 17f7d5d 07/19: Restored docstring argument in `define-hook-helper'., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers b373c79 08/19: Removed define-mode-hook-helpers, since it only moves the word "mode" around., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers f1409ec 05/19: Updated README to include new usage.,
Ian Dunn <=
- [elpa] scratch/hook-helpers 73d0cb5 13/19: Added gitignore file, Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers e253e03 11/19: Implemented new design for anonymous helpers, Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 5e4a3a8 02/19: Added remove-hook-helper to README., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 706af98 15/19: Clean up describe-hook-helpers, Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 3bb2282 09/19: Updated README, removing define-mode-hook-helper., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 7f1eccf 16/19: Fixed bug in hkhlp-normalize-hook-spec, Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 0386e23 04/19: Modified define-hook-helper to more closely match defun., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 0fc0b3d 14/19: Fixed bug in define-hook-helper, Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers dff9910 10/19: Added `define-hook-function' to allow defining a function to be added to multiple hooks., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers a46803b 17/19: Fixed failing tests, Ian Dunn, 2017/04/23