From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: amicitas Newsgroups: gmane.emacs.help Subject: Re: Setting truncate-lines based on file type (extension) Date: Wed, 30 Sep 2009 13:09:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <041b1f7f-5c7f-4753-ac0b-f179ccbcbfe6@o9g2000prg.googlegroups.com> References: <1f1c52b2-58c2-4674-98b0-836acf647b33@v25g2000yqk.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1254346968 12842 80.91.229.12 (30 Sep 2009 21:42:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Sep 2009 21:42:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 30 23:42:41 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mt6wb-0004MF-AV for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Sep 2009 23:42:41 +0200 Original-Received: from localhost ([127.0.0.1]:42620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mt6wa-0004fR-Rq for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Sep 2009 17:42:40 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!o9g2000prg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: 198.129.107.146 Original-X-Trace: posting.google.com 1254341350 2291 127.0.0.1 (30 Sep 2009 20:09:10 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 30 Sep 2009 20:09:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o9g2000prg.googlegroups.com; posting-host=198.129.107.146; posting-account=JuDB_AoAAABk2mey3NzOZWwD6rN14r2d User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:173460 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:68572 Archived-At: On Sep 29, 11:00=A0pm, Kevin Rodgers wrote: > amicitas wrote: > > For certain types of files I want to set truncate-lines to true. =A0I > > would like to be able to specify these files based on the file > > extension. =A0While I know how to set the mode, but how would I go abou= t > > changing settings? > > (defun my-set-truncate-lines () > =A0 =A0"Set `truncate-lines' to t when visiting a file whose extension is > \"ext1\", \"ext2\", or \"ext3\"." > =A0 =A0(when (member (file-name-extension buffer-file-name) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 '("ext1" "ext2" "ext3")) > =A0 =A0 =A0(setq truncate-lines t)) > =A0 =A0;; return value for find-file-not-found-hooks: > =A0 =A0nil) > > (add-hook 'find-file-hook 'my-set-truncate-lines) > (add-hook 'find-file-not-found-functions 'my-set-truncate-lines) > > -- > Kevin Rodgers > Denver, Colorado, USA Thank you Kevin. That is precisely what I was looking for. In my case I am using this to make viewing of certain types of data and calibration files easier. These files should be opened in 'text- mode', except with out wrapping. Setting a mode hook is therefore not appropriate. This seems like a better solution that creating (or finding) a 'data-mode'. Thanks again -- amicitas