1

我可能违反了我的 .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()
4

1 回答 1

2

确保这package-directory-list包括您的 elpa 路径~/.emacs.d/elpa

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

对我来说,它照常工作,我不会手动为包添加任何特定路径。的值package-enable-at-startupt我的配置中。

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

(require 'workgroups2)在您的配置中的包初始化之前,请尝试将其移至下方。

于 2013-10-20T20:44:43.350 回答