fix(emacs): Guix dependency tables & categories

This commit is contained in:
Pavel Korytov 2021-06-17 11:46:49 +03:00
parent 738595780f
commit bee1990318
2 changed files with 51 additions and 14 deletions

View file

@ -558,9 +558,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(use-package wakatime-mode
:straight t
:disabled
:config
(advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime-cli")))
(advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime")))
(global-wakatime-mode))
(use-package request
@ -568,7 +567,6 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(use-package activity-watch-mode
:straight t
:disabled
:config
(global-activity-watch-mode))
@ -1455,14 +1453,27 @@ parent."
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p ".*[C|c]ategory.*" elem)))))
(string-match-p ".*[C|c]ategory.*" elem))))
(disabled-name-index
(cl-position
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p ".*[D|d]isabled.*" elem)))))
(when dep-name-index
(dolist (elem (cdr table))
(when
(or
(not category)
(not category-name-index)
(string-match-p category (nth category-name-index elem)))
(and
(or
(and
(not category)
(not category-name-index))
(and
category-name-index
(string-match-p category (nth category-name-index elem))))
(or
(not disabled-name-index)
(string-empty-p (nth disabled-name-index elem))))
(add-to-list
'dependencies
(substring-no-properties (nth dep-name-index elem)))))))))
@ -2105,6 +2116,10 @@ parent."
;; (add-hook 'emacs-lisp-mode-hook #'smartparens-strict-mode)
(add-hook 'emacs-lisp-mode-hook #'lispy-mode)
(add-hook 'lisp-mode-hook #'aggressive-indent-mode)
;; (add-hook 'emacs-lisp-mode-hook #'smartparens-strict-mode)
(add-hook 'lisp-mode-hook #'lispy-mode)
(use-package clojure-mode
:straight t
:mode "\\.clj[sc]?\\'"
@ -2374,8 +2389,8 @@ parent."
'("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") ("/usr/bin/env bash")))
(tramp-remote-shell "/usr/bin/env bash")
(tramp-login-env (("SHELL") (locate-file "file" exec-path)))
(tramp-remote-shell (locate-file "file" exec-path))
(tramp-remote-shell-args ("-c")))))
@ -2560,3 +2575,15 @@ parent."
:action (lambda (elem)
(setq zone-programs (vector (cdr elem)))
(zone))))
(use-package elcord
:straight t
:if (and (string= (system-name) "pdsk") (not my/slow-ssh))
:config
(elcord-mode))
(use-package guix
:straight t
:commands (guix)
:init
(my-leader-def "ag" 'guix))

View file

@ -1,5 +1,5 @@
#+PROPERTY: header-args :mkdirp yes
#+PROPERTY: header-args:emacs-lisp :tangle ./.emacs.d/init.el :mkdirp yes
#+PROPERTY: header-args:emacs-lisp :tangle ~/.emacs.d/init.el :mkdirp yes
#+TODO: CHECK(s) | OFF(o)
#+begin_quote
@ -2347,6 +2347,7 @@ A function to extract Guix dependencies from the org file.
- If column name matches =[G|g]uix.*dep=, its contents will be added to the result.
- If =CATEGORY= is passed, a column with name =[C|c]ategory= will be used to filter results. That way one file can be used to produce multiple manifests.
- If =CATEGORY= is not passed, entries with non-empty category will be filtered out
- If there is a =[D|d]isabled= column, entries which have non-empty value in this column will be filtered out.
#+begin_src emacs-lisp
@ -2380,10 +2381,18 @@ A function to extract Guix dependencies from the org file.
(dolist (elem (cdr table))
(when
(and
;; Category
(or
(not category)
(not category-name-index)
(string-match-p category (nth category-name-index elem)))
;; Category not set and not present in the table
(and
(or (not category) (string-empty-p category))
(not category-name-index))
;; Category is set and present in the table
(and
category-name-index
(not (string-empty-p category))
(string-match-p category (nth category-name-index elem))))
;; Not disabled
(or
(not disabled-name-index)
(string-empty-p (nth disabled-name-index elem))))
@ -3863,6 +3872,7 @@ Shows which file is being edited in Emacs.
:if (and (string= (system-name) "pdsk") (not my/slow-ssh))
:config
(elcord-mode))
#+end_src
** Guix
#+begin_src emacs-lisp
(use-package guix