From e7ff1cfa1af57dbdf1795471b7d40b87e73bf046 Mon Sep 17 00:00:00 2001 From: Steve Youngs Date: Fri, 12 Feb 2021 16:22:57 +1000 Subject: [PATCH] Update pkgusr.el to deal with multi-line install group. * lisp/pkgusr.el (pkgusr-all-pkgs): Allow for the install group being split across multiple lines. Signed-off-by: Steve Youngs --- lisp/pkgusr.el | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/pkgusr.el b/lisp/pkgusr.el index d6a9ac1..6ca4146 100644 --- a/lisp/pkgusr.el +++ b/lisp/pkgusr.el @@ -5,7 +5,7 @@ ;; Author: Steve Youngs ;; Maintainer: Steve Youngs ;; Created: <2007-07-13> -;; Time-stamp: +;; Time-stamp: ;; Homepage: N/A ;; Keywords: utils package-management @@ -62,12 +62,18 @@ (defun pkgusr-all-pkgs () "Return a list of all installed packages." - (let ((lst (with-temp-buffer - (insert-file-contents "/etc/group") - (re-search-forward "^install:x:9999:" nil t) - (narrow-to-region (point) (point-at-eol)) - (split-string-by-char (buffer-string) ?,)))) - lst)) + (let ((pkgs "")) + (with-temp-buffer + (insert-file-contents "/etc/group") + (catch 'done + (while t + (if (re-search-forward "^install:x:9999:" nil t) + (setq pkgs (concat pkgs + (buffer-substring (point) + (point-at-eol)) + ",")) + (throw 'done nil)))) + (split-string-by-char (substring pkgs 0 -1) ?,)))) (defvar pkgusr-all-pkgs (pkgusr-all-pkgs) "A list of all installed packages.") -- 2.25.1