2

我正在尝试emacs用于 grails 开发。在grails-emacs-mode上试过

在我的 ubuntu 12.04 上有emacs和。emacs23

prayag@prayag:~$ ls -l /usr/share/emacs[tab][tab]
emacs/   emacs23/ 

正如 grails-emacs-mode 所建议的那样,我将文件复制grails-mode.elprimary.org我的emacs23/site-list

prayag@prayag:~$ ls -l /usr/share/emacs23/site-lisp/
total 32
-rw-r--r-- 1 root root  3013 Nov 17 00:39 debian-startup.elc
drwxr-xr-x 2 root root  4096 Nov 17 00:39 dictionaries-common
-rw-r--r-- 1 root root 18205 Feb 14 01:11 grails-mode.el
-rw-r--r-- 1 root root     0 Feb 14 01:11 primary.org
-rw-r--r-- 1 root root   106 Sep 22 01:16 subdirs.el

然后,由于主目录中不存在文件,因此在init.el内部创建。内容_.emacs.d.emacsinit.el

(require 'grails-mode)
(setq grails-mode t)
(setq project-mode t)
(add-to-list 'auto-mode-alist '("\.gsp$" . nxml-mode)) ; Use whatever mode you want for views.
(project-load-all) ; Loads all saved projects. Recommended, but not required.

现在,openingemacs23在菜单栏中没有显示任何 grails。

我也试过

M-x
load-file .emacs.d/init.el

抛出

Warning (initialization): An error occurred while loading `/home/prayag/.emacs.d/init.el':

File error: Cannot open load file, project-mode

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

grails-emacs

启动emacs23 --debug-init时,抛出以下错误。

Debugger entered--Lisp error: (file-error "Cannot open load file" "project-mode")
  require(project-mode)
  eval-buffer(#<buffer  *load*<2>> nil "/usr/share/emacs/23.3/site-lisp/grails-mode.el" nil t)  ; Reading at buffer position 422
  load-with-code-conversion("/usr/share/emacs/23.3/site-lisp/grails-mode.el" "/usr/share/emacs/23.3/site-lisp/grails-mode.el" nil t)
  require(grails-mode)
  eval-buffer(#<buffer  *load*> nil "/home/prayag/.emacs.d/init.el" nil t)  ; Reading at buffer position 23
  load-with-code-conversion("/home/prayag/.emacs.d/init.el" "/home/prayag/.emacs.d/init.el" t t)
  load("/home/prayag/.emacs.d/init" t t)
  #[nil "\205\264
4

2 回答 2

1

我根本不知道圣杯模式。我刚刚单击了您的链接,他们声明项目模式是一个依赖项:

依赖项:项目模式是唯一的依赖项。

因此,您还必须安装它。链接到 Emacs 项目代码。我希望你这个项目没有额外的依赖...

附带说明:稍后,尝试安装最后一个 emacs (v24),它嵌入了一种非常方便的方式来处理包安装和处理包依赖项。我刚刚检查了它,它存在于另一个(但非常了解)存储库中:Marmalade-repo.org。

于 2013-02-14T11:32:08.043 回答
1

grails-mode需要 emacs-grails-mode 页面上提到的 project-mode。因此,您还需要安装project-mode

还从这里获取剩余的 groovy 包(除了 grails-mode 之外的所有包)。

emacs-grails-mode-ext是对 grails-mode 的适度贡献,允许您直接从 emacs 运行 Grails 命令。对于给定的项目(项目模式),您可以运行 Grails 命令,例如create-domain-classcreate-service等。

我还从这里使用了ido-find-file-in-tag-files函数,我将它绑定到Cx CMf

使用 emacs-grails-mode 的简单指南:

  • 从命令行或eshell创建项目-> grails create-app yourapp
  • 使用dired,转到您的 Grails 项目文件夹
  • Mx project-new -> 创建一个新项目(project-mode)
  • Mx project-save -> 保存项目
  • Mx project-load-and-select -> 你的项目名称作为参数
  • 如果您使用菜单栏,还有一个 Grails 菜单

如果你安装了 emacs24,你也可以在这里使用我当前的 emacs 设置。我相信它适用于 Ubuntu 12.04,但我不确定。我通常在 OSX 上从源代码构建 emacs,或者在 Ubuntu 中使用emacs-snapshot 。

希望这可以帮助。

于 2013-02-14T11:48:27.613 回答