Fix if/else scope in yow.c from Rudi
[sxemacs] / info / sppm.texi
1 \input texinfo
2 @c %**start of header
3 @setfilename sppm.info
4 @settitle SXEmacs Policies & Procedures Manual
5 @finalout
6 @setchapternewpage on
7 @c %**end of header
8
9 @c Define a macro or 2 (abbrevs)
10 @macro sy
11 Steve Youngs
12 @end macro
13
14 @macro s
15 Steve
16 @end macro
17
18 @macro syc
19 Copyright @copyright{} 2004 - 2011 @sy{}
20 @end macro
21
22 @macro sye
23 @email{steve@@sxemacs.org, @sy{}}
24 @end macro
25
26 @macro cver
27 22.1.14
28 @end macro
29
30 @macro nver
31 22.1.15
32 @end macro
33
34
35 @set EDITION First
36 @set UPDATED March 14, 2011
37
38 @c Things would be a lot easier if everything supported the `@copying'
39 @c command, I wouldn't have to put in these conditionals.  --SY.
40 @ifnottex
41 @copying
42 This is the SXEmacs Policies & Procedures Manual.
43 It was last updated @value{UPDATED}.
44
45 @syc{}.
46
47 @quotation
48 Permission is granted to copy, distribute and/or modify this document
49 under the terms of the GNU General Public Licence, Version 2.
50
51 Permission is granted to copy and distribute translations of this manual
52 into another language, under the above conditions for modified versions.
53 @end quotation
54
55 @ignore
56 Permission is granted to process this file through Tex and print the
57 results, provided the printed document carries copying permission
58 notice identical to this one except for the removal of this paragraph
59 (this paragraph not being relevant to the printed manual).
60 @end ignore
61 @end copying
62 @end ifnottex
63
64 @dircategory SXEmacs Development
65 @direntry
66 * SPPM::                        SXEmacs Policies & Procedures Manual.
67 @end direntry
68
69 @titlepage
70 @title SXEmacs Policies & Procedures Manual
71 @subtitle @value{EDITION} edition, last updated on @value{UPDATED}.
72 @vskip 0pt plus 1filll
73 @ifnottex
74 @insertcopying
75 @end ifnottex
76 @iftex
77 This is the SXEmacs Policies & Procedures Manual.
78 It was last updated @value{UPDATED}.
79
80 @syc{}.
81
82 @quotation
83 Permission is granted to copy, distribute and/or modify this document
84 under the terms of the GNU General Public Licence, Version 2.
85
86 Permission is granted to copy and distribute translations of this manual
87 into another language, under the above conditions for modified versions.
88 @end quotation
89
90 @ignore
91 Permission is granted to process this file through Tex and print the
92 results, provided the printed document carries copying permission
93 notice identical to this one except for the removal of this paragraph
94 (this paragraph not being relevant to the printed manual).
95 @end ignore
96 @end iftex
97 @author by @sye{}
98 @end titlepage
99 @c Set up the headers and footers for the printed output (postscript).
100 @headings off
101 @everyheading @thischapter @|@| @thispage
102 @everyfooting @thistitle @|@| @syc{}
103
104 @contents
105
106 @node Top, Mission Statement, (dir), (dir)
107
108 @ifinfo
109 This is the @value{EDITION} edition of the @cite{SXEmacs Policies & Procedures Manual}
110 @end ifinfo
111
112 @ifnottex
113 @insertcopying
114 @end ifnottex
115
116 This document, as its name implies, is directed towards anyone who is
117 actively involved (or thinking of becoming actively involved) in the
118 development of @uref{http://www.sxemacs.org/, SXEmacs}.
119
120 @menu
121 * Mission Statement::           Why we do what we do
122 * Online Presence::             Where we make our first impressions
123 * Dispute Resolution::          Arguments can be resolved
124 * Coding Style::                Making sure your code looks like our code
125 * Patches::                     Handling contributed code/docs
126 * Feature Requests::            Dealing with feature requests
127 * Support Requests::            Handling support requests
128 * Bug Reports::                 Dealing with bug reports
129 * Making Releases::             Getting the finished product to the user
130 * New Features::                Getting new stuff into the code base
131 * Compatibility::               With XEmacs and GNU/Emacs
132 * Copyright and Licencing::     We won't accept just any old licence
133 * Developer Recruitment::       How to get new blood
134 * Making/Altering Policies::    Changing or updating this document
135 * Version Control::             How we keep track of the source
136 * Concept Index::               Concept Index
137 @end menu
138
139 @node Mission Statement, Online Presence, Top, Top
140 @chapter SXEmacs Mission Statement
141 @cindex mission statement
142 @cindex motivation
143 @cindex drive
144
145 Our mission is to@dots{}
146
147 @quotation
148 To provide the Open Source community with a text editing and development
149 environment that is based on XEmacs and is 2nd to none in regards to
150 stability, features, and innovation.
151
152 To foster a user and developer friendly project environment.
153
154 And, above all, to have fun doing it.
155 @end quotation
156
157 @node Online Presence, Dispute Resolution, Mission Statement, Top
158 @comment  node-name,  next,  previous,  up
159 @chapter SXEmacs' Online Presence
160 @cindex http
161 @cindex www
162 @cindex web
163 @cindex online
164 @cindex ftp
165 @cindex sxemacs online
166 @cindex online, sxemacs
167
168 The SXEmacs project maintains a number of @dfn{online} services.
169 Including@dots{}
170
171 @itemize @bullet
172 @item
173 @uref{http://www.sxemacs.org/, The SXEmacs Web Site}
174 @item
175 @uref{http://downloads.sxemacs.org/, Release and Snapshot Tarballs}
176 @item
177 @uref{irc://irc.freenode.net/#sxemacs, The SXEmacs IRC channel}
178 @item
179 @uref{http://issues.sxemacs.org/, The SXEmacs Issue Tracker} @ref{Bug Reports}
180 @ref{Feature Requests} @ref{Support Requests}.
181 @item
182 @uref{http://store.sxemacs.org/, SXEmacs Merchandise}
183 @end itemize
184
185 @menu
186 * Web Site::                    Our shop front
187 * Download Site::               Where we keep the tarballs
188 * IRC::                         For those who like to talk about it
189 * Merchandise::                 Got the software@dots{} Get the T-Shirt
190 @end menu
191
192 @node Web Site, Download Site, Online Presence, Online Presence
193 @comment  node-name,  next,  previous,  up
194 @chapter SXEmacs Web Site
195 @cindex web
196 @cindex http
197 @cindex www.sxemacs.org
198
199 The SXEmacs web site content is kept under the same version control
200 system as SXEmacs itself @ref{Version Control}.  That means that
201 anyone can submit changes and updates to the site in the same manner
202 that they would for code submissions to SXEmacs @xref{Patches}.
203
204 There's really not much more to tell about the web site.  It is just
205 your normal run-of-the-mill web site.  And as everyone knows, HTML
206 blows goats so it doesn't get updated anywhere near as often as it
207 should.  We do have a @email{webmaster@@sxemacs.org, Webmaster}, so if
208 you do have any comments about the site, you should direct them there.
209 Or, alternatively, @email{sxemacs-devel@@sxemacs.org, SXEmacs Devel}
210 mailing list.
211
212 @node Download Site, IRC, Web Site, Online Presence
213 @comment  node-name,  next,  previous,  up
214 @chapter SXEmacs Download Site
215 @cindex download
216 @cindex downloads
217 @cindex source code
218 @cindex source
219 @cindex tarball
220
221 @uref{http://downloads.sxemacs.org/releases/, SXEmacs release downloads} is
222 where you'll find release tarballs and release to release patches
223 available for download.
224
225 @uref{http://downloads.sxemacs.org/snapshots/, SXEmacs snapshot downloads} 
226 is where you can find snapshot tarballs which are uploaded from time
227 to time.  Please note that these snapshots can sometimes be very
228 unstable.
229
230 If you would like something made available for download at the SXEmacs
231 download site, contact @sye{}.
232
233 @node IRC, Merchandise, Download Site, Online Presence
234 @comment  node-name,  next,  previous,  up
235 @chapter SXEmacs on IRC
236 @cindex irc
237 @cindex talk
238 @cindex chat
239 @cindex support
240
241 Developers official communcation platform is the mailing list provided
242 at sxemacs.org. However, to discuss problems and assist users more
243 efficiently there is an official IRC channel.
244
245 SXEmacs IRC channel @dfn{#sxemacs} is located at freenode (formerly
246 known as OPN). Please use following URI to refer to it:
247
248 @uref{irc://irc.freenode.net/#sxemacs}
249
250 @subheading Various IRC HowTOs
251
252 @itemize @bullet
253 @item
254 Connecting to the network and joining the channel
255
256 Fire up your favourite irc client and use:
257 @code{/server irc.freenode.net} to connect to the network and
258 @code{/join #sxemacs} to join the community.
259 @item
260 HowTo become a respected regular
261
262 Okay, you've decided to be active on IRC and hopefully help other
263 users. You have joined the channel and idle around thirsting for hard
264 problems by helpless users.
265
266 In that case you will have to have a reliable (not-changing) nickname
267 that is linked to your person in order to refer to you.  This will help
268 us in blaming you if you misdirect users with your answers and even help
269 us to praise you if you convinced RMS to switch to SXEmacs ;)
270
271 Therefore, freenode provides a mechanism to eternalise yourself via
272 the nickname you carry. Use @code{/nickserv register <password>}
273 to engrave your nickname for your personal use.
274
275 This nickname is yours from now on. To identify yourself to freenode
276 use @code{/nickserv identify <samepasswordasabove>}
277
278 Your user mode will be changed to @dfn{+e} in case of successful
279 identification.
280
281 Whenever you see unscrupulous people carrying your nickname or your
282 nickname is ghosted because of a reconnection, you can just
283 @code{/nickserv ghost <yournickname> <yourpassword>} to send the 
284 other client to oblivion.
285
286 Okay, now that you've registered yourself with freenode, you're
287 nickname can be referred to, independently from whether you are
288 carrying that nick or not. Just do @code{/nickserv info <nickname>}
289 to obtain some information on a nickname you see and like to refer 
290 to.
291 @item
292 HowTo to be listed in the channel access list
293
294 There is no influence on this access list on the users and developer's
295 side.  It is merely up to the project lead who has control over it.
296 @item
297 Host cloaks
298
299 The only way to get one is to ask the project lead (JackaLX).
300 @item
301 No IRC client
302
303 You don't have an IRC client but still want to shoot the breeze with
304 us on IRC?  Then we have an answer for you@dots{}
305 @uref{http://www.sxemacs.org/irc.html, Chat from the web}.
306 @end itemize
307
308 @node Merchandise,, IRC, Online Presence
309 @comment  node-name,  next,  previous,  up
310 @chapter SXEmacs Merchandise
311 @cindex merchandise
312 @cindex shop
313 @cindex shopping
314 @cindex gift
315 @cindex money
316 @cindex t-shirt
317 @cindex retail therapy
318 @cindex donate
319 @cindex support
320 @cindex donation
321
322 At @uref{http://store.sxemacs.org/, The SXEmacs Store} you will find
323 for sale various cool and sexy goodies sporting the SXEmacs logo.  The
324 proceeds from all purchases go toward covering the costs involved in
325 the upkeep of the SXEmacs project.  Be the first on your street to own
326 a @i{I'm Too Sexy For My Emacs} T-shirt!
327
328 @node Dispute Resolution, Coding Style, Online Presence, Top
329 @comment  node-name,  next,  previous,  up
330 @chapter Dispute Resolution
331 @cindex dispute resolution
332 @cindex resolution, dispute
333 @cindex resolving disputes
334 @cindex disputes, resolving
335 @cindex argue
336 @cindex arguments
337
338 @quotation
339 When two people agree on everything, one of them isn't needed.
340 @end quotation
341
342 I can't remember where that quote comes from so if anyone reading this
343 knows, please let us know so we can give credit where credit is due.
344
345 We are all mature adults and most of the time we don't let our egos get
346 in the way of getting things done.  But human nature being what it is
347 means that from time to time we'll have conflict or disagreements.  In
348 the vast majority of these cases a resolution will come quickly and
349 easily through reasonable discussion.
350
351 This section is for those rare occasions that will be the exception to
352 the above.
353
354 In the event of a unresolvable dispute, the SXEmacs Project Lead,
355 @sye{}, will, at his discretion, take one or more of the following
356 steps@dots{}
357
358 @itemize
359 @item
360 Decide the outcome.
361 @item
362 Call a @dfn{vote} @ref{Voting}.
363 @item
364 Call a @dfn{postponement}.  This will mean that all parties will be
365 asked to stop discussing the matter until some date in the future.  This
366 future date will be given at the time the SXEmacs Project Lead calls the
367 postponement.  The idea here is to give everyone a chance to cool down
368 so that reasonable discussion can continue.
369 @end itemize
370
371 @menu
372 * Voting::                      Deciding things via ballot
373 @end menu
374
375 @node Voting,, Dispute Resolution, Dispute Resolution
376 @comment  node-name,  next,  previous,  up
377 @chapter Voting
378 @cindex voting
379 @cindex vote
380 @cindex ballot
381
382 Sometimes things are best decided with a vote.  This section describes
383 how these votes are to be held.
384
385 Who may participate in a vote?  Anyone subscribed to the SXEmacs
386 Developers' mailing list, @email{sxemacs-devel@@sxemacs.org}.
387
388 Who may call a vote?  The SXEmacs Project Lead, @sye{}.  Of course
389 anyone may ask the Project Lead to call a vote.
390
391 @subsection Mechanics of the Vote
392
393 @enumerate
394 @item
395 The votes will be cast via email on the SXEmacs Developers' mailing
396 list, @email{sxemacs-devel@@sxemacs.org}.
397 @item
398 The @dfn{ballot paper} will have the email subject
399 @dfn{[Vote] Subject of vote}. The body of this email will contain the
400 details of the ballot.  The actual questions or points that make up what
401 is being voted on should be in a form that makes it easy to respond to.
402 In other words they should be either multiple choice or yes/no type
403 questions.
404 @item
405 Each person wishing to participate in the vote will simply reply
406 @emph{once} to this email.  The reply or @dfn{vote} @emph{must} come to
407 the mailing list.
408 @item
409 Anyone wishing to abstain need not do anything.  Just don't reply to the
410 ballot email.
411 @item
412 There will be a time limit restriction on voting on any matter.  This
413 time limit will be a minimum of one calendar week from the time the vote
414 is declared @dfn{open}.  The vote is declared @dfn{open} with the
415 posting of the initial ballot email (with the subject prefix of
416 @dfn{[Vote]}.
417 @end enumerate
418
419
420 @subsection Deciding the Outcome
421
422 As soon as practicable after the vote closes (when the time limit has
423 expired) the SXEmacs Project Lead will tally up all the votes and post
424 the results to the SXEmacs Developers' mailing list,
425 @email{sxemacs-devel@@sxemacs.org}.  This post will have the email
426 subject @dfn{[Vote Results] Subject of vote}.
427
428 For an issue to be decided via vote it must receive the majority of the
429 total number of votes with a minimum of four votes.
430
431 @smallexample
432 Issue decided:
433
434   A - 5 votes
435   B - 2 votes
436
437 A - wins
438 @end smallexample
439
440 @smallexample
441 Issue undecided:
442
443   A - 3 votes
444   B - 2 votes
445 @end smallexample
446
447
448 @node Coding Style, Patches, Dispute Resolution, Top
449 @comment  node-name,  next,  previous,  up
450 @chapter Coding Style
451 @cindex coding style
452 @cindex style, coding
453 @cindex style
454 @cindex coding
455
456 SXEmacs has two main programming languages, Emacs Lisp, and C, therefore
457 we need two sets of coding styles.
458
459 @subsection Coding Style -- Emacs Lisp
460 @cindex emacs lisp coding style
461 @cindex coding style, emacs lisp
462 @cindex lisp coding style
463 @cindex coding style, lisp
464
465 Read @pxref{(lispref)Style Tips}
466
467 Please take particular note of@dots{}
468
469 @quotation
470 Don't make a habit of putting close-parentheses on lines by
471 themselves; Lisp programmers find this disconcerting.  Once in a
472 while, when there is a sequence of many consecutive
473 close-parentheses, it may make sense to split them in one or two
474 significant places.
475 @end quotation
476
477 The only other thing I have to say about lisp coding style is to keep
478 your lines @emph{under} 80 columns in length.
479
480 @subsection Coding Style -- C
481 @cindex C coding style
482 @cindex coding style, C
483
484 @quotation
485 First off, I'd suggest printing out a copy of the GNU coding standards,
486 and NOT read it.  Burn them, it's a great symbolic gesture.
487
488   -- Linus Torvalds
489 @end quotation
490
491 @menu
492 * General C Style::             What you should use everywhere
493 * SXEmacs Specific Style::      Our idiosyncrasies
494 @end menu
495
496 @node General C Style, SXEmacs Specific Style, Coding Style, Coding Style
497 @chapter General C Style
498 @cindex C coding style
499 @cindex coding style, C
500 @cindex general coding style
501 @cindex coding style, general
502
503 SXEmacs C code follows, to a large degree, the coding style of the Linux
504 Kernel source.  Much of this section is a verbatim copy of
505 @file{./Documentation/CodingStyle} from the Linux kernel sources.
506
507 @heading Indentation
508 @cindex indentation
509 @cindex indentation coding style
510 @cindex coding style, indentation
511
512 Tabs are 8 characters, and thus indentations are also 8 characters.
513 There are heretic movements that try to make indentations 4 (or even 2!)
514 characters deep, and that is akin to trying to define the value of PI to
515 be 3.
516
517 Rationale: The whole idea behind indentation is to clearly define where
518 a block of control starts and ends.  Especially when you've been looking
519 at your screen for 20 straight hours, you'll find it a lot easier to see
520 how the indentation works if you have large indentations.
521
522 Now, some people will claim that having 8-character indentations makes
523 the code move too far to the right, and makes it hard to read on a
524 80-character terminal screen.  The answer to that is that if you need
525 more than 3 levels of indentation, you're screwed anyway, and should
526 fix your program.
527
528 In short, 8-char indents make things easier to read, and have the added
529 benefit of warning you when you're nesting your functions too deep.
530 Heed that warning.
531
532 Don't put multiple statements on a single line unless you have something
533 to hide:
534
535 @smallexample
536         if (condition) do_this;
537           do_something_everytime;
538 @end smallexample
539
540 Outside of comments and documentation, spaces are never used for
541 indentation, and the above example is deliberately broken.
542
543 @cindex coding style, whitespace
544 @cindex whitespace
545 Don't leave whitespace at the end of lines.  There is a
546 @file{whitespace.el} which you can get from
547 @uref{http://www.dsmit.com/lisp/}.  Use it.
548
549 @heading Breaking long lines and strings
550 @cindex long lines
551 Coding style is all about readability and maintainability using commonly
552 available tools.
553
554 The limit on the length of lines is 80 columns and this is a hard limit.
555
556 Statements longer than 80 columns will be broken into sensible chunks.
557 Descendants are always substantially shorter than the parent and are placed
558 substantially to the right. The same applies to function headers with a long
559 argument list. Long strings are as well broken into shorter strings.
560
561 @smallexample
562 void
563 fun(int a, int b, int c)
564 @{
565         if (condition)
566                 printf("Warning this is a very very very long printf with "
567                                                 "3 parameters a: %u b: %u "
568                                                 "c: %u \n", a, b, c);
569         else
570                 next_statement;
571 @}
572 @end smallexample
573
574 @heading Placing Braces
575 @cindex braces
576 @cindex coding style, braces
577 The other issue that always comes up in C styling is the placement of
578 braces.  Unlike the indent size, there are few technical reasons to
579 choose one placement strategy over the other, but the preferred way, as
580 shown to us by the prophets Kernighan and Ritchie, is to put the opening
581 brace last on the line, and put the closing brace first, thusly:
582
583 @smallexample
584         if (x is true) @{
585                 we do y
586         @}
587 @end smallexample
588
589 However, there is one special case, namely functions: they have the
590 opening brace at the beginning of the next line, thus:
591
592 @smallexample
593         int function(int x)
594         @{
595                 body of function
596         @}
597 @end smallexample
598
599 Heretic people all over the world have claimed that this inconsistency
600 is ...  well ...  inconsistent, but all right-thinking people know that
601 (a) K&R are @emph{right} and (b) K&R are right.  Besides, functions are
602 special anyway (you can't nest them in C).
603
604 Note that the closing brace is empty on a line of its own, @emph{except}
605 in the cases where it is followed by a continuation of the same statement,
606 ie a "while" in a do-statement or an "else" in an if-statement, like this:
607
608 @smallexample
609         do @{
610                 body of do-loop
611         @} while (condition);
612 @end smallexample
613
614 and
615
616 @smallexample
617         if (x == y) @{
618                 ..
619         @} else if (x > y) @{
620                 ...
621         @} else @{
622                 ....
623         @}
624 @end smallexample
625
626 @heading Naming
627 @cindex naming
628 @cindex coding style, naming
629 C is a Spartan language, and so should your naming be.  Unlike Modula-2
630 and Pascal programmers, C programmers do not use cute names like
631 @var{ThisVariableIsATemporaryCounter}.  A C programmer would call that
632 variable @var{tmp}, which is much easier to write, and not the least more
633 difficult to understand.
634
635 HOWEVER, while mixed-case names are frowned upon, descriptive names for
636 global variables are a must.  To call a global function "foo" is a
637 shooting offense.
638
639 GLOBAL variables (to be used only if you _really_ need them) need to
640 have descriptive names, as do global functions.  If you have a function
641 that counts the number of hidden buffers, you should call that
642 @code{count_hidden_buffers()} or similar, you should @emph{not} call it
643 @code{cntbuf()}.
644
645 Encoding the type of a function into the name (so-called Hungarian
646 notation) is brain damaged - the compiler knows the types anyway and can
647 check those, and it only confuses the programmer.  No wonder MicroSoft
648 makes buggy programs.
649
650 LOCAL variable names should be short, and to the point.  If you have
651 some random integer loop counter, it should probably be called @var{i}.
652 Calling it @var{loop_counter} is non-productive, if there is no chance
653 of it being mis-understood.  Similarly, @var{tmp} can be just about any
654 type of variable that is used to hold a temporary value.
655
656 If you are afraid to mix up your local variable names, you have another
657 problem, which is called the @dfn{function-growth-hormone-imbalance
658 syndrome}.  See next.
659
660 @heading Functions
661 @cindex functions
662 @cindex coding style, functions
663 Functions should be short and sweet, and do just one thing.  They should
664 fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
665 as we all know), and do one thing and do that well.
666
667 A function's return type should be put on a line by itself like this:
668
669 @smallexample
670 int
671 main(int argc, char **argv)
672 @{
673         ...
674         ...
675 @}
676 @end smallexample
677
678 This also helps things like @code{etags}.
679
680 The maximum length of a function is inversely proportional to the
681 complexity and indentation level of that function.  So, if you have a
682 conceptually simple function that is just one long (but simple)
683 case-statement, where you have to do lots of small things for a lot of
684 different cases, it's OK to have a longer function.
685
686 However, if you have a complex function, and you suspect that a
687 less-than-gifted first-year high-school student might not even
688 understand what the function is all about, you should adhere to the
689 maximum limits all the more closely.  Use helper functions with
690 descriptive names (you can ask the compiler to in-line them if you think
691 it's performance-critical, and it will probably do a better job of it
692 than you would have done).
693
694 Another measure of the function is the number of local variables.  They
695 shouldn't exceed 5-10, or you're doing something wrong.  Re-think the
696 function, and split it into smaller pieces.  A human brain can
697 generally easily keep track of about 7 different things, anything more
698 and it gets confused.  You know you're brilliant, but maybe you'd like
699 to understand what you did 2 weeks from now.
700
701 @heading Commenting
702 @cindex commenting
703 @cindex comments
704 @cindex coding style, commenting
705 @cindex coding style, comments
706 Comments are good, but there is also a danger of over-commenting.
707 @emph{NEVER} try to explain @emph{HOW} your code works in a comment:
708 it's much better to write the code so that the @emph{working} is
709 obvious, and it's a waste of time to explain badly written code.
710
711 Generally, you want your comments to tell @emph{WHAT} your code does, not
712 @emph{HOW}.  Also, try to avoid putting comments inside a function body:
713 if the function is so complex that you need to separately comment parts of
714 it, you should probably go back to section on @dfn{Functions} for a while.
715 You can make small comments to note or warn about something particularly
716 clever (or ugly), but try to avoid excess.  Instead, put the comments at
717 the head of the function, telling people what it does, and possibly WHY it
718 does it.
719
720 A comment in C looks like @code{/* a comment */}.  A comment in C++
721 looks like @code{// a comment}.  Don't get them confused and don't
722 @emph{ever} use C++ style comments.
723
724 This style of commenting in C @emph{is} acceptable:
725
726 @smallexample
727 /*
728  * A comment style in C that is quite often used
729  * for multi-line comments.
730  */
731 @end smallexample
732
733
734 @heading Macros
735 @cindex macro
736 @cindex coding style, macros
737 Names of macros defining constants and labels in enums are capitalised.
738
739 @smallexample
740 #define CONSTANT 0x12345
741 @end smallexample
742
743 Enums are preferred when defining several related constants.
744
745 CAPITALISED macro names are appreciated but macros resembling functions
746 may be named in lower case.
747
748 Generally, inline functions are preferable to macros resembling functions.
749
750 Macros with multiple statements should be enclosed in a do - while block:
751
752 @smallexample
753 #define macrofun(a,b,c)                         \
754         do @{                                   \
755                 if (a == 5)                     \
756                         do_this(b,c);           \
757         @} while (0)
758 @end smallexample
759
760 @subheading Things to avoid when using macros:
761 @cindex macro
762 @enumerate
763 @item
764 macros that affect control flow:
765
766 @smallexample
767 #define FOO(x)                                  \
768         do @{                                   \
769                 if (blah(x) < 0)                \
770                         return -EBUGGERED;      \
771         @} while(0)
772 @end smallexample
773
774 is a @emph{very} bad idea.  It looks like a function call but exits the "calling"
775 function; don't break the internal parsers of those who will read the code.
776
777 @item
778 macros that depend on having a local variable with a magic name:
779
780 @smallexample
781 #define FOO(val) bar(index, val)
782 @end smallexample
783
784 might look like a good thing, but it's confusing as hell when one reads the
785 code and it's prone to breakage from seemingly innocent changes.
786
787 @item
788 macros with arguments that are used as l-values: FOO(x) = y; will
789 bite you if somebody e.g. turns FOO into an inline function.
790
791 @item
792 forgetting about precedence: macros defining constants using expressions
793 must enclose the expression in parentheses. Beware of similar issues with
794 macros using parameters.
795
796 @smallexample
797 #define CONSTANT 0x4000
798 #define CONSTEXP (CONSTANT | 3)
799 @end smallexample
800 @end enumerate
801
802 @heading Further Reading
803 @cindex further reading
804 @cindex coding style, further reading
805 @display
806 The C Programming Language, Second Edition
807 by Brian W. Kernighan and Dennis M. Ritchie.
808 Prentice Hall, Inc., 1988.
809 ISBN 0-13-110362-8 (paperback), 0-13-110370-9 (hardback).
810 @uref{http://cm.bell-labs.com/cm/cs/cbook/}
811
812 The Practice of Programming
813 by Brian W. Kernighan and Rob Pike.
814 Addison-Wesley, Inc., 1999.
815 ISBN 0-201-61586-X.
816 @uref{http://cm.bell-labs.com/cm/cs/tpop/}
817 @end display
818
819 GNU manuals - where in compliance with K&R and this text - for cpp, gcc,
820 gcc internals and indent, all available from @uref{http://www.gnu.org/}
821
822 WG14 is the international standardization working group for the programming
823 language C, @uref{http://std.dkuug.dk/JTC1/SC22/WG14/}
824
825 @node SXEmacs Specific Style,,General C Style, Coding Style
826
827 @chapter SXEmacs Specific Style
828 @cindex sxemacs specific coding style
829 @cindex coding style, sxemacs specific
830
831 This section was lifted almost word for word from the XEmacs
832 @file{CODING-STANDARDS} by Ben Wing.
833
834 @heading Specially-prefixed functions/variables:
835 @cindex coding style, function prefix
836 @cindex coding style, variable prefix
837 @cindex coding style, functions
838 @cindex coding style, variables
839 @itemize @bullet
840 @item
841 All global C variables whose value is constant and is a symbol begin
842 with a capital Q, e.g. @var{Qkey_press_event}. (The type will always be
843 @dfn{Lisp_Object}.)
844
845 @item
846 All other global C variables whose value is a @dfn{Lisp_Object} (this
847 includes variables that forward into Lisp variables plus others like
848 @var{Vselected_console}) begin with a capital V.
849
850 @item
851 No C variables whose value is other than a @dfn{Lisp_Object} should begin
852 with a capital V. (This includes C variables that forward into
853 integer or boolean Lisp variables.)
854 All global C variables whose value is a struct Lisp_Subr begin with a
855 capital S. (This only occurs in connection with DEFUN ()).
856
857 @item
858 All C functions that are Lisp primitives begin with a capital F,
859 and no others should begin this way.
860 @end itemize
861
862 @heading Functions for manipulating Lisp types:
863 @cindex coding style, functions
864 @itemize @bullet
865 @item
866 Any function that creates an empty or mostly empty Lisp object
867 should begin allocate_(). (*Not* make_().) (Except, of course,
868 for Lisp primitives, which usually begin Fmake_()).
869
870 @item
871 Any function that converts a pointer into an equivalent Lisp_Object
872 should begin make_().
873
874 @item
875 Any function that converts a Lisp_Object into its equivalent pointer
876 and checks the type and validity of the object (e.g. making sure
877 it's not dead) should begin decode_().
878
879 @item
880 Any function that looks up a Lisp object (e.g. buffer, face) given
881 a symbol or string should begin get_(). (Except, of course, for
882 Lisp primitives, which usually begin Fget_()).
883 @end itemize
884
885 @heading Other:
886
887 Any header-file declarations of the sort
888
889 @smallexample
890    struct foobar;
891 @end smallexample
892
893 go into the @dfn{types} section of @file{lisp.h}.
894
895
896 @node Patches, Feature Requests, Coding Style, Top
897 @comment  node-name,  next,  previous,  up
898 @chapter Patches
899 @cindex patches
900 @cindex contributions
901 @cindex diff
902 @cindex patch
903
904 Ideally, the best way to get your patches into the SXEmacs code base is
905 to have @s{} fetch them directly from your git repo.  If, for any
906 reason you are not able to set up a repository with read-only access
907 for (at least) @s{}, that doesn't mean that you can't still contribute
908 your patches and code.
909
910 You can check how to setup a publicly accessible repo at @xref{Setting
911 up a publicly accessible repo}.
912
913 There are a number of different situations and circumstances that you
914 may find yourself in with regards to contributing to the SXEmacs
915 project.  I'll try to cover the main ones here, but please note that
916 they @emph{all} have two things in common@dots{}
917
918 @enumerate
919 @item
920 A diff is always sent to 
921 @email{sxemacs-patches@@sxemacs.org, SXEmacs Patches}.
922 @item
923 The diff is always in @dfn{unified} format  
924 @code{diff -u oldfile newfile}
925 @end enumerate
926
927 @menu
928 * Sending a patch from a git repo::
929                                 Procedure to send a patch from a git repo,
930                                 be it a publicly accessible one, or just a
931                                 private clone from the master repo.
932 * Vanilla sources (no repo)::   Just the source tree that isn't under
933                                 git control.
934 @end menu
935
936 @node Sending a patch from a git repo, Vanilla sources (no repo), Patches, Patches
937 @comment  node-name,  next,  previous,  up
938 @chapter Sending a patch from a git repo
939 @cindex patches
940 @cindex contributions
941 @cindex diff
942 @cindex patch
943
944 Firstly, if you can set up an accessible remote repo, please do so.
945 You can see how easy it is in section @xref{Setting up a publicly
946 accessible repo}.  It will make things so much easier for everyone.
947 We do understand that there may be some valid reasons why you can't,
948 and that is okay, this section still provides a valid workflow.
949
950
951 @subheading Preparing a patch from a git repo
952
953 Are you in the right place?  You cloned the SXEmacs sources with
954 @code{git clone http://git.sxemacs.org/sxemacs}.
955
956 Yes?  OK, great, read on.
957
958 Your workflow should run something along these lines@dots{}
959
960 @enumerate
961 @item
962 @code{git pull} from your master branch to sync up with the main
963 SXEmacs repo.
964 @item
965 @code{git checkout -b mybugfix} to create and checkout a new branch.
966 You can call it whatever you like, just as long as @emph{you} know
967 what it's about. (Yeah, we recommend that you do all your work on
968 branches and keep your master branch as pristine as possible).
969 @item
970 hack hack edit edit fix fix hack
971 @item
972 Test!  If all is good, proceed.  If not, return to the previous step.
973 @item
974 Depending on how you like to deal with change logs, and if the changes
975 were small and trivial or detailed and large:
976
977 @itemize @bullet
978 @item
979 @code{git commit -sam "Summary of changes"}  For use with small quick
980 changes that don't really warrant verbose logs to document them.
981 @item
982 @code{git commit -sa}  This form will fire up an editor for you to
983 write your change logs in@footnote{You can set which editor to use
984 with @code{git config --global core.editor my_fav_editor}. @s{} has
985 his set to a shell function called @dfn{edit} which fires up gnuclient
986 if SXEmacs is running, or SXEmacs if not.}.
987 @item
988 @code{git commit -saF mylogfile}  Use this form for the times when you
989 have logged your changes as you went to the file @file{mylogfile}.
990 @end itemize
991
992 Please take note, that whichever commit command you use, to
993 @emph{always} use the @code{-s} option to add a @dfn{Signed-off-by}
994 entry to the log.  This will indicate that you played some role in
995 getting the patch into the code base, and, perhaps more importantly,
996 you had permission to do so@footnote{There might be
997 licencing/copyright things to be aware of, especially in the case of
998 working on SXEmacs either for your employer, or during your employer's
999 time.}.
1000
1001 For patches that you're submitting to the main SXEmacs code base that
1002 have originated from somebody else (maybe you have a small team of
1003 sub-developers working for you), the @dfn{Signed-off-by} entry also
1004 indicates that you have reviewed, tested, and approved the patch.  And
1005 also, the original author has permission to submit it.
1006 @item
1007 @code{git checkout master}  To flip back to your master branch.
1008 @item
1009 @code{git merge --no-ff mybugfix}  To merge the changes from the
1010 @dfn{mybugfix} branch into master.  The @code{--no-ff} forces git to
1011 create a new commit object even if a fast-forward could have been used
1012 to carry out the merge.
1013
1014 At this point everything that was in the @dfn{mybugfix} branch is now
1015 in your master branch, so you no longer need it. You can safely delete
1016 it with @code{git branch -d mybugfix}.
1017
1018 Now if you have a publicly accessible repo, you should do:
1019 @item
1020 @code{git push myremote master}  To push the changes to your publicly
1021 accessible repo, @dfn{myremote}.
1022 @end enumerate
1023
1024 If your repos is private, it is safe to skip the push and just advance
1025 to the next step.
1026
1027 @subheading @anchor{Patch Submission}Patch Submission
1028
1029 At this point, your changes are ready for @s{} to be incorporated into
1030 the main SXEmacs code base.  All you need to do is let him know, and
1031 you can easily do that with the following 2 git commands:
1032
1033 @enumerate
1034 @item
1035 @code{git format-patch --add-header="X-Git-Repo: REPO-URL" \@*
1036 @indent
1037 --subject-prefix="P-Req" --numbered -o DIR origin}
1038 @item
1039 @code{git send-email \@*
1040 @indent
1041 --to="SXEmacs Patches <sxemacs-patches@@sxemacs.org>" \@*
1042 @indent
1043 --from="$(git config user.name) <$(git config user.email)>" DIR}
1044 @end enumerate
1045
1046 If you not have have a publicly accessible repository, the SXEmacs
1047 developers can't pull in your changesets directly from you.  Instead,
1048 once your patch hits the mailing list and is approved, it will be
1049 applied manually to the SXEmacs code base.
1050
1051 You could, in theory, use a post-commit hook, but I'd not recommend
1052 it.  Think about the situation where you are working on something
1053 fairly big.  You'd most likely commit several times before you have
1054 things ready for us.
1055
1056 If you have a publicly accessible repo, be sure to setup automation
1057 like in @xref{Automation}.
1058
1059 @node Vanilla sources (no repo),, Sending a patch from a git repo, Patches
1060 @comment  node-name,  next,  previous,  up
1061 @chapter Vanilla sources (no repo)
1062 @cindex patches
1063 @cindex contributions
1064 @cindex diff
1065 @cindex patch
1066
1067 Are you in the right place?  All you have is a SXEmacs source tarball
1068 and you don't have @file{git} installed.
1069
1070 Yes?  OK, great, read on.
1071
1072 You will have the toughest time of it I'm afraid because you will have
1073 to do everything manually.  But it isn't too bad.  No worse than for any
1074 other project.
1075
1076 Your hacking cycle will look something like this:
1077
1078 @enumerate
1079 @item
1080 Unpack the source tarball somewhere and @emph{don't touch it}.  This
1081 will be your pristine sources.
1082 @item
1083 Make a copy of your pristine sources somewhere else.  This will be your
1084 working tree where you make your changes.
1085 @item
1086 cd into your working tree and hack hack hack
1087 @item
1088 Jump out of your working tree and do:
1089 @code{diff -urNp pristine-tree working-tree > my-sxemacs.diff}
1090
1091 A note of caution here: Please ensure that you are diff'ing clean
1092 trees.  In other words, run @code{make distclean} in your working tree
1093 @emph{before} creating the diff.
1094 @item
1095 Send @file{my-sxemacs.diff} (gzip'd if large) as a MIME attachment
1096 together with a detailed description of your changes to the
1097 @email{sxemacs-patches@@sxemacs.org, SXEmacs Patches} mailing list.
1098 @end enumerate
1099
1100 @node Feature Requests, Support Requests, Patches, Top
1101 @comment  node-name,  next,  previous,  up
1102 @chapter Feature Requests
1103 @cindex request, feature
1104
1105 From time to time someone will wander into the mailing list or our
1106 IRC channel saying something like "ya know, SXEmacs is cool, but it
1107 would truly @emph{rock} if it had @dfn{fooble-klangers}.  How 'bout
1108 it guys?  Can somebody please add @dfn{fooble-klangers} to SXEmacs?".  
1109
1110 @emph{That's} a @dfn{Feature Request}.
1111
1112 It doesn't matter what a @dfn{fooble-klanger} is.  It doesn't matter
1113 if having said @dfn{fooble-klanger} would make SXEmacs rock or not.
1114 What @strong{DOES MATTER} is that we acknowledge the request.  And we
1115 acknowledge it quickly.
1116
1117 So how quick is quickly?  Anything greater than 48 hours is @emph{slow}.
1118 We should try to get an initial ack out within 24 hours of the feature
1119 request hitting the mailing list@footnote{All legitimate feature requests
1120 should eventually end up on the @uref{http://issues.sxemacs.org/, SXEmacs
1121 Issue Tracker}.}.  I totally understand that the 24 hour turn-around
1122 won't always be possible.  Often there'll be extenuating circumstances
1123 (I'm writing this right now in the middle of a 2 week period with no
1124 internet connection).
1125
1126 The acknowledgment doesn't need to be anything more than just that, an
1127 acknowledgment.  You don't need to have a 100,000 lines of working
1128 code that proves how much @dfn{fooble-klangers} make or don't make
1129 SXEmacs rock before you let the guy know that he isn't talking to a
1130 brick wall.
1131
1132 A feature request can only end up in one of 3 scenarios...
1133
1134 @enumerate 1
1135 @item
1136 Implemented code.
1137 @item
1138 Discarded idea.
1139 @item
1140 Forgotten about.
1141 @end enumerate
1142
1143 Of those, #3 is @strong{UNACCEPTABLE}!  That means, if you see a
1144 feature request that is more than 48 hours old and hasn't been
1145 acknowledged, it is @strong{YOUR} responsibility to do something about
1146 it.
1147
1148 A feature request on our @uref{http://issues.sxemacs.org/, Issue
1149 Tracker} is a issue that has the @dfn{FeatReq} flag set and the
1150 severity set to @dfn{enhancement}.
1151
1152
1153 @node Support Requests, Bug Reports, Feature Requests, Top
1154 @comment  node-name,  next,  previous,  up
1155 @chapter Support Requests
1156 @cindex request, support
1157
1158 Support requests are a call for help from our users and as such have
1159 @emph{top priority}.  Much of @xref{Feature Requests}, applies equally
1160 here.
1161
1162 Support requests are @emph{everyone's} responsibility, so if you see
1163 one and you think you can help, do so.
1164
1165 @node Bug Reports, Making Releases, Support Requests, Top
1166 @comment  node-name,  next,  previous,  up
1167 @chapter Bug Reports
1168 @cindex report, bug
1169
1170 Bug reports are a @emph{good} thing.  They show that people are using
1171 the code that you spent so much time and effort in writing.  Bug
1172 reports are an opportunity to improve SXEmacs.  Never be scared of bug
1173 reports.  Never get annoyed or upset by bug reports.  Welcome them.
1174 As a matter of fact, worry if you don't see any bug reports.  That
1175 would mean we aren't working hard enough. :-)
1176
1177 All bug reports have to be submitted to our
1178 @uref{http://issues.sxemacs.org/, Issue Tracker}.  So it goes without
1179 saying that you already have an account on our Issue Tracker, and if
1180 you don't, go get one @emph{now}.
1181
1182 Because the Issue Tracker is just that, it @dfn{tracks} issues, all
1183 followups and correspondence concerning a bug @emph{must} be added via
1184 the issue tracker itself.  @emph{DO NOT} follow up to a bug report on
1185 the mailing list.  If a bug report is submitted to the mailing list
1186 initially (because the submitter wasn't aware of our Issue Tracker),
1187 the person submitting the report should be directed to our
1188 @uref{http://issues.sxemacs.org/, Issue Tracker}.  If they are
1189 unwilling or unable to do so, one of us will do so.
1190
1191 If a bug report results in a patch and merge request, the summary of
1192 the patch log should contain the text: "(Closes bug #n)", where `n' is
1193 the number that our Issue Tracker has assigned to that bug.  The bug
1194 should be marked as "fixed" (stating in which revision) on the Issue
1195 Tracker.  It should not be marked "Closed" until just prior to a
1196 release.  Closing bugs is the job and responsibility of the project
1197 lead, or whoever is responsible for making releases.
1198
1199
1200 @node Making Releases, New Features, Bug Reports, Top
1201 @comment  node-name,  next,  previous,  up
1202 @chapter Making Releases
1203 @cindex release
1204
1205 From time to time, at the project lead's discretion, a release
1206 will be made and tarballs created and made available on
1207 @uref{http://downloads.sxemacs.org/releases/, the SXEmacs download site}.
1208
1209 The decision as to @emph{when} to cut a release is generally
1210 influenced by two factors:
1211
1212 @enumerate 1
1213 @item
1214 How stable the code base is currently.
1215 @item
1216 Whether the changes since the last release warrant a new release.
1217 @end enumerate
1218
1219 The minimum number of revisions between releases is one.  The maximum
1220 number of revisions between releases is, well, there is no maximum.
1221
1222 The actual steps involved in cutting a release are:
1223
1224 @itemize @bullet
1225 @item
1226 Finalise things like...
1227 @itemize
1228 @item
1229 Update @file{etc/NEWS}
1230 @item
1231 Make sure @file{INSTALL}, @file{PROBLEMS} etc are up to date.
1232 @item
1233 Update @file{sxemacs.texi} at@dots{}
1234 @quotation
1235 It corresponds to:
1236   version-string
1237 @end quotation
1238 @item
1239 Update the codename and version in @file{autogen.sh}
1240 @item
1241 Update the versioning macros in this document.
1242 @end itemize
1243 @item
1244 Commit those updates.
1245
1246 @code{git commit -sam "SXEmacs v@nver{} is released!"}
1247 @item
1248 Create a new tag which will be the version number of this release.
1249
1250 @code{git tag -s v@nver{} -m "SXEmacs v@nver{}"}
1251 @item
1252 Push it to the public repo.
1253
1254 @code{git push --tags origin master}
1255 @item
1256 Prepare tarball:
1257
1258 (in the release working directory)
1259
1260 @smallexample
1261 git archive --format=tar \
1262     --prefix=sxemacs-@nver{}/ HEAD | \
1263     (cd ~/upload && tar xf -)
1264 @end smallexample
1265
1266 @item
1267 Clean out the working directory and do autotool preparations.
1268
1269 @smallexample
1270 HAMMER=1 ./autogen.sh
1271 @end smallexample
1272
1273 @item
1274 Copy the autotool files to the exported tree
1275
1276 @smallexample
1277 cp -va libltdl ~/upload/sxemacs-@nver{} &&
1278 for f in $(git ls-files --others -i --exclude-standard); do
1279     cp -va $@{f@} ~/upload/sxemacs-@nver{}/$@{f@}
1280 done
1281 @end smallexample
1282
1283 @item
1284 Add a ChangeLog
1285
1286 @smallexample
1287 git log --stat v@cver{}..v@nver{} > ~/upload/sxemacs-@nver{}/ChangeLog
1288 @end smallexample
1289
1290 @item
1291 Create the tarball:
1292
1293 @smallexample
1294 cd ~/upload
1295 for type in bz2 gz lzma xz; do
1296     tar --create --owner=0 --group=0 --auto-compress --file \
1297         sxemacs-@nver{}.tar.$@{type@} sxemacs-@nver{}
1298     md5sum sxemacs-@nver{}.tar.$@{type@} > sxemacs-@nver{}.tar.$@{type@}.md5
1299     gpg --detach-sign --armor \
1300       --output sxemacs-@nver{}.tar.$@{type@}.asc sxemacs-@nver{}.tar.$@{type@}
1301 done
1302 @end smallexample
1303 @item
1304 @c replace this with the appropriate git magic
1305 Create a diff against the previous version.
1306 @itemize
1307 @item
1308 Unpack the previous release's tarball
1309 @item
1310 @example
1311 diff -urNp sxemacs-@cver{} sxemacs-@nver{} > sxemacs-@cver{}-@nver{}.diff
1312 gzip sxemacs-@cver{}-@nver{}.diff
1313 @end example
1314 @end itemize
1315
1316 @item
1317 Create md5 and gpg sig for diff file.
1318
1319 See items describing this for the release tarball.
1320
1321 @item
1322 Move the tarball, diff, GnuPG sigs, and md5sums to
1323 @uref{http://downloads.sxemacs.org/releases/, SXEmacs Download Site}.
1324
1325 @item
1326 Rename the @file{LATEST-IS-VER} file.
1327 @example
1328 mv LATEST-IS-@cver{} LATEST-IS-@nver{}
1329 @end example
1330
1331 @item
1332 Update www.sxemacs.org:
1333
1334 @itemize
1335 @item
1336 Update @file{download.html}
1337 @item
1338 Add @file{ChangeLog-@nver{}} to the website
1339 @item
1340 Update @file{index.html}
1341 @end itemize
1342
1343 @item
1344 Send a release announcement to @email{sxemacs-devel@@sxemacs.org,
1345 SXEmacs Devel} and comp.emacs.xemacs.
1346
1347 @item
1348 Make a new release and  announcement on Freshmeat (our FM id: 52281) 
1349
1350 @item
1351 Commit the first patch to the next version, which would be adding a
1352 @file{ChangeLog.d/ChangeLog-@nver} 
1353 @end itemize
1354
1355
1356 @node New Features, Compatibility, Making Releases, Top
1357 @comment  node-name,  next,  previous,  up
1358 @chapter New Features
1359 @cindex feature, new
1360
1361 How do you get a new feature into SXEmacs?  It's not hard, but
1362 remember this, we look at any new feature in this order of
1363 priority... 
1364
1365 @enumerate 1
1366 @item
1367 Tested working code.
1368 @item
1369 A plan of action with @dfn{Proof of concept} code.
1370 @item
1371 A plan of action with a willingness to write the code.
1372 @item
1373 An idea with a willingness to move it to a real plan and then to
1374 code. 
1375 @item
1376 An idea with a willingness to help test any code resulting from it.
1377 @item
1378 @dfn{Hey, wouldn't it be cool if...}
1379 @end enumerate
1380
1381 Don't be disheartened if you aren't a master programmer, quite often
1382 the best new features and ideas come from non-programmers.  All too
1383 often the people writing the code get caught up in what they are doing
1384 and find it hard to see things from @dfn{outside of the box}.  Anyone
1385 can help with ideas and with testing new code and features.
1386
1387 Any new feature begins with an idea, and at @emph{that} point somebody
1388 should post that idea to @email{sxemacs-devel@@sxemacs.org, SXEmacs
1389 Devel}.
1390
1391 @node Compatibility, Copyright and Licencing, New Features, Top
1392 @comment  node-name,  next,  previous,  up
1393 @chapter Compatibility
1394 @cindex compatibility, xemacs
1395 @cindex compatibility, emacs
1396
1397 All I'll say about this is that for the foreseeable future, SXEmacs
1398 will remain 100% backwardly compatible with XEmacs where emacs lisp is
1399 concerned.  An emacs lisp package or library that runs on XEmacs
1400 @emph{will} run on SXEmacs.
1401
1402 If you find a place where this isn't true, you should report it as a
1403 bug, @xref{Bug Reports}.
1404
1405 If you find areas where SXEmacs is incompatible with GNU/Emacs at the
1406 emacs lisp level, that is an issue between GNU/Emacs and XEmacs.
1407
1408 @node Copyright and Licencing, Developer Recruitment, Compatibility, Top
1409 @comment  node-name,  next,  previous,  up
1410 @chapter Copyright and Licencing
1411
1412 SXEmacs is an @dfn{Open Source} project.  Because of that we can only
1413 accept code and contributions that are covered by an Open Source
1414 licence.
1415
1416 We differ from the GNU/Emacs project in that we will accept any
1417 @dfn{OSI} approved Open Source licence, not just the GNU GPL.  That
1418 means that if you are more comfortable with, say, the BSD licence,
1419 that's cool by us.
1420
1421 We also won't ask you to reassign your copyright to anyone else.  If
1422 you want to reassign your copyright to the FSF (for example), you can,
1423 but we won't reject any contributions from you because you haven't.
1424 @footnote{If you contribute code to SXEmacs that you want included in
1425 GNU/Emacs you will have to reassign copyright to the FSF.  Please
1426 understand that that is a GNU/Emacs requirement and @emph{not} a
1427 SXEmacs requirement}
1428
1429 @subheading SXEmacs and your Employer
1430 This is @strong{very} important.  If you write code for SXEmacs either
1431 on your employer's time (while you are at work), or using your
1432 employer's resources (hardware, software, electricity, furniture, etc)
1433 then your employer may have legal copyright of your work.
1434
1435 @strong{PLEASE} be up front with your employer and clear it with them
1436 @strong{before} you write anything for SXEmacs.  It is OK and
1437 perfectly acceptable to submit contributions to SXEmacs that are
1438 copyrighted to your employer, providing (and this is the key) your
1439 employer is willing to release the code under an approved OSI
1440 licence.
1441
1442 Don't overlook or dismiss this.  It is here to safeguard you, your
1443 employer, the SXEmacs project as a whole, and @sy{} personally.
1444
1445 @subheading Documentation Licences
1446 Please don't licence any documentation under the FSF's new @dfn{Free
1447 Documentation Licence}.  This isn't a slight against the FSF or the
1448 GNU project, it is just because it will mean that our documentation
1449 would not be able to be included in XEmacs.  It may even cause
1450 problems going the other way as well (XEmacs to SXEmacs).
1451
1452 For that reason, we'll err on the side of caution.
1453
1454 @node Developer Recruitment, Making/Altering Policies, Copyright and Licencing, Top
1455 @comment  node-name,  next,  previous,  up
1456 @chapter Developer Recruitment
1457 @cindex recruitment
1458
1459 We don't actively try to recruit new developers in any kind of formal
1460 way.  What we do is use SXEmacs for everything everyday and not hide
1461 the fact that we do. :-)  That in itself makes people curious and some
1462 ask about this thing called @dfn{SXEmacs}.  Show them what it is,
1463 point them to the @uref{http://www.sxemacs.org/, web site}, encourage
1464 them to subscribe to @email{sxemacs-devel@@sxemacs.org, SXEmacs
1465 Devel}, and even help them get an account on
1466 @uref{http://issues.sxemacs.org/, Our Issue Tracker}.  And low and
1467 behold!  We have a new developer.
1468
1469 One recruitment tool that we do have is @dfn{sxemacs.org} email
1470 addresses.  If you'd like one, contact @sye{}.  Then you can use that
1471 email address whenever and whereever you like.  Hmm, perhaps not
1472 @emph{everywhere}, it might not look so good if you use it for log in
1473 details to a pr0n site. :-P
1474
1475 @node Making/Altering Policies, Version Control, Developer Recruitment, Top
1476 @comment  node-name,  next,  previous,  up
1477 @chapter Making/Altering Policies
1478 @cindex policies, changing
1479
1480 How do you get these policies and proceedures changed?  Simple.  Just
1481 post to @email{sxemacs-devel@@sxemacs.org, SXEmacs Devel} stating
1482 where what how when and why.  If it is non-controversial and makes
1483 sense, it'll probably be accepted quickly.  If not, there could be
1484 lengthy @dfn{discussions} and possibly even a vote @xref{Voting}.
1485
1486 @sy{} will always have the final word and make the ultimate decision,
1487 but he isn't an immovable force, his mind can be changed and he
1488 @emph{does} listen to what the rest of the project is saying. :-)
1489
1490 @node Version Control, Concept Index, Making/Altering Policies, Top
1491 @comment  node-name,  next,  previous,  up
1492 @chapter Version Control
1493 @cindex version control
1494 @cindex arch
1495 @cindex tla
1496 @cindex git
1497
1498 The SXEmacs Project keeps control of its sources with git, starting
1499 with version 22.1.13.
1500 The main repository is that of the Project Lead (@sy{}).  It is
1501 located at:
1502
1503 @smallexample
1504   http://git.sxemacs.org/sxemacs
1505 @end smallexample
1506
1507 Checking out a copy of SXEmacs is as easy as:
1508
1509 @smallexample
1510   git clone http://git.sxemacs.org/sxemacs
1511 @end smallexample
1512
1513 See how to patches in chapter @xref{Patches}.
1514
1515 @menu
1516 * Setting up a publicly accessible repo::
1517                                    A git repo that others have read
1518                                    access to .
1519 * Setting up a private repos::     A git repo only you have access to.
1520 * Other Developers' Repositories:: Git repos of regular developers of 
1521                                    SXEmacs.
1522 @end menu
1523
1524
1525 @node  Setting up a publicly accessible repo, Setting up a private repos, Version Control, Version Control
1526 @comment  node-name,  next,  previous,  up
1527 @chapter Setting up a publicly accessible repo
1528 @cindex version control
1529 @cindex repo
1530 @cindex git
1531 @cindex contributions
1532
1533 You only need to read this section if you are able to host a publicly
1534 accessible repo somewhere.
1535
1536 Getting everything set up is really very easy.  I think you'll be
1537 quite surprised if you haven't done this sort of thing before.  In the
1538 examples below I'm assuming that you have shell access to your remote
1539 host via ssh@dots{}
1540
1541 @smallexample
1542 user@@localhost ~ $ ssh user@@your.host
1543 user@@host ~ $ mkdir -v sxemacs
1544 user@@host ~ $ cd !$
1545 user@@host ~/sxemacs $ git init --bare
1546 user@@host ~/sxemacs $ echo @dfn{Your Name's SXEmacs Repo} > description
1547 user@@host ~/sxemacs $ exit
1548 user@@localhost ~ $ git clone http://git.sxemacs.org/sxemacs
1549 user@@localhost ~ $ cd sxemacs
1550 user@@localhost ~/sxemacs $ git remote add myremote \
1551     ssh://user@@your.host/~/sxemacs
1552 @end smallexample
1553
1554 And that's it!  Told you it was easy, didn't I?  All you have to do
1555 now is push your local copy to your remote@dots{}
1556
1557 @smallexample
1558 git push myremote master
1559 @end smallexample
1560
1561
1562 @subheading @anchor{Automation}Automation
1563
1564 The last two commands for patch submission listed in @xref{Patch
1565 Submission}, @code{format-patch} and @code{send-email} are fairly long
1566 and hairy.  You'd no doubt have trouble remembering them.  But, never
1567 fear, git has a few tricks up her sleeve to make your life easier.
1568
1569 @subsection Automating with Hooks
1570
1571 If you are lucky enough to @emph{NOT} be using github@footnote{github
1572 is great and may be the ideal solution for you to host your repo
1573 somewhere, but it is inflexible in that you get no shell access, you
1574 can't set up custom hooks, and you are very limited in what git config
1575 settings you can tweak.} to host your publicly accessible repo you can
1576 set up a @dfn{post-receive} hook to automatically send your pull
1577 requests to the SXEmacs mailing list when you push to it.
1578
1579 @subsubsection Setting Up The post-receive Hook
1580
1581 Remember: This hook runs from your publicly accessible repo (your
1582 remote), and @emph{NOT} from your local working directory.  It is
1583 called after you push to your remote.
1584
1585 Jump over to your remote now and follow these steps
1586
1587 @enumerate
1588 @item
1589 Take a look in the file
1590 @file{hooks/post-receive.sample}.  At the bottom of that file there is
1591 a commented line, that when uncommented would call another script,
1592 @file{post-receive-email}.  Check that the path is correct, and
1593 uncomment it.
1594 @item
1595 Rename @file{hooks/post-receive.sample} to @file{hooks/post-receive}
1596 @item
1597 Tweak the remote's config with@dots{}
1598
1599 @smallexample
1600 git config hooks.mailinglist \
1601     "SXEmacs Patches <sxemacs-patches@@sxemacs.org>"
1602 git config hooks.envelopesender "Your Name <your@@email>"
1603 git config hooks.emailprefix "[P-Req] "
1604 git config hooks.showrev "git show -C %s; echo"
1605 @end smallexample
1606 @item
1607 @code{echo "Your Name's SXEmacs Repo" > description}
1608 @end enumerate
1609
1610 Take note that the SXEmacs mailing lists will funnel any post from
1611 non-subscribers into the moderation queue.  So make sure that the
1612 address you set @dfn{hooks.envelopesender} to is subscribed to the
1613 patches list. 
1614
1615 Also be aware that using this @dfn{post-receive} hook will mean that 
1616 every time you push to your publicly accessible repo, a message will be
1617 sent to sxemacs-patches; this includes instances where you merely 
1618 are pulling the latest from mainline and mirroring. Hence, the use of 
1619 aliases as discussed below may be preferable. 
1620
1621 @subsection @anchor{Automating with Aliases}Automating with Aliases
1622
1623 Git allows you to define aliases that will let you do all kinds of
1624 funky things.  Remember those hairy @code{format-patch} and
1625 @code{send-email} commands?
1626
1627 @smallexample
1628 git config alias.sxe-fp 'format-patch --add-header="X-Git-Repo: REPO-URL" \
1629     --subject-prefix="P-Req" --numbered'
1630
1631 git config alias.sxe-sm 'send-email \
1632     --to="SXEmacs Patches <sxemacs-patches@@sxemacs.org>" \
1633     --from="$(git config user.name) <$(git config user.email)>"'
1634 @end smallexample
1635
1636 With those 2 aliases set you can get your pull requests in by
1637 doing@dots{}
1638
1639 @code{git sxe-fp -o DIR origin && git sxe-sm DIR}
1640
1641 @subsection Making Life Even Easier with git config
1642
1643 You can make your life even easier by having git store things in its
1644 config.  In this case, you can store those @code{format-patch} and
1645 @code{send-email} command line options in the repo's config@dots{}
1646
1647 @smallexample
1648 git config format.headers "X-Git-Repo: YOUR-REMOTE-URL"
1649 git config format.subjectprefix "P-Req"
1650 git config format.numbered true
1651
1652 git config sendemail.to \
1653     "SXEmacs Patches <sxemacs-patches@@sxemacs.org>"
1654 git config sendemail.from "Your Name <your@@email>"
1655 @end smallexample
1656
1657 With those settings, the commands: @code{git format-patch -o DIR
1658 origin}, and @code{git send-email DIR} are now equivalent of the
1659 original long hairy ones mentioned further up.
1660
1661 Be careful when setting up aliases and config settings that you only
1662 make them global if you absolutely have to.  All the ones I've shown
1663 here have been repo-specific.
1664
1665 @node  Setting up a private repos, Other Developers' Repositories, Setting up a publicly accessible repo, Version Control
1666 @comment  node-name,  next,  previous,  up
1667 @chapter Setting up a private repos
1668 @cindex version control
1669 @cindex repo
1670 @cindex git
1671 @cindex contributions
1672
1673 Git makes it as easy to create a private repos as getting a checkout
1674 of the source code. In fact, all you need to do is to actually
1675 checkout and you have a repos:
1676
1677 @smallexample
1678   git clone http://git.sxemacs.org/sxemacs
1679 @end smallexample
1680
1681 You may want to follow some of the steps in @xref{Automating with
1682 Aliases}, to easy your life when sending patches if you plan to
1683 contribute frequently from this repo. Please note that in this case
1684 you should not reference any REPO-URL.
1685
1686 However if you do plan to contribute frequently, we strongly suggest
1687 you configure a publicly accessible repos.
1688
1689 More details at @xref{Setting up a publicly accessible repo}.
1690
1691 @node  Other Developers' Repositories,, Setting up a private repos, Version Control
1692 @comment  node-name,  next,  previous,  up
1693 @chapter Other Developers' Repositories
1694 @cindex version control
1695 @cindex repo
1696 @cindex git
1697 @cindex contributions
1698
1699 As previously mentioned, the master SXEmacs repo is at:
1700 @smallexample
1701   http://git.sxemacs.org/sxemacs
1702 @end smallexample
1703
1704 Some of these repos may not be publicly accessible or may not be
1705 accessible 24/7.
1706
1707 @itemize @bullet
1708 Nelson
1709 @item
1710 http://git.nelsonferreira.com/sxemacs
1711 Sebastian
1712 @item
1713 git://github.com/hroptatyr/sxemacs.git
1714 @end itemize
1715
1716 And that is it for now.  We've only just moved to git and the
1717 main SXEmacs developers haven't set up their repos.
1718
1719 @c @itemize @bullet
1720 @c Sebastian
1721 @c @item
1722 @c http://www.math.tu-berlin.de/~freundt/archives/sxemacs/
1723 @c Evgeny
1724 @c @item
1725 @c http://arch.xwem.org/2006/
1726 @c Norbert
1727 @c @item
1728 @c http://arafel.viteno.net:33080/arch/sxemacs/
1729 @c Martin K@"uhl
1730 @c @item
1731 @c http://www.informatik.uni-bremen.de/~mkhl/sxemacs-mirror/
1732 @c Alexey Mikhailov (karma)
1733 @c @item
1734 @c http://karma.ezunix.org/arch/2005/
1735 @c Hynek
1736 @c @item
1737 @c http://hynek.in-berlin.de/archive/
1738 @c Horst Burkhardt (PeanutHorst)
1739 @c @item
1740 @c http://midcom.steveyoungs.com/oss-vc/sxemacs/
1741 @c Nick Granado
1742 @c @item
1743 @c http://www.heatxsink.com/2005/
1744 @c @end itemize
1745
1746 And of course the main repo (Steve's) is at:
1747
1748 http://git.sxemacs.org/sxemacs
1749 http://git.sxemacs.org/website  (our website is under git too)
1750
1751 @subheading The tla repository for versions upto 22.1.12
1752
1753 The old tla repos at http://arch.sxemacs.org/2010 still exist, and
1754 will remain forever.  If you ever need anything from them just install
1755 @code{tla} and leech them with that.
1756
1757 The reason we are keeping them around indefinitely is because the move
1758 to git meant a loss of history.  There are tools available for
1759 converting a arch repo to git, but they failed to work in our case
1760 because of the cached revisions in our repos.
1761
1762 @node Concept Index,, Version Control, Top
1763 @unnumbered Concept Index
1764 @printindex cp
1765
1766 @bye