unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Pascal Bourguignon <spam@thalassa.informatimago.com>
Subject: Re: comment / uncomment region
Date: 03 Aug 2004 10:21:31 +0200	[thread overview]
Message-ID: <87smb4zl6c.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: mailman.2535.1091502983.1960.help-gnu-emacs@gnu.org

exits funnel <exitsfunnel@yahoo.com> writes:

> > Or, if you don't want to program a mode for your
> > grammar files you
> > could have a find-file-hook that would check the
> > file type (or file
> > name extension) and would initialize the buffer
> > environment when it
> > finds that a grammar is being opened. Something
> > like:
> > 
> > (add-hook 'find-file-hook
> >      (lambda () 
> >         (when (string-match "\\.grammar$"
> > (buffer-file-name))
> >            (setf comment-start "//")
> >            ;; ...
> >            )))
> 
> Actually, I was surprised to find that adding this to
> my .emacs file didn't have any affect.  If I replaced
> the setf with a call to message( ) it similarly was
> not being exectued when I visited a .grammar file. 
> I'm running emacs 21.3.1 on Redhat Linux.  This seems
> simple enough.  Any thoughts?  Thanks.

Sorry, there's an 's' at find-file-hooks:

  (add-hook 'find-file-hooks
       (lambda () 
          (when (string-match "\\.grammar$"  (buffer-file-name))
             (setf comment-start "//")
             ;; ...
             )))

With this variable, it works.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein

       reply	other threads:[~2004-08-03  8:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2535.1091502983.1960.help-gnu-emacs@gnu.org>
2004-08-03  8:21 ` Pascal Bourguignon [this message]
2004-08-03 14:16   ` comment / uncomment region Stefan Monnier
     [not found] <mailman.2297.1091309895.1960.help-gnu-emacs@gnu.org>
2004-08-01  1:57 ` Pascal Bourguignon
2004-08-02  2:33   ` exits funnel
2004-08-02 15:49   ` Kevin Rodgers
2004-08-03  3:12   ` exits funnel
2004-07-31 21:34 exits funnel

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=87smb4zl6c.fsf@thalassa.informatimago.com \
    --to=spam@thalassa.informatimago.com \
    /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).