From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Haines Brown Newsgroups: gmane.emacs.help Subject: Having .emacs distinguish betweeen LaTeX and XeLaTeX Date: Sun, 27 May 2012 07:00:44 -0400 Message-ID: <87mx4tkhwj.fsf@engels.HistoricalMaterialism.info> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1338116714 7752 80.91.229.3 (27 May 2012 11:05:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 May 2012 11:05:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 27 13:05:14 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SYbHd-0007zx-HR for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2012 13:05:13 +0200 Original-Received: from localhost ([::1]:55488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYbHd-0005Gu-2i for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2012 07:05:13 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Sun, 27 May 2012 06:01:47 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:4DXxDVvb4Kx06q95TWFrjAJPNCA= Original-Lines: 32 X-Usenet-Provider: http://www.giganews.com Original-X-Trace: sv3-9DVXgwUNjfqbGJ1GiUnDN8dlBbilXTw2BniHTUUZ2a++GaAqB5DgQ50HnKZclfxY0KBqHT3am2Wf6S0!ZAOzmFu97XTKvTtusx6DirbiLDZ2YC24mtwL1oxCazWAPPlkEpYj1wZbQdNGnvVBx0IrPzUEzYCp!i+6s Original-X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2385 Original-Xref: usenet.stanford.edu gnu.emacs.help:192608 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85014 Archived-At: I would like to specify the TeX engine with the emacs command line, such as with C-c C-c latex and C-c C-c xelatex, rather than having it only call whichever TeX-engine is specified in AUCTeX configuration or in .emacs init file. At present I can only switch between processing LaTeX and XeLaTeX files by inserting or commenting a line in .emacs (setq TeX-engine 'xetex) and reload emacs. Simplest would be to have AUCTeX not specify any TeX-engine and instead use the engine specified at the command prompt. There does not seem to be any way to do this, and so an alternative might be for .emacs to specify the TeX engine by distinguishing between LaTeX and XeLaTeX files. Someone using the Jed editor does this. He sets the default TeX-engine to xetex if the document uses packages peculiar to XeTeX: if (re_fsearch("\\usepackage.*unicode-math") or re_fsearch("\\usepackage.*fontspec") or re_fsearch("\\usepackage.*polyglossia") ) define_blocal_var("latex_output", "xetex"); Is it possible to something comparable to this if construction in .emacs init? I know nothing of lisp, but guess it would be something like: ( if (search-forward "\usepackage*fontspec") or (search-forward "\usepackage*polyglossia") (setq TeX-engine 'xetex)) Haines Brown