From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: lee Newsgroups: gmane.emacs.help Subject: setting the mode of a buffer Date: Fri, 07 Mar 2014 01:10:44 +0100 Organization: my virtual residence Message-ID: <8738iukgvv.fsf@yun.yagibdah.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1394156436 28677 80.91.229.3 (7 Mar 2014 01:40:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Mar 2014 01:40:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 07 02:40:45 2014 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 1WLjmG-0004zH-84 for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Mar 2014 02:40:44 +0100 Original-Received: from localhost ([::1]:33969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLjmF-000085-BA for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Mar 2014 20:40:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLjjY-00079M-JM for help-gnu-emacs@gnu.org; Thu, 06 Mar 2014 20:38:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLjjS-0007lx-Jh for help-gnu-emacs@gnu.org; Thu, 06 Mar 2014 20:37:56 -0500 Original-Received: from client-194-42-186-216.muenet.net ([194.42.186.216]:39971 helo=yun.yagibdah.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLjjS-0007lm-Ba for help-gnu-emacs@gnu.org; Thu, 06 Mar 2014 20:37:50 -0500 Original-Received: from lee by yun.yagibdah.de with local (Exim 4.80.1) (envelope-from ) id 1WLiUS-0005CV-0r for help-gnu-emacs@gnu.org; Fri, 07 Mar 2014 01:18:16 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Mail-Followup-To: help-gnu-emacs@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 194.42.186.216 X-Mailman-Approved-At: Thu, 06 Mar 2014 20:40:24 -0500 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:96285 Archived-At: Hi, how would I set the mode of a buffer along the lines of ... (with-current-buffer buffer (set-auto-mode t)) ... but by setting a particular mode rather calling a function to set modes which would be automatically set. The above works, though it seems to be rather inefficient. I have tried with (set-auto-mode-0) and got errors because a hook involved with the mode I was trying to set couldn=C2=B4t find its function. In the end, what I=C2=B4m trying to achieve is to be able to reload a mode after it has been modified. To reload it, I=C2=B4m using (unload-feature), and that disables the mode for all buffers for which it is enabled. It also magically removes an entry in auto-mode-alist for this mode. When the mode is reloaded, I have to enable it for all relevant buffers manually. To avoid having to do this, I=C2=B4ve finally written a function that goes through the buffer-list and enables the mode for particular buffers. This function uses (set-auto-mode), in lack of a better alternative. Perhaps I=C2=B4m going all wrong about this and there is a better way to reload a mode? --=20 Knowledge is volatile and fluid. Software is power.