unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* The correct patch
@ 2005-03-29 20:53 Olive
  2005-03-29 22:14 ` Karl Berry
  0 siblings, 1 reply; 3+ messages in thread
From: Olive @ 2005-03-29 20:53 UTC (permalink / raw)
  Cc: karl

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

I submited a patch to correct the fact that the standard tex-mode fails 
for files containing special characters. I submited here the correct (I 
hope) patch (I have forget a few things in the last patch). I have also 
correct a bug which prevent tex-region to work.

In this patch I have replaced the call to "comint-quote-argument" with 
"shell-quote-argument" which I think is much better.

Note that some implementation of tex fails for files containing special 
characters (TeTeX for instance); in this case nothing can be done in emacs.

This patch is (I think) of some importance for user of MS-Windows due to 
the spaces present in "Documents and Settings") (I have not tested in 
under Windows myself; I much prefer GNU/Linux).

I am currenctly implementating forward and inverse search with the 
standard TeX mode. This is not in this patch (since it does not correct 
a bug) but if someone is interested, just mail me (and please don't tell 
me to use auctex).

Olive

[-- Attachment #2: tex-mode.el.patch --]
[-- Type: text/x-patch, Size: 2590 bytes --]

*** tex-mode.el.orig	2005-03-29 22:17:07.000000000 +0200
--- tex-mode.el	2005-03-29 22:23:30.000000000 +0200
***************
*** 781,787 ****
    (setq tex-command latex-run-command)
    (setq tex-start-of-header "\\\\document\\(style\\|class\\)")
    (setq tex-end-of-header "\\\\begin\\s-*{document}")
!   (setq tex-trailer "\\end\\s-*{document}\n")
    ;; A line containing just $$ is treated as a paragraph separator.
    ;; A line starting with $$ starts a paragraph,
    ;; but does not separate paragraphs if it has more stuff on it.
--- 781,787 ----
    (setq tex-command latex-run-command)
    (setq tex-start-of-header "\\\\document\\(style\\|class\\)")
    (setq tex-end-of-header "\\\\begin\\s-*{document}")
!   (setq tex-trailer "\\end{document}\n")
    ;; A line containing just $$ is treated as a paragraph separator.
    ;; A line starting with $$ starts a paragraph,
    ;; but does not separate paragraphs if it has more stuff on it.
***************
*** 1352,1359 ****
  	    (concat
  	     (if file
  		 (if star (concat (substring cmd 0 star)
! 				  file (substring cmd (1+ star)))
! 		   (concat cmd " " file))
  	       cmd)
  	     (if background "&" ""))))
        ;; Switch to buffer before checking for subproc output in it.
--- 1352,1359 ----
  	    (concat
  	     (if file
  		 (if star (concat (substring cmd 0 star)
! 				  (shell-quote-argument file) (substring cmd (1+ star)))
! 		   (concat cmd " " (shell-quote-argument file)))
  	       cmd)
  	     (if background "&" ""))))
        ;; Switch to buffer before checking for subproc output in it.
***************
*** 1444,1456 ****
           (compile-command
            (if star
  	      (concat (substring command 0 star)
! 		      (comint-quote-filename file)
  		      (substring command (1+ star)))
              (concat command " "
  		    (if (< 0 (length tex-start-options-string))
  			(concat
  			 (shell-quote-argument tex-start-options-string) " "))
! 		    (comint-quote-filename file)))))
      (tex-send-tex-command compile-command dir)))
  
  (defun tex-send-tex-command (cmd &optional dir)
--- 1444,1456 ----
           (compile-command
            (if star
  	      (concat (substring command 0 star)
! 		      (shell-quote-argument file)
  		      (substring command (1+ star)))
              (concat command " "
  		    (if (< 0 (length tex-start-options-string))
  			(concat
  			 (shell-quote-argument tex-start-options-string) " "))
! 		    (shell-quote-argument file)))))
      (tex-send-tex-command compile-command dir)))
  
  (defun tex-send-tex-command (cmd &optional dir)

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The correct patch
  2005-03-29 20:53 Olive
@ 2005-03-29 22:14 ` Karl Berry
  0 siblings, 0 replies; 3+ messages in thread
From: Karl Berry @ 2005-03-29 22:14 UTC (permalink / raw)
  Cc: bug-gnu-emacs

    In this patch I have replaced the call to "comint-quote-argument" with 
    "shell-quote-argument" which I think is much better.

That part seems fine, but can you explain this part of the patch?

!   (setq tex-trailer "\\end\\s-*{document}\n")
--- 781,787 ----
!   (setq tex-trailer "\\end{document}\n")

I'm not saying it's wrong, just want to understand it, and it seems
faster to ask you than research it from scratch :).  I see
tex-end-of-header has the \\s-*.

Thanks,
karl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The correct patch
@ 2005-03-29 22:36 Olive
  0 siblings, 0 replies; 3+ messages in thread
From: Olive @ 2005-03-29 22:36 UTC (permalink / raw)


Karl Berry wrote:

 >     In this patch I have replaced the call to "comint-quote-argument" 
with     "shell-quote-argument" which I think is much better.
 >
 > That part seems fine, but can you explain this part of the patch?
 >
 > !   (setq tex-trailer "\\end\\s-*{document}\n")
 > --- 781,787 ----
 > !   (setq tex-trailer "\\end{document}\n")


tex-trailer is the string to insert at the end of a region to build the 
temporary file to compile. It is not a regular expression to search; 
just a normal string to insert.

 >
 > I'm not saying it's wrong, just want to understand it, and it seems
 > faster to ask you than research it from scratch :).  I see
 > tex-end-of-header has the \\s-*.


Yes, tex-end-of-header is the string to search in the origial document 
to find the \begin{document}: this is a regular expression.

To answer your previous question, my version of TeX fail with filename 
with space (I says it fails as is, I have not tried to play with the 
catcode) but I know that miktex is fine with. But as you says this is 
off topic.

[oesser@pcolivier ~]$ latex "this is a try.tex"
This is TeX, Version 3.14159 (Web2C 7.4.5)
! I can't find file `this'.
<*> this
          is a try.tex
Please type another input file name:

Sincerely,

Olive

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-29 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-29 22:36 The correct patch Olive
  -- strict thread matches above, loose matches on Subject: below --
2005-03-29 20:53 Olive
2005-03-29 22:14 ` Karl Berry

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).