emacs初始化和更新emacs包

时间:2013-10-20 19:49:52

标签: emacs package package-managers

我违反了可能是我的.emacs文件中最基本的emacs包规则,方法是加载一个特定的路径到一个更新的emacs(workgroups2)包。因此,每次发布新版本时,升级时我都必须编辑我的emacs文件(这是下面的第一行)。

以下是我的emacs文件的相关部分。如何在不添加特定路径的情况下加载它?让我知道你有什么其他建议,谢谢!

要明确我们正在考虑的问题是:(add-to-list 'load-path "~/.emacs.d/elpa/workgroups2-20130915.1509")

(add-to-list 'load-path "~/.emacs.d/elpa/workgroups2-20130915.1509")
(require 'workgroups2)
(setq package-enable-at-startup nil)
(package-initialize)

(desktop-save-mode nil)     ; save all opened files (or disable it)                                                                                                         
(setq wg-prefix-key (kbd "C-c w")
      wg-restore-associated-buffers t ; restore all buffers opened in this WG?                                                                                              
      wg-use-default-session-file t   ; turn off for "emacs --daemon"                                                                                                       
      wg-default-session-file "~/.emacs.d/emacs_def.wg"
      wg-use-faces nil
      wg-morph-on nil)                  ; animation off                                                                                                                     

;; Keyboard shortcuts - load, save, switch                                                                                                                                  
(global-set-key (kbd "<pause>")     'wg-reload-session)
(global-set-key (kbd "C-S-<pause>") 'wg-save-session)
(global-set-key (kbd "s-z")         'wg-switch-to-workgroup)
(global-set-key (kbd "s-/")         'wg-switch-to-previous-workgroup)

(workgroups-mode 1)     ; Activate workgroups 

编辑:如果我注释掉该行,这就是调试器给我的:

Debugger entered--Lisp error: (file-error "Cannot open load file" "workgroups2")
  require(workgroups2)
  eval-buffer(#<buffer  *load*> nil "/home/d2b2/.emacs.d/init.el" nil t)  ; Reading at buffer position 6014
  load-with-code-conversion("/home/d2b2/.emacs.d/init.el" "/home/d2b2/.emacs.d/init.el" t t)
  load("/home/d2b2/.emacs.d/init" t t)
  #[0 "^H\205\262^@     \306=\203^Q^@\307^H\310Q\202;^@ \311=\204^^^@\307^H\312Q\202;^@\313\307\314\315#\203*^@\316\202;^@\313\307\314\317#\203:^@\320\nB^R\321\202;^@\316\$
  command-line()
  normal-top-level()

编辑:现在注释掉这两行,我们遇到以下错误:

Debugger entered--Lisp error: (error ":END: line missing at position 186")
  signal(error (":END: line missing at position 186"))
  error(":END: line missing at position %s" 186)
  org-flag-drawer(t)
  org-cycle-hide-drawers(all)
  org-set-startup-visibility()
  org-mode()
  desktop-restore-file-buffer("/home/d2b2/.todo" ".todo" nil)
  #[nil "^H     \236A\206^H^@\305\n^K\f#\207" [desktop-buffer-major-mode desktop-buffer-mode-handlers desktop-buffer-file-name desktop-buffer-name desktop-buffer-misc deskt$
  desktop-create-buffer(206 "/home/d2b2/.todo" ".todo" org-mode (workgroups-mode) 1 (nil nil) nil nil ((buffer-file-coding-system . undecided-unix) (truncate-lines . t)))
  eval-buffer(#<buffer  *load*> nil "/home/d2b2/.emacs.desktop" nil t)  ; Reading at buffer position 813
  load-with-code-conversion("/home/d2b2/.emacs.desktop" "/home/d2b2/.emacs.desktop" t t)
  load("/home/d2b2/.emacs.desktop" t t t)
  desktop-read()
  #[nil "\304\211^X     \235\203^O^@\305^H      \"^Q\306^R)\n\205^Z^@\307 \210\310\211^S\207" [key command-line-args desktop-save-mode inhibit-startup-screen "--no-desktop"$
  run-hooks(after-init-hook)
  command-line()
  normal-top-level()

1 个答案:

答案 0 :(得分:2)

请确保package-directory-list包含您通往elpa ~/.emacs.d/elpa的路径。

然后package.el初始化一些包,它将包的名称添加到 package-activated-list并推送包目录 (例如〜/ .emacs.d / elpa / workgroups2-20130915.1509)到load-path 自动。

对我而言,它照常工作,我不会手动为包添加任何特定的pathes。 我的配置中package-enable-at-startup的值为t

package-enable-at-startup doc: “当Emacs启动时是否激活已安装的软件包...如果是 package-enable-at-startup的值为nil,您可以随时键入M-x package-initialize来激活包系统。“

(require 'workgroups2)在配置初始化包之前,尝试将其移到下面。