emacs: breaking changes in MEGA CLI :c

This commit is contained in:
Pavel Korytov 2025-02-20 11:26:56 +03:00
parent b2d03efaf4
commit 59e92e678f
2 changed files with 30 additions and 28 deletions

View file

@ -7753,7 +7753,7 @@ base toot."
(telega-webpage-chat-link :foreground (my/color-value 'base0) (telega-webpage-chat-link :foreground (my/color-value 'base0)
:background (my/color-value 'fg))) :background (my/color-value 'fg)))
:config :config
(when (file-directory-p "~/.guix-extra-profiles/emacs/") (when (file-exists-p "~/.guix-extra-profiles/emacs/emacs/bin/telega-server")
(setq telega-server-command (setq telega-server-command
(expand-file-name (expand-file-name
"~/.guix-extra-profiles/emacs/emacs/bin/telega-server"))) "~/.guix-extra-profiles/emacs/emacs/bin/telega-server")))
@ -8670,16 +8670,16 @@ Which creates the following output:
The functions also skips lines in [square brackets] and ones that The functions also skips lines in [square brackets] and ones that
start with more than 3 spaces." start with more than 3 spaces."
(when-let* ((lines (seq-filter (when-let* ((lines (seq-filter
(lambda (s) (not (or (string-empty-p s) (lambda (s) (not (or (string-empty-p s)
(string-match-p (rx bos "[" (* nonl) "]") s) (string-match-p (rx bos "[" (* nonl) "]") s)
(string-match-p (rx bos (>= 3 " ")) s)))) (string-match-p (rx bos (>= 3 " ")) s))))
(split-string string "\n"))) (split-string string "\n")))
(first-line (car lines)) (first-line (car lines))
(headers (split-string first-line)) (headers (split-string first-line))
(header-indices (mapcar (header-indices (mapcar
(lambda (header) (lambda (header)
(cl-search header first-line)) (cl-search header first-line))
headers))) headers)))
(cl-loop for line in (cdr lines) (cl-loop for line in (cdr lines)
collect (cl-loop for header in headers collect (cl-loop for header in headers
for start in header-indices for start in header-indices
@ -8703,8 +8703,9 @@ The return value is a list of alists with the following keys:
collect `((path . ,(if (file-directory-p localpath) collect `((path . ,(if (file-directory-p localpath)
(concat localpath "/") (concat localpath "/")
localpath)) localpath))
(enabled . ,(string-equal (alist-get 'ACTIVE value) (enabled . ,(seq-contains-p
"Enabled")))))) '("Pending" "Loading" "Running")
(alist-get 'RUN_STATE value)))))))
(defun my/index--tree-get-paths (tree &optional kind) (defun my/index--tree-get-paths (tree &optional kind)
"Get paths from TREE. "Get paths from TREE.
@ -8746,7 +8747,7 @@ The return value is a list of commands as defined by
(append (append
(cl-loop for path in (seq-difference mega-paths-to-enable mega-paths-enabled) (cl-loop for path in (seq-difference mega-paths-to-enable mega-paths-enabled)
if (seq-contains-p mega-paths-disabled path) if (seq-contains-p mega-paths-disabled path)
collect (list (format "mega-sync -e \"%s\"" path) "Mega enable sync" 5) collect (list (format "mega-sync -r \"%s\"" path) "Mega enable sync" 5)
else append (list else append (list
(list (format "mega-mkdir -p \"%s\"" (list (format "mega-mkdir -p \"%s\""
(my/index--mega-local-path path)) (my/index--mega-local-path path))

View file

@ -10670,7 +10670,7 @@ Or you can load up Element for a moment to see what the mention was, if that's e
(telega-webpage-chat-link :foreground (my/color-value 'base0) (telega-webpage-chat-link :foreground (my/color-value 'base0)
:background (my/color-value 'fg))) :background (my/color-value 'fg)))
:config :config
(when (file-directory-p "~/.guix-extra-profiles/emacs/") (when (file-exists-p "~/.guix-extra-profiles/emacs/emacs/bin/telega-server")
(setq telega-server-command (setq telega-server-command
(expand-file-name (expand-file-name
"~/.guix-extra-profiles/emacs/emacs/bin/telega-server"))) "~/.guix-extra-profiles/emacs/emacs/bin/telega-server")))
@ -11943,16 +11943,16 @@ Which creates the following output:
The functions also skips lines in [square brackets] and ones that The functions also skips lines in [square brackets] and ones that
start with more than 3 spaces." start with more than 3 spaces."
(when-let* ((lines (seq-filter (when-let* ((lines (seq-filter
(lambda (s) (not (or (string-empty-p s) (lambda (s) (not (or (string-empty-p s)
(string-match-p (rx bos "[" (* nonl) "]") s) (string-match-p (rx bos "[" (* nonl) "]") s)
(string-match-p (rx bos (>= 3 " ")) s)))) (string-match-p (rx bos (>= 3 " ")) s))))
(split-string string "\n"))) (split-string string "\n")))
(first-line (car lines)) (first-line (car lines))
(headers (split-string first-line)) (headers (split-string first-line))
(header-indices (mapcar (header-indices (mapcar
(lambda (header) (lambda (header)
(cl-search header first-line)) (cl-search header first-line))
headers))) headers)))
(cl-loop for line in (cdr lines) (cl-loop for line in (cdr lines)
collect (cl-loop for header in headers collect (cl-loop for header in headers
for start in header-indices for start in header-indices
@ -11979,8 +11979,9 @@ The return value is a list of alists with the following keys:
collect `((path . ,(if (file-directory-p localpath) collect `((path . ,(if (file-directory-p localpath)
(concat localpath "/") (concat localpath "/")
localpath)) localpath))
(enabled . ,(string-equal (alist-get 'ACTIVE value) (enabled . ,(seq-contains-p
"Enabled")))))) '("Pending" "Loading" "Running")
(alist-get 'RUN_STATE value)))))))
#+end_src #+end_src
And get the same data from the tree. And get the same data from the tree.
@ -12028,7 +12029,7 @@ The return value is a list of commands as defined by
(append (append
(cl-loop for path in (seq-difference mega-paths-to-enable mega-paths-enabled) (cl-loop for path in (seq-difference mega-paths-to-enable mega-paths-enabled)
if (seq-contains-p mega-paths-disabled path) if (seq-contains-p mega-paths-disabled path)
collect (list (format "mega-sync -e \"%s\"" path) "Mega enable sync" 5) collect (list (format "mega-sync -r \"%s\"" path) "Mega enable sync" 5)
else append (list else append (list
(list (format "mega-mkdir -p \"%s\"" (list (format "mega-mkdir -p \"%s\""
(my/index--mega-local-path path)) (my/index--mega-local-path path))