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

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

Re: [h-e-w] per directory customization


From: Stephen Leake
Subject: Re: [h-e-w] per directory customization
Date: 18 Dec 2001 10:12:18 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

"Yogesh Sajanikar" <address@hidden> writes:

> Frequently, I would like to change settings depending upon which directory I
> am working in. Is there any hooks which will serve my purpose?

I use the mode hook for the language I'm editing. Here's a snippet of
my C mode hook:

(defun sal-c-mode-hook ()
  (setq c-style-variables-are-local-p t)
  (c-set-style "gnu")

  (cond

   ((let ((case-fold-search nil))
      (or (string-match "gcc" default-directory)
          (string-match "binutils" default-directory)))
    ;; We are editing GNU code, so do _not_ use
    ;; sal-clean-buffer; GNU code has tabs in it.
    )

   (t
    ;; use sal-clean-buffer, and require a project file

    ;; non-style stuff
    (add-hook 'local-write-file-hooks 'sal-clean-buffer)
    (add-hook (make-local-hook 'ff-pre-find-hooks) 'c-require-project-file nil 
t)
    )

    (set (make-variable-buffer-local 'ff-other-file-alist) 'c-other-file-alist)
    (else-mode)
   )) ;; end cond, defun

(add-hook 'c-mode-hook 'sal-c-mode-hook)


The form (string-match "gcc" default-directory") tests to see if I'm
in a directory with "gcc" anywhere in the path.

I put search paths and such in the "project file"; I've adapted the
Ada mode project files for C.

Have fun! 

-- 
-- Stephe




reply via email to

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