unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How in .dir-locals.el make association between file extension and Emacs mode?
Date: Mon, 10 Jan 2011 01:12:29 +0200	[thread overview]
Message-ID: <igdfcv$brg$1@dough.gmane.org> (raw)
In-Reply-To: <87y670b6y5.fsf@puma.rapttech.com.au>

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	other threads:[~2011-01-09 23:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 22:31 How in .dir-locals.el make association between file extension and Emacs mode? Oleksandr Gavenko
2011-01-04  7:40 ` Kevin Rodgers
2011-01-04 12:48   ` Oleksandr Gavenko
     [not found]   ` <mailman.0.1294145359.16099.help-gnu-emacs@gnu.org>
2011-01-04 23:11     ` Tim X
2011-01-09 23:12       ` Oleksandr Gavenko [this message]
     [not found]       ` <mailman.0.1294614772.18285.help-gnu-emacs@gnu.org>
2011-01-10  0:00         ` Tim X
2011-01-10 18:23         ` Stefan Monnier
2011-01-19 20:54           ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='igdfcv$brg$1@dough.gmane.org' \
    --to=gavenkoa@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).