[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/hook-helpers 597fce1 03/19: Updated README to include sav
From: |
Ian Dunn |
Subject: |
[elpa] scratch/hook-helpers 597fce1 03/19: Updated README to include savannah project link. |
Date: |
Sun, 23 Apr 2017 12:50:38 -0400 (EDT) |
branch: scratch/hook-helpers
commit 597fce173aa51947fc56831f1c6f690e29e99365
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Updated README to include savannah project link.
---
README.org | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/README.org b/README.org
index 0e7d7be..935fc25 100644
--- a/README.org
+++ b/README.org
@@ -21,6 +21,8 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>.
#+END_QUOTE
* Introduction
+[[https://savannah.nongnu.org/projects/hook-helpers-el/][Savannah Project]]
+
Often times, I see people define a function to be used once in a hook. If
they don’t do this, then it will be an anonymous function. If the anonymous
function is modified, then the function can’t be removed. With a function
@@ -31,6 +33,30 @@ anaphoric ~add-hook~, but one that can be called many times
without risking
redundant hook functions. It gives a cleaner look and feel to Emacs
configuration files, and could even be used in actual libraries.
+The purpose of this package is to build upon add-hook and remove-hook. When
you have something like the following:
+
+#+BEGIN_SRC emacs-lisp
+(defun my/after-init-hook ()
+ (set-scroll-bar-mode nil))
+#+END_SRC
+
+You've got to remember to actually add this to the after-init-hook variable.
Alternatively, you can use a lambda function:
+
+#+BEGIN_SRC emacs-lisp
+(add-hook 'after-init-hook (lambda () (set-scroll-bar-mode nil)))
+#+END_SRC
+
+But then if you want to modify the function, it's permanently stuck on the
after-init-hook variable, and you have to deal with it. It's not a problem for
after-init-hook, which is used once, but would be a problem for a mode hook,
like text-mode-hook.
+
+Instead, hook-helpers can do the following:
+
+#+BEGIN_SRC emacs-lisp
+(define-hook-helper after-init
+ (set-scroll-bar-mode nil))
+#+END_SRC
+
+Which handles everything for you.
+
* Usage
Under the hood, ~define-hook-helper~ creates a new function, called
- [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 <=
- [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, 2017/04/23
- [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