[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/hook-helpers 7f1eccf 16/19: Fixed bug in hkhlp-normalize-
From: |
Ian Dunn |
Subject: |
[elpa] scratch/hook-helpers 7f1eccf 16/19: Fixed bug in hkhlp-normalize-hook-spec |
Date: |
Sun, 23 Apr 2017 12:50:41 -0400 (EDT) |
branch: scratch/hook-helpers
commit 7f1eccfe4ed4d9e350b272f95b37a2f9da3751e4
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Fixed bug in hkhlp-normalize-hook-spec
* hook-helpers.el (hkhlp-normalize-hook-spec): Correctly handle list
structure
* hook-helpers-tests.el (hkhlp-normalize-hook-spec-test): Test for single
list
form
* Makefile: Add check target
---
Makefile | 16 ++++++++++++++++
hook-helpers-tests.el | 4 +++-
hook-helpers.el | 7 ++++---
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 3ef4668..68d4062 100644
--- a/Makefile
+++ b/Makefile
@@ -39,3 +39,19 @@ hook-helpers-autoloads.el:
clean:
-rm -f *.elc
+
+check:
+ @$(EMACS) \
+ -L "." \
+ --load "ert" \
+ --load "hook-helpers-tests.el" \
+ -f ert-run-tests-batch-and-exit
+
+help:
+ $(info )
+ $(info make all - Default)
+ $(info make compile - Compile Emacs Lisp Files)
+ $(info make autoloads - Generate Autoloads)
+ $(info make clean - Remove generated .elc files)
+ $(info make check - Run Tests)
+ @echo ""
diff --git a/hook-helpers-tests.el b/hook-helpers-tests.el
index 9d732fc..c5758e6 100644
--- a/hook-helpers-tests.el
+++ b/hook-helpers-tests.el
@@ -40,7 +40,9 @@
'((c++-mode-hook) (org-mode-hook . t))))
(should (equal (hkhlp-normalize-hook-spec '((c++-mode-hook . t)
(org-mode-hook . t)))
- '((c++-mode-hook . t) (org-mode-hook . t)))))
+ '((c++-mode-hook . t) (org-mode-hook . t))))
+ (should (equal (hkhlp-normalize-hook-spec '((c++-mode-hook . t)))
+ '((c++-mode-hook . t)))))
(ert-deftest hkhlp-create-hook-helper-test ()
(let ((test-hook nil))
diff --git a/hook-helpers.el b/hook-helpers.el
index 336cf7c..0923ecf 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -42,7 +42,7 @@
(cl-defstruct hook-helper
id function hooks source-file)
-(defun hkhlp-normalize-hook-spec (hook-spec)
+(defun hkhlp-normalize-hook-spec (hook-spec &optional recursed)
"Turns HOOK-SPEC into a list of cons-cells, each one (HOOK . APPEND)
HOOK is the name of the full variable to use
@@ -52,12 +52,13 @@ APPEND is a Boolean"
;; HOOK
(list (cons hook-spec nil)))
((and (consp hook-spec)
+ (symbolp (car hook-spec))
(booleanp (cdr hook-spec)))
;; (HOOK . APPEND)
(list hook-spec))
- ((listp hook-spec)
+ ((and (listp hook-spec) (not recursed))
;; List of specs
- (apply 'append (mapcar (lambda (spec) (hkhlp-normalize-hook-spec spec))
hook-spec)))
+ (mapcar (lambda (spec) (car (hkhlp-normalize-hook-spec spec t)))
hook-spec))
(t
(warn "Unrecognized hook-spec %s" hook-spec))))
- [elpa] scratch/hook-helpers 597fce1 03/19: Updated README to include savannah project link., (continued)
- [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, 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 <=
- [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
- [elpa] scratch/hook-helpers 93ae501 12/19: Finished last commit., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 7970dcf 01/19: Initial commit., Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers ff95f49 18/19: Preparations to push to ELPA, Ian Dunn, 2017/04/23
- [elpa] scratch/hook-helpers 365d8de 19/19: Add 'packages/hook-helpers/' from commit 'ff95f4944f3d6d1a43aca141cb7fa36a9043704d', Ian Dunn, 2017/04/23