[Top][All Lists]

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

[AUCTeX] Patch on latex.el / LaTeX-mark-environment

From: Vincent Belaïche
Subject: [AUCTeX] Patch on latex.el / LaTeX-mark-environment
Date: Thu, 17 Jul 2008 22:47:42 +0200
User-agent: Thunderbird (Windows/20080421)

Dear Ralf,

Sorry for the very very long delay: as far as I understood a patch is just a unified diff file between modified file and latest version. I downloaded the latest latex.el version from the CVS Web interface (this is the version you have modified about 116 minutes ago. And I made the difference file as follows: (../auctex.patch/latex.el is the modified one).
I had some hard time keeping it within 12 +lines.
Sorry for having been too lazy for installing CVS on my machine, and making things properly with the Emacs 'C-x v ='. I hope that the command line "diff -u" result is usable without effort by you, otherwise please feel free to make me know.

-------------------------- patch below ----------------------------------
diff -u latex.el ../auctex.patch/latex.el
--- latex.el    Thu Jul 17 20:21:41 2008
+++ ../auctex.patch/latex.el    Thu Jul 17 20:37:58 2008
@@ -3344,17 +3344,24 @@
    (or (= level 0)
    (error "Can't locate beginning of current environment"))))

-(defun LaTeX-mark-environment ()
+(defun LaTeX-mark-environment (&optional count)
  "Set mark to end of current environment and point to the matching begin.
+If passed a prefix argument COUNT, mark the outer environnment by COUNT levels.
+Example: if point is --!-- and COUNT=2, env1 is the marked environment.
+    \\begin{env1} \\begin{env2} --!-- \\begin{env2} \\begin{env1}
Will not work properly if there are unbalanced begin-end pairs in
comments and verbatim environments"
-  (interactive)
-  (let ((cur (point)))
-    (LaTeX-find-matching-end)
+  (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)
-    (LaTeX-find-matching-begin)
+    (dotimes (c count) (LaTeX-find-matching-begin))

(defun LaTeX-fill-environment (justify)

reply via email to

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