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)))
|
||||
|
||||
|
||||
(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)
|
||||
(package-initialize)
|
||||
(let ((pkgs (mapcar 'car package-alist)))
|
||||
(dolist (pkg pkgs)
|
||||
(message "%s - %s"
|
||||
pkg (package-desc-version (cadr (assq pkg package-alist)))))))
|
||||
(let ((pkgs (mapcar 'car package-alist))
|
||||
(output-buffer (or filepath "*Packages and Versions*")))
|
||||
(with-temp-buffer
|
||||
(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 ()
|
||||
|
|
Loading…
Reference in a new issue