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

[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
 



reply via email to

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