当我在Emacs 24上运行list-packages时,我得到一个如下所示的屏幕:
问题是许多包的名称比包列长.如何使这个列更宽,以便我可以看到完整的包名?
最佳答案 也许有一个更优雅的解决方案,但我想出了这个.您可以使用以下代码定义列的宽度,并根据需要更改变量package-menu-column-width.然后,您需要将它包含在您的init文件中(在(require’package)之后).它来自package.el文件,它定义了表的格式.请参阅代码中的第一条注释,您需要修改列的宽度.您可以以类似的方式继续其他列.
;; <<<< here you have to adapt the number to your needs >>>>
(defcustom package-menu-column-width 18
"Width of the package column."
:type 'number
:group 'package)
(define-derived-mode package-menu-mode tabulated-list-mode "Package Menu"
"Major mode for browsing a list of packages.
Letters do not insert themselves; instead, they are commands.
\\<package-menu-mode-map>
\\{package-menu-mode-map}"
(setq tabulated-list-format
`[("Package" ,package-menu-column-width package-menu--name-predicate)
("Version" 12 nil)
("Status" 10 package-menu--status-predicate)
,@(if (cdr package-archives)
'(("Archive" 10 package-menu--archive-predicate)))
("Description" 0 nil)])
(setq tabulated-list-padding 2)
(setq tabulated-list-sort-key (cons "Status" nil))
(add-hook 'tabulated-list-revert-hook 'package-menu--refresh nil t)
(tabulated-list-init-header))