bug-auctex
[Top][All Lists]
Advanced

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

[Bug-AUCTeX] 11.83; folding, fontification and noweb ie Rnw file


From: Patrick Drechsler
Subject: [Bug-AUCTeX] 11.83; folding, fontification and noweb ie Rnw file
Date: Thu, 14 Dec 2006 00:52:42 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061117)

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.

Be sure to consult the FAQ section in the manual before submitting
a bug report.  If the bug (or problem) is triggered by a specific
(La)TeX file, you should try to produce a minimal sample file
showing the problem and include it in your report.

Your bug report will be posted to the AUCTeX bug reporting list.
------------------------------------------------------------------------
Minimal example:

=====================================
\documentclass{article}
\usepackage{graphicx}
\begin{document}
%% don't forget to create a folder named "pics":
\SweaveOpts{prefix.string=pics/delete-me}
\SweaveOpts{echo=FALSE}
\SweaveOpts{width=5, height=5}
\setkeys{Gin}{width=.85\linewidth}
\begin{itemize}
\item When opening the file with emacs, syntax highlighting is not complete
  (TODO: take screenshot).
\item Incorrect folding:
  \begin{enumerate}
  \item Figure environment is folded. OK. This figure environment
contains a
    noweb chunk.
  \item When moving the cursor downward line by line (using the cursor down
    key) things become highlighted correctly (see screenshot TODO: take
    screenshot).
  \item When putting the cursor at the first position of the line
    \verb|[figure]| and then expanding/unfolding it by pressing the
    cursor-right key the figure is unfolded. OK.
  \item Now keep moving the cursor downward until passing the end of
the noweb
    chunk. The figure environment is folded before you can edit
    the figure caption. The only way to edit the caption while using
folding is
    to place the cursor directly after the folded \verb|[figure]| and
moving
    the cursor to the left.
  \end{enumerate}
\end{itemize}

@
<<loaddata, echo=FALSE>>=

x <- c(1:10)
y <- sin(x)

@ %def

@
<<somepic001, fig=TRUE>>=

plot(y~x,
     ylab="foo",
     xlab="bar")

@ %def

\begin{figure}[!tbp]
  \centering
@
<<somepic002, fig=TRUE>>=

y2 <- x+10
boxplot(x,y2,
        boxwex=0.5,
        xlab="foo2",
        ylab="bar2")

@ %def
  \caption{Some caption text.}
  \label{fig:fig002}
\end{figure}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
=====================================

Since fontification is difficult to describe I will refer to screenshots. To suppress the download rate of other people reading this list not interested I am putting these images online.

General problem description:
----------------------------

Folding is buggy when using AUCTeX with noweb mode. Furthermore syntax highlighting is not consistent in noweb mode using auctex.


Steps needed to reproduce the problems:
---------------------------------------

0. A current version of ESS (Emacs Speaks Statistics) from:
http://ess.r-project.org/downloads/ess/
To activate ESS-mode you can copy the ESS section from my init.el file below.

0.1 (optional) To actually run the example through Sweave you will need a working R installation on your system. This is not necessary to reproduce the errors decribed here.

1. Copy above file into a new directory and use a *.Rnw extension such
as "testing.Rnw". Ie ~/tmp/bugreport/testing.Rnw.

2. Create a folder "pics" within that directory (~/tmp/bugreport/pics).

3. Use the parts of my ~/.emacs.d/init.el from below.

4. Start emacs by using "emacs ~/tmp/bugreport/testing.Rnw &".

Figure environment is folded. OK. The displayed figure environment
contains a noweb chunk. Syntax highlighting is not correct.

- screenshot 1 (start): http://tinyurl.com/tx9jv

5. Move cursor downward line by line using the arrow-cursor-down key.

When moving the cursor downward line by line things become highlighted correctly:

- screenshot 2 (before-first-chunk):
        http://tinyurl.com/y6zo34
- screenshot 3 (entering-first-chunk):
        http://tinyurl.com/y6tm5p
- screenshot 4 (after-exiting-second-chunk):
        http://tinyurl.com/udx76

6. When putting the cursor at the first position of the line [figure] (line 47, position 0) and then expanding/unfolding it by pressing the arrow-right key the figure is unfolded. OK. Cursor is on line 47, position 1.

- screenshot 5 (after-entering-figure):
        http://tinyurl.com/y4uxmv

Move the cursor above @ %def (line 57, position 0) and recenter screen with `C-l':

- screenshot 6 (cursor-in-chunk-above-at-def):
        http://tinyurl.com/sq3wv

7. Now move the cursor downward one line using the down-arrow key passing the end of the noweb chunk. The figure environment is collapsed/folded before you can edit the figure caption. Emacs puts me on line 61. The only way to edit the caption while using folding is to place the cursor directly after the folded [figure] and moving the cursor to the left.

- screenshot 7 (cursor-one-more-down):
        http://tinyurl.com/w3hqa


8. The first chunk is highlighted incorrectly, no matter where the cursor is.


Please direct me to the correct address if this question is inappropriate in this list.

BTW: Has anybody else noticed that starting emacs with the option "emacs -fs" when using gnome as window manager really takes up *all* the screen?

init.el (mind the line breaks)
=====================================
====== START INIT.EL FOR BUG REPORT =
=====================================

;;  ============================================================
;; AUCTEX ======================================================
;;  ============================================================

;; this is needed because otherwise auctex will not be loaded:
(cond
 ((file-directory-p "/home/patrick/")
  (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")))
;; the following line loads auctex from original emacs deb install:
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

;; active folding:
(add-hook 'LaTeX-mode-hook (lambda ()
                             (TeX-fold-mode 1)
                             (TeX-fold-buffer)))

;; activate auto-fill-mode:
(add-hook 'LaTeX-mode-hook (lambda ()
                             (turn-on-auto-fill)))

;; activate fill-column length (http://www.gnu.franken.de/ke/emacs/dot-emacs.html):
(defun pd-latex-mode-hook ()
  "LaTeX setup."
  (setq fill-column 79))
(add-hook 'LaTeX-mode-hook 'pd-latex-mode-hook)

;;  ============================================================
;; REFTEX ======================================================
;;  ============================================================
(setq reftex-plug-into-AUCTeX t)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode

;; from the RefTeX manual:
(setq reftex-use-external-file-finders t)
(setq reftex-external-file-finders
      '(("tex" . "kpsewhich -format=.tex %f")
        ("bib" . "kpsewhich -format=.bib %f")))

;; As a summary, here are the settings I recommend for heavy use of
;; RefTeX with large documents:
(setq reftex-enable-partial-scans t
      reftex-save-parse-info t
      reftex-use-multiple-selection-buffers t)

;; (setq reftex-bibpath-environment-variables
;;       '("/home/patrick/data/uni/literature/bibtex-files/"))

;;; done in section sweave below:
;; ;; Reftex and Noweb files:
;; (setq reftex-file-extensions
;;       '(("Rnw" ".Rnw" "nw" "tex" ".tex" ".ltx") ("bib" ".bib")))
;; (setq TeX-file-extensions
;;       '("Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))

(eval-after-load "ispell"
  '(let ((list (car ispell-tex-skip-alists)))
     (add-to-list 'list '("\\\\cite[tpk]" ispell-tex-arg-end))
     (setcar ispell-tex-skip-alists list)))

(eval-after-load "ispell"
  '(let ((list (car ispell-tex-skip-alists)))
     (add-to-list 'list '("\\\\citeal[tp]" ispell-tex-arg-end))
     (setcar ispell-tex-skip-alists list)))

;;  ============================================================
;; ESS =========================================================
;;  ============================================================
(cond
 ((file-directory-p "C:/Programme")
  ; do Windows stuff:
  (setq-default inferior-R-program-name "C:/Programme/R/R-2.4.0/bin/Rterm")
  )
 ((file-directory-p "/home/patrick/")
  ; do GNU/Linux stuff
  )
)

(load "~/.emacs.d/mysitelisp/ess/ess-5.3.3/lisp/ess-site")

(cond
 ((file-directory-p "C:/Programme")
  ; do Windows stuff:
  )
 ((file-directory-p "/home/patrick/")
  ;; do GNU/Linux stuff
  ;; From Martin Maechler <address@hidden>:
  (eval-after-load "comint" '(progn
                               (setq comint-scroll-to-bottom-on-output 'others)
                               ;; (setq comint-scroll-show-maximum-output t) ; 
I find jumpy
                               (define-key comint-mode-map [up]
                                 'comint-previous-matching-input-from-input)
                               (define-key comint-mode-map [down]
                                 'comint-next-matching-input-from-input)
                               (define-key comint-mode-map "\C-a"
                                 'comint-bol-or-process-mark)))

  )
)

;;  ============================================================
;; SWEAVE ======================================================
;;  ============================================================
;; Sweave mode:
(defun Rnw-mode ()
  (require 'ess-noweb)
  (noweb-mode)
  (if (fboundp 'R-mode)
      (setq noweb-default-code-mode 'R-mode)))
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
(add-to-list 'auto-mode-alist '("\\.Snw\\'" . Rnw-mode))

(setq reftex-file-extensions
      '(("Snw" "Rnw" "nw" "tex" ".tex" ".ltx") ("bib" ".bib")))
(setq TeX-file-extensions
      '("Snw" "Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
(setq reftex-try-all-extensions t)

;; auto-fill-mode for noweb files:
(add-hook 'noweb-mode-hook (lambda ()
                             (turn-on-auto-fill)))

;; set column fill length:
(defun pd-noweb-mode-hook ()
  (setq fill-column 79)) ; where auto-fill should wrap
(add-hook 'noweb-mode-hook 'pd-noweb-mode-hook)


;;;; I have this in my customize section:

;;  ============================================================
;; STUFF I'VE EXCLUDED FROM CUSTOMIZE WINDOWS <-> GNU/LINUX ====
;;  ============================================================

(cond
 ((file-directory-p "C:/Programme")
  ;; do Windows stuff:
  ;; Windows:
;;[...]
  )
 ((file-directory-p "/home/patrick/")
  ;; GNU/Linux:
;;[...]
(setq safe-local-variable-values (quote ((TeX-master . "carausius-fluid") (TeX-master . "../../main") (TeX-master . "../main") (TeX-master . "../pd_thesis") (TeX-master . "../../../pd_thesis") (TeX-master . t) (TeX-command-default . "make pdf") (TeX-master . "../mythesis") (TeX-master . "pd_thesis") (TeX-master . "plan") (TeX-master . "../../pd_thesis"))))
  ;(setq uniquify-buffer-name-style (quote forward) nil (uniquify))
  )
)

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(LaTeX-math-menu-unicode t)
 '(TeX-DVI-via-PDFTeX t)
 '(TeX-PDF-mode t)
'(TeX-command-list (quote (("TeX" "%(PDF)%(tex) %S%(PDFout) \"%(mode)\\input %t\"" TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX") ("LaTeX" "%l \"%(mode)\\input{%t}\"" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "%(PDF)amstex %S%(PDFout) \"%(mode)\\input %t\"" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt" "texexec --once --texutil %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ("View" "%V" TeX-run-discard t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help "Generate PostScript file") ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command") ("ps4pdf" "ps4pdf %s" TeX-run-command nil t :help "Run ps4pdf on file")))) '(TeX-fold-env-spec-list (quote (("[noweb]" ("noweb")) ("[comment]" ("comment")) ("[figure]" ("figure")) ("[table]" ("table"))))) '(TeX-fold-macro-spec-list (quote (("[f]" ("footnote")) (1 ("cite" "citep" "citet" "citealp" "citealt")) ("[l]" ("label")) (1 ("ref" "pageref" "fref" "Fref" "vref" "Vref" "vpageref")) ("[i]" ("index")) ("*" ("item")) ("..." ("dots")) (1 ("part" "chapter" "section" "subsection" "subsubsection" "paragraph" "subparagraph" "part*" "chapter*" "section*" "subsection*" "subsubsection*" "paragraph*" "subparagraph*" "emph" "textit" "textsl" "textmd" "textrm" "textsf" "texttt" "textbf" "textsc" "textup")) (2 ("vrefrange")))))
 '(TeX-one-master "\\.\\(texi?\\|dtx\\|Rnw\\)$")
 '(column-number-mode t)
 '(display-time-24hr-format t)
 '(display-time-mode t)
 '(inferior-R-args "--no-save --no-restore")
 '(iswitchb-mode t)
 '(pc-selection-mode t nil (pc-select))
 '(show-paren-mode t)
 '(transient-mark-mode t)
======= END INIT.EL CUSTOMIZE ======

=====================================
======= EOF INIT.EL FOR BUG REPORT ==
=====================================


Emacs  : GNU Emacs 22.0.91.14 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2006-12-12 on trurl
Package: 11.83

current state:
==============
(setq
 AUCTeX-date "2006-06-07"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("style" "auto"
"/home/patrick/data/uni/literature/bibtex-files/style"
                  "/home/patrick/data/uni/literature/bibtex-files/auto"
                  "/usr/local/share/emacs/site-lisp/auctex/style" 
"/usr/local/var/auctex")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master nil
 TeX-command-list '(("TeX" "%(PDF)%(tex) %S%(PDFout) \"%(mode)\\input
%t\"" TeX-run-TeX nil
                     (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain 
TeX")
                    ("LaTeX" "%l \"%(mode)\\input{%t}\"" TeX-run-TeX nil 
(latex-mode
doctex-mode)
                     :help "Run LaTeX")
                    ("Makeinfo" "makeinfo %t" TeX-run-compile nil 
(texinfo-mode) :help
                     "Run Makeinfo with Info output")
                    ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil
(texinfo-mode) :help
                     "Run Makeinfo with HTML output")
                    ("AmSTeX" "%(PDF)amstex %S%(PDFout) \"%(mode)\\input %t\""
TeX-run-TeX nil
                     (ams-tex-mode) :help "Run AMSTeX")
                    ("ConTeXt" "texexec --once --texutil %(execopts)%t" 
TeX-run-TeX nil
                     (context-mode) :help "Run ConTeXt once")
                    ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil
(context-mode) :help
                     "Run ConTeXt until completion")
                    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run 
BibTeX")
                    ("View" "%V" TeX-run-discard t t :help "Run Viewer")
                    ("Print" "%p" TeX-run-command t t :help "Print the file")
                    ("Queue" "%q" TeX-run-background nil t :help "View the 
printer
queue" :visible
                     TeX-queue-command)
                    ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help
                     "Generate PostScript file")
                    ("Index" "makeindex %s" TeX-run-command nil t :help "Create 
index
file")
                    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help
                     "Check LaTeX file for correctness")
                    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil 
t :help
                     "Spell-check the document")
                    ("Clean" "TeX-clean" TeX-run-function nil t :help
                     "Delete generated intermediate files")
                    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
                     "Delete generated intermediate and output files")
                    ("Other" "" TeX-run-command t t :help "Run an arbitrary 
command")
                    ("ps4pdf" "ps4pdf %s" TeX-run-command nil t :help "Run 
ps4pdf on
file"))
 )








reply via email to

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