updated my/list-packages-and-versions
This commit is contained in:
parent
e867c87227
commit
117be3a752
1 changed files with 15 additions and 5 deletions
|
@ -357,13 +357,23 @@ DIRECTORY is the directory where the org files are located."
|
||||||
(org-mode)))
|
(org-mode)))
|
||||||
|
|
||||||
|
|
||||||
(defun my/list-packages-and-versions ()
|
(defun my/list-packages-and-versions (&optional filepath)
|
||||||
|
"List installed packages and their versions.
|
||||||
|
If FILEPATH is provided, export the output to the specified file.
|
||||||
|
Otherwise, output to the message buffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(package-initialize)
|
(package-initialize)
|
||||||
(let ((pkgs (mapcar 'car package-alist)))
|
(let ((pkgs (mapcar 'car package-alist))
|
||||||
(dolist (pkg pkgs)
|
(output-buffer (or filepath "*Packages and Versions*")))
|
||||||
(message "%s - %s"
|
(with-temp-buffer
|
||||||
pkg (package-desc-version (cadr (assq pkg package-alist)))))))
|
(dolist (pkg pkgs)
|
||||||
|
(insert (format "%s - %s\n"
|
||||||
|
pkg (package-desc-version (cadr (assq pkg package-alist))))))
|
||||||
|
(if (or (called-interactively-p 'interactive) (not filepath))
|
||||||
|
(message "%s" (buffer-string))
|
||||||
|
(when filepath
|
||||||
|
(set-buffer-file-coding-system 'utf-8-unix)
|
||||||
|
(write-file filepath))))))
|
||||||
|
|
||||||
|
|
||||||
(defun my/copy-org-id-at-point ()
|
(defun my/copy-org-id-at-point ()
|
||||||
|
|
Loading…
Reference in a new issue