Emacs/Guix: Fix first/second -> cl-first/cl-second with Emacs 27.

master
Pierre Neidhardt 2020-09-09 11:51:10 +02:00
parent 931ace0920
commit ff651bc384
1 changed files with 16 additions and 16 deletions

View File

@ -80,8 +80,8 @@ If MULTIPLE? is non-nil, return a list of (NAME FILE) of the selected manifests.
(if multiple? (if multiple?
(mapcar (lambda (name) (mapcar (lambda (name)
(assoc name files)) (assoc name files))
(completing-read-multiple prompt (mapcar #'first files))) (completing-read-multiple prompt (mapcar #'cl-first files)))
(assoc (completing-read prompt (mapcar #'first files)) (assoc (completing-read prompt (mapcar #'cl-first files))
files)))))) files))))))
(defun ambrevar/guix-query-manifest (&optional manifest multiple?) (defun ambrevar/guix-query-manifest (&optional manifest multiple?)
@ -125,7 +125,7 @@ the channel specification."
"Edit system. "Edit system.
If SYSTEM is nil, it is queried from the systems found in `ambrevar/guix-system-directory'." If SYSTEM is nil, it is queried from the systems found in `ambrevar/guix-system-directory'."
(interactive) (interactive)
(setq system (second (ambrevar/guix-query-system system))) (setq system (cl-second (ambrevar/guix-query-system system)))
(find-file system)) (find-file system))
(global-set-key (kbd "C-x c s") #'ambrevar/guix-edit-system) (global-set-key (kbd "C-x c s") #'ambrevar/guix-edit-system)
(with-eval-after-load 'evil (with-eval-after-load 'evil
@ -137,7 +137,7 @@ If SYSTEM is nil, it is queried from the systems found in `ambrevar/guix-system-
"Edit MANIFEST. "Edit MANIFEST.
If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-manifest-directory'." If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-manifest-directory'."
(interactive) (interactive)
(setq manifest (second (ambrevar/guix-query-manifest manifest))) (setq manifest (cl-second (ambrevar/guix-query-manifest manifest)))
(find-file manifest)) (find-file manifest))
(global-set-key (kbd "C-x c g") #'ambrevar/guix-edit-manifest) (global-set-key (kbd "C-x c g") #'ambrevar/guix-edit-manifest)
(with-eval-after-load 'evil (with-eval-after-load 'evil
@ -154,7 +154,7 @@ If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-man
(defun ambrevar/guix-find-channel-from-manifest (pattern) (defun ambrevar/guix-find-channel-from-manifest (pattern)
"Return the channel specification file matching PATTERN in "Return the channel specification file matching PATTERN in
`ambrevar/guix-channel-spec-directory'." `ambrevar/guix-channel-spec-directory'."
(first (directory-files ambrevar/guix-channel-spec-directory 'full (cl-first (directory-files ambrevar/guix-channel-spec-directory 'full
(concat pattern "-channel")))) (concat pattern "-channel"))))
(defun ambrevar/run-in-eshell (command) (defun ambrevar/run-in-eshell (command)
@ -194,7 +194,7 @@ If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-man
(let* ((guix (if channel (let* ((guix (if channel
(let ((dest (expand-file-name (let ((dest (expand-file-name
;; TODO: What name should we use with multiple manifests? ;; TODO: What name should we use with multiple manifests?
(first (first manifests)) (cl-first (cl-first manifests))
ambrevar/guix-extra-channels))) ambrevar/guix-extra-channels)))
(make-directory dest 'parents) (make-directory dest 'parents)
(format "guix pull --channels=%s --profile=%s/guix && %s/guix/bin/guix" (format "guix pull --channels=%s --profile=%s/guix && %s/guix/bin/guix"
@ -203,7 +203,7 @@ If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-man
(shell-quote-argument dest))) (shell-quote-argument dest)))
"guix"))) "guix")))
(dolist (manifest-pair manifests) (dolist (manifest-pair manifests)
(let ((manifest-name (first manifest-pair))) (let ((manifest-name (cl-first manifest-pair)))
(make-directory (expand-file-name manifest-name (make-directory (expand-file-name manifest-name
ambrevar/guix-extra-profiles) ambrevar/guix-extra-profiles)
'parents))) 'parents)))
@ -212,8 +212,8 @@ If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-man
'ambrevar/run-in-shell) 'ambrevar/run-in-shell)
(mapconcat #'identity (mapconcat #'identity
(mapcar (lambda (manifest-pair) (mapcar (lambda (manifest-pair)
(let ((manifest-name (first manifest-pair)) (let ((manifest-name (cl-first manifest-pair))
(manifest (second manifest-pair)) (manifest (cl-second manifest-pair))
(profile (expand-file-name ambrevar/guix-extra-profiles))) (profile (expand-file-name ambrevar/guix-extra-profiles)))
(string-join (string-join
(list "echo" (format "'==> Installing manifest %S to profile %S'" (list "echo" (format "'==> Installing manifest %S to profile %S'"
@ -231,7 +231,7 @@ If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-man
(unless channel (unless channel
;; TODO: Only do this when manifest install has succeeded. ;; TODO: Only do this when manifest install has succeeded.
(dolist (manifest-pair manifests) (dolist (manifest-pair manifests)
(let ((manifest-name (first manifest-pair))) (let ((manifest-name (cl-first manifest-pair)))
(ambrevar/guix-save-channel-specs (ambrevar/guix-save-channel-specs
(format "%s/guix-%s-channels.scm" (format "%s/guix-%s-channels.scm"
ambrevar/guix-channel-spec-directory ambrevar/guix-channel-spec-directory
@ -250,11 +250,11 @@ non-nil, then try to use a channel specification file from
`ambrevar/guix-channel-spec-directory' if any." `ambrevar/guix-channel-spec-directory' if any."
(interactive) (interactive)
(let* ((manifest-pair (ambrevar/guix-query-manifest manifest)) (let* ((manifest-pair (ambrevar/guix-query-manifest manifest))
(manifest-name (first manifest-pair)) (manifest-name (cl-first manifest-pair))
(manifest (second manifest-pair)) (manifest (cl-second manifest-pair))
(channel (or channel (channel (or channel
(and current-prefix-arg (and current-prefix-arg
(second (ambrevar/guix-query-channel-spec))) (cl-second (ambrevar/guix-query-channel-spec)))
(and ambrevar/guix-always-use-channel-specs (and ambrevar/guix-always-use-channel-specs
(ambrevar/guix-find-channel-from-manifest manifest-name))))) (ambrevar/guix-find-channel-from-manifest manifest-name)))))
(%ambrevar/guix-install-manifest (list manifest-pair) channel))) (%ambrevar/guix-install-manifest (list manifest-pair) channel)))
@ -270,7 +270,7 @@ With a prefix argument, query for a channel specification file."
(let* ((manifests (or manifests (ambrevar/guix-query-manifest nil :multiple))) (let* ((manifests (or manifests (ambrevar/guix-query-manifest nil :multiple)))
(channel (or channel (channel (or channel
(and current-prefix-arg (and current-prefix-arg
(second (ambrevar/guix-query-channel-spec)))))) (cl-second (ambrevar/guix-query-channel-spec))))))
(%ambrevar/guix-install-manifest manifests channel))) (%ambrevar/guix-install-manifest manifests channel)))
(global-set-key (kbd "C-x c G") #'ambrevar/guix-install-manifests) (global-set-key (kbd "C-x c G") #'ambrevar/guix-install-manifests)
(with-eval-after-load 'evil (with-eval-after-load 'evil
@ -284,8 +284,8 @@ System is queried from those found in `ambrevar/guix-system-directory'. "
(interactive) (interactive)
(require 'init-shell) ; For `helm-ff-preferred-shell-mode'. (require 'init-shell) ; For `helm-ff-preferred-shell-mode'.
(let* ((system-pair (ambrevar/guix-query-system system)) (let* ((system-pair (ambrevar/guix-query-system system))
(system-name (first system-pair)) (system-name (cl-first system-pair))
(system (second system-pair))) (system (cl-second system-pair)))
(funcall (if (eq helm-ff-preferred-shell-mode 'eshell-mode) (funcall (if (eq helm-ff-preferred-shell-mode 'eshell-mode)
'ambrevar/run-in-eshell 'ambrevar/run-in-eshell
'ambrevar/run-in-shell) 'ambrevar/run-in-shell)