[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08/23: emacs: Add 'guix-memoized-defalias' macro.
From: |
Alex Kost |
Subject: |
08/23: emacs: Add 'guix-memoized-defalias' macro. |
Date: |
Sun, 30 Aug 2015 15:28:12 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit 6543601fa05b629b387d1da0b5fc5fe81ecaf24c
Author: Alex Kost <address@hidden>
Date: Sun Aug 16 06:46:52 2015 +0300
emacs: Add 'guix-memoized-defalias' macro.
* emacs/guix-utils.el (guix-memoized-defalias): New macro.
(guix-memoized-font-lock-keywords): New variable.
---
emacs/guix-utils.el | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index fb1ca60..0b8a760 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -262,6 +262,27 @@ See `defun' for the meaning of arguments."
(mapconcat #'symbol-name arglist " ")
docstring)))
+(defmacro guix-memoized-defalias (symbol definition &optional docstring)
+ "Set SYMBOL's function definition to memoized version of DEFINITION."
+ (declare (doc-string 3) (indent 1))
+ `(defalias ',symbol
+ (guix-memoize #',definition)
+ ,(or docstring
+ (format "Memoized version of `%S'." definition))))
+
+(defvar guix-memoized-font-lock-keywords
+ (eval-when-compile
+ `((,(rx "("
+ (group "guix-memoized-" (or "defun" "defalias"))
+ symbol-end
+ (zero-or-more blank)
+ (zero-or-one
+ (group (one-or-more (or (syntax word) (syntax symbol))))))
+ (1 font-lock-keyword-face)
+ (2 font-lock-function-name-face nil t)))))
+
+(font-lock-add-keywords 'emacs-lisp-mode guix-memoized-font-lock-keywords)
+
(provide 'guix-utils)
;;; guix-utils.el ends here
- branch master updated (600233b -> eb097f3), Alex Kost, 2015/08/30
- 02/23: emacs: Add 'guix-prettify' to 'guix' custom group., Alex Kost, 2015/08/30
- 01/23: emacs: Remove leftover internal variable., Alex Kost, 2015/08/30
- 03/23: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/30
- 04/23: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/30
- 05/23: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/30
- 09/23: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/30
- 06/23: emacs: Add utils to copy guix command., Alex Kost, 2015/08/30
- 08/23: emacs: Add 'guix-memoized-defalias' macro.,
Alex Kost <=
- 07/23: emacs: Add 'guix-any'., Alex Kost, 2015/08/30
- 10/23: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/30
- 17/23: ui: Add 'run-guix'., Alex Kost, 2015/08/30
- 11/23: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/30
- 12/23: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/30
- 18/23: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/30
- 15/23: emacs: Add minibuffer readers., Alex Kost, 2015/08/30
- 19/23: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/30
- 13/23: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/30
- 14/23: emacs: Add help variables., Alex Kost, 2015/08/30