[OS X Emacs] emacs Latex word/expression auto-completion
wishi
brouce at gmx.net
Fri Oct 10 10:46:22 EDT 2008
Hi!
Well... completely lacking. I wouldn't say that. :) No!
I found something interesting:
http://www.emacswiki.org/cgi-bin/emacs-en/CompletionUI
I edited my init files accordingly, after installing it.. and added:
(global-set-key [(tab)] 'smart-tab)
(defun smart-tab ()
"This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, expands it. Else indents the
current line."
(interactive)
(if (minibufferp)
(unless (minibuffer-complete)
(dabbrev-expand nil))
(if mark-active
(indent-region (region-beginning)
(region-end))
(if (looking-at "\\_>")
(dabbrev-expand nil)
(indent-for-tab-command)))))
That's adding non-context aware tab-completion, but by using the
semantic bovinator in competionUI this could be enhanced. I'm not sure
jet how I can do that.
http://www.emacswiki.org/cgi-bin/emacs-en?CategoryCompletion
I read about a popup completion which is context sensitive. Of course by
computer scientific points you can implement this in Lisp... can.
http://nschum.de/src/emacs/company-mode/
This seems to be a very cool approach. I'm nut sure whether is's
Aquamacs or me, being incompatible:
;; add-to-list 'load-path "$PATH")
(require 'company-mode)
(require 'company-bundled-completions)
(company-install-bundled-completions-rules)
In my .emacs this works out, without errors.
http://www.emacswiki.org/cgi-bin/emacs-en/CompanyMode
I'm somehow unsure how to invoke this - the documentation is quite small
I'd say.
At the moment the tab completion saves typing - but I guess I'm doing
some more stuff. Would be a great default implementation in Aquamacs,
because math-folks don't necessary know LISP but like ease and Auctex -
which don't come together very often :)
Thanks,
wishi
Adrian schrieb:
> Hi Wishi,
> You can define abbrevs in emacs that work like auto-completions. However,
> these are not ideal for LaTeX. I used to use AlphaX as a text editor, which
> had a great completions system, and I agree that it's something that Emacs
> seems to be sorely lacking.
>
> For more information about abbrevs, how they work, and how to define them,
> you might check out this chapter in the Emacs manual:
> http://www.cs.utah.edu/dept/old/texinfo/emacs19/emacs_28.html. There is
> also a handy page on how to define your own abbrevs in a file rather than
> defining each one individually at the command line as the Emacs manual
> suggests: http://www.math.umn.edu/~aoleg/emacs/latex.shtml.
>
> A few caveats, however:
> 1) The second reference above is for xemacs, so you might have to change a
> bit of the syntax. I got it mostly working with Aquamacs if you need more
> info.
> 2) Abbrevs beginning with a "\" character don't work! For example, "\a"
> will not expand to "\alpha". Any abbrev beginning with a "\" character
> seems to fail, even those defined at the command line. I sent a message to
> this group yesterday about this problem, but I have yet to hear anything
> back.
>
> Until someone else replies back with a better suggestion (and I really hope,
> for Emacs' sake, that there is a better option), slash-less abbrevs are the
> best I can offer.
>
> Happy TeXing,
> Adrian
>
> 2008/10/9 wishi <brouce at gmx.net>
>
>> Hi fellows!
>>
>> I'm writing lots of math-stuff at the moment, in LaTeX. Auctex in
>> Aquamacs emacs (pre-installed) comes in very handy. But what I'm
>> missing, being not a really sophisticated emacs user: where's something
>> like Tab-Completion for Latex (or other) expressions? Sometimes they are
>> really long ;).
>> I got to know emacs can everything. Well... ;) Can I complete words,
>> just like an IDE can, hitting Tab?
>> If someone knows a nifty default option I can put in my .emacs to enable
>> that by default - would be great.
>>
>> Another question: If I want to create a Tab, to format my source-code a
>> little better, emacs resists doing that. I don't know... seems to be a
>> little wired having 20 matrices. Is there any option to make that
>> possible, too?
>>
>> Thanks in advance,
>> wishi
>>
>> _____________________________________________________________
>> MacOSX-Emacs mailing list
>> MacOSX-Emacs at email.esm.psu.edu
>> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
>> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
>>
>>
>
>
> ------------------------------------------------------------------------
>
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
More information about the MacOSX-Emacs
mailing list