Compare commits
4 commits
e867c87227
...
2e2783b291
Author | SHA1 | Date | |
---|---|---|---|
2e2783b291 | |||
a293015346 | |||
95f25de948 | |||
117be3a752 |
2 changed files with 24 additions and 4 deletions
|
@ -54,6 +54,10 @@
|
|||
:windows-command "npm install -g bash-language-server"
|
||||
:message nil
|
||||
:enabled t)
|
||||
;; (cscope
|
||||
;; :linux-command "sudo pacman -S --noconfirm cscope"
|
||||
;; :message nil
|
||||
;; :enabled t)
|
||||
(ctags
|
||||
:darwin-command "brew install universal-ctags"
|
||||
:linux-command "sudo pacman -S --noconfirm ctags"
|
||||
|
|
|
@ -357,13 +357,29 @@ 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.
|
||||
If the file is an org file, insert a title with the Emacs version at the beginning.
|
||||
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)))))))
|
||||
(with-temp-buffer
|
||||
;; Insert title if the output is an org file
|
||||
(when (and filepath (string-suffix-p ".org" filepath))
|
||||
(insert (format "#+TITLE: My Packages and Versions on Emacs %s\n" emacs-version))
|
||||
(insert (format "#+DATE: %s\n" (format-time-string "%Y-%m-%d %H:%M:%S"))))
|
||||
;; Insert package and version information
|
||||
(dolist (pkg pkgs)
|
||||
(insert (format "%s - %s\n"
|
||||
pkg (package-desc-version (cadr (assq pkg package-alist))))))
|
||||
;; Output to message buffer or write to file
|
||||
(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