From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: turning on SGML mode Date: Fri, 13 Mar 2020 09:38:04 +0100 Message-ID: <20200313083804.GA12641@tuxteam.de> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="T4sUOijqQbZv57TR" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="83837"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 13 09:40:41 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCfs1-000Lgo-6W for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 09:40:41 +0100 Original-Received: from localhost ([::1]:55668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfs0-0007nn-9R for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 04:40:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48142) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfpf-0005Ui-DU for help-gnu-emacs@gnu.org; Fri, 13 Mar 2020 04:38:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfpd-0001xs-Rc for help-gnu-emacs@gnu.org; Fri, 13 Mar 2020 04:38:15 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:56081) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCfpd-0001Oy-AV for help-gnu-emacs@gnu.org; Fri, 13 Mar 2020 04:38:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=5kWAfKU3XlmsxEpHCNyn6FlMRBbYOcfhUnncQlLt9Xg=; b=KBTp6DU9gvYTx0evKRcQ6v2elDV3L8nY24+Boyx6lDdf26r2uToH2+1UvcmjLzwgtQyV7X2dPOoa6Nj2SolZB/smrI9vAA5tbH7hNjXRmD4+VYqZ/OCqW0nLMPbXAPI+yNUault3W9IjCIsyGVs6yUDFnhDMjD+DFmCJNATT0e4Q1bVijoAL/cMobnXRxLY0efcn1RkWhoSnVzFWgRseQRj9aF4GKw/WuSTLT3tmBkZXI+Tu/N8kdDWhEXywhH3BllkHAFOVtORTl/ygyywG534+ftHkhNJ4bF6EIYyj3jWOc0Drnj4pUnTpGjlElan0BE65RGu4NKVel4CzvA1//w==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1jCfpU-0003Z1-OR for help-gnu-emacs@gnu.org; Fri, 13 Mar 2020 09:38:04 +0100 Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 5.199.139.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122573 Archived-At: --T4sUOijqQbZv57TR Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 12, 2020 at 10:01:14PM +0100, Ulrich Deiters wrote: > Dear all, >=20 > I abuse Emacs for my typesetting, i.e., I use Emacs with the psgml > extension to edit XML documents (where Emacs gives me context-dependent > menus and automatic syntax checks), translate the XML file to LaTeX, > and convert the outcome to PDF. >=20 > My XML file starts with >=20 > > >
> =E2=80=A6 >=20 > and I invoke Emacs by >=20 > emacs -l $ATXHOME/interface/cfg_emacs.el -geometry +0+0 >=20 > where cfg_emacs.el contains definitions of menu points etc. >=20 > My problem: Whenever I start Emacs, I need to enter >=20 > ESC x sgml-mode >=20 > manually. I tried to add >=20 > (setq-default major-mode 'sgml-mode) Since Emacs is made to edit many different kinds of files, there's no "one major mode" to be in. But there's a way to decide which major mode to set depending on a multitude of factors. See the chapter "Choosing File Modes" in your Emacs manual for all the gory details, which you can find online around here [1]. In a nutshell, Emacs looks at the content of the file's first line(s) for a hint on what this file is; failing that it looks then at the file name. You have a few choices here: the "first line tag", i.e. sneaking "-*- mode: psgml -*-" whithin the first line seems out (or at least somewhat ugly) because the first line is already taken up by the XML "cookie". Secondly, you might want to customize your variable "magic-mode-alist", which is a list of pairs associating a regular expression (to match the file's beginning) to a major mode. This looks like a good candidate, since your second line "...