Setting default Java mode?
I haven't figured out how to do this aside from tinkering with the source itself.
When working with JSPs, is it possible to set the default java-mode to jde-mode?
If it's not, could the feature be requested?
I changed it in the source for myself a while ago, but through my tinkering I somehow broke the electric-parens so that every time I type a parenthesis, I'd be stopped by an error report (meaning two such error reports every time I typed in a function!)
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- nXhtml Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- lborgman
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Try
M-x customize-group RET mumamo RET
and then look at the option
mumamo-
Revision history for this message
|
#2 |
I've tried for the last hour or so, but I'm still at a loss. What should I be adding here?
Revision history for this message
|
#3 |
I might have misunderstood you. I thought that you wanted jde-mode in java-mode chunks in multi major modes like jsp-nxhtml-mumamo.
Do you understand what I mean? Is this what you want?
If that is what you want then you can do like this:
M-x customize-option RET mumamo-major-modes RET
You should add a new entry there where the first Symbol is java-mode and the second Symbol is jde-mode.
Could you perhaps try tell me how I could have made this more understandable and easier to do for you?
Revision history for this message
|
#4 |
"jde-mode in java-mode chunks in multi major modes like jsp-nxhtml-mumamo" sounds exactly like what I want.
I'd already tried:
INS DEL Symbol: java-mode
Repeat:
INS DEL Choice: Value Menu Function: jde-mode
INS
INS DEL Symbol: java-mode
Repeat:
INS DEL Choice: Value Menu Function: java-mode
INS DEL Choice: Value Menu Function: jde-mode
INS
and numerous permutations of the same. In the second one, it still works as normal (but no JDE), but in the first one, nxhtml-mode stops recognizing anything between the <% %> tags (meaning it doesn't switch modes).
If it's supposed to say "Symbol" instead of "Function", well, when I switch it to "Symbol", save and exit, when I come back to the Customize-Group page, it reverts to "Function". Is this important?
Revision history for this message
|
#5 |
The "Symbol" versus "Function" is not very important. If the function is not loaded it says Symbol.
I think the first one is the one you want of your choiced above is the one you want. Probably something goes wrong, that is why it does not work. Can you look in the message buffer and see if there is something that can help?
Revision history for this message
|
#6 |
Thanks for the quick reply!
Here's what I get in *Messages*. The first error happens every time I open a .jsp file--I always have to open it twice (regardless of whether I've tried to set up nxhtml with JDE. Someone else reported the same problem at EmacsWiki).
The rest is more ELisp than I know how to deal with...
Error: (error Variable binding depth exceeds max-specpdl-size) [2 times]
Setting customized JDE variables to startup values...
Symbol's function definition is void: turn-on-
mumamo-
** In buffer addedGame.jsp
backtrace()
(let ((standard-output standard-output)) (backtrace))
(let ((standard-output ...)) (let (...) (backtrace)) (with-current-
(with-
(let ((format-string2 ...) (bt ...)) (mumamo-
" ... bt) (quote highlight)) (apply (quote message) format-string2 lwarn-type args) (run-with-
mumamo-
(condition-case err (progn (mumamo-
(if (not mumamo-
(mumamo-
mumamo-
(let ((syntax-min ...) (syntax-max ...) (chunk-min ...) (chunk-max ...)) (when (<= here syntax-min) (mumamo-
(let* ((chunk ...) (old-chunk chunk) (chunk-min ...) (chunk-max ...) (chunk-min-1 ...) (chunk-max-1 ...) (chunk-min-face ...) (chunk-max-face ...) (chunk-major ...) (chunk-values ...) (cv-min ...) (cv-max ...) (cv-major-sub ...) (max) prev-major prev-chunk (need-new-chunk nil)) (mumamo-msgfntfy "old-chunk=%s cv-min/cv-max %s/%s" old-chunk cv-min cv-max) (unless cv-max (setq cv-max end)) (unless old-chunk (mumamo-
(while (and fontified-t (< here end)) (mumamo-msgfntfy "mumamo-
(let* ((old-point ...) (here start) (main-major ...) (fontified-t t) after-change-
(progn (let* (... ... ... ... after-change-
(unwind-protect (progn (let* ... ... ... ... ... ... ... ...)) (set-match-data save-match-
(let ((save-
(save-match-data (let* (... ... ... ... after-change-
mumamo-
(let ((debugger ...) (debug-on-error t)) (mumamo-
(condition-case err (let (... ...) (mumamo-
(if (not mumamo-
(mumamo-
(if (and mumamo-
mumamo-
font-
run-hook-
byte-
jit-lock-
jit-lock-
mumamo-
mumamo-
mumamo-
** In buffer addedGame.jsp
backtrace()
(let ((standard-output standard-output)) (backtrace))
(let ((standard-output ...)) (let (...) (backtrace)) (with-current-
(with-
(let ((format-string2 ...) (bt ...)) (mumamo-
" ... bt) (quote highlight)) (apply (quote message) format-string2 lwarn-type args) (run-with-
mumamo-
(condition-case err (let (... ...) (mumamo-
(if (not mumamo-
(mumamo-
(if (and mumamo-
mumamo-
font-
run-hook-
byte-
jit-lock-
jit-lock-
mumamo-
mumamo-
Setting customized JDE variables to startup values...
Symbol's function definition is void: turn-on-
Wrong type argument: listp, jde-run-
mumamo-
** In buffer addedGame.jsp
backtrace()
(let ((standard-output standard-output)) (backtrace))
(let ((standard-output ...)) (let (...) (backtrace)) (with-current-
(with-
(let ((format-string2 ...) (bt ...)) (mumamo-
" ... bt) (quote highlight)) (apply (quote message) format-string2 lwarn-type args) (run-with-
mumamo-
(condition-case err (let (... ...) (mumamo-
(if (not mumamo-
(mumamo-
(if (and mumamo-
mumamo-
font-
run-hook-
byte-
jit-lock-
jit-lock-
mumamo-
mumamo-
MuMaMo error, please look in the *Message* buffer
MuMaMo error, please look in the *Message* buffer
MuMaMo error, please look in the *Message* buffer
Using vacuous schema
Revision history for this message
|
#7 |
Which version of CEDET and JDEE are you using?
I am not using either of them yet, but I know there has been quite a number of changes to CEDET and also to JDEE. The function turn-on-
Could you perhaps checkout the development versions of CEDET and JDEE and try again?
Revision history for this message
|
#8 |
I'll try that and report back.
Revision history for this message
|
#9 |
Well, I downloaded the jdee & cedet tarballs and set them up, and now when I open a .jsp file jdee does indeed seem to get started up, but the behaviour is the same as regular java-mode.
When point is between some <% %> tags and I press enter to open a new line, I get:
Internal nXML mode error in nxml-after-change (Wrong type argument: number-or-marker-p, nil), degrading
dolist: Variable binding depth exceeds max-specpdl-size
Here's what I get in *Messages*:
Using vacuous schema
Error: (error Variable binding depth exceeds max-specpdl-size) [2 times]
Loading jde...
mumamo-
** In buffer addGame.jsp
backtrace()
(let ((standard-output standard-output)) (backtrace))
(let ((standard-output ...)) (let (...) (backtrace)) (with-current-
(with-
(let ((format-string2 ...) (bt ...)) (mumamo-
" ... bt) (quote highlight)) (apply (quote message) format-string2 lwarn-type args) (run-with-
mumamo-
(condition-case err (let (... ...) (mumamo-
(if (not mumamo-
(mumamo-
(if (and mumamo-
mumamo-
font-
run-hook-
byte-
jit-lock-
jit-lock-
mumamo-
mumamo-
Loading jde... [16 times]
MuMaMo error, please look in the *Message* buffer
Using vacuous schema
Loading jde... [16 times]
Using vacuous schema [2 times]
Internal nXML mode error in nxml-after-change (Wrong type argument: number-or-marker-p, nil), degrading
Entering debugger...
file-truename: Variable binding depth exceeds max-specpdl-size
Revision history for this message
|
#10 |
Oh, and the JDEE I was using was the Ubuntu .deb package, which is the same version as the tarball I downloaded.
Revision history for this message
|
#11 |
I have checked out the latest sources from the repositories for JDEE and CEDET. Could you please tell me what you enter in your .emacs to setup CEDET and JDEE so I can test here?
Revision history for this message
|
#12 |
(add-to-list 'load-path (expand-file-name "~/elisp/
(add-to-list 'load-path (expand-file-name "~/elisp/
(add-to-list 'load-path (expand-file-name "~/elisp/
(add-to-list 'load-path (expand-file-name "~/elisp/elib"))
(add-to-list 'load-path (expand-file-name "~/elisp/
(add-to-list 'load-path (expand-file-name "~/elisp/
;; Initialize CEDET.
(load-file (expand-file-name "~/elisp/
(setq defer-loading-jde t)
(if defer-loading-jde
(progn
(autoload 'jde-mode "jde" "JDE mode." t)
(setq auto-mode-alist
(append
'
auto-
(require 'jde))
Revision history for this message
|
#13 |
I have just uploaded version 1.48 of nXhtml with a small bug fix that is needed to get it to work with jde-mode. I also made a change so that jde-mode now is the default for the <% ... %> chunks if it is available.
I tried the devel version of CEDET and JDEE and it is possible to get the chunks to have major mode jde-mode.
However I have not tried how it works, since I have not used CEDET or JDEE myself yet. Could you please tell me how it works for you? I would be surprised if there were no buffer local variables to survive when moving between chunks, but I have not looked at what is needed.
Revision history for this message
|
#14 |
It works now (at least in the couple of minutes I played around with it, it did everything I expected)! Although, it didn't work with the CEDET and JDEE packages I downloaded myself. It only worked when I reinstalled the Ubuntu packages (which is perfectly fine by me!)
A couple of things, though.
Doing M-x customize-group RET mumamo RET and selecting Major Modes gives me this error:
Debugger entered--Lisp error: (void-function nil)
nil((command :tag "Major mode") javascript-mode)
widget-
It slipped my mind, but maybe i should mention that I'm using the ubuntu emacs-snapshot 1:20080228-1ubuntu1 package and that I'm set up for a Japansese UTF-8 environment (for Japanese input. I still do everything in English, but I need to input Japanese characters here and there).
I mention this, because with the JDEE and CEDET that weren't from Ubuntu, I was getting this error:
Invalid read syntax: "invalid multibyte form"
This is how I've set up my Japanese environment in my .emacs:
;; Make Japanese the default language
(set-language-
(set-buffer-
(set-default buffer-
(set-default-
(prefer-
(set-default default-
;; Add anthy.el to the load path
(push "/usr/local/
;; Load anthy.el
(load-library "anthy")
;; Set japanese-anthy as the default input-method
(setq default-
;; Use Japanese keyboard key to toggle Japanese input on and off.
(global-set-key [zenkaku-hankaku] 'toggle-
(global-set-key "\C-\\" nil)
Revision history for this message
|
#15 |
Actually, I've found now that I get the "Invalid read syntax: invalid multibyte form" error even when I remove all the Japanese environment stuff.
Revision history for this message
|
#16 |
Hi Angus77, I found the root cause for the customization backtrace issue; see https:/
(require 'ourcomments-