summaryrefslogtreecommitdiff
path: root/emacs/guix-utils.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-08-12 15:28:55 +0300
committerAlex Kost <alezost@gmail.com>2015-08-30 18:26:01 +0300
commitc10521e97679c35a40926084e049445cc5053254 (patch)
tree86d9739f72b209064e4b5402e1fa25054e1bffd5 /emacs/guix-utils.el
parent935d079bb75c1144946ac9e9915a2278896a458d (diff)
downloadpatches-c10521e97679c35a40926084e049445cc5053254.tar
patches-c10521e97679c35a40926084e049445cc5053254.tar.gz
emacs: Add and use 'guix-while-search'.
* emacs/guix-utils.el (guix-while-search): New macro. * emacs/guix-pcomplete.el (guix-pcomplete-run-guix-and-search): Use it. * emacs/guix-prettify.el (guix-prettify-decompose-buffer): Likewise.
Diffstat (limited to 'emacs/guix-utils.el')
-rw-r--r--emacs/guix-utils.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index dc0c58a114..8a0673a3a0 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -160,6 +160,14 @@ accessed with KEYS."
(find-file file)
(message "File '%s' does not exist." file)))
+(defmacro guix-while-search (regexp &rest body)
+ "Evaluate BODY after each search for REGEXP in the current buffer."
+ (declare (indent 1) (debug t))
+ `(save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward ,regexp nil t)
+ ,@body)))
+
;;; Diff