[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] auto-fill and tabular environments

From: Brett Presnell
Subject: [AUCTeX] auto-fill and tabular environments
Date: Wed, 17 Nov 2010 11:15:43 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

I have auto-fill turned on automatically in text modes like LaTeX.  However, I
often find myself editing fairly wide tables and I would like to have auto-fill
automatically turned off when the point is a tabular environment.

Is there any easy way to accomplish this?

For the record, the default for LaTeX-indent-environment-list includes
("tabular") and ("tabular*") and I did try changing these to ("tabular"
current-indentation) and ("tabular*" current-indentation).  I didn't
expect this to defeat auto-fill and it doesn't, but I thought I should
mention that I had tried it anyway.

PS: As is pointed out in the auctex manual, align-current is very useful
when editing tabular environemnts, but it has the negative effect of
losing the position of the point.  This bothered me enough that I
finally added the following to my .emacs and I thought that someone else
might find it handy as well.  I would appreciate any comments on how
this can or should be improved (I feel a bit queasy about stealing the
register P for example).

;; Align current environment without losing the point.  Mapped to C-cC-a.
;; Mainly used for the tabular and tabular* environments.
(defun LaTeX-align-current-environment ()
  (point-to-register ?P)
  (jump-to-register ?P))
(add-hook 'LaTeX-mode-hook
  (lambda ()
   (define-key LaTeX-mode-map "\C-c\C-a" 'LaTeX-align-current-environment)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]