* Project initialization files?
@ 2012-07-17 17:25 Bruce Korb
2012-07-17 17:45 ` Eli Zaretskii
2012-07-17 18:17 ` Jambunathan K
0 siblings, 2 replies; 6+ messages in thread
From: Bruce Korb @ 2012-07-17 17:25 UTC (permalink / raw
To: emacs-devel
Hi,
I am probably not guessing the correct search term to find prior discussions
of what I'm interested in, sorry. Anyway, I work on a number of different
projects and each of them have their own favored way of indenting the code.
To cope with this, emacs and Vim have mechanisms for automatically
formatting the code to the preferred formatting style. All you need is a little
comment like "c-file-style: gnu", for example. Well, the Linux kernel has
decided to remove these warts, they've never been acceptable at my various
employers and often they are not incorporated into projects I play around with.
What to do? It seems to me there ought to be some way of saying, "C files
in this tree are gnu-style, that tree is Stroustrup and over there use
the linux-kernel's favored style. I think it boils down to this question:
How hard would it be to set up a personal registry of projects
(~/emacs.d/projects)
that specified the c-file-style for all .c/.h files in a tree? So if
I edit files in
~/my-day-job, I use the "work" style, etc.
Does such a thing already exist? EDE isn't quite it and it requires a special
file added to the source code to boot. But what I'd like to find ought to be
able to pilfer some of that code...
Suggestions? Thanks! - Bruce
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Project initialization files?
2012-07-17 17:25 Project initialization files? Bruce Korb
@ 2012-07-17 17:45 ` Eli Zaretskii
2012-07-17 20:25 ` Bruce Korb
2012-07-17 21:12 ` Dan Nicolaescu
2012-07-17 18:17 ` Jambunathan K
1 sibling, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2012-07-17 17:45 UTC (permalink / raw
To: Bruce Korb; +Cc: emacs-devel
> From: Bruce Korb <bkorb@gnu.org>
> Date: Tue, 17 Jul 2012 10:25:33 -0700
>
> What to do? It seems to me there ought to be some way of saying, "C files
> in this tree are gnu-style, that tree is Stroustrup and over there use
> the linux-kernel's favored style. I think it boils down to this question:
>
> How hard would it be to set up a personal registry of projects
> (~/emacs.d/projects)
> that specified the c-file-style for all .c/.h files in a tree? So if
> I edit files in
> ~/my-day-job, I use the "work" style, etc.
>
> Does such a thing already exist? EDE isn't quite it and it requires a special
> file added to the source code to boot. But what I'd like to find ought to be
> able to pilfer some of that code...
Is the .dir-locals.el feature (described in the "Specifying File
Variables" node of the Emacs manual) fit the bill? If not, why not?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Project initialization files?
2012-07-17 17:25 Project initialization files? Bruce Korb
2012-07-17 17:45 ` Eli Zaretskii
@ 2012-07-17 18:17 ` Jambunathan K
1 sibling, 0 replies; 6+ messages in thread
From: Jambunathan K @ 2012-07-17 18:17 UTC (permalink / raw
To: Bruce Korb; +Cc: emacs-devel
C-h r
g Directory Variables
or
(info "(emacs) Directory Variables")
> Hi,
>
> I am probably not guessing the correct search term to find prior discussions
> of what I'm interested in, sorry. Anyway, I work on a number of different
> projects and each of them have their own favored way of indenting the code.
> To cope with this, emacs and Vim have mechanisms for automatically
> formatting the code to the preferred formatting style. All you need is a little
> comment like "c-file-style: gnu", for example. Well, the Linux kernel has
> decided to remove these warts, they've never been acceptable at my various
> employers and often they are not incorporated into projects I play around with.
>
> What to do? It seems to me there ought to be some way of saying, "C files
> in this tree are gnu-style, that tree is Stroustrup and over there use
> the linux-kernel's favored style. I think it boils down to this question:
>
> How hard would it be to set up a personal registry of projects
> (~/emacs.d/projects)
> that specified the c-file-style for all .c/.h files in a tree? So if
> I edit files in
> ~/my-day-job, I use the "work" style, etc.
>
> Does such a thing already exist? EDE isn't quite it and it requires a special
> file added to the source code to boot. But what I'd like to find ought to be
> able to pilfer some of that code...
>
> Suggestions? Thanks! - Bruce
>
>
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Project initialization files?
2012-07-17 17:45 ` Eli Zaretskii
@ 2012-07-17 20:25 ` Bruce Korb
2012-07-21 22:06 ` Nix
2012-07-17 21:12 ` Dan Nicolaescu
1 sibling, 1 reply; 6+ messages in thread
From: Bruce Korb @ 2012-07-17 20:25 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs development
Hi Eli,
On Tue, Jul 17, 2012 at 10:45 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> ~/my-day-job, I use the "work" style, etc.
>>
>> Does such a thing already exist?
> Is the .dir-locals.el feature (described in the "Specifying File
> Variables" node of the Emacs manual) fit the bill? If not, why not?
Only that it entails adding a file to the source tree. But then,
adding a superior directory with this file is probably as easy as maintaining
~/.emacs.d/projects anyway, so no real difference.
Thank you!! :) Cheers - Bruce
P.S. ``To avoid slowdown, this search is skipped for remote files.''
Remote files over a 10GigE or better connection may not be so "remote".
Maybe a way to say, "search anyway"? Anyway, I'm stil glad to know
of this :)
PPS: on one platform, my home directory is a remote mount with
/some/very/long/list/of/superior/directories, so I suppose an empty
.dir-locals.el
file would cut off the search and do nothing?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Project initialization files?
2012-07-17 17:45 ` Eli Zaretskii
2012-07-17 20:25 ` Bruce Korb
@ 2012-07-17 21:12 ` Dan Nicolaescu
1 sibling, 0 replies; 6+ messages in thread
From: Dan Nicolaescu @ 2012-07-17 21:12 UTC (permalink / raw
To: Eli Zaretskii; +Cc: Bruce Korb, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Bruce Korb <bkorb@gnu.org>
>> Date: Tue, 17 Jul 2012 10:25:33 -0700
>>
>> What to do? It seems to me there ought to be some way of saying, "C files
>> in this tree are gnu-style, that tree is Stroustrup and over there use
>> the linux-kernel's favored style. I think it boils down to this question:
>>
>> How hard would it be to set up a personal registry of projects
>> (~/emacs.d/projects)
>> that specified the c-file-style for all .c/.h files in a tree? So if
>> I edit files in
>> ~/my-day-job, I use the "work" style, etc.
>>
>> Does such a thing already exist? EDE isn't quite it and it requires a special
>> file added to the source code to boot. But what I'd like to find ought to be
>> able to pilfer some of that code...
>
> Is the .dir-locals.el feature (described in the "Specifying File
> Variables" node of the Emacs manual) fit the bill? If not, why not?
What this points out is that we haven't made much effort to spread the
knowledge about .dir-locals.el.
GNU projects like GCC/gdb/binutils/etc could incorporate customized
versions of .dir-locals.el (the one in emacs can be used as a starting
point)...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Project initialization files?
2012-07-17 20:25 ` Bruce Korb
@ 2012-07-21 22:06 ` Nix
0 siblings, 0 replies; 6+ messages in thread
From: Nix @ 2012-07-21 22:06 UTC (permalink / raw
To: Bruce Korb; +Cc: Eli Zaretskii, emacs development
On 17 Jul 2012, Bruce Korb spake thusly:
> Hi Eli,
>
> On Tue, Jul 17, 2012 at 10:45 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>> ~/my-day-job, I use the "work" style, etc.
>>>
>>> Does such a thing already exist?
>
>> Is the .dir-locals.el feature (described in the "Specifying File
>> Variables" node of the Emacs manual) fit the bill? If not, why not?
>
> Only that it entails adding a file to the source tree.
Emacs supports 'directory classes', which let you say things like
(dir-locals-set-directory-class (expand-file-name "~/a/b/c") 'gnu
(dir-locals-set-directory-class (expand-file-name "~/x/y/z") 'linux)
(dir-locals-set-directory-class (expand-file-name "~/foo/bar") 'otbs)
and then you can say e.g.
(dir-locals-set-class-variables
'gnu '((c-mode . ((c-file-style . "gnu")
(fill-column . 80)
(sentence-end-double-space . t)
(indent-tabs-mode . t)))))
to set variables in each class to your heart's content, without any need
to touch the directories themselves.
--
NULL && (void)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-07-21 22:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 17:25 Project initialization files? Bruce Korb
2012-07-17 17:45 ` Eli Zaretskii
2012-07-17 20:25 ` Bruce Korb
2012-07-21 22:06 ` Nix
2012-07-17 21:12 ` Dan Nicolaescu
2012-07-17 18:17 ` Jambunathan K
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.