all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch for tex-mode.el (more compatibility with AUCTeX)
@ 2004-11-27 23:40 Markus Rost
  2004-11-28 11:47 ` David Kastrup
  2004-11-29  6:11 ` Richard Stallman
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Rost @ 2004-11-27 23:40 UTC (permalink / raw)


Currently tex-mode supports the variable TeX-master (from AUCTeX) if
it is a string.  See lines 1694-1698 in tex-mode.el.  I suggest to
support the variable TeX-master also if it is set to 't.  In that case
the "master" of the file is the file itself, so the right thing is to
run TeX on the buffer's file.  What about the following patch for
tex-mode.el?  Stefan?

I have a bunch of old .tex files which have Local Variable sections
created by AUCTeX.  The patch would make tex-mode handle those files
better.


	* textmodes/tex-mode.el (tex-main-file): Add a compatibility with
	AUCTeX.


===Buffer *vc-diff*=========================================
*** tex-mode.el.~1.150.~	Mon Oct 25 16:35:24 2004
--- tex-mode.el	Sat Nov 27 18:20:28 2004
***************
*** 1700,1709 ****
  		   (if (not buffer-file-name)
  		       (error "Buffer is not associated with any file")
  		     (file-relative-name
! 		      (if (save-excursion
! 			    (goto-char (point-min))
! 			    (re-search-forward tex-start-of-header
! 					       (+ (point) 10000) t))
  			  ;; This is the main file.
  			  buffer-file-name
  			;; This isn't the main file, let's try to find better,
--- 1700,1713 ----
  		   (if (not buffer-file-name)
  		       (error "Buffer is not associated with any file")
  		     (file-relative-name
! 		      (if (or
! 			   ;; Compatibility with AUCTeX.
! 			   (with-no-warnings
! 			    (and (boundp 'TeX-master) (eq TeX-master t)))
! 			   (save-excursion
! 			     (goto-char (point-min))
! 			     (re-search-forward tex-start-of-header
! 						(+ (point) 10000) t)))
  			  ;; This is the main file.
  			  buffer-file-name
  			;; This isn't the main file, let's try to find better,
============================================================

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

* Re: Patch for tex-mode.el (more compatibility with AUCTeX)
  2004-11-27 23:40 Patch for tex-mode.el (more compatibility with AUCTeX) Markus Rost
@ 2004-11-28 11:47 ` David Kastrup
  2004-11-29  6:11 ` Richard Stallman
  1 sibling, 0 replies; 4+ messages in thread
From: David Kastrup @ 2004-11-28 11:47 UTC (permalink / raw)
  Cc: emacs-devel

Markus Rost <rost@ias.edu> writes:

> Currently tex-mode supports the variable TeX-master (from AUCTeX) if
> it is a string.  See lines 1694-1698 in tex-mode.el.  I suggest to
> support the variable TeX-master also if it is set to 't.  In that
> case the "master" of the file is the file itself, so the right thing
> is to run TeX on the buffer's file.  What about the following patch
> for tex-mode.el?  Stefan?
>
> I have a bunch of old .tex files which have Local Variable sections
> created by AUCTeX.  The patch would make tex-mode handle those files
> better.

BTW, while there probably is nothing speaking against that patch, I'd
be interested in hearing why you would not go for the obvious
"solution", namely just using AUCTeX, which you obviously have been
using before at some time.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Patch for tex-mode.el (more compatibility with AUCTeX)
  2004-11-27 23:40 Patch for tex-mode.el (more compatibility with AUCTeX) Markus Rost
  2004-11-28 11:47 ` David Kastrup
@ 2004-11-29  6:11 ` Richard Stallman
  2004-11-29 21:08   ` Markus Rost
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2004-11-29  6:11 UTC (permalink / raw)
  Cc: emacs-devel

Wouldn't this patch be a more natural way to handle TeX-master = t?

*** tex-mode.el	26 Oct 2004 04:21:48 -0400	1.150
--- tex-mode.el	28 Nov 2004 16:19:05 -0500	
***************
*** 1693,1701 ****
    (let* ((file (or tex-main-file
  		   ;; Compatibility with AUCTeX.
  		   (with-no-warnings
! 		    (when (and (boundp 'TeX-master) (stringp TeX-master))
! 		      (make-local-variable 'tex-main-file)
! 		      (setq tex-main-file TeX-master)))
  		   ;; Try to guess the main file.
  		   (if (not buffer-file-name)
  		       (error "Buffer is not associated with any file")
--- 1693,1705 ----
    (let* ((file (or tex-main-file
  		   ;; Compatibility with AUCTeX.
  		   (with-no-warnings
! 		    (when (boundp 'TeX-master)
! 		      (if (stringp TeX-master)
! 			  (progn
! 			    (make-local-variable 'tex-main-file)
! 			    (setq tex-main-file TeX-master))
! 			(when (eq TeX-master t)
! 			  (file-relative-name buffer-file-name)))))
  		   ;; Try to guess the main file.
  		   (if (not buffer-file-name)
  		       (error "Buffer is not associated with any file")

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

* Re: Patch for tex-mode.el (more compatibility with AUCTeX)
  2004-11-29  6:11 ` Richard Stallman
@ 2004-11-29 21:08   ` Markus Rost
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Rost @ 2004-11-29 21:08 UTC (permalink / raw)
  Cc: emacs-devel

> From: Richard Stallman <rms@gnu.org>
> CC: emacs-devel@gnu.org
> Reply-to: rms@gnu.org
> Date: Mon, 29 Nov 2004 01:11:12 -0500
> X-Scanned-By: MIMEDefang 2.42
> X-Spam-Level: 
> 
> Wouldn't this patch be a more natural way to handle TeX-master = t?

Yes, but your patch may perhaps result in an error if buffer-file-name
is nil.  Below is another version, which is essentially your patch,
except for a test for buffer-file-name being non-nil.  Let me know
whether I should install it.

By the way, one could fix my original problem also by just removing
the handling of TeX-master completely.  Not that I want to suggest
that -- with the new patch things should work well.


===Buffer *vc-diff*=========================================
Index: tex-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/tex-mode.el,v
retrieving revision 1.150
diff -c -r1.150 tex-mode.el
*** tex-mode.el	25 Oct 2004 20:35:24 -0000	1.150
--- tex-mode.el	29 Nov 2004 19:38:52 -0000
***************
*** 1693,1701 ****
    (let* ((file (or tex-main-file
  		   ;; Compatibility with AUCTeX.
  		   (with-no-warnings
! 		    (when (and (boundp 'TeX-master) (stringp TeX-master))
! 		      (make-local-variable 'tex-main-file)
! 		      (setq tex-main-file TeX-master)))
  		   ;; Try to guess the main file.
  		   (if (not buffer-file-name)
  		       (error "Buffer is not associated with any file")
--- 1693,1704 ----
    (let* ((file (or tex-main-file
  		   ;; Compatibility with AUCTeX.
  		   (with-no-warnings
! 		    (when (boundp 'TeX-master)
! 		      (cond ((stringp TeX-master)
! 			     (make-local-variable 'tex-main-file)
! 			     (setq tex-main-file TeX-master))
! 			    ((and (eq TeX-master t) buffer-file-name)
! 			     (file-relative-name buffer-file-name)))))
  		   ;; Try to guess the main file.
  		   (if (not buffer-file-name)
  		       (error "Buffer is not associated with any file")
============================================================

> 
> *** tex-mode.el	26 Oct 2004 04:21:48 -0400	1.150
> --- tex-mode.el	28 Nov 2004 16:19:05 -0500	
> ***************
> *** 1693,1701 ****
>     (let* ((file (or tex-main-file
>   		   ;; Compatibility with AUCTeX.
>   		   (with-no-warnings
> ! 		    (when (and (boundp 'TeX-master) (stringp TeX-master))
> ! 		      (make-local-variable 'tex-main-file)
> ! 		      (setq tex-main-file TeX-master)))
>   		   ;; Try to guess the main file.
>   		   (if (not buffer-file-name)
>   		       (error "Buffer is not associated with any file")
> --- 1693,1705 ----
>     (let* ((file (or tex-main-file
>   		   ;; Compatibility with AUCTeX.
>   		   (with-no-warnings
> ! 		    (when (boundp 'TeX-master)
> ! 		      (if (stringp TeX-master)
> ! 			  (progn
> ! 			    (make-local-variable 'tex-main-file)
> ! 			    (setq tex-main-file TeX-master))
> ! 			(when (eq TeX-master t)
> ! 			  (file-relative-name buffer-file-name)))))
>   		   ;; Try to guess the main file.
>   		   (if (not buffer-file-name)
>   		       (error "Buffer is not associated with any file")
> 

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

end of thread, other threads:[~2004-11-29 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-27 23:40 Patch for tex-mode.el (more compatibility with AUCTeX) Markus Rost
2004-11-28 11:47 ` David Kastrup
2004-11-29  6:11 ` Richard Stallman
2004-11-29 21:08   ` Markus Rost

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.