Initial Commit
[packages] / xemacs-packages / patcher / doc / patcher.texi
1 \input texinfo
2
3 @c patcher.texi --- Patcher documentation
4
5 @c Copyright (C) 2012 Didier Verna.
6 @c Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011 Didier Verna.
7
8 @c Author:        Didier Verna <didier@xemacs.org>
9 @c Maintainer:    Didier Verna <didier@xemacs.org>
10 @c Created:       Sun Apr 21 21:34:06 2002
11 @c Last Revision: Mon Jan 16 11:28:06 2012
12
13 @c This file is part of Patcher.
14
15 @c Patcher is free software; you can redistribute it and/or modify
16 @c it under the terms of the GNU General Public License version 3,
17 @c as published by the Free Software Foundation.
18
19 @c Patcher is distributed in the hope that it will be useful,
20 @c but WITHOUT ANY WARRANTY; without even the implied warranty of
21 @c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 @c GNU General Public License for more details.
23
24 @c You should have received a copy of the GNU General Public License
25 @c along with this program; if not, write to the Free Software
26 @c Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28
29 @c Commentary:
30
31 @c Contents management by FCM version 0.1.
32
33
34 @c %** start of header
35 @setfilename patcher.info
36 @settitle Patcher
37 @setchapternewpage odd
38 @setcontentsaftertitlepage
39 @dircategory Emacs
40 @direntry
41 * Patcher: (patcher). Automatic maintenance of RCS-based projects.
42 @end direntry
43 @c %** end of header
44
45
46 @c ====================================================================
47 @c Definitions
48 @c ====================================================================
49 @set VERSION 4.0
50
51 @macro copyrightdate
52 Copyright @copyright{} 2010, 2011, 2012 Didier Verna.@*
53 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, @c
54 2008, 2009 Didier Verna.
55 @end macro
56
57 @macro etc
58 @i{etc.}
59 @end macro
60
61 @c Subproject options index
62 @macro spoindex{name}
63 @cindex Subproject Option, @t{:\name\}
64 @cindex @t{:\name\} (subproject option)
65 @end macro
66
67 @c Project option index
68 @macro poindex{name}
69 @cindex Project Option, @t{:\name\}
70 @cindex @t{:\name\} (project option)
71 @end macro
72
73 @c Fallbacked project option index
74 @macro fpoindex{name}
75 @poindex{\name\}
76 @vindex patcher-default-\name\
77 @end macro
78
79 @c Built-in theme index
80 @macro bitindex{name}
81 @cindex Built-in Theme, @t{\name\}
82 @cindex Theme, Built-in, @t{\name\}
83 @cindex @t{\name\} (built-in theme)
84 @end macro
85
86 @c Built-in RCS theme index
87 @macro birtindex{name}
88 @bitindex{\name\}
89 @bitindex{\name\-ws}
90 @end macro
91
92
93
94 @c ====================================================================
95 @c Copyright
96 @c ====================================================================
97 @ifinfo
98 This file contains the documentation for Patcher version
99 @value{VERSION}, an XEmacs package for automating the maintenance of
100 RCS-based projects.
101
102 @copyrightdate{}
103
104 Permission is granted to make and distribute verbatim copies of this
105 manual provided the copyright notice and this permission notice are
106 preserved on all copies.
107
108 @ignore
109 Permission is granted to process this file through TeX and print the
110 results, provided the printed document carries a copying permission
111 notice identical to this one except for the removal of this paragraph
112 (this paragraph not being relevant to the printed manual).
113
114 @end ignore
115 Permission is granted to copy and distribute modified versions of this
116 manual under the conditions for verbatim copying, provided also that the
117 sections entitled ``Copying'' and ``GNU General Public License'' are
118 included exactly as in the original, and provided that the entire
119 resulting derived work is distributed under the terms of a permission
120 notice identical to this one.
121
122 Permission is granted to copy and distribute translations of this manual
123 into another language, under the above conditions for modified versions,
124 except that this permission notice may be stated in a translation
125 approved by the Free Software Foundation.
126 @end ifinfo
127
128
129
130 @c ====================================================================
131 @c Title Page
132 @c ====================================================================
133 @titlepage
134 @title Patcher
135 @subtitle Automatic maintenance of RCS-based projects from within XEmacs
136 @subtitle Version @value{VERSION}
137 @author Didier Verna <@email{didier@@xemacs.org}>
138 @page
139 @vskip 0pt plus 1filll
140 @copyrightdate{}
141
142
143 Permission is granted to make and distribute verbatim copies of this
144 manual provided the copyright notice and this permission notice are
145 preserved on all copies.
146
147 Permission is granted to copy and distribute modified versions of this
148 manual under the conditions for verbatim copying, provided also that the
149 sections entitled ``Copying'' and ``GNU General Public License'' are
150 included exactly as in the original, and provided that the entire
151 resulting derived work is distributed under the terms of a permission
152 notice identical to this one.
153
154 Permission is granted to copy and distribute translations of this manual
155 into another language, under the above conditions for modified versions,
156 except that this permission notice may be stated in a translation
157 approved by the Free Software Foundation.
158 @end titlepage
159
160
161
162 @c ====================================================================
163 @c Master menu
164 @c ====================================================================
165 @ifnottex
166 @node Top, Copying, , (dir)
167 @top Patcher
168
169 Patcher is an XEmacs package designed to automate and ease the
170 maintenance of RCS-based projects. It provides assistance in building,
171 submitting and committing patches, as well as in handling the
172 corresponding ChangeLog entries, for example by creating skeletons.
173
174 This info file documents Patcher version @value{VERSION}.
175
176 @menu
177 * Copying::            The GNU General Public License
178 * Introduction::       What Patcher is all about
179 * Installation::       How to get and install Patcher
180 * Quick Start::        For the brave and the impatient
181 * User Manual::        A step-by-step guide to using Patcher
182 * XEmacs Development:: An XEmacs specific sample setup
183 * Indexes::            Concept, Variable, Function and Keystroke
184 @end menu
185
186 Patcher is developed by Didier Verna @email{didier@@xemacs.org}.
187
188 @end ifnottex
189
190
191
192 @c ====================================================================
193 @c Copying
194 @c ====================================================================
195 @node Copying, Introduction, Top, Top
196 @unnumbered Copying
197
198 Patcher is free software; you can redistribute it and/or modify it under
199 the terms of the GNU General Public License version 3,
200 as published by the Software Foundation.
201
202 Patcher is distributed in the hope that it will be useful, but WITHOUT
203 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
204 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
205 more details.
206
207 You should have received a copy of the GNU General Public License
208 along with this program; if not, write to the Free Software
209 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
210
211
212
213 @c ====================================================================
214 @c Introduction
215 @c ====================================================================
216 @node Introduction, Installation, Copying, Top
217 @chapter Introduction
218
219 When a project becomes important in size, or when the development is
220 performed cooperatively by several people across the Internet, it is a
221 common practice to help maintaining it by using a revision control
222 system. Such tools (Git, Mercurial, Subversion, Darcs, CVS, PRCS to name
223 a few) usually work by maintaining a centralized or distributed project
224 archive (also called a repository) that keeps track of the history of
225 the changes, lets you develop different ``branches'' at the same time
226 and perform operations like merges between these different project
227 branches.
228
229 In such ``RCS-based'' maintenance models, making the project evolve
230 usually involves repeatedly the same few steps, some of which can be
231 tedious: you work on your local copy of the project; once you're
232 satisfied with your changes, you create a patch by diffing your local
233 copy against the project's archive; then (or progressively), you
234 construct the ChangeLog entries. Finally, you propose your changes by
235 sending a mail to the developers list with your patch and the ChangeLog
236 entries included, hoping that your proposition will be accepted. If
237 you're one of the maintainers, you will still probably send the message
238 to the list, simply announcing the modification, and immediately commit
239 the patch with an informative log message.
240
241 Patcher is an XEmacs package designed to automate this process. Patcher
242 can't work on the project for you. However, as soon as you give it some
243 basic knowledge on the project structure and repository, it can
244 automatically build a patch by comparing your local copy with the
245 repository, create ChangeLog entries, prepare a mail announcing the
246 changes, and even commit the patch for you with a informative log
247 message. All of this is done in just a few keystrokes. Additionally,
248 Patcher can perform some sanity checks, like verifying that your local
249 copy is up-to-date, that you did not forget some ChangeLog entries, that
250 the commit operation went well and so on.
251
252 If you're brave and impatient, and want to start using the basics of
253 Patcher as soon as possible, see @ref{Quick Start}. It is recommended to
254 read it anyway, since it gives an overview of how Patcher works. If you
255 know the basics and want a more detailed guide, see @ref{User Manual}.
256
257 Enjoy using Patcher!
258
259
260
261 @c ====================================================================
262 @c Installation
263 @c ====================================================================
264 @node Installation, Quick Start, Introduction, Top
265 @chapter Installation
266
267 @menu
268 * Distribution::                How to get Patcher
269 * Requirements::                What you need to get Patcher running
270 * Insinuation::                 How to plug Patcher into other libraries
271 @end menu
272
273
274 @c Distribution =======================================================
275 @node Distribution, Requirements, , Installation
276 @section Distribution
277
278 Patcher is a standard XEmacs package. As such, you can download and
279 install it directly from a running XEmacs session. The packages
280 interface is accessible from the @samp{Tools} menu or via @kbd{M-x
281 list-packages}). You may also manually download a tarball or use the
282 Mercurial repository. See
283 @uref{http://www.xemacs.org/Develop/packages.html} for more information.
284
285 Otherwise, Patcher is also distributed as a standalone package directly
286 from my website (a Git repository and tarballs are available), at
287 @uref{http://www.lrde.epita.fr/~didier/software/elisp/misc.php}. You
288 will also find different inlined versions of this documentation at that
289 place. For standalone installation instructions, please read the
290 @file{INSTALL} file in the distribution.
291
292
293 @c Requirements =======================================================
294 @node Requirements, Insinuation, Distribution, Installation
295 @section Requirements
296
297 Patcher currently works with XEmacs 21.4 or later. Patcher might also
298 have some other requirements, depending on how you use it:
299
300 @itemize @bullet
301 @item
302 If you let Patcher create ChangeLogs for you (@pxref{ChangeLogs
303 Handling}), you will need the @file{add-log} library from the
304 @file{xemacs-base} package, version 2.21 or later, installed on your
305 system.
306
307 @item
308 If you want to send mails from Patcher (@pxref{Mail Methods}), you will
309 need a mail user agent. Patcher currently supports @file{sendmail},
310 @file{message} and @file{Gnus} natively and through the
311 @file{compose-mail} interface. Other MUA might be partly supported when
312 used with @code{compose-mail}. Patcher will probably suffer from non
313 critical deficiencies in that case however (it will issue warnings).
314 @end itemize
315
316
317 @c Insinuation ========================================================
318 @node Insinuation, , Requirements, Installation
319 @section Insinuation
320
321 With a proper installation of Patcher (either way), you don't need any
322 special trickery in your @file{.emacs} file because all entry points to
323 the library should be autoloaded.
324
325 However, Patcher has the ability to hook into external libraries, but
326 won't do so unless requested. Currently, Patcher has hooks for Gnus
327 only. If you're using Gnus as your MUA, you might want to add the
328 following line to your @file{gnusrc} file:
329
330 @example
331 (patcher-insinuate-gnus)
332 @end example
333
334 This will add some facilities described along the text.
335
336
337
338 @c ====================================================================
339 @c Quick Start
340 @c ====================================================================
341 @node Quick Start, User Manual, Installation, Top
342 @chapter Quick Start
343
344 This chapter demonstrates the use of Patcher through a quick and basic
345 setup. Adapt the example as you wish. See also @ref{XEmacs Development}
346 for an XEmacs specific sample setup. Let's make some assumptions first:
347
348 @itemize @bullet
349 @item
350 You own a computer.
351 @item
352 You have the @file{add-log} library from the @file{xemacs-base} package,
353 version 2.21 or later, installed on your system.
354 @item
355 You're working on a Git project called SuperProj.
356 @item
357 Your local clone of the Git repository is located in
358 @file{/home/me/superproj}.
359 @item
360 You have commit access to this project.
361 @item
362 There is a mailing list for developers at
363 @email{superproj-devel@@superproj.org}.
364 @item
365 Your repository is up-to-date, but you've done some hacking in the
366 sources that you'd like to commit.
367 @item
368 Since you're lazy, you didn't write the ChangeLog entries yet.
369 @end itemize
370
371
372 @menu
373 * Setting up Patcher::     Making Patcher aware of your project
374 * Calling Patcher::        Preparing a patch and a message
375 * Filling the ChangeLogs:: Patcher only creates skeletons
376 * Filling the Message::    You should insert the ChangeLog entries
377 * Committing the Patch::   Applying your modifications to the archive
378 * Sending the Message::    Telling people about your modifications
379 @end menu
380
381
382 @c The Project Descriptor =============================================
383 @node Setting up Patcher, Calling Patcher, Quick Start, Quick Start
384 @section Setting up Patcher
385
386 The first thing to do is to make patcher aware of your ``SuperProj''
387 project. Put this in your @file{.emacs} file:
388
389 @lisp
390 (setq patcher-projects
391         '(("SuperProj" "/home/me/superproj"
392         :to-address "superproj-devel@@superproj.org"
393         :commit-privilege t
394         :themes (git))))
395 @end lisp
396
397 @cindex Project Descriptor
398 @cindex Descriptor, Project
399 @vindex patcher-projects
400 As you can imagine, @code{patcher-projects} is a user option in which
401 you store information about the projects you want to manage with
402 Patcher. It is actually a list of what's called @dfn{project
403 descriptors}. Here's the meaning of the only project descriptor we have
404 in the example above: we have a project named ``SuperProj'', located in
405 @file{/home/me/superproj} and for which emails should be sent to
406 @email{superproj-devel@@superproj.org}. In addition to that, this
407 project is handled by Git.
408
409 @cindex Project Option
410 @cindex Theme
411 Note the particular syntax for specifying the mailing address. This is
412 what's called a @dfn{project option}. Contrary to the project's name and
413 directory, which are mandatory and always appear as the first and second
414 elements of a project descriptor, project options are optional and can
415 appear in any order. Note also that we have used a @code{:themes} option
416 for specifying the revision control system in use. A ``theme'' is a set
417 of options with particular values. Patcher happens to come with some
418 predefined themes, including one for Git.
419
420
421 @c Calling Patcher ====================================================
422 @node Calling Patcher, Filling the ChangeLogs, Setting up Patcher, Quick Start
423 @section Calling Patcher
424
425 Now you want to build a patch with your changes, and prepare a message
426 to submit them. The way Patcher works is currently to setup the message
427 first, and then to control all subsequent operations from there. In
428 other words, to create a patch, you actually ask Patcher to prepare a
429 mail. Type this:
430
431 @lisp
432 M-x patcher-mail
433 @end lisp
434
435 @findex patcher-mail
436 First, you're prompted (with completion) for a project name (the first
437 element of each project descriptor, remember?). We currently only have a
438 ``SuperProj'' project, so hitting @kbd{TAB} will directly fill the
439 minibuffer in with this only choice. Then, you're prompted for a subject
440 line that will be used in the mail. Say something sensible here.
441
442 Three operations are now executed in turn:
443
444 @enumerate
445 @item
446 @fpoindex{to-address}@c
447 Patcher prepares a mail buffer. The message will be sent to the address
448 you specified with the @code{:to-address} project option, and the
449 subject line now reads ``[PATCH] something sensible here''.
450 @item
451 Patcher now builds the patch. The command used to do this is specified
452 in the Git theme, but it is a project option so it can be changed. Upon
453 successful completion of this command (we assume that's indeed the
454 case), the patch is inserted into the mail buffer. Some information
455 about the patch is provided just above it (the command used, the files
456 affected and so on).
457 @item
458 Finally, Patcher generates ChangeLog skeletons from what it understands
459 of the patch. This involves visiting the appropriate ChangeLog files,
460 and creating initial entries.
461 @end enumerate
462
463
464 @c Filling the ChangeLogs =============================================
465 @node Filling the ChangeLogs, Filling the Message, Calling Patcher, Quick Start
466 @section Filling the ChangeLogs
467
468 @findex patcher-mail-next-change-log
469 @findex patcher-change-log-next
470 @kindex C-c C-p n
471 Patcher has just created initial ChangeLog entries for you. You must now
472 browse through the ChangeLog file(s) and fill the entries as you see
473 fit. From the mail buffer type @kbd{C-c C-p n}
474 (@code{patcher-mail-first-change-log}). This command will bring you to
475 the first ChangeLog file that you need to fill in. From a ChangeLog
476 buffer, the same keyboard sequence will will bring you to the next one,
477 and so on (@code{patcher-change-log-next}).
478
479 @findex patcher-change-log-mail
480 @kindex C-c C-p m
481 Once you're done, you can very well save the ChangeLog buffers. However,
482 don't kill them! Don't even think about it. Patcher still needs them.
483 From any of the ChangeLog buffers you just filled in, type @kbd{C-c C-p
484 m} (@code{patcher-change-log-mail}). This will bring you back to the
485 mail buffer.
486
487
488 @c Inserting the ChangeLog entries ====================================
489 @node Filling the Message, Committing the Patch, Filling the ChangeLogs, Quick Start
490 @section Filling the message
491
492 Now that you're satisfied with your ChangeLog entries and you've
493 returned to the mail buffer, you want to write some explanation text in
494 the message. I'll let you do that. You also want to insert the ChangeLog
495 entries corresponding to your patch, since they are usually much more
496 readable than the patch itself.
497
498 @findex patcher-mail-insert-change-logs
499 @kindex C-c C-p l
500 Inserting your ChangeLog entries in the mail buffer is as simple as
501 typing @kbd{C-c C-p l} (@code{patcher-mail-insert-change-logs}). This
502 command places them just above the patch, with a short information line
503 (per ChangeLog file) on top.
504
505
506 @c Committing the Patch ===============================================
507 @node Committing the Patch, Sending the Message, Filling the Message, Quick Start
508 @section Committing the Patch
509
510 If you have commit access to your project, you should read this.
511 Otherwise, you may directly jump to @ref{Sending the Message}.
512
513 Committing your changes involves three steps: preparing the commit
514 command, preparing the commit log message, and actually committing the
515 changes. Although Patcher can do all of this in one shot, it gives you
516 control each step by default.
517
518 @findex patcher-mail-commit
519 @kindex C-c C-p c
520 In order to start the commit process, simply type @kbd{C-c C-p c}
521 (@code{patcher-mail-commit}). Congratulations. You've just been
522 transported to a new buffer, the ``log message'' buffer. This buffer
523 lets you edit the log message that will accompany your commit. Note that
524 the message is initialized with the subject line of your mail. This is
525 also a project option.
526
527 @findex patcher-logmsg-commit
528 @kindex C-c C-p c
529 @kindex C-c C-c
530 Once you're satisfied with the log message, type @kbd{C-c C-p c} or
531 @kbd{C-c C-c} (@code{patcher-logmsg-commit}). This command computes the
532 commit command to use, and while you think that you're done this time,
533 you're not quite there yet. Indeed, patcher transports you to yet
534 another buffer called the ``commit command'' buffer. This buffer lets
535 you modify, or at least check the commit command to use.
536
537 The default commit command is specified in the Git theme, but it is of
538 course a project option so it can be changed. Note that Patcher stores
539 the log message in a temporary file and uses the @option{-F} option of
540 the Git @samp{commit} command. Finally, note that Patcher has
541 automatically appended the affected ChangeLog files to the commit
542 command.
543
544 @findex patcher-cmtcmd commit
545 @kindex C-c C-p c
546 @kindex C-c C-c
547 If the commit command suits you, type @kbd{C-c C-p c} or @kbd{C-c C-c}
548 (@code{patcher-cmtcmd-commit}). This time, you're done. If you had not
549 previously saved the ChangeLog files, Patcher will do it for you just
550 before committing.
551
552 As Patcher doesn't do pushing (neither pulling) yet, you may now want to
553 push your changes to the remote repository by hand.
554
555
556 @c Sending the Message ================================================
557 @node Sending the Message, , Committing the Patch, Quick Start
558 @section Sending the Message
559
560 Sending the message has actually nothing to do with Patcher. It depends
561 on the method you use for sending mails, but will usually be done via a
562 @kbd{C-c C-c} command of some sort. On thing to note however: if you've
563 committed your changes via Patcher, the message has been slightly
564 modified: the subject line now reads ``[COMMIT] something sensible
565 here'' instead of ``[PATCH] something sensible here'', and a short
566 commit notice has been inserted just at the beginning of the message's
567 body.
568
569 That's it. That was easy. Congratulations on your first shot at Patcher,
570 anyway! Of course, Patcher is much more powerful and customizable than
571 what has been described in this chapter. For a complete documentation on
572 how to use and customize Patcher, please refer to @ref{User Manual}.
573
574
575
576 @c ====================================================================
577 @c User Manual
578 @c ====================================================================
579 @node User Manual, XEmacs Development, Quick Start, Top
580 @chapter User Manual
581
582 This chapter provides a step-by-step guide to using Patcher. Everything
583 there is to know about Patcher is here, though the features are
584 introduced progressively.
585
586 All user options that are going to be presented in this manual can be
587 found in the @code{patcher} customization group, or a subgroup of it.
588
589 @findex patcher-version
590 @kindex C-c C-p v
591 At any time, and in any buffer related to a Patcher project (mail,
592 ChangeLog @etc{}), you can query the current version of Patcher by
593 calling the function @code{patcher-version}, bound to @kbd{C-c C-p v}.
594
595 @menu
596 * Starting Up::         Patcher entry points
597 * Message Generation::  Specifying how a mail is to be constructed
598 * Patch Generation::    Specifying how a patch is to be constructed
599 * ChangeLogs Handling:: How Patcher behaves with respect to ChangeLogs
600 * Project Check In::    Committing your changes from Patcher
601 * Mail Sending::        Sending the message and cleaning up the place
602 * More On Commands::    Error handling and other generalities
603 @end menu
604
605 @ignore
606 The manual is currently organized in a rather sequential way: one
607 chapter for source patches, one for ChangeLogs. This might not be the
608 best way to do it. Another way is to split the information in terms of
609 patch/ChangeLog creation, and Patch/ChangeLog appearance in messages.
610 @end ignore
611
612
613 @c Starting Up ========================================================
614 @node Starting Up, Project Descriptors, User Manual, User Manual
615 @section Starting Up
616
617 Starting up Patcher implies first defining a project, and then calling
618 one of the entry point functions. This section describes how to do that.
619
620 @menu
621 * Project Descriptors::   The project specification mechanism
622 * Entry Points::          Ways to fire up Patcher
623 * Project Relocation::    Temporarily changing a project's directory
624 * Subprojects::           Working on a project subset
625 * Submodules::            Projects under projects
626 * Patcher Instances::     Working on several projects in parallel
627 @end menu
628
629 @node Project Descriptors, Entry Points, Starting Up, Starting Up
630 @subsection Project Descriptors
631
632 @cindex Project Descriptor
633 @cindex Descriptor, Project
634 @vindex patcher-projects
635 Projects specifications are stored in @code{patcher-projects}. This user
636 option is actually a list of @dfn{project descriptors}. Each project
637 descriptor has the following form: @samp{(@var{NAME} @var{DIR}
638 @var{:OPTION} @var{VALUE} @dots{})}
639
640 @itemize @bullet
641 @item
642 @var{NAME} is a string naming your project.
643 @item
644 @var{DIR} is a string specifying the directory in which to find the
645 project. It can also be set to @code{nil} in which case Patcher will
646 prompt you for the project's location every time it is needed (such
647 projects are called ``floating'' projects). This feature may be useful
648 when you maintain several clones of the same repository but want to
649 define it only once in Patcher. Another potential use of this is when
650 several independent projects happen to share exactly the same set of
651 options.
652 @item
653 @cindex Project Option
654 @fpoindex{to-address}@c
655 The remainder of a project descriptor is a sequence of zero or more
656 option/value pairs that we call @dfn{project options}. All option names
657 start with a colon. The type of a value depends on the corresponding
658 option. For example, there is a project option named @code{:to-address},
659 whose value should be a string giving the email address to which you
660 want to send Patcher messages.
661 @end itemize
662
663 When Patcher needs the value for a particular project option, it looks
664 for it directly in the project descriptor, but also in other places.
665 This process is described below.
666
667 @menu
668 * Themes::                 Collections of options
669 * Project inheritance::    Getting options from other projects
670 * Fallbacks::              Default values for project options
671 * Retrieval::              The process of getting an option's value
672 * Inheritance or theme?::  The proper way to factor out option values
673 @end menu
674
675 @node Themes, Project inheritance, , Project Descriptors
676 @subsubsection Themes
677
678 @cindex Theme
679 If you have several projects sharing the same option set, you might want
680 to setup a theme. Themes are named collections of project options.
681
682 @vindex patcher-themes
683 Themes are stored in the @code{patcher-themes} user option. This option
684 is a list of themes. Each theme has the following form:
685 @samp{(@var{NAME} @var{:OPTION} @var{VALUE} @dots{})}.
686
687 @var{NAME} is the theme's name (a symbol). The remainder of the list is
688 a sequence of zero or more option/value pairs, just like in project
689 descriptors.
690
691 @fpoindex{themes}@c
692 In order to use a theme in a given project, a @code{:themes} project
693 option is provided. It is a list of theme names (symbols). Use this
694 option in your project descriptor, and the project will implicitly
695 inherit all options from the corresponding theme.
696
697 One important note: as @code{:themes} is a project option, it can appear
698 in a theme. In other words, themes can inherit from other themes. When
699 Patcher tries to retrieve an option from a theme (an that option is not
700 directly available), the themes tree is traversed depth first.
701
702 @vindex patcher-max-theme-depth
703 Because themes can contain themes, a bogus setting might lead to an
704 infinite loop (a cycle in a theme graph). To prevent this, the
705 @code{patcher-max-theme-depth} user option is provided. It represents
706 the expected maximum theme nesting level and defaults to 8.
707
708 @cindex Built-in Theme
709 @cindex Theme, Built-in
710 @vindex patcher-built-in-themes
711 @birtindex{git}@c
712 @birtindex{hg}@c
713 @birtindex{darcs}@c
714 @birtindex{svn}@c
715 @birtindex{cvs}@c
716 @birtindex{prcs}@c
717 Patcher comes with a set of built-in themes for several revision control
718 systems. These are Git, Mercurial (Hg), Darcs, Subversion (Svn), CVS and
719 PRCS. Look at the value of @code{patcher-built-in-themes} to see what's
720 in them. Each of these themes have a @code{-ws} counterpart which
721 eliminates white-space differences in diff outputs. This comes in handy
722 if you are a committer (@pxref{Project Check In}) and you perform some
723 kind of automatic white-space cleanup in the files you edit, especially
724 when you let Patcher generate the ChangeLog entries (@pxref{ChangeLogs
725 Handling}).
726
727 @vindex pather-themes
728 While you can't modify the value of @code{patcher-built-in-themes},
729 you're free to do whatever you want in @code{patcher-themes},
730 including creating a theme with the same name as a built-in one. This
731 new theme will take precedence over the other. Having this built-in
732 variable (a constant, actually) lets me modify its value from release
733 to release without risking to smash your own adjustments.
734
735 @node Project inheritance, Fallbacks, Themes, Project Descriptors
736 @subsubsection Project inheritance
737
738 @cindex Project Inheritance
739 When two projects are very similar, you might prefer to use the project
740 inheritance mechanism described below over themes.
741
742 @poindex{inheritance}@c
743 There is a special project option called @code{:inheritance}. This
744 option must be a list of project names (strings). The inheritance of a
745 project defines a list of projects from which to inherit options.
746
747 One important note: inherited projects might have their own
748 @code{:inheritance} option set to other projects in turn. In other
749 words, the project inheritance can be more than one level deep. Just as
750 for themes traversal, when Patcher tries to retrieve an option and this
751 option is not available directly, the inheritance tree is traversed
752 depth first.
753
754 @vindex patcher-max-inheritance-depth
755 Because inherited projects can inherit from projects, a bogus setting
756 might lead to an infinite loop (a cycle in a project graph). To prevent
757 this, the @code{patcher-max-inheritance-depth} user option is provided.
758 It represents the expected maximum project inheritance level and
759 defaults to 8.
760
761 The @code{:inheritance} project option is somewhat special in the sense
762 that it can't appear in a theme. We will encounter other exceptions
763 later in this manual.
764
765
766 @node Fallbacks, Retrieval, Project inheritance, Project Descriptors
767 @subsubsection Fallbacks
768
769 @cindex Fallback
770 @fpoindex{to-address}@c
771 For each existing project option, Patcher also has a @dfn{fallback} user
772 option with a default value that would be shared among all projects not
773 setting the option explicitly. The name of the fallback is obtained by
774 replacing the colon in the project option's name with the prefix
775 @code{patcher-default-}. For example, the fallback corresponding to the
776 @code{:to-address} project option is named
777 @code{patcher-default-to-address}.
778
779 The @code{:inheritance} project option is also special in the sense that
780 it doesn't have a corresponding fallback. We will encounter other
781 exceptions later in this manual.
782
783 In the remainder of this manual, we will rarely mention the fallbacks
784 again. When we introduce a new project option, just remember that it
785 always has a corresponding fallback (well, not always, as you just
786 discovered).
787
788
789 @node Retrieval, Inheritance or theme?, Fallbacks, Project Descriptors
790 @subsubsection Retrieval
791
792 When Patcher needs the value of a particular project option, it looks
793 for it in the following manner:
794
795 @itemize @bullet
796 @item
797 First, it looks directly in the project descriptor to see if the option
798 is given.
799
800 @item
801 @fpoindex{themes}@c
802 @vindex patcher-themes
803 If that fails, it next tries the given themes, if any. This involves
804 recursively traversing the project's themes tree. Options successfully
805 retrieved in themes are said to be @dfn{themed}.
806
807 @item
808 @poindex{inheritance}@c
809 If that still fails, it then tries the inherited projects, if any. This
810 involves recursively traversing the project's inheritance tree. Options
811 successfully retrieved in inherited projects are said to be
812 @dfn{inherited}. Note that in turn, such options could have been
813 actually themed in the inherited project.
814
815 @item
816 If that fails again, it finally falls back to the value given in the
817 corresponding fallback (if it exists). In such a case, the option is
818 said to be @dfn{fallbacked}.
819 @end itemize
820
821 Note that a value of @code{nil} for a project option @strong{is an
822 actual value}. It is not equivalent to an option being unset. As a
823 consequence, if Patcher finds a project option with a value of
824 @code{nil} somewhere, it will use it and stop the search, even if a non
825 @code{nil} value could be retrieved later from a theme, an inherited
826 project or a fallback. This provides you with a way to annihilate
827 themed, inherited or fallbacked options.
828
829 The retrieval process is completely dynamic. In particular, this means
830 that even if you already have a running Patcher instance, you can still
831 modify the project's options, and these modifications will be taken into
832 account in your running instance. In fact, the only thing you can't do
833 with a running Patcher instance is modify the project's name.
834
835 Beware however that modifying an option while a corresponding project
836 has been instantiated is not very safe, and should be avoided as much as
837 possible.
838
839
840 @node Inheritance or theme?, , Retrieval, Project Descriptors
841 @subsubsection Inheritance or theme?
842
843 Let us summarize the four available ways to provide an option for a
844 project: a direct setting in the project descriptor, a global default
845 value in the fallback user option, plus themes and inherited projects.
846
847 At that point, you might be wondering why the themes and inheritance
848 concepts were both designed, since they actually perform very similar
849 tasks. Good question. Here is a good answer.
850
851 Projects might share options for different reasons. For example, my
852 ``XEmacs'' (source) and ``XEmacs Packages'' projects share many options
853 (@code{To:} address, @code{From:} address, diff and commit commands and
854 so on) because they both relate to XEmacs. On the other hand I have
855 personal but totally unrelated projects that share the same commands
856 because they are all handled through a common system: Git.
857
858 In other words, you should rather use the inheritance mechanism when
859 projects relate to each other, and the theme mechanism for settings that
860 are orthogonal the projects they apply to.
861
862
863 @node Entry Points, Project Relocation, Project Descriptors, Starting Up
864 @subsection Entry Points
865
866 Patcher currently uses the mail buffers as ``master'' buffers for
867 controlling all operations: building a patch, creating the ChangeLog
868 entries, committing@dots{} all is done from the mail buffer. Note
869 however that you don't need to actually send mails to use Patcher
870 (@pxref{Fake Mail Method}).
871
872 To use Patcher on a certain project, you start by preparing a (possibly
873 fake) mail. There are several ways to do so: you could start a brand new
874 message, ``adapt'' a message already in preparation to Patcher, or even
875 compose some sort of a Patcher reply to another message.
876
877 @findex patcher-mail-kill
878 @kindex C-c C-p k
879 At any time from a mail buffer, you may change your mind and decide that
880 starting Patcher was a mistake. You can then call the function
881 @code{patcher-mail-kill}, bound to @kbd{C-c C-p k}, and Patcher will
882 ``kill'' the current project, cleaning up the place like Patcher had
883 never existed before.
884
885 @menu
886 * Mail Creation::         Brand new messages
887 * Mail Adaptation::       Adapting existing messages
888 * Gnus Insinuation::      Using Gnus as your mail backend
889 @end menu
890
891 @node Mail Creation, Mail Adaptation, Entry Points, Entry Points
892 @subsubsection Mail Creation
893
894 Creating a message is done with the following function.
895
896 @defun patcher-mail
897 Start composing a brand new Patcher message. This function interactively
898 prompts you for the name of the project and for a (mail) subject line.
899 It also performs a global diff of your project.
900 @end defun
901
902
903 @node Mail Adaptation, Gnus Insinuation, Mail Creation, Entry Points
904 @subsubsection Mail Adaptation
905
906 Assuming that you are already editing a message (with your usual MUA),
907 you can adapt it to Patcher. This might be useful if you want to reply
908 to a normal message with a Patcher mail and your MUA is unknown to
909 Patcher (@pxref{Insinuation}). Start by creating the reply, and then
910 adapt it to Patcher.
911
912 @defun patcher-mail-adapt
913 Adapt an existing message to Patcher by prompting you for the name of a
914 project and possibly a new subject. This function also performs a global
915 diff of your project.
916 @end defun
917
918 @fpoindex{subject-rewrite-format}@c
919 When adapting a message to Patcher, you are always prompted for a new
920 subject line, although you can just hit @kbd{Return} to leave it empty.
921 If there is indeed a subject change (that is, if there is both an old
922 subject and a new one), Patcher uses a project option called
923 @code{:subject-rewrite-format} to modify the subject line. The subject
924 rewrite format is a string in which a @samp{%s} is replaced with the new
925 subject, while a @samp{%S} is replaced with the old one.
926
927 By default, the subject rewrite format is @samp{"%s (was: %S)"}. Note
928 that the subject prefix (@pxref{Message Customization}) is added in
929 front of the subject line @emph{after} the subject has been rewritten.
930
931
932 @node Gnus Insinuation, , Mail Adaptation, Entry Points
933 @subsubsection Gnus Insinuation
934
935 If you're using Gnus to read mail and have properly insinuated it
936 (@pxref{Insinuation}), Patcher offers different Gnus-like ways to answer
937 mails and adapt them to Patcher. All the functions below are available
938 from both the Gnus Summary and Article buffers.
939
940 @defun patcher-gnus-summary-followup
941 @kindex C-c C-p f
942 Compose a followup to an article, and adapt it to Patcher. This function
943 is bound to @kbd{C-c C-p f}.
944 @end defun
945
946 @defun patcher-gnus-summary-followup-with-original
947 @kindex C-c C-p F
948 Idem, but also cite the original article. This function is bound to
949 @kbd{C-c C-p F}.
950 @end defun
951
952 @defun patcher-gnus-summary-reply
953 @kindex C-c C-p r
954 Like @code{patcher-gnus-summary-followup}, but compose a reply. This
955 function is bound to @kbd{C-c C-p r}.
956 @end defun
957
958 @defun patcher-gnus-summary-reply-with-original
959 @kindex C-c C-p R
960 Idem, but also cite the original article. This function is bound to
961 @kbd{C-c C-p R}.
962 @end defun
963
964 @node Project Relocation, Subprojects, Entry Points, Starting Up
965 @subsection Project Relocation
966
967 Earlier (@pxref{Project Descriptors}), we talked about floating projects
968 (those having a null directory). There might also be times when you want
969 to temporarily relocate a non-floating project (for instance just this
970 once, without modifying the project descriptor). You can relocate a
971 project by calling any of the entry point functions with a prefix of 1
972 (@key{C-u 1}).
973
974 Since people have a tendency to keep clones under the same umbrella
975 directory, it seems convenient to start prompting you for the relocation
976 directory under the parent of the project's original directory. Patcher
977 does that.
978
979 As previously mentioned for floating projects (@pxref{Project
980 Descriptors}), an interesting side effect of relocation is that it
981 allows you to use one particular project descriptor for another,
982 completely independent project which would happen to use exactly the
983 same set of options.
984
985 @node Subprojects, Submodules, Project Relocation, Starting Up
986 @subsection Subprojects
987
988 @cindex Subproject
989 As mentioned before (@pxref{Entry Points}) the entry point functions all
990 perform a global diff of your project just after having prepared the
991 mail buffer. There might be times, however, when you want to work on a
992 project subset only (a specific set of files or directories), for
993 instance in order to commit only a few of the current changes. This
994 concept is know to Patcher as working on a ``subproject''.
995
996 A subproject is essentially defined by the project on which it is based,
997 an optional subdirectory in which the whole subproject resides and an
998 optional set of specific files to work on, in that subdirectory.
999
1000 @b{Warning:} for technical reasons (and also because right now I don't
1001 want to clutter Patcher's code too much with workarounds for deficient
1002 RCSes), it is not possible to define Mercurial subprojects with a
1003 specific subdirectory. This problem will go away when issue 2726 is
1004 resolved (@uref{http://mercurial.selenic.com/bts/issue2726}).
1005
1006 When you provide an explicit set of files to work on, it is not
1007 necessary (it is even forbidden) to specify the ChangeLog files. Patcher
1008 will automatically find them for you. In other words, only specify
1009 source files, not ChangeLog files.
1010
1011 Patcher offers to ways of working on subprojects: either temporarily or
1012 by defining them in a permanent fashion.
1013
1014 @menu
1015 * Temporary Subprojects::       Subprojects which are not permanent
1016 * Permanent Subprojects::       Subprojects which are not temporary
1017 @end menu
1018
1019 @node Temporary Subprojects, Permanent Subprojects, Subprojects, Subprojects
1020 @subsubsection Temporary Subprojects
1021
1022 @cindex Temporary Subproject
1023 @cindex Subproject, Temporary
1024 In order to work on a temporary subproject, call any of the entry point
1025 functions (@pxref{Entry Points}) with a simple prefix argument
1026 (@key{C-u}). Patcher will then prompt you for an optional subdirectory
1027 and for a specific set of files to work on, under that particular
1028 subdirectory. There, you can in fact specify files as well as
1029 directories, use wildcards, just as you would construct a shell command
1030 line diff.
1031
1032 Note that since the files you provide can in fact be directories, you
1033 can circumvent the Mercurial limitation mentioned above by @emph{not}
1034 providing a specific subdirectory, but instead give it as a file at the
1035 second prompt. This workaround also applies to permanent subprojects, as
1036 described in the next section.
1037
1038
1039 @node Permanent Subprojects, , Temporary Subprojects, Subprojects
1040 @subsubsection Permanent Subprojects
1041
1042 @cindex Permanent Subproject
1043 @cindex Subproject, Permanent
1044 If you happen to work more than once on the same project subset, it will
1045 quickly become annoying to have to specify explicitly the same
1046 subdirectory and/or files over and over again. Consequently, Patcher
1047 offers you a way to permanently define subprojects.
1048
1049 @menu
1050 * Defining Subprojects::  Storing subprojects definitions
1051 * Project Naming::     When different projects have the same name
1052 * Command Directory::     For non local revision control systems
1053 @end menu
1054
1055
1056 @node Defining Subprojects, Project Naming, , Permanent Subprojects
1057 @b{Defining Subprojects}
1058
1059 @cindex Subproject Descriptor
1060 @cindex Descriptor, Subproject
1061 @vindex patcher-subprojects
1062 The user option @code{patcher-subprojects} stores a list of
1063 @dfn{subproject descriptors}. A subproject descriptor is almost the same
1064 as a project descriptor, with a few exceptions:
1065
1066 @itemize @bullet
1067 @item
1068 Instead of the project directory field (the second field in a project
1069 descriptor), you rather specify the name of the project this subproject
1070 is based on.
1071
1072 @item
1073 @cindex Subproject Option
1074 In addition to the standard project options we've already seen, two
1075 subproject options are available:
1076
1077 @table @code
1078 @item :subdirectory
1079 @spoindex{subdirectory}@c
1080 This lets you specify a subdirectory of the original project's directory
1081 in which the whole subproject resides. This subdirectory must be
1082 provided @emph{relative} to the original project's directory.
1083
1084 @item :files
1085 @spoindex{files}@c
1086 This lets you specify a list of files or directories composing the
1087 subproject. Each file specification may be provided @emph{relative} to
1088 the subdirectory above, if any, or to the original project's directory.
1089 They may also contain wildcards.
1090 @end table
1091
1092 Please note that these subproject options have no corresponding fallback
1093 (that would be meaningless). They can't appear in a theme either.
1094
1095 @item
1096 @poindex{inheritance}@c
1097 Subprojects don't have an @code{:inheritance} mechanism. Instead, they
1098 implicitly inherit from their base project (which in turn can inherit
1099 from other projects).
1100 @end itemize
1101
1102 Here are some important remarks about permanent subprojects:
1103
1104 @itemize @bullet
1105 @item
1106 Permanent subprojects are accessible in exactly the same way as normal
1107 projects, that is, via the entry point functions (@pxref{Entry Points}).
1108 A subproject @emph{is} a project, after all. Because of that, projects
1109 and permanent subprojects can't share names. Patcher always looks for
1110 subprojects first, and then regular projects.
1111
1112 @item
1113 @spoindex{subdirectory}@c
1114 @spoindex{files}@c
1115 A subproject with neither a @code{:subdirectory} nor a @code{:files}
1116 option is exactly the same as the base project, apart from project
1117 options that you would override. This can hence be seen as an elegant
1118 (or kludgy, depending on the viewpoint) way to define project
1119 ``variants''.
1120
1121 @item
1122 Since Patcher doesn't really make a distinction between projects and
1123 subprojects, it is possible to work on a temporary subproject based
1124 itself on a subproject: simply call one of the entry point functions
1125 with a simple prefix argument, and select a permanent subproject when
1126 prompted. The effect is then to work on a subsubproject: you can specify
1127 an optional subsubdirectory and override the set of files affected by
1128 the patch.
1129
1130 @item
1131 Finally, note that it is even possible to both relocate a project
1132 @emph{and} work on a temporary subproject. In order to do that, use a
1133 prefix argument of -1 instead of just 1 (@key{C-u -1}). And now, try to
1134 imagine the brain damage that is caused by using a prefix of -1 and then
1135 select a permanent subproject as the base project. The effect is to work
1136 on a sub-sub-relocated project@dots{}.
1137 @end itemize
1138
1139
1140 @node Project Naming, Command Directory, Defining Subprojects, Permanent Subprojects
1141 @b{Project Naming}
1142
1143 @vindex patcher-projects
1144 @vindex patcher-subprojects
1145 As you already know, Patcher distinguishes (sub)projects by their
1146 @var{NAME} field in the @code{patcher-projects} and
1147 @code{patcher-subprojects} user options. This name is meant to be
1148 explicit and convenient for the user to read. However, some RCSes like
1149 (the decidedly weird) PRCS require the @emph{actual} project name in
1150 their commands. It would then be difficult to define project variants
1151 for the same directory but with different names.
1152
1153 @fpoindex{name}@c
1154 To remedy this problem, patcher provides a @code{:name} project option.
1155 If set, it will be used by diff and commit commands instead of the
1156 project's name when necessary. See @ref{Diff Command} for details on how
1157 to do that.
1158
1159
1160 @node Command Directory, , Project Naming, Permanent Subprojects
1161 @b{Command Directory}
1162
1163 Most of the revision control systems out there can perform in any of the
1164 project's subdirectories. For that and other technical reasons, Patcher
1165 will normally execute all commands in the specified (sub)directory of
1166 the specified (sub)project. This principle does not always hold however.
1167 For example, PRCS (weird, did I mention it already?) can only work in
1168 the project's root directory.
1169
1170 @fpoindex{command-directory}@c
1171 If you want to define projects for which the revision control system can
1172 be executed in only one directory, Patcher provides you with the
1173 @code{:command-directory} project option (a string). This directory must
1174 be provided relative to the project's directory (but note that it must
1175 usually go upwards).
1176
1177 All commands (diff and commit ones) will be executed from there. Also,
1178 note that the command directory does not change the way you might
1179 specify files. Patcher modifies all needed paths automatically to handle
1180 the command directory properly. This means that you should continue to
1181 specify files relatively to the (sub)project's (sub)directory,
1182 regardless of the existence of a command directory.
1183
1184 When needed, a command directory should always be specified in a project
1185 (in which case it will most likely be the same as the project's
1186 directory) and never in subprojects. Otherwise, temporary subprojects
1187 would fail to get it.
1188
1189
1190 @node Submodules, Patcher Instances, Subprojects, Starting Up
1191 @subsection Submodules
1192
1193 @cindex Submodule
1194 Related to the notion of subproject is that of ``submodule'' (or
1195 ``subrepo'') as some RCSes would put it. A submodule is a standalone
1196 project that appears under another project (so it looks like a
1197 subproject, only it isn't).
1198
1199 Normally, there is nothing special about submodules, in the sense that
1200 if you want to handle them from Patcher, you would define them as
1201 regular projects. However, there are ways to detect submodules
1202 automatically, which can be very convenient if you have plenty of them
1203 (this happens for XEmacs packages for instance).
1204
1205 Patcher currently knows how to detect submodules of Mercurial and Git
1206 projects. The effect is to define new projects that inherit from the
1207 umbrella project automatically, with their own name and directory, so
1208 that you don't need to define them by hand.
1209
1210 @birtindex{git}@c
1211 @birtindex{hg}@c
1212 @fpoindex{submodule-detection-function}@c
1213 @findex patcher-hg-detect-submodules
1214 @findex patcher-git-detect-submodules
1215 Automatic detection of submodules is controlled via the
1216 @code{:submodule-detection-function} project option. Its value is a
1217 symbol naming a function, or @code{nil} if you don't want autodetection.
1218 The built-in Git and Mercurial themes set this option to
1219 @code{patcher-hg-detect-submodules} and
1220 @code{patcher-git-detect-submodules} respectively.
1221
1222 @findex patcher-detect-submodules
1223 Submodules are detected automatically by scanning the value of
1224 @code{patcher-projects} the first time you use Patcher in an XEmacs
1225 session. If you further modify this variable, it may be needed to
1226 recompute the list of known submodules. You can do this by calling
1227 @code{patcher-detect-submodules} interactively.
1228
1229
1230 @node Patcher Instances, , Submodules, Starting Up
1231 @subsection Patcher Instances
1232
1233 The concept of subproject brings up the question of having Patcher
1234 working on different patches at the same time. It is possible under some
1235 conditions:
1236
1237 @itemize @bullet
1238 @item
1239 You can have as many simultaneous Patcher instances as you want on
1240 projects that don't overlap.
1241
1242 @item
1243 You can have as many simultaneous Patcher instances as you want on the
1244 same project, as long as there is no overlapping between each
1245 subproject. This means that you can't have source files, or even
1246 ChangeLog files in common.
1247
1248 @item
1249 It is also possible, to some extent, to work simultaneously on
1250 overlapping instances of Patcher, although this is mostly uncharted
1251 territory. More precisely, Patcher keeps track of which project(s) refer
1252 to specific source or ChangeLog files, and knows how to associate a
1253 particular ChangeLog entry with a particular project. However, Patcher
1254 does not support interactive selection of patches (@`a la Darcs or Git)
1255 yet, and if you commit one of two overlapping projects, you will most
1256 likely need to rediff the other one.
1257 @end itemize
1258
1259
1260 @c Message Generation =================================================
1261 @node Message Generation, Patch Generation, User Manual, User Manual
1262 @section Message Generation
1263
1264 Patcher starts working on the project (by first creating
1265 the patch) after the message is prepared. Because of this, we'll start
1266 by reviewing the mail-related customizations you might want to setup.
1267
1268 @menu
1269 * Mail Methods::          Using a particular mailer
1270 * Message Customization:: Specifying initial contents for messages
1271 @end menu
1272
1273 @node Mail Methods, Message Customization, Message Generation, Message Generation
1274 @subsection Mail Methods
1275
1276 @fpoindex{mail-method}@c
1277 Since there are different mail packages working in XEmacs, Patcher
1278 supports different methods for preparing messages. You can specify the
1279 method you prefer in the @code{:mail-method} project option. The value
1280 must be a symbol.
1281
1282 @menu
1283 * Standard Mail Methods:: Patcher supports standard mail packages
1284 * Fake Mail Method::      Patcher supports not sending mails
1285 * Other Mail Methods::    Patcher supports everything
1286 @end menu
1287
1288 @node Standard Mail Methods, Fake Mail Method, Mail Methods, Mail Methods
1289 @subsubsection Standard Mail Methods
1290
1291 Patcher currently supports @file{sendmail}, @file{message} and
1292 @file{Gnus} natively and through the @file{compose-mail} interface.
1293 Other MUA might be partly supported when used with @code{compose-mail}.
1294 Patcher will probably suffer from non critical deficiencies in that case
1295 however (it will issue warnings).
1296
1297 @table @code
1298 @item compose-mail
1299 @findex compose-mail
1300 @findex patcher-mail-compose-mail
1301 @vindex mail-user-agent
1302 This is the default. It is implemented via the function
1303 @code{patcher-mail-compose-mail} which calls @code{compose-mail} to
1304 prepare the message. If you are not familiar with @samp{compose-mail},
1305 you might also want to throw an eye to the user option
1306 @code{mail-user-agent}. If your project does not specify an address to
1307 send the message to (@pxref{Message Customization}), it is prompted for.
1308
1309 @item sendmail
1310 @findex mail
1311 @findex patcher-mail-sendmail
1312 A direct interface to the @code{mail} function from the @code{sendmail}
1313 package. It is implemented via the function
1314 @code{patcher-mail-sendmail}. If your project does not specify an
1315 address to send the message to (@pxref{Message Customization}), it is
1316 prompted for.
1317
1318 @item message
1319 @findex message-mail
1320 @findex patcher-mail-message
1321 A direct interface to the @code{message-mail} function from the
1322 @code{message} library (it is part of @code{Gnus}). It is implemented
1323 via the function @code{patcher-mail-message}. If your project does not
1324 specify an address to send the message to (@pxref{Message
1325 Customization}), it is prompted for.
1326
1327 @item gnus
1328 @findex gnus-post-news
1329 @findex patcher-mail-gnus
1330 A direct interface to the @code{gnus-post-news} function from the
1331 @code{Gnus} package (it can also send mails@dots{}). It is implemented
1332 via the function @code{patcher-mail-gnus}. This mail method is
1333 interesting when you maintain a special mail group for messages that you
1334 send with Patcher, most probably because they are sent to some
1335 mailing-list, such as @email{xemacs-patches@@xemacs.org}.
1336
1337 @fpoindex{gnus-group}@c
1338 This method uses a Gnus group name and acts as if you had type @samp{C-u
1339 a} on that group in the @code{*Group*} buffer, hence honoring the group
1340 parameters and posting-styles. If your project does not specify a Gnus
1341 group name (@pxref{Message Customization}), it is prompted for.
1342 @end table
1343
1344 This last mail method is special in the sense that it requires a running
1345 Gnus session to work. If that's needed, Patcher can start Gnus for you
1346 in several ways, according to the following user options:
1347
1348 @table @code
1349 @item patcher-mail-run-gnus
1350 @vindex patcher-mail-run-gnus
1351 If @code{nil}, Patcher will never start Gnus and abort the operation
1352 instead. If @code{t}, Patcher will always start Gnus when needed. If
1353 @code{prompt}, Patcher will ask you what (you want) to do. This is the
1354 default behavior.
1355
1356 @item patcher-mail-run-gnus-other-frame
1357 @vindex patcher-mail-run-gnus-other-frame
1358 Used when Patcher has to start Gnus by itself. If @code{nil}, continue
1359 using the current frame. If @code{t}, start Gnus in another frame (this
1360 is the default). If @code{follow}, start Gnus in another frame, and use
1361 this new frame to prepare the Patcher mail.
1362 @end table
1363
1364 @node Fake Mail Method, Other Mail Methods, Standard Mail Methods, Mail Methods
1365 @subsubsection Fake Mail Method
1366
1367 @findex patcher-mail-fake
1368 At that point, you might be wondering why the mail method is a project
1369 option and not simply a user option, since you probably only use one
1370 mail agent at all. Right. But you might one day work on projects for
1371 which you don't need to send messages at all. This could happen if you
1372 start using Patcher on a project of your own for instance. For that
1373 reason, there is a @code{fake} mail method available. It is implemented
1374 via the @code{patcher-mail-fake} function and calls no particular mail
1375 user agent. Once you type @kbd{C-c C-c} to virtually send the fake
1376 message, it only performs some cleanup.
1377
1378 All right. But did we really need this fake method? I mean, one could
1379 use the usual mail method, and simply not send the message in the end.
1380 Huh, yeah, ok@dots{} Actually, it is very probable that in a future
1381 release of Patcher, the mail buffer won't be the master buffer anymore,
1382 and mail sending will be just another optional step in the process. In
1383 that case, the mail method is likely to move away from project option
1384 to standard user option.
1385
1386 @node Other Mail Methods, , Fake Mail Method, Mail Methods
1387 @subsubsection Other Mail Methods
1388
1389 @fpoindex{mail-method}@c
1390 If you're not satisfied with the provided mail methods (want a @code{vm}
1391 one?), you can provide your own, more or less (patches welcome if you do
1392 so). Here's what to do: set your @code{:mail-method} project option to,
1393 say, @code{foo}, and write your own function which must be named
1394 @code{patcher-mail-foo}.
1395
1396 This function must take two arguments (a project descriptor and a string
1397 containing the subject of the message), and prepare a mail buffer. If
1398 you want to do this, you should see how it's done for the built-in
1399 methods.
1400
1401 Note that the mail adaptation facility won't be available for your
1402 custom method. For that, you would have to hack the internals of
1403 Patcher.
1404
1405
1406 @node Message Customization, , Mail Methods, Message Generation
1407 @subsection Message Customization
1408
1409 When preparing a message, Patcher can fill some parts of it for you.
1410 Here's a list of mail-related project options.
1411
1412 @table @code
1413 @item :user-name
1414 @fpoindex{user-name}@c
1415 The name (your name) to use when composing the message. It will affect
1416 the @code{From:} header. This option is used by all mail methods but
1417 @code{fake}. If not given, @code{user-full-name} is used.
1418
1419 @item :user-mail
1420 @fpoindex{user-mail}@c
1421 The mail (your mail) address to use when composing the message. It will
1422 affect the @code{From:} header. This option is used by all mail methods but
1423 @code{fake}. If not given, @code{user-mail-address} is used.
1424
1425 @item :to-address
1426 @fpoindex{to-address}@c
1427 The address to send messages to (a string). This option is used by all
1428 mail methods but @code{gnus} and @code{fake}. If not given, it is
1429 prompted for when calling @code{patcher-mail}.
1430
1431 @item :gnus-group
1432 @fpoindex{gnus-group}@c
1433 The Gnus group name to use for posting messages (a string). This option
1434 is used only by the @code{gnus} mail method. If not given, it is
1435 prompted for when calling @code{patcher-mail}.
1436
1437 Note that if you configured your name and mail in Gnus, for instance
1438 through posting styles, these configurations take precedence over the
1439 corresponding Patcher options.
1440
1441 @item :subject-prefix
1442 @fpoindex{subject-prefix}@c
1443 A prefix for the subject line of messages. It can be @code{nil} or a
1444 string. By default, ``[PATCH]'' is used. This part of subjects is never
1445 prompted for. The subject prefix understands @samp{%n} and @samp{%N}
1446 substitutions. @xref{Diff Command}, and @ref{Project Naming} for more
1447 information. Also, a space is inserted between the prefix and the
1448 remainder of the subject, when appropriate.
1449
1450 @item :subject
1451 @fpoindex{subject}@c
1452 A default value for prompted subjects (a string). Please note that this
1453 is used @strong{only} to provide a default value for prompted subjects.
1454 Subjects are @strong{always} prompted for. The subject understands
1455 @samp{%n} and @samp{%N} substitutions. @xref{Diff Command}, and
1456 @ref{Project Naming} for more information.
1457
1458 @item :mail-prologue
1459 A prologue to insert at the top of a message body (a string).
1460 @end table
1461
1462 @c Patch Generation ===================================================
1463 @node Patch Generation, ChangeLogs Handling, Message Generation, User Manual
1464 @section Patch Generation
1465
1466 Patcher creates patches by diffing your local copy of the project
1467 against the repository. This is done automatically after preparing a
1468 message, so you shouldn't normally bother to do it manually. There are
1469 however situations in which you need to diff your project again, for
1470 instance if an error occurred during the initial diff (@pxref{More On
1471 Commands}), or if you suddenly decided to further modify the source
1472 files.
1473
1474 @findex patcher-mail-diff
1475 @kindex C-c C-p d
1476 The way to regenerate the patch manually is to call
1477 @code{patcher-mail-diff} from the mail buffer. This function is bound to
1478 @kbd{C-c C-p d} in this buffer.
1479
1480 When possible, Patcher also tries to check that your project is
1481 up-to-date with respect to the archive, and will inform you otherwise.
1482
1483 In the remainder of this section, we describe the different ways to
1484 customize the diff process and the appearance of its output.
1485
1486 @menu
1487 * Diff Command::        Specifying the command to generate the patch
1488 * Diff Headers::        Associating hunks with files
1489 * Diff Line Filter::    Omitting lines from the diff output
1490 * Diff Prologue::       A header is inserted above the patch
1491 @end menu
1492 @c #### NOTE: The after-diff hook feature is currently unused and not
1493 @c documented.
1494
1495 By the way, (re)generating the patch does not necessarily mean that it
1496 is directly inserted into the mail buffer. This also depends on the
1497 ChangeLogs behavior (@pxref{ChangeLogs Handling}).
1498
1499 @node Diff Command, Diff Headers, Patch Generation, Patch Generation
1500 @subsection Diff Command
1501
1502 @fpoindex{diff-command}@c
1503 @findex patcher-mail
1504 The diff command used to generate the patch is specified by the
1505 @code{:diff-command} project option. You can also punctually change this
1506 command by calling @code{patcher-mail-diff} with a prefix argument.
1507 Patcher will then prompt you for a new command and use it exclusively
1508 for this particular patch.
1509
1510 By the way, don't use the prefix argument of @code{patcher-mail-diff} as
1511 a way to specify files (that is work on a subproject). It is not meant
1512 for that. It is meant only to modify the diff command for this instance
1513 only, not the files to which it applies.
1514
1515 The diff command is in fact a template string that supports dynamic
1516 expansion for a set of special constructs. The following ones are
1517 currently available.
1518
1519 @table @code
1520 @item %n
1521 @fpoindex{name}@c
1522 A @samp{%n} will be replaced with the project's name, that is, either
1523 the value of the @samp{:name} option (@pxref{Project Naming}) or the
1524 name of the project descriptor. This may be useful in commands with
1525 weird options syntax, like PRCS.
1526 @item %N
1527 If you want to use the project descriptor's name, regardless of the
1528 value of the @code{:name} option, use @code{%N} instead of @code{%n}.
1529 @item %f
1530 A @samp{%f} will be replaced with explicitly diff'ed files and their
1531 accompanying ChangeLog files if any, or will simply be discarded for a
1532 global diff.
1533 @item %?f@{STR@}
1534 If there are explicitly diff'ed files, this construct will be replaced
1535 by @samp{STR}. Otherwise, it will simply be discarded.
1536 @item %!f@{STR@}
1537 This is the opposite of the previous one: if there are explicitly
1538 diff'ed files, this construct will be discarded. Otherwise, it will be
1539 replaced by @samp{STR}.
1540 @end table
1541
1542 @birtindex{git}@c
1543 Here is an example to clarify this: the default diff command for Git in
1544 the @samp{git} built-in theme (@pxref{Themes}) is the following:
1545
1546 @samp{git diff --no-prefix HEAD%?f@{ -- @}%f}
1547
1548 One important note: all diff commands in Patcher @strong{must} have a
1549 @samp{%f} construct somewhere, even if you always perform global diffs
1550 only (but in fact, you never really know that for sure). The reason is
1551 that there are situations in which Patcher may need to diff specific
1552 files, even for a global diff.
1553
1554 See also @ref{More On Commands} for cases where a diff command would
1555 fail.
1556
1557 @node Diff Headers, Diff Line Filter, Diff Command, Patch Generation
1558 @subsection Diff Headers
1559
1560 When Patcher generates a diff, it needs to associate every hunk with the
1561 corresponding source file (and possibly with the corresponding ChangeLog
1562 file as well). Unfortunately, different revision control systems might
1563 generate different diff outputs, making this association difficult to
1564 establish.
1565
1566 @fpoindex{diff-header}@c
1567 Patcher provides a @code{:diff-header} project option to help. Its value
1568 is of the form @code{(REGEXP NUMBER1 NUMBER2)}. @code{REGEXP} is used to
1569 match the beginning of a diff output while NUMBER1 and NUMBER2 are the
1570 parenthesized levels in which to find the corresponding old and new file
1571 names.
1572
1573 When the change involves modifying a file's contents, the old and new
1574 file names will be the same. However, they can be different in several
1575 situations, like when a file is renamed, created or deleted. In case of
1576 creation or deletion, some revision control systems use
1577 ``@code{/dev/null}'' to denote a virtual old or new file.
1578
1579 @vindex patcher-built-in-themes
1580 If you want to see some examples, have a look at the built-in themes in
1581 @code{patcher-built-in-themes} (@pxref{Themes}). They contain presets
1582 for different revision control systems, along with suitable
1583 @code{:diff-header} options.
1584
1585 Also, you should pay attention to the fact that the values of the
1586 @code{:diff-header} and @code{:diff-command} options may depend on one
1587 another to work properly. For instance, the diff output of Mercurial
1588 looks different when you use the @code{--git} option.
1589
1590
1591 @node Diff Line Filter, Diff Prologue, Diff Headers, Patch Generation
1592 @subsection Diff Line Filter
1593 When generating a global diff, that is, without specifying the files
1594 affected by the patch explicitly, some uninformative lines might be
1595 present in the output. A typical example occurs in CVS: it indicates
1596 files present in your local copy but otherwise unknown to the server
1597 with a question mark in diff outputs.
1598
1599 @fpoindex{diff-line-filter}@c
1600 Patcher has a project option named @code{:diff-line-filter} that lets
1601 filter out such unwanted lines. This must be a regular expression
1602 matching a whole line. Caution however: do not put beginning or end of
1603 lines markers in your regexp. Patcher will do it for you.
1604
1605 @node Diff Prologue, , Diff Line Filter, Patch Generation
1606 @subsection Diff Prologue
1607
1608 Patcher can (and does) insert a special prologue just above a patch in
1609 the message in preparation. This prologue gives information such as the
1610 diff command used, the files affected and so on.
1611
1612 @fpoindex{diff-prologue-function}@c
1613 @findex patcher-default-diff-prologue
1614 The function used to generate this prologue can be specified with the
1615 @code{:diff-prologue-function} project option. A value of @code{nil}
1616 means don't insert any prologue. By default, the internal function
1617 @code{patcher-default-diff-prologue} is used. If you want to provide
1618 your own, here's how to do it.
1619
1620 Your function should take two mandatory arguments: @code{name} and
1621 @code{kind}. @code{name} is the name of the project and @code{kind} is
1622 the kind of diff. Possible values for the @code{kind} argument are:
1623
1624 @table @code
1625 @item :sources
1626 indicates a source diff only,
1627 @item :change-logs
1628 indicates a ChangeLog diff only,
1629 @item :mixed
1630 indicates a diff on both source and ChangeLog files.
1631 @end table
1632
1633 Your function should also accept the following set of Common Lisp style
1634 keyword arguments (take a look at the provided function if you don't
1635 know how to do this). These arguments will be bound when appropriate,
1636 according to the kind of diff being performed.
1637
1638 @table @code
1639 @item source-diff
1640 the command used to create a source diff,
1641 @item change-log-diff
1642 the command used to create a ChangeLog diff,
1643 @item source-files
1644 sources files affected by the current patch,
1645 @item change-log-files
1646 ChangeLog files affected by the current patch.
1647 @end table
1648
1649 In the case of a mixed diff, a @code{nil} value for
1650 @code{change-log-diff} indicates that the same command was used for both
1651 the source and ChangeLog files.
1652
1653 Finally, your function should perform insertion at the current point in
1654 the current buffer.
1655
1656
1657 @c ChangeLog Handling =================================================
1658 @node ChangeLogs Handling, Project Check In, Patch Generation, User Manual
1659 @section ChangeLogs Handling
1660
1661 ChangeLogs management in Patcher involves two aspects: how ChangeLog
1662 entries are created, and how they appear in the messages. Both aspects
1663 can be customized beyond your craziest dreams.
1664
1665 @findex patcher-change-log-kill
1666 @kindex C-c C-p k
1667 It is possible to kill a project from a related ChangeLog file by using
1668 the same binding as in the mail buffer: @kbd{C-c C-p k}
1669 (@code{patcher-change-log-kill}).
1670
1671 @menu
1672 * ChangeLogs Naming::     Are ChangeLogs called ChangeLogs?
1673 * ChangeLogs Updating::   How Patcher deals with ChangeLogs
1674 * ChangeLogs Navigation:: Browsing ChangeLog buffers
1675 * ChangeLogs Appearance:: How ChangeLogs appear in messages
1676 * ChangeLogs Prologue::   A header is inserted above the ChangeLogs
1677 * ChangeLogs Status::     Getting rid of ancient technology
1678 @end menu
1679
1680 @node ChangeLogs Naming, ChangeLogs Updating, ChangeLogs Handling, ChangeLogs Handling
1681 @subsection ChangeLogs Naming
1682
1683 @fpoindex{change-log-file-name}@c
1684 By default, Patcher thinks that ChangeLog files are named ``ChangeLog''.
1685 That is very clever, but if for some obscure reason that is not the case
1686 in your project, you can change this by setting the
1687 @code{:change-log-file-name} project option (a string).
1688
1689 @ignore
1690 Apart from changing Patcher's idea of ChangeLog file names, this option
1691 has another interesting application: suppose you're working in a project
1692 that has ChangeLog files, but you don't want patcher to treat them in a
1693 special way at all (you want Patcher to consider them as ordinary source
1694 files). The way to do this is to set @code{:change-log-file-name} to
1695 something that doesn't exist in your project, for instance ``
1696 ChangeLog'' (note the frontal space).
1697 @end ignore
1698
1699 @node ChangeLogs Updating, ChangeLogs Navigation, ChangeLogs Naming, ChangeLogs Handling
1700 @subsection ChangeLogs Updating
1701
1702 @fpoindex{change-logs-updating}
1703 The way Patcher deals with ChangeLogs is controlled via the
1704 @code{:change-logs-updating} project option. Its value (a symbol) must
1705 be one of @code{automatic} (the default), @code{manual} or @code{nil}.
1706
1707 @menu
1708 * Automatic ChangeLogs::        Automatic creation of ChangeLog skeletons
1709 * Manual ChangeLogs::           When ChangeLog entries already exist
1710 * No ChangeLogs::               For project that don't use ChangeLog files
1711 @end menu
1712
1713 @node Automatic ChangeLogs, Manual ChangeLogs, , ChangeLogs Updating
1714 @subsubsection Automatic ChangeLogs
1715
1716 Automatic ChangeLogs mode is the default. Each time you (re)generate a
1717 diff, Patcher (re)creates ChangeLog skeletons in the appropriate
1718 ChangeLog files, by analyzing the generated diff. You then need to fill
1719 the entries manually.
1720
1721 Note that when Patcher creates skeletons for you, you should
1722 @strong{never} kill the ChangeLog buffers while a project is running.
1723 Otherwise, Patcher will loose track of what it has or has not generated.
1724
1725 @menu
1726 * Skeleton Generation:: How skeletons are created.
1727 * Skeleton Parameters:: What the skeletons look like.
1728 * ChangeLog Files::     Linking and saving ChangeLogs.
1729 @end menu
1730
1731 @node Skeleton Generation, Skeleton Parameters, Automatic ChangeLogs, Automatic ChangeLogs
1732
1733 @findex patch-to-change-log
1734 @findex patcher-default-diff-cleaner
1735 @fpoindex{diff-cleaner}@c
1736 ChangeLog skeletons are not generated by Patcher directly, but rather by
1737 the function @code{patch-to-change-log} from the @code{add-log} library,
1738 itself from the @code{xemacs-base} package. This function supports only
1739 standard and CVS diff, in unified format.
1740
1741 For revision control systems that output something different, Patcher
1742 provides a @code{:diff-cleaner} option. This option names a function
1743 that will be used to ``cleanup'' the diff (so that it looks like a
1744 standard one, just before calling @code{patch-to-change-log}.
1745
1746 @birtindex{git}@c
1747 @birtindex{hg}@c
1748 @birtindex{darcs}@c
1749 @birtindex{prcs}@c
1750 Patcher comes with a generic cleaner function named
1751 @code{patcher-default-diff-cleaner} which is used by default and works
1752 correctly with Git, Mercurial, Darcs and PRCS, as long as you use the
1753 corresponding built-in themes (@pxref{Themes}), or in fact, as long as
1754 the corresponding @code{:diff-header} option is correct (@pxref{Diff
1755 Headers}).
1756
1757
1758 @node Skeleton Parameters, ChangeLog Files, Skeleton Generation, Automatic ChangeLogs
1759
1760 @fpoindex{change-logs-user-name}@c
1761 @fpoindex{user-name}@c
1762 @fpoindex{change-logs-user-mail}@c
1763 @fpoindex{user-mail}@c
1764 @findex patch-to-change-log
1765 @vindex user-full-name
1766 @vindex user-mail-address
1767 Patcher has two project options that give you some control on the
1768 generated ChangeLog skeleton: @code{:change-logs-user-name} and
1769 @code{:change-logs-user-mail}. As you might expect, these are strings
1770 defining your name and mail address for ChangeLog entries'headers. When
1771 @code{nil}, Patcher falls back to (respectively) the @code{:user-name}
1772 and @code{:user-mail} project options. If in turn set to @code{nil},
1773 Patcher lets the function @code{patch-to-change-log} decide what to use
1774 (most probably what the user options @code{user-full-name} and
1775 @code{user-mail-address} say).
1776
1777 @node ChangeLog Files, , Skeleton Parameters, Automatic ChangeLogs
1778
1779 Normally, you don't modify source files when working with Patcher.
1780 However, ChangeLog files need update and saving in automatic mode.
1781 Patcher provides two hooks for plugging in additional processing on
1782 ChangeLog files.
1783
1784 @itemize @bullet
1785 @item @code{:link-change-log-hook}
1786 @fpoindex{link-change-log-hook}@c
1787 This hook is run every time Patcher ``links'' a ChangeLog file to a
1788 project. Linking a ChangeLog file in this context means figuring out
1789 that it is involved in the current patch. Every function in this hook
1790 will be given the ChangeLog file name (relative to the project's
1791 directory) as argument. Also, it is guaranteed that when this hook is
1792 run, the current directory (in whatever the current buffer is) is set to
1793 the project's directory.
1794 @item @code{:after-save-change-log-hook}
1795 @fpoindex{after-save-change-log-hook}@c
1796 This hook is run every time you save a ChangeLog file. The functions in
1797 this hook are executed in the ChangeLog's buffer. To be honest with you,
1798 I didn't invent anything here, and I must confess that this is not a
1799 real hook. Instead, what you specify in this project option is simply
1800 added to the ChangeLog's local after-save-hook.
1801 @end itemize
1802
1803 Now you're wondering what you could possibly use these two options for
1804 (apart from ringing the terminal bell I mean), and you're right. In
1805 fact, their existence comes from my desire to support Git projects by
1806 index.
1807
1808 @birtindex{git}@c
1809 @birtindex{git-index}@c
1810 @bitindex{git-index-automatic-change-logs}@c
1811 @vindex patcher-built-in-themes
1812 If you look at @code{patcher-built-in-themes}, you will find two themes
1813 for Git (along with their their whitespace-cleaning counterpart):
1814 @code{git} and @code{git-index}. The @code{git-index} one will only work
1815 on what's in the Git staging area. This is cool as long as ChangeLog
1816 files are written by hand @pxref{Manual ChangeLogs}. However, in
1817 automatic mode, we need a way to add them to the index once the
1818 skeletons are filled in. This is done by another built-in theme that you
1819 must add explicitly to your project, called
1820 @code{git-index-automatic-change-logs}. This theme uses the two options
1821 described above to automatically add ChangeLog entries to the staging
1822 area.
1823
1824 @node Manual ChangeLogs, No ChangeLogs, Automatic ChangeLogs, ChangeLogs Updating
1825 @subsubsection Manual ChangeLogs
1826
1827 In manual mode, Patcher assumes that you create ChangeLog entries
1828 manually, as you write the code, so it won't create ChangeLog skeletons.
1829 It is important to understand that in this situation, ChangeLog entries
1830 @strong{must} have been written @strong{before} you call Patcher.
1831 Patcher won't let you write them in the process.
1832
1833 Even in @code{manual} mode, Patcher might still need to know the
1834 affected ChangeLog files (for the commit process) and your exact
1835 ChangeLog entries in each of these files (for insertion in the message).
1836 The ChangeLog files are automatically deduced from the patch. When
1837 that's required, however, you will be presented with each ChangeLog file
1838 in turn, and invited to precise the number of ChangeLog entries
1839 concerning this patch. These entries must of course appear at the top of
1840 the file.
1841
1842 @node No ChangeLogs, , Manual ChangeLogs, ChangeLogs Updating
1843 @subsubsection No ChangeLogs
1844
1845 This mode is for projects that don't do ChangeLogs. Patcher won't try to
1846 create ChangeLog entries, and won't expect that you have written
1847 ChangeLog entries either.
1848
1849 Note that if you @emph{do} have ChangeLog files in this mode, they will
1850 be regarded as ordinary source files. As a consequence, this is a case
1851 where it is not forbidden to list them explicitly as part of a
1852 subproject, although I don't see why you would want to do that.
1853
1854
1855 @node ChangeLogs Navigation, ChangeLogs Appearance, ChangeLogs Updating, ChangeLogs Handling
1856 @subsection ChangeLogs Navigation
1857
1858 Patcher provides commands for navigating across ChangeLog and mail
1859 buffers, something especially convenient when you need to fill them by
1860 hand after skeletons have been created.
1861
1862 @kindex C-c C-p n
1863 @kindex C-c C-p p
1864 @findex patcher-change-log-next
1865 @findex patcher-change-log-previous
1866 @findex patcher-mail-first-change-log
1867 @findex patcher-mail-previous-change-log
1868 Patcher sees a project's mail and ChangeLog buffers as a circular chain
1869 that can be walked forward and backward by typing @kbd{C-c C-p n} or
1870 @kbd{C-c C-p p} respectively (depending on the buffer you're in, this
1871 involves either @code{patcher-change-log-next},
1872 @code{patcher-change-log-previous}, @code{patcher-mail-first-change-log}
1873 or @code{patcher-mail-last-change-log}).
1874
1875 @kindex C-c C-p m
1876 @kindex C-c C-p N
1877 @kindex C-c C-p P
1878 @findex patcher-change-log-mail
1879 @findex patcher-change-log-first
1880 @findex patcher-change-log-last
1881 From a ChangeLog buffer, you can also shortcut the cycle and switch back
1882 to the mail buffer directly by typing @kbd{C-c C-p m}
1883 (@code{patcher-change-log-mail}), or switch to the first / last
1884 ChangeLog buffer respectively by typing @kbd{C-c C-p P}
1885 (@code{patcher-change-log-first}) / @kbd{C-c C-p N}
1886 (@code{patcher-change-log-last}).
1887
1888
1889 @node ChangeLogs Appearance,  ChangeLogs Prologue, ChangeLogs Navigation, ChangeLogs Handling
1890 @subsection ChangeLogs Appearance
1891
1892 @fpoindex{change-logs-appearance}@c
1893 The appearance of ChangeLog entries in the message is controlled by the
1894 @code{:change-logs-appearance} project option. Its value must be a
1895 symbol from the following:
1896
1897 @table @code
1898 @item verbatim
1899 This is the default. ChangeLog entries appear just as text in the
1900 message, above the patch. Most people prefer this kind of appearance
1901 since it is the most readable.
1902
1903 @item pack
1904 ChangeLog entries appear as a patch (they are diff'ed against the
1905 archive). This patch is however distinct from the source patch, and
1906 appears above it.
1907
1908 @item patch
1909 ChangeLog entries appear as a patch (they are diff'ed against the
1910 archive), and this patch is integrated into the source patch. In other
1911 words, the message looks like a global patch integrating both the
1912 sources and the ChangeLogs.
1913
1914 @item nil
1915 The ChangeLog entries don't appear in the message at all.
1916 @end table
1917
1918 @fpoindex{change-logs-diff-command}@c
1919 When the ChangeLogs appearance is either @code{pack} or @code{patch},
1920 the diff command used to generate the patch is controlled by the
1921 @code{:change-logs-diff-command} project option. The value can be
1922 @code{nil}, meaning that the same diff command is to be used as for the
1923 sources (@pxref{Diff Command}), or it can be a string specifying an
1924 alternate command.
1925
1926 When diffing ChangeLog files, it is strongly recommended that you remove
1927 contexts from the diff, because otherwise, ChangeLog patches often fail
1928 to apply correctly.
1929
1930 @birtindex{git}@c
1931 @fpoindex{diff-command}@c
1932 The @code{:change-logs-diff-command} project option supports the same
1933 substitution constructs as the @code{:diff-command} one (@pxref{Diff
1934 Command}). For example, here is the ChangeLogs diff command used in the
1935 @code{git} built-in theme (@pxref{Themes}): @samp{git diff -U0
1936 --no-prefix HEAD%?f@{ -- @}%f}.
1937
1938 @findex patcher-mail-insert-change-logs
1939 @findex patcher-change-logs-insert-change-logs
1940 @kindex C-c C-p l
1941 When ChangeLog entries are written in advance (@pxref{Manual
1942 ChangeLogs}), Patcher can (and does) insert them into the mail buffer
1943 automatically. However, Patcher cannot tell when you're done filling in
1944 skeletons (@pxref{Automatic ChangeLogs}), so in such a case you need to
1945 insert the ChangeLog entries explicitly. This is done by calling the
1946 function @code{patcher-mail-insert-change-logs}. It is bound to @kbd{C-c
1947 C-p l} in the mail buffer.
1948
1949 With an additional prefix argument, or when your project is set to not
1950 normally include ChangeLogs in mail buffers, you will also be prompted
1951 for an alternate appearance (for this time only).
1952
1953 In fact, this function can also be used in all situations to
1954 @strong{reinsert} the ChangeLog entries into the mail buffer, whatever
1955 their appearance. This comes in handy if you decide to further modify
1956 them after the initial insertion (it's never too late to fix a typo).
1957
1958 One last note: the same binding is available in ChangeLog buffers as
1959 well. The effect is to call
1960 @code{patcher-change-log-insert-change-logs}, which in essence switches
1961 to the mail buffer and performs insertion in a row. This saves you one
1962 @kbd{C-c C-p m} keystroke.
1963
1964 @node ChangeLogs Prologue, ChangeLogs Status, ChangeLogs Appearance, ChangeLogs Handling
1965 @subsection ChangeLogs Prologue
1966
1967 ChangeLog prologues are small pieces of informative text that Patcher
1968 adds above each ChangeLog insertion in the mail buffer.
1969
1970 @fpoindex{change-logs-prologue}@c
1971 When the ChangeLogs appearance is @code{verbatim}, Patcher inserts one
1972 prologue per ChangeLog file. The prologue's contents is controlled by
1973 the @code{:change-logs-prologue} project option (a string). A @samp{%f}
1974 appearing in this string will be replaced with the ChangeLog filename.
1975 The default value for @code{patcher-default-change-logs-prologue} is
1976 @code{"%f addition:"}.
1977
1978 @fpoindex{diff-prologue-function}@c
1979 @findex patcher-default-diff-prologue
1980 When the ChangeLogs appearance is @code{pack}, Patcher inserts only one
1981 prologue for the whole ChangeLogs patch. When @code{patch}, there is a
1982 single prologue for both the ChangeLogs and the sources. For customizing
1983 the prologue in both of these cases, see @ref{Diff Prologue}.
1984
1985 @node ChangeLogs Status, , ChangeLogs Prologue, ChangeLogs Handling
1986 @subsection ChangeLogs Status
1987
1988 Let's face it. ChangeLogs are in fact an obsolete concept that dates
1989 back to the old days when we used to work without revision control
1990 systems. Now the story is different: we have commit log messages,
1991 @code{git blame} and what not, to the point that ChangeLog files are big
1992 and not really useful anymore.
1993
1994 On the other hand, the ChangeLog file @emph{format} is still convenient
1995 to describe modifications, for instance in the commit log message. So
1996 how nice would it be to continue manipulating ChangeLog entries, as
1997 usual, but just not store them into files?
1998
1999 @fpoindex{default-change-logs-status}@c
2000 Patcher can do that. It has a project option named
2001 @code{:change-logs-status} which can have two values (symbols). A value
2002 of @code{persistent} (the default) is in fact what we have assumed so
2003 far: there are ChangeLog files and they are part of the project. This is
2004 the traditional approach.
2005
2006 @fpoindex{change-log-file-name}@c
2007 A value of @code{ephemeral} on the other hand means that your ChangeLog
2008 entries exist only temporarily, to be used in the commit log message
2009 and/or inserted verbatim in the mail. Patcher does this by creating a
2010 temporary ChangeLog file (named after the @code{:change-log-file-name}
2011 project option) in the project's base directory, and getting rid of it
2012 after the mail is sent. As a result, everything works just as if the
2013 ChangeLog file was real: ChangeLog entries can be generated
2014 automatically or written manually @etc{}
2015
2016 The only restriction is that you cannot diff the ephemeral ChangeLog
2017 entries because they are not really part of the project, so their
2018 appearance can only be @code{verbatim}. Also, when you use an ephemeral
2019 ChangeLog, beware to use a file name that doesn't conflict with existing
2020 files (old ChangeLog files may for example be renamed to
2021 @file{ChangeLog.dead}).
2022
2023
2024 @bitindex{ephemeral-change-logs}@c
2025 Because there's only one, virtual, ephemeral ChangeLog file located at
2026 the project's base directory, the default value for the ChangeLogs
2027 prologue doesn't work very well in the ephemeral case. It doesn't make
2028 sense to refer to the file itself, since it's only temporary. A simpler
2029 prologue like ``ChangeLog entries:'' would suffice. Patcher provides a
2030 built-in theme called @samp{ephemeral-change-logs} that you can use to
2031 both set the ChangeLog status to @samp{ephemeral} and modify the
2032 prologue at the same time.
2033
2034 @birtindex{git-index}@c
2035 @bitindex{git-index-automatic-change-logs}@c
2036 One final note: if you use the @code{git-index} built-in theme with
2037 ephemeral ChangeLogs, don't use it in conjunction with
2038 @code{git-index-automatic-change-logs}, even if the ChangeLogs entries
2039 are generated automatically by Patcher. Otherwise, they would be added
2040 to the staging area, which is definitely not what you want.
2041
2042
2043 @c Project Check In ===================================================
2044 @node Project Check In, Mail Sending, ChangeLogs Handling, User Manual
2045 @section Project Check In
2046
2047 @findex patcher-mail-commit
2048 @kindex C-c C-p c
2049 If you have the privilege to commit your changes yourself, you might do
2050 so directly from the mail buffer, as the last operation before actually
2051 sending the message. This is done by calling the function
2052 @code{patcher-mail-commit} which is bound to @kbd{C-c C-p c} in the mail
2053 buffer.
2054
2055 Committing directly from Patcher has the advantage that both the commit
2056 log message and command-line are constructed automatically. Of course,
2057 you still have an in-depth control on the commit process.
2058
2059 @menu
2060 * Commit Command::       Specifying the command to commit the patch
2061 * Log Message Handling:: Building a commit log message
2062 * Commit Operation::     Actually committing your changes
2063 @end menu
2064
2065 @node Commit Command, Log Message Handling, Project Check In, Project Check In
2066 @subsection Commit Command
2067
2068 @findex patcher-mail-commit
2069 @fpoindex{commit-command}@c
2070 The command used to to commit a patch is specified by the
2071 @code{:commit-command} project option (a string). You can also
2072 temporarily change the command in question by calling
2073 @code{patcher-mail-commit} with a prefix argument. As usual, note that
2074 this prefix argument is not meant to modify the affected files on the
2075 command-line. It's meant only to punctually modify the commit command
2076 itself. The affected files are computed automatically by Patcher.
2077
2078 The commit command supports the same dynamic expansion constructs as the
2079 diff command (@pxref{Diff Command}), and also adds two of its own.
2080
2081 @table @code
2082 @item %s
2083 A @code{%s} occurring in the commit command string will be replaced with
2084 the name of a file containing the commit log message (@pxref{Log Message
2085 Handling}). This file is a temporary file handled by Patcher.
2086
2087 @item %S
2088 A @code{%S} occurring in the commit command string will be replaced with
2089 the commit log message itself (@pxref{Log Message Handling}). Since the
2090 intent here is to use the message as a command-line argument, it will be
2091 automatically quoted against shell expansion.
2092 @end table
2093
2094 Please note that exactly as for the diff command, a @code{%f} is
2095 required in your commit commands, unless you know for sure that you will
2096 never ever work on a subproject. But you never know that. Besides, you
2097 should always also provide either a @code{%s} or a @code{%S}, unless
2098 your archival software does not support log messages. I'm not actually
2099 sure such a beast exists.
2100
2101 @birtindex{git}@c
2102 As an example, here is the commit command for the Git built-in theme
2103 (@pxref{Themes}): @samp{git commit %!f@{-a @}-F %s%?f@{ -- @}%f}
2104
2105
2106 @node Log Message Handling, Commit Operation, Commit Command, Project Check In
2107 @subsection Log Message Handling
2108
2109 Most project management tools understand the concept of a @dfn{log
2110 message}: a short yet informative message that accompany the commit
2111 operation, which is also stored in the repository.
2112
2113 @fpoindex{edit-log-message}@c
2114 Before a commit operation, Patcher always builds an initial log message,
2115 based on certain elements under your control. What happens next is
2116 controlled the @code{:edit-log-message} project option: if @code{t} (the
2117 default), you will be able to manually edit the log message. If
2118 @code{nil}, Patcher will proceed directly to the next step
2119 (@pxref{Commit Operation}).
2120
2121 Please note that Patcher stores log messages in temporary files that
2122 may be used later by the commit command.
2123
2124 @menu
2125 * Log Message Elements:: Elements Patcher can add automatically
2126 * Log Message Editing::  Manually modifying the log message
2127 @end menu
2128
2129 @node Log Message Elements, Log Message Editing, Log Message Handling, Log Message Handling
2130 @subsubsection Log Message Elements
2131
2132 @fpoindex{log-message-items}@c
2133 Patcher has the ability to initialize the log message with different
2134 elements. These elements are specified with the
2135 @code{:log-message-items} project option. Its value is either
2136 @code{nil}, meaning that you don't want any initialization, or a list of
2137 symbols specifying the elements you desire. The available items are:
2138
2139 @table @code
2140 @item subject
2141 The subject of the message. The subject's prefix is automatically
2142 removed.
2143
2144 @item compressed-change-logs
2145 The ``compressed'' ChangeLog entries. Only the most important part of
2146 the ChangeLogs is preserved, so the entries appear in a more compact
2147 fashion.
2148
2149 @item change-logs
2150 The raw ChangeLog entries.
2151 @end table
2152
2153 @fpoindex{change-logs-separator}@c
2154 By default, only the message's subject is used. When using more than one
2155 item, they appear in the order specified above. If anything appears
2156 before the raw ChangeLog entries, a separator string is used. This
2157 string is specified by the @code{:change-logs-separator} project option.
2158 By default the string looks like ``--- ChangeLog entries follow: ---''.
2159
2160
2161 Note that it only makes sense to set @code{:log-message-items} to
2162 @code{nil} if you also ask Patcher to let you edit the message
2163 (@pxref{Log Message Editing}). Otherwise, your commit would end up with
2164 empty log messages.
2165
2166
2167 @node Log Message Editing, , Log Message Elements, Log Message Handling
2168 @subsubsection Log Message Editing
2169
2170 If so required, Patcher lets you manually edit the log message after
2171 having initialized it. Log message editing happens in a special buffer
2172 called @code{*<project name> Patcher Project Log Message*}.
2173
2174 @findex patcher-logmsg-mode
2175 @vindex patcher-logmsg-mode-hook
2176 @vindex patcher-logmsg-font-lock-keywords
2177 @vindex patcher-comment-face
2178 @vindex patcher-reference-face
2179 This buffer is governed by a major mode called
2180 @code{patcher-logmsg-mode}. This mode offers a hook,
2181 @code{patcher-logmsg-mode-hook}, which you can use to plug additional
2182 behavior like turning on font lock. If you do so, you might also want to
2183 have a look at @code{patcher-logmsg-font-lock-keywords},
2184 @code{patcher-comment-face} and @code{patcher-reference-face} which are
2185 the built-in elements for log message fontification.
2186
2187 When the log message buffer is initialized, it starts with an
2188 informative comment header. The actual log message starts at the first
2189 non blank line after this header.
2190
2191 While editing this buffer, commands to insert the items described in
2192 @ref{Log Message Elements} are at your disposal. These commands perform
2193 insertion at point:
2194
2195 @table @code
2196 @item patcher-logmsg-insert-subject
2197 @findex patcher-logmsg-insert-subject
2198 @kindex C-c C-p s
2199 Bound to @kbd{C-c C-p s}. Insert the message's subject (sans the
2200 prefix).
2201
2202 @item patcher-logmsg-insert-change-logs
2203 @findex patcher-logmsg-insert-change-logs
2204 @kindex C-c C-p l
2205 Bound to @kbd{C-c C-p l}. Insert the ChangeLog entries. Use a prefix
2206 argument if you also want the ChangeLogs separator string to be
2207 inserted.
2208
2209 @item patcher-logmsg-insert-compressed-change-logs
2210 @findex patcher-logmsg-insert-compressed-change-logs
2211 @kindex C-c C-p L
2212 Bound to @kbd{C-c C-p L}. Insert the compressed ChangeLog entries. Use a
2213 prefix argument if you also want the ChangeLogs separator string to be
2214 inserted.
2215 @end table
2216
2217 @findex patcher-logmsg-init-message
2218 @kindex C-c C-p i
2219 In addition to these commands, you can also completely reinitialize the
2220 log message by calling the function @code{patcher-logmsg-init-message},
2221 bound to @kbd{C-c C-p i}. Caution: this command first erases the buffer.
2222
2223 @findex patcher-logmsg-commit
2224 @kindex C-c C-p c
2225 @kindex C-c C-c
2226 Once you're happy with your log message, you proceed to the commit
2227 operation by calling the function @code{patcher-logmsg-commit}, bound to
2228 either @kbd{C-c C-p c} as in mail buffers, or directly to @kbd{C-c C-c}.
2229
2230 Finally, the log message offers two more commands in case you change your
2231 mind about the commit:
2232
2233 @table @code
2234 @item patcher-logmsg-cancel
2235 @findex patcher-logmsg-cancel
2236 @kindex C-c C-z
2237 Bound to @kbd{C-c C-z}. Use this when you decide to cancel the commit
2238 operation (but not the whole project). Patcher will simply bring you
2239 back to where you came from; typically the mail buffer.
2240 @item patcher-logmsg-kill
2241 @findex patcher-logmsg-kill
2242 @kindex C-c C-k
2243 Bound to @kbd{C-c C-k}. Use this to completely kill the project.
2244 Remember that you can also do that from mail or ChangeLog buffers.
2245 @end table
2246
2247
2248 @node Commit Operation, , Log Message Handling, Project Check In
2249 @subsection Commit Operation
2250
2251 @kindex C-c C-p c
2252 @kindex C-c C-c
2253 The commit operation occurs after typing @kbd{C-c C-p c} from the mail
2254 buffer if you have not required log message editing, or after typing
2255 @kbd{C-c C-p c} or @kbd{C-c C-c} from the log message buffer otherwise.
2256
2257 @fpoindex{edit-commit-command}@c
2258 At that point, Patcher has constructed a proper commit command. What
2259 happens next depends on the value of the @code{:edit-commit-command}
2260 project option: if @code{nil}, Patcher performs the commit operation
2261 directly. Otherwise (the default), you have the ability to edit or at
2262 least confirm the commit command.
2263
2264 Commit command editing happens in a special buffer called
2265 @code{*<project name> Patcher Project Commit Command*}.
2266
2267 @findex patcher-cmtcmd-mode
2268 @vindex patcher-cmtcmd-mode-hook
2269 @vindex patcher-cmtcmd-font-lock-keywords
2270 @vindex patcher-comment-face
2271 @vindex patcher-reference-face
2272 This buffer is governed by a major mode called
2273 @code{patcher-cmtcmd-mode}. This mode offers a hook,
2274 @code{patcher-cmtcmd-mode-hook}, which you can use to plug additional
2275 behavior like turning on font lock. If you do so, you might also want to
2276 have a look at @code{patcher-cmtcmd-font-lock-keywords},
2277 @code{patcher-comment-face} and @code{patcher-reference-face} which are
2278 the built-in elements for commit command fontification.
2279
2280 This buffer starts with an informative comment header. The actual commit
2281 command consists in all non blank and non comment lines concatenated
2282 together.
2283
2284 @findex patcher-cmtcmd-commit
2285 @kindex C-c C-p c
2286 @kindex C-c C-c
2287 Once you're happy with your commit command, you finally perform the
2288 operation by calling the function @code{patcher-cmtcmd-commit}, bound to
2289 both @kbd{C-c C-p c} as in mail buffers, and to @kbd{C-c C-c}.
2290
2291 The commit command buffer offers two more commands in case you change
2292 your mind about the commit:
2293
2294 @table @code
2295 @item patcher-cmtcmd-cancel
2296 @findex patcher-cmtcmd-cancel
2297 @kindex C-c C-z
2298 Bound to @kbd{C-c C-z}. Just as in log message buffers, use this when
2299 you decide to cancel the commit operation (but not the whole project).
2300 Patcher will simply bring you back to where you came from; typically the
2301 mail buffer or the log message buffer.
2302 @item patcher-cmtcmd-kill
2303 @findex patcher-cmtcmd-kill
2304 @kindex C-c C-k
2305 Bound to @kbd{C-c C-k}. Just as in log message buffers, use this to
2306 completely kill the project. Remember that you can also do that from
2307 mail or ChangeLog buffers as well.
2308 @end table
2309
2310
2311 After the commit operation, Patcher changes some parts of the mail
2312 buffer in the following manner:
2313
2314 @itemize @bullet
2315 @item
2316 @fpoindex{subject-committed-prefix}@c
2317 The subject prefix is changed to that specified by the
2318 @code{:subject-committed-prefix} project option (a string), unless it is
2319 @code{nil}. By default, ``[COMMIT]'' is used.
2320
2321 @item
2322 @fpoindex{committed-notice}@c
2323 A commit notice is added at the very beginning of the message's body.
2324 This notice is specified by the @code{:committed-notice} project option.
2325 It can be @code{nil} or a string. By default, it reads ``NOTE: this
2326 patch has been committed.''.
2327 @end itemize
2328
2329
2330 @c Mail Sending =======================================================
2331 @node Mail Sending, More On Commands, Project Check In, User Manual
2332 @section Mail Sending
2333
2334 Sending the message will most probably be done by typing @samp{C-c C-c}
2335 in the mail buffer. This is also the case when you're using the fake
2336 mail method, by the way.
2337
2338 @menu
2339 * Before Sending:: Patcher does some checkings
2340 * After Sending::  patcher does some cleanup
2341 @end menu
2342
2343 @node Before Sending, After Sending, Mail Sending, Mail Sending
2344 @subsection Before Sending
2345
2346 There are circumstances in which Patcher will perform some checkings on
2347 your message when you send it, just before it is actually sent:
2348
2349 @itemize @bullet
2350 @item ChangeLogs insertion
2351
2352 @fpoindex{check-change-logs-insertion}@c
2353 In case of manual ChangeLog insertion (@pxref{ChangeLogs Appearance}),
2354 Patcher can check that you have indeed inserted the ChangeLog entries
2355 before sending the message. This behavior is controlled by the
2356 @code{:check-change-logs-insertion} project option. A value of
2357 @code{nil} means never check (the message will be sent as-is). A value
2358 of t means check, and abort the sending if the ChangeLog entries are
2359 missing. A value of @code{ask} (the default) means ask for your opinion
2360 on this terrible matter.
2361
2362 @item Commit Operation
2363
2364 @fpoindex{commit-privilege}@c
2365 Patcher has a @code{:commit-privilege} project option; a Boolean
2366 specifying whether you're likely to commit your changes by yourself.
2367
2368 @fpoindex{check-commit}@c
2369 In case of commit privilege, Patcher can check that you have indeed
2370 committed your changes before sending the message. This behavior is
2371 controlled by the @code{:check-commit} user option. A value of
2372 @code{nil} means never check (the message will be sent as-is). A value
2373 of t means check, and abort the sending if the commit operation has not
2374 been performed. A value of @code{ask} (the default) means ask for your
2375 opinion on this rather unfortunate situation.
2376 @end itemize
2377
2378
2379 Two notes on these checkings:
2380
2381 @itemize @bullet
2382 @item
2383 For uninteresting technical reasons, Patcher does not currently (and
2384 will probably never) offer you an automatic ChangeLogs insertion or
2385 commit operation, at mail sending time, but just abort the sending
2386 process in some circumstances. That's not a big deal though.
2387
2388 @item
2389 For other uninteresting technical reasons, these checkings require a
2390 native knowledge of your mail user agent. Patcher does not currently
2391 support all mail user agents on earth (I'll add them on demand however).
2392 If that's the case, you will be warned and invited to send me a message.
2393 Also, you can send me one on April 21st: it's my birthday.
2394 @end itemize
2395
2396 @node After Sending, , Before Sending, Mail Sending
2397 @subsection After Sending
2398
2399 After sending the message, Patcher also performs some cleanup
2400 operations, that you can customize. The cleanup is controlled by the
2401 following project options. Each one is a Boolean option which defaults
2402 to @code{t}.
2403
2404 @table @code
2405 @item :kill-sources-after-sending
2406 @fpoindex{kill-sources-after-sending}@c
2407 Whether to kill source files after sending the message. If @code{nil},
2408 the source files will remain visited.
2409
2410 @item :kill-change-logs-after-sending
2411 @fpoindex{kill-change-logs-after-sending}@c
2412 Whether to kill ChangeLog files after sending the message. If
2413 @code{nil}, the ChangeLog files will remain visited.
2414 @end table
2415
2416 When Patcher is allowed to kill a source or ChangeLog file, it will only
2417 actually kill it if it was responsible for loading it for this
2418 particular project in the first place. For instance, if the file was
2419 already visited before Patcher was launched, or if another Patcher
2420 project is also using the file, then it won't be killed regardless of
2421 the value of these options.
2422
2423
2424 @c More On Commands ===================================================
2425 @node More On Commands, , Mail Sending, User Manual
2426 @section More On Commands
2427
2428 This section deals with information that apply to all commands used by
2429 Patcher (diff and commit operations).
2430
2431 @menu
2432 * Prefixing Commands::  Bypassing a firewall
2433 * Error Handling::      Dealing with errors
2434 @end menu
2435
2436 @node Prefixing Commands, Error Handling, , More On Commands
2437 @subsection Prefixing Commands
2438
2439 If you're working on a distant archive and you're behind a firewall, you
2440 might need to prefix all your commands with something like
2441 @code{runsocks}. Of course, this can be done manually in all your
2442 command settings, but Patcher offers you a simpler way to do it.
2443
2444 @fpoindex{pre-command}@c
2445 There is a project option named @code{:pre-command} which can be used
2446 for this kind of thing. It must be a string that will be prepended to
2447 all operations performed by Patcher.
2448
2449
2450 @node Error Handling, , Prefixing Commands, More On Commands
2451 @subsection Error Handling
2452
2453 From time to time, commands may fail for different reasons. Patcher
2454 tracks command failures and lets you know when that happens.
2455
2456 @fpoindex{ignore-diff-status}@c
2457 The first thing Patcher does is to check the external processes exit
2458 codes. A non-zero exit code will normally trigger a Patcher error. There
2459 is however one notable exception: @code{cvs diff} has this incredibly
2460 stupid idea of returning an exit code of 1 when the diff succeeds, and
2461 is non-empty. Because of this, Patcher provides an option named
2462 @code{:ignore-diff-status} that is set to @code{t} in the CVS theme.
2463 There should be no reason to use it in any other context.
2464
2465 @birtindex{cvs}@c
2466 @fpoindex{failed-command-regexp}@c
2467 Next, Patcher looks for specific strings in process output. The
2468 @code{:failed-command-regexp} project option lets you specify a regular
2469 expression to match with the output of an aborted command. In the CVS
2470 built-in theme for example (@pxref{Themes}), the value is @samp{"^cvs
2471 \\[[^]]* aborted\\]"}.
2472
2473
2474
2475 @c ====================================================================
2476 @c XEmacs Development
2477 @c ====================================================================
2478 @node XEmacs Development, Indexes, User Manual, Top
2479 @appendix XEmacs Development
2480
2481 XEmacs development occurs on a Mercurial repository. Patches are
2482 advertised on @email{xemacs-patches@@xemacs.org}. We assume that you are
2483 a committer and have a clone of the main repository located at
2484 @file{/usr/local/src/xemacs/21.5}. Your @file{hgrc} file should look
2485 like this (replace my identity with yours):
2486
2487 @cartouche
2488 @verbatim
2489 [ui]
2490 username = Didier Verna <didier@xemacs.org>
2491
2492 [paths]
2493 default      = ssh://hg@bitbucket.org/xemacs/xemacs
2494 @end verbatim
2495 @end cartouche
2496
2497 The following project settings will do nicely for hacking XEmacs:
2498
2499 @cartouche
2500 @verbatim
2501 '("XEmacs 21.5" "/usr/local/src/xemacs/21.5"
2502    :to-address "xemacs-patches@xemacs.org"
2503    :change-logs-user-mail "didier@xemacs.org"
2504    :commit-privilege t
2505    :log-message-items (subject change-logs)
2506    :themes (mercurial))
2507 @end verbatim
2508 @end cartouche
2509
2510 If you want to also work on the packages, you may clone the big umbrella
2511 repository. Let's assume you do so in
2512 @file{/usr/local/share/emacs-lisp/source/xemacs-packages}. Your
2513 @file{hgrc} file should look like this:
2514
2515 @cartouche
2516 @verbatim
2517 [ui]
2518 username = Didier Verna <didier@xemacs.org>
2519
2520 [paths]
2521 default      = ssh://hg@bitbucket.org/xemacs/xemacs-packages
2522 @end verbatim
2523 @end cartouche
2524
2525 The following project settings will do nicely for hacking the packages
2526 (all settings are in fact inherited from the main XEmacs 21.5 project):
2527
2528 @cartouche
2529 @verbatim
2530 '("XEmacs Packages" "/usr/local/share/emacs-lisp/source/xemacs-packages"
2531   :inheritance ("XEmacs 21.5"))
2532 @end verbatim
2533 @end cartouche
2534
2535 However, note that you shouldn't work on this project directly. Every
2536 package is in fact stored under this project as a Mercurial submodule.
2537 Patcher detects every such submodule automatically and creates a
2538 corresponding project for you (submodule projects are named @samp{XEmacs
2539 Packages (<submodule>)}. Because those really are independent projects,
2540 you should probably also update every @file{hgrc} file with your
2541 identity.
2542
2543
2544
2545 @c ====================================================================
2546 @c Indexes
2547 @c ====================================================================
2548 @node Indexes, , XEmacs Development, Top
2549 @appendix Indexes
2550
2551 @menu
2552 * Concept Index::
2553 * Variable Index::
2554 * Function Index::
2555 * Keystroke Index::
2556 @end menu
2557
2558
2559 @c -------------
2560 @c Concept Index
2561 @c -------------
2562 @node Concept Index, Variable Index, Indexes, Indexes
2563 @section Concepts
2564 @printindex cp
2565 @page
2566
2567
2568 @c --------------
2569 @c Variable Index
2570 @c --------------
2571 @node Variable Index, Function Index, Concept Index, Indexes
2572 @section Variables
2573 @printindex vr
2574 @page
2575
2576
2577 @c --------------
2578 @c Function Index
2579 @c --------------
2580 @node Function Index,  Keystroke Index, Variable Index, Indexes
2581 @section Functions
2582 @printindex fn
2583 @page
2584
2585
2586 @c ---------------
2587 @c Keystroke Index
2588 @c ---------------
2589 @node Keystroke Index,  , Function Index, Indexes
2590 @section Keystrokes
2591 @printindex ky
2592 @page
2593
2594
2595 @bye
2596
2597 @c Don't add stuff under this line!!
2598 @c patcher.texi ends here
2599
2600 @c  LocalWords:  Patcher patcher RCS ChangeLog Darcs CVS PRCS MUA SuperProj kbd
2601 @c  LocalWords:  subproject subdirectory logmsg findex kindex vindex cmtcmd
2602 @c  LocalWords:  samp cartouche