From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: Having .emacs distinguish betweeen LaTeX and XeLaTeX Date: Sun, 27 May 2012 14:16:46 +0300 Message-ID: <87d35pzxep.fsf@mithlond.arda> References: <87mx4tkhwj.fsf@engels.HistoricalMaterialism.info> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1338141698 7289 80.91.229.3 (27 May 2012 18:01:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 May 2012 18:01:38 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Haines Brown Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 27 20:01:35 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 1SYhmY-0004LX-TN for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2012 20:01:35 +0200 Original-Received: from localhost ([::1]:41028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYhmY-00030M-MD for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2012 14:01:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYbT7-0006aK-6Z for help-gnu-emacs@gnu.org; Sun, 27 May 2012 07:17:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYbT5-0008Ni-FD for help-gnu-emacs@gnu.org; Sun, 27 May 2012 07:17:04 -0400 Original-Received: from mta-out.inet.fi ([195.156.147.13]:35380 helo=jenni3.inet.fi) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYbT5-0008Mb-4d for help-gnu-emacs@gnu.org; Sun, 27 May 2012 07:17:03 -0400 Original-Received: from mithlond.arda (84.251.132.215) by jenni3.inet.fi (8.5.140.03) id 4FACED0500923968; Sun, 27 May 2012 14:16:49 +0300 Original-Received: from dtw by mithlond.arda with local (Exim 4.72) (envelope-from ) id 1SYbSp-0001fk-1O; Sun, 27 May 2012 14:16:47 +0300 In-Reply-To: <87mx4tkhwj.fsf@engels.HistoricalMaterialism.info> (Haines Brown's message of "Sun, 27 May 2012 07:00:44 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 195.156.147.13 X-Mailman-Approved-At: Sun, 27 May 2012 14:01:30 -0400 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:85019 Archived-At: * Haines Brown [2012-05-27 07:00:44 -0400] wrote: > 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)) If you know nothing of Lisp this may not help you but I'll paste my settings anyway. It could be modified to match your needs. (add-hook 'LaTeX-mode-hook #'tl-latex-mode-hook) (defun tl-latex-mode-hook () (add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t)) (setq TeX-command-default (save-excursion (save-restriction (widen) (goto-char (point-min)) (let ((re (concat "^\\s-*\\\\usepackage\\(?:\\[.*\\]\\)?" "{.*\\<\\(?:font\\|math\\)spec\\>.*}"))) (save-match-data (if (re-search-forward re 3000 t) "XeLaTeX" "LaTeX")))))) (auto-fill-mode 1) (outline-minor-mode 1) (abbrev-mode 1) (setq fill-column 72))