* Ralf Angeli (2005-05-05) writes:
> Agreed. As we traditionally alter point (e.g. in figure environments
> it will be placed inside the environment before the caption), it will
> be better to change the position of mark as well, i.e. to push a new
> mark onto the mark ring.
Argh! This will break functions all over the board which call
`LaTeX-insert-item' after `LaTeX-insert-environment' if one does not
explicitely deactivate the mark. The mark could be deactivated in
`LaTeX-insert-item' but this will of course take away the possibility
to use an active selection as optional argument for \item. But
looking at the current code, implementing something like this does not
seem feasible anyway. Ugh, unless I can find a solution I am
confident with, I tend to keep my hands off of this. A patch is
attached if somebody is interested in it.
--
Ralf
Index: latex.el
===================================================================
RCS file: /cvsroot/auctex/auctex/latex.el,v
retrieving revision 5.365
diff -u -r5.365 latex.el
--- latex.el 30 Apr 2005 22:43:59 -0000 5.365
+++ latex.el 5 May 2005 10:19:11 -0000
@@ -600,10 +600,15 @@
"Insert LaTeX ENVIRONMENT with optional argument EXTRA."
(let ((active-mark (and (TeX-active-mark)
(not (eq (mark) (point)))))
- comment-flag prefix)
+ start-marker end-marker comment-flag prefix)
(when active-mark
- (if (< (mark) (point))
- (exchange-point-and-mark)))
+ (if (> (mark) (point))
+ (progn
+ (setq start-marker (copy-marker (point) t))
+ (setq end-marker (copy-marker (mark))))
+ (setq start-marker (copy-marker (mark) t))
+ (setq end-marker (copy-marker (point)))
+ (goto-char (mark))))
(unless (TeX-looking-at-backward
(if (and LaTeX-insert-into-comments
(TeX-in-commented-line)
@@ -615,7 +620,7 @@
;; Do this before we insert anything which might alter the prefix.
(when active-mark
(save-excursion
- (goto-char (mark))
+ (goto-char end-marker)
(unless (progn (skip-chars-forward " \t") (eolp))
;; Use `(insert "\n")' instead of `(newline)' because in contrast
;; to Emacs, XEmacs moves the mark if `newline' is used.
@@ -632,7 +637,7 @@
(LaTeX-newline)
(if active-mark
(progn
- (goto-char (mark))
+ (goto-char end-marker)
(unless (TeX-looking-at-backward
(if (and LaTeX-insert-into-comments
(TeX-in-commented-line)
@@ -649,7 +654,8 @@
(if active-mark
(or (assoc environment LaTeX-indent-environment-list)
(LaTeX-fill-environment nil))
- (indent-according-to-mode)))
+ (indent-according-to-mode))
+ (push-mark (marker-position start-marker)))
(TeX-math-input-method-off))
(defun LaTeX-modify-environment (environment)
@@ -1074,6 +1080,7 @@
"Insert a new item in an environment.
You may use `LaTeX-item-list' to change the routines used to insert the item."
(interactive "*")
+ (deactivate-mark)
(let ((environment (LaTeX-current-environment)))
(LaTeX-newline)
(if (assoc environment LaTeX-item-list)
_______________________________________________
bug-auctex mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-auctex