Molitor, Stephen wrote:
> I'd like to turn off the 'if' abbreviation everywhere, including
comments.
> Thanks to Paul K, I've got jde-gen-cflow-if turned of, so if
doesn't expand
> in Java code. However, inside a comment, 'If' expands to 'if'
(lower case).
> There's some messages in the mail archive about why this is so;
I'd just
> like to turn 'if' off completely. When I run 'list-abbrevs' from
a buffer
> in jde-mode, I don't see 'if' listed. How do I turn 'if'
expansion off,
> even in comments?
>
Not exactly a solution, but it works for me:
I don't like the "electric" behavior of the abbreviations, but want
to use the the cflow abbreviations explicitly, on key press.
Therefore I normally disable abbrev-mode and map a key to
expand-abbrev. This gives you the best of both worlds.
I found that JDEE initializes the the abbrev-tables only when
jde-enable-abbrev-mode ist true. So I enabled it, but I'm turning
off abbrev-mode in jde-entering-java-buffer-hook.
Here's how to do it:
customize-variable jde-entering-java-buffer-hook and
insert disable-abbrev-mode. Put following into your .emacs:
;; Is there a way I can enter a function with arguments into the
;; customize form of jde-entering-java-buffer-hook?
;; ... define a wrapper.
(defun disable-abbrev-mode ()
"unconditionally disable abbref-mode"
(interactive)
(abbrev-mode 0))
(global-set-key [(control return)] 'expand-abbrev)
Another nice snippet, if you like completition on tab
like in a shell:
;; work best if you have set jde-complete-use-menu to nil
(require 'hippie-exp)
(defun my-indent-complete (arg)
"A special indent/complete function"
(interactive "p")
(if zmacs-region-active-p
(indent-region (mark) (point) nil)
(if (save-excursion (skip-chars-backward " \t") (not (bolp)))
(if (equal major-mode 'jde-mode)
(jde-complete-at-point-menu)
;; or if you use Xrefactory
;;
(xref-completion (point))
(hippie-expand arg))
(indent-for-tab-command))))
(global-set-key [(tab)] 'my-indent-complete)
(define-key text-mode-map [(tab)] 'my-indent-complete)
Cheers, Ole
--
Ole Arndt http://www.tivano.de/