help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How in .dir-locals.el make association between file extension and Em


From: Oleksandr Gavenko
Subject: Re: How in .dir-locals.el make association between file extension and Emacs mode?
Date: Mon, 10 Jan 2011 01:12:29 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

On 2011-01-05 1:11, Tim X wrote:
Oleksandr Gavenko<gavenkoa@gmail.com>  writes:
I store collected my tips under same folder with .txt extension.

Every time when I create new .txt file I forget add:

   -*- mode: outline; coding: utf-8; fill-column: 80 -*-

to header. There are nearly 120 files.

I can fix headers from time to time by script but this require
spending own time, so ugly.

I expect that Emacs already have mechanism to make this.
Per project configurations which provided by standard Emacs packages.

My first comment would be that you should not need to have these headers
at all - at least not with a fairly recent version of emacs. I only need
these types of file headers for the unusual/special case. What you have
in yours looks like the common or standard setup.

Yes. I want eliminate them.

1.  You can add files with extension .txt to auto-file-alist so that all
*.txt files will start up with outline mode enabled.  Eliminate need for
first setting in your header.

I prefer save association for '*.txt' to 'text-mode'.

.txt files usually interpreted as text files by many software.

If I make own unique extension I must teach all another soft how
understand this files (if this is possible )).

2. UTF-8 is rapidly becoming the default coding system for most systems.
Unless you have the need for an alternative coding system because of
special characters that are not well supported under utf-8, you probably
should set this as your system default. Emacs will use the default
platform coding system as its default. So, set your environment to utf-8
and eliminate the second option from your header.

Agree, but how about Russian Windows with it default cp1251?

3. You can set the fill column via the custom 8nterface and you can
enable filling (wrapping) from the options menu for all text modes. This
would eliminate the last of your header settings and you would no longer
need the header line at all.

Set fill-column every time I edit new file is unnecessary work.

And I always forget which value I prefer 78 or 80 or 90 or 120?

As I store files under version control when run 'fill-region'
with different 'fill-column' I get changes in places where I do
not edit text.

Another alternative to the above is to just put these settings in your
.dir-local file and ensure only *.txt fiels live below that directory.

I understand how set 'fill-column' via '.dir-local.el'.

But how set coding system and make association between file extension
and Emacs modes?

However, my recommendation for this specific case is that you start using
org-mode.

I notice you are already using outline mode for your tip/note files, so
you will already be familiar with much of org-mode (which is based on
outline), plus you get a lot of other really handy things.

By default, files with the extension of .org will be palced in org mode,
so you can just try it by opening a file with that extension. Org mode
is so extremely useful for keeping notes/tips I'm not even sure where to
start. Some of its benefits include

        * Improved key bindings for cycling through outline levels etc
        * Handy table editing support
        * Quick capturing of information, with formatting and other bits
        * Useful linking and hypertext support
        * Support for wiki like markup
        * Export to multiple output formats


plus much much more. Cannot recommend it highly enough.
Thanks for interest and tips. I would try org-mode.

Currently I use 'outline-mode' for:

 * colouring headers to make it more visible
 * folding text to see document structure (only headers shown)


Sorry, but I repeat question:

How set coding system and make association between file extension
and Emacs modes per directory?

--
Best regards!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]