如何使Emacs的ELPA列表包屏幕的“包”列更宽?

Ana*_*Ana 5 emacs elpa

当我list-packages在Emacs 24上运行时,我得到一个类似于以下内容的屏幕:

埃尔帕

问题在于许多软件包的名称都比软件包列长。如何扩大此列的范围,以便可以看到完整的软件包名称?

hom*_*ess 3

也许有一个更优雅的解决方案,但我想出了这个。您可以使用以下代码定义列的宽度并根据package-menu-column-width需要更改变量。然后,您需要将其包含到您的初始化文件中(在 后面(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))
Run Code Online (Sandbox Code Playgroud)