[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] Contribution to AUCTeX
From: |
Vincent Belaïche |
Subject: |
[AUCTeX] Contribution to AUCTeX |
Date: |
Sun, 30 May 2010 07:20:58 +0200 |
Hello,
Here is a contribution to AUCTeX, this is to add the mark-environement
to the Texinfo mode.
Vincent.
PS--1: I also took the opportunity of this change to optimize the
regexp. I know that it is bad practice to make two changes in the same
patch, but that seemed so minor to me, that I could not resist the
temptation.
PS-0: I had to make tricks with beginning-of-line, because
Texinfo-find-env-end and Texinfo-find-env-start do not work axactly the
same way as LaTeX-find-matching-end and LaTeX-find-matching-beginning. I
don't know whether this is the good way, or it would have been
preferable to align Texinfo-find-env-end and Texinfo-find-env-start on
the LaTeX way.
PS-1: I had indicated a bug with Texinfo some while ago ([Bug-AUCTeX]
Can't TeX-font on latex2e.texi). Latest mail was on (2010-04-30). Sorry
I cannot reproduce that me too now. I don't know what really happened
now, when I debugged it, there was some style hook breaking
TeX-font-list with the LaTeX one, but now it works fine. sorry for the
disturbance I caused.
PS-2: Ralf, I realize that I had never answer to your question:
> By the way, which email address did you use for the assignment.
> Hotmail or Gmail? (I've used the Gmail address for the ChangeLog
> entry for now.)
Well, frankly speaking that was so long a time ago that I don't remember
which one I used in the assignment. I usually use the hotmail address
for mailing lists, and the following address (mapped to the gmail
address) for Changelogs: (format "vincentb1%cusers%csourceforge%cnet" 64
46 46). FYI, I read
my gmail significantly more often than my hotmail.
*** tex-info.el.old Sat Jun 27 21:08:15 2009
--- c:/Programme/GNU/emacs-extension/lisp/auctex/tex-info.el Sun May 30
04:52:03 2010
***************
*** 55,61 ****
(defconst texinfo-environment-regexp
;; Overwrite version from `texinfo.el'.
(concat "address@hidden("
! (mapconcat 'car Texinfo-environment-list "\\|")
"\\|end\\)\\>")
"Regexp for environment-like Texinfo list commands.
Subexpression 1 is what goes into the corresponding address@hidden'
statement.")
--- 55,61 ----
(defconst texinfo-environment-regexp
;; Overwrite version from `texinfo.el'.
(concat "address@hidden("
! (regexp-opt (mapcar 'car Texinfo-environment-list)) "\\|")
"\\|end\\)\\>")
"Regexp for environment-like Texinfo list commands.
Subexpression 1 is what goes into the corresponding address@hidden'
statement.")
***************
*** 152,157 ****
--- 152,185 ----
(goto-char (match-beginning 0))
(error "Can't locate start of current environment")))))
+
+
+ (defun Texinfo-mark-environment (&optional count)
+ "Set mark to end of current environment and point to the matching begin.
+ If prefix argument COUNT is given, mark the respective number of
+ enclosing environments. The command will not work properly if
+ there are unbalanced begin-end pairs in comments and verbatim
+ environments."
+ (interactive "p")
+ (setq count (if count (abs count) 1))
+ (let ((cur (point)) beg end)
+ ;; Only change point and mark after beginning and end were found.
+ ;; Point should not end up in the middle of nowhere if the search fails.
+ (save-excursion
+ (dotimes (c count)
+ (Texinfo-find-env-end)
+ (beginning-of-line 2))
+ (setq end (line-beginning-position))
+ (goto-char cur)
+ (dotimes (c count)
+ (Texinfo-find-env-start)
+ (unless (= (1+ c) count)
+ (beginning-of-line 0)))
+ (setq beg (point)))
+ (set-mark end)
+ (goto-char beg)
+ (TeX-activate-region)))
+
(defun Texinfo-insert-node ()
"Insert a Texinfo node in the current buffer.
That means, insert the string address@hidden' and prompt for current,
***************
*** 223,228 ****
--- 251,257 ----
;; Simulating LaTeX-mode
(define-key map "\C-c\C-e" 'Texinfo-environment)
+ (define-key map "\C-c." 'Texinfo-mark-environment)
(define-key map "\C-c\n" 'address@hidden)
(or (key-binding "\e\r")
(define-key map "\e\r" 'address@hidden)) ;*** Alias
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX] Contribution to AUCTeX,
Vincent Belaïche <=