summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Belaïche <vincentb1@users.sourceforge.net>2012-11-25 06:05:34 +0100
committerVincent Belaïche <vincentb1@users.sourceforge.net>2012-11-25 06:05:34 +0100
commite2cb57f5f5794d75cd237e2d6ec2b4d16157c2cd (patch)
tree0f863f509fe1c2ea0ed8d1b3e3fdf0a0b5d49dfd
parent1c4f115d4c4eb1aa71c25d21e8bdec2f8da97700 (diff)
downloademacs-e2cb57f5f5794d75cd237e2d6ec2b4d16157c2cd.tar.gz
* textmodes/reftex-parse.el (reftex-parse-from-file): Use variable reftex-section-info-function in order to be compatible with Texinfo integration.
* textmodes/reftex.el (reftex-section-pre-regexp, reftex-section-post-regexp, reftex-section-info-function): New variable. (reftex-compile-variables): Use variables reftex-section-pre-regexp, reftex-section-post-regexp, and reftex-section-info-function in order to be compatible with Texinfo integration. * textmodes/reftex-toc.el (reftex-toc-promote-action): use reftex-section-pre-regexp variable in order to be compatible with Texinfo integration.
-rw-r--r--lisp/ChangeLog17
-rw-r--r--lisp/textmodes/reftex-parse.el2
-rw-r--r--lisp/textmodes/reftex-toc.el2
-rw-r--r--lisp/textmodes/reftex.el24
4 files changed, 34 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2e7e6c5be50..f0a487370d3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,20 @@
+2012-11-24 Vincent Belaïche <vincentb1@users.sourceforge.net>
+
+ * textmodes/reftex-parse.el (reftex-parse-from-file): Use variable
+ reftex-section-info-function in order to be compatible with
+ Texinfo integration.
+
+ * textmodes/reftex.el (reftex-section-pre-regexp)
+ (reftex-section-post-regexp, reftex-section-info-function): New
+ variable.
+ (reftex-compile-variables): Use variables
+ reftex-section-pre-regexp, reftex-section-post-regexp, and
+ reftex-section-info-function in order to be compatible with Texinfo integration.
+
+ * textmodes/reftex-toc.el (reftex-toc-promote-action): use
+ reftex-section-pre-regexp variable in order to be compatible with
+ Texinfo integration.
+
2012-11-25 Chong Yidong <cyd@gnu.org>
* faces.el: Make face-spec-set more analogous to setq.
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 791b5d7b945..7169e70d6c4 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -251,7 +251,7 @@ of master file."
;; the next parsing iteration.
(when (eq (char-before) ?\\) (backward-char))
;; Insert in List
- (setq toc-entry (reftex-section-info file))
+ (setq toc-entry (funcall reftex-section-info-function file))
(when toc-entry
;; It can happen that section info returns nil
(setq level (nth 5 toc-entry))
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 4f73322d3f5..eec15be4d83 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -785,7 +785,7 @@ PRO-OR-DE is assumed to be dynamically scoped into this function."
(marker (nth 4 data)))
(with-current-buffer (marker-buffer marker)
(goto-char (marker-position marker))
- (if (looking-at (concat "\\([ \t]*\\\\\\)" (regexp-quote name)))
+ (if (looking-at (concat "\\([ \t]*" reftex-section-pre-regexp "\\)" (regexp-quote name)))
(replace-match (concat "\\1" newname))
(error "Fatal error during %smotion" pro-or-de)))))
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index bdee0fcf1d4..dfbeda38fd9 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -301,7 +301,9 @@ on the menu bar.
(modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
- (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
+ (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib)
+
+ (run-hooks 'reftex-mode-hook))
;; Mode was turned off
(easy-menu-remove reftex-mode-menu)))
@@ -664,6 +666,16 @@ will deactivate it."
(defvar reftex-find-label-regexp-format nil)
(defvar reftex-find-label-regexp-format2 nil)
+;; Constants for making RefTeX open to Texinfo hooking
+(defvar reftex-section-pre-regexp "\\\\")
+;; Including `\' as a character to be matched at the end of the regexp
+;; will allow stuff like \begin{foo}\label{bar} to be matched. This
+;; will make the parser to advance one char too much. Therefore
+;; `reftex-parse-from-file' will step one char back if a section is
+;; found.
+(defvar reftex-section-post-regexp "\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n\\]")
+(defvar reftex-section-info-function 'reftex-section-info)
+
(defvar reftex-memory nil
"Memorizes old variable values to indicate changes in these variables.")
@@ -1083,16 +1095,10 @@ This enforces rescanning the buffer on next use."
reftex-include-file-commands "\\|")
"\\)[{ \t]+\\([^} \t\n\r]+\\)"))
(section-re
- ;; Including `\' as a character to be matched at the end
- ;; of the regexp will allow stuff like
- ;; \begin{foo}\label{bar} to be matched. This will make
- ;; the parser to advance one char too much. Therefore
- ;; `reftex-parse-from-file' will step one char back if a
- ;; section is found.
- (concat wbol "\\\\\\("
+ (concat wbol reftex-section-pre-regexp "\\("
(mapconcat (lambda (x) (regexp-quote (car x)))
reftex-section-levels-all "\\|")
- "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n\\]"))
+ "\\)" reftex-section-post-regexp))
(appendix-re (concat wbol "\\(\\\\appendix\\)"))
(macro-re
(if macros-with-labels