|
From: | Vincent Belaïche |
Subject: | [AUCTeX] Contribution |
Date: | Mon, 5 May 2008 06:05:32 +0200 |
Hello, To mark as region an environment I find it slightly more convenient in some case if you can pass a numeric argument to LaTeX-mark-environment to tell it how many level upwards the environment to be selected is. Here is how I suggest to modify latex.el (the old code is commented out) : -------------------------------------------------------------------------- ;- (defun LaTeX-mark-environment () ;- "Set mark to end of current environment and point to the matching begin. ;- Will not work properly if there are unbalanced begin-end pairs in ;- comments and verbatim environments" ;- (interactive) ;- (let ((cur (point))) ;- (LaTeX-find-matching-end) ;- (beginning-of-line 2) ;- (set-mark (point)) ;- (goto-char cur) ;- (LaTeX-find-matching-begin) ;- (TeX-activate-region))) ;- (defun LaTeX-mark-environment (&optional count) "Set mark to end of current environment and point to the matching begin. If passed a prefix argument N will mark the outer environnment by N level, not passing any prefix being equivalent to N=1. For instance if is point is at the position of the * below and prefix argument 2 is passed then the marked environment is env2. \\begin{env1} \\begin{env2} \\begin{env4} \\end{env4} \\begin{env3} *point \\end{env3} \\begin{env2} \\end{env1} Will not work properly if there are unbalanced begin-end pairs in comments and verbatim environments" (interactive "p") (unless count (seq count 1)) (let ( (cur (point))) (unless (> count 0) (error "invalid prefix arg, expects a positive number")) (dotimes (c count) (LaTeX-find-matching-end) ) (beginning-of-line 2) (set-mark (point)) (goto-char cur) (dotimes (c count) (LaTeX-find-matching-begin) ) (TeX-activate-region)) ) Plus de 15 millions de français utilisent Windows Live Messenger ! Téléchargez Messenger, c'est gratuit ! |
[Prev in Thread] | Current Thread | [Next in Thread] |