are correct. You can use something like the following in the info
directory in the Emacs build tree:
-emacs -Q --eval "(setq Info-default-directory-list '(\".\"))" \
+emacs -Q --eval "(progn (require 'info) (setq Info-directory-list '(\".\")))" \
-f info-xref-check-all
make emacs.dvi, elisp.dvi, and deal with any errors (undefined
* BUGS
-** rms: gnus-dired.el is a mistake. Those features should not
-be part of Gnus. They should be moved to some other part of Emacs.
-rsteib: Gnus dependencies in `gnus-dired.el' (and `mailcap.el') have been
-minimized. I don't know what is left to do here.
-
** Check for modes which bind M-s that conflicts with a new global binding M-s
and change key bindings where necessary. The current list of modes:
basic.texi cyd
buffers.texi cyd
building.texi cyd
-calendar.texi
+calendar.texi rgm
cal-xtra.texi
cmdargs.texi cyd
commands.texi cyd
custom.texi cyd
dired.texi cyd
-dired-xtra.texi
+dired-xtra.texi rgm
display.texi cyd
emacs.texi
emacs-xtra.texi
entering.texi cyd
files.texi cyd
fixit.texi cyd
-fortran-xtra.texi
+fortran-xtra.texi rgm
frames.texi cyd
glossary.texi
help.texi cyd
streams.texi cyd
strings.texi cyd
symbols.texi cyd
-syntax.texi
+syntax.texi cyd
text.texi
tips.texi
variables.texi cyd
windows.texi
* PLANNED ADDITIONS
-* pov-mode (probably not for Emacs-23: waiting for a Free POV-Ray).
+* pov-mode (waiting for a Free POV-Ray)
** gas-mode ?
\f
+2012-02-17 Glenn Morris <rgm@gnu.org>
+
+ * ack.texi (Acknowledgments): Mention Gnulib.
+
+ * ack.texi, calendar.texi, cal-xtra.texi: Use "Bahá'í".
+
+ * calendar.texi: Misc small changes, including updating the dates
+ of examples.
+
+2012-02-16 Glenn Morris <rgm@gnu.org>
+
+ * calendar.texi: Misc small changes.
+
+ * vc1-xtra.texi (VC Delete/Rename, CVS Options):
+ * cal-xtra.texi (Diary Display): Fix TeX cross-refs to other manuals.
+
+ * dired-xtra.texi (Subdir Switches): Small fixes.
+
+ * fortran-xtra.texi: Tiny changes and some adjustments to line breaks.
+
+2012-02-15 Glenn Morris <rgm@gnu.org>
+
+ * sending.texi (Mail Sending): smtpmail-auth-credentials was removed.
+
2012-02-12 Glenn Morris <rgm@gnu.org>
* ack.texi (Acknowledgments):
@item
Rolf Ebert co-wrote Ada mode.
+@item
+Paul Eggert integrated the Gnulib portability library, and made many
+other portability fixes to the C code; as well as his contributions
+to VC and the calendar.
+
@item
Stephen Eglen wrote @file{mspools.el}, which tells you which Procmail
folders have mail waiting in them; and @file{iswitchb.el}, a feature
Security protocol; @file{sasl-cram.el} and @file{sasl-digest.el} (with
Kenichi Okada), and @file{sasl.el}, support for Simple Authentication
and Security Layer (SASL); @file{plstore.el} for secure storage of
-propery lists; and the EasyPG (and its predecessor PGG)
+property lists; and the EasyPG (and its predecessor PGG)
package, for GnuPG and PGP support.
@item
John Wiegley wrote @file{align.el}, a set of commands for aligning text
according to regular-expression based rules; @file{isearchb.el} for fast
buffer switching; @file{timeclock.el}, a package for keeping track of
-time spent on projects; the Baha'i calendar support;
+time spent on projects; the Bahá'í calendar support;
@file{pcomplete.el}, a programmable completion facility;
@file{remember.el}, a mode for jotting down things to remember;
@file{eudcb-mab.el}, an address book backend for the Emacs Unified
-@c This is part of the Emacs manual.
-@c Copyright (C) 2004-2012 Free Software Foundation, Inc.
+@c This is part of the Emacs manual. -*- coding: iso-latin-1 -*-
+@c Copyright (C) 2004-2012 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@c
@c This file is included either in emacs-xtra.texi (when producing the
general holidays (@code{holiday-general-holidays}),
local holidays (@code{holiday-local-holidays}),
sun- and moon-related holidays (@code{holiday-solar-holidays}),
-Baha'i holidays (@code{holiday-bahai-holidays}),
+Bahá'í holidays (@code{holiday-bahai-holidays}),
Christian holidays (@code{holiday-christian-holidays}),
Hebrew (Jewish) holidays (@code{holiday-hebrew-holidays}),
Islamic (Muslim) holidays (@code{holiday-islamic-holidays}),
@minus{}1 the last occurrence, @minus{}2 the second-to-last occurrence, and
so on).
- You can specify holidays that occur on fixed days of the Baha'i,
+ You can specify holidays that occur on fixed days of the Bahá'í,
Chinese, Hebrew, Islamic, and Julian calendars too. For example,
@smallexample
@subsection Diary Entries Using non-Gregorian Calendars
As well as entries based on the standard Gregorian calendar, your
-diary can have entries based on Baha'i, Hebrew, or Islamic dates.
+diary can have entries based on Bahá'í, Hebrew, or Islamic dates.
Recognition of such entries can be time-consuming, however, and since
most people don't use them, you must explicitly enable their use. If
you want the diary to recognize Hebrew-date diary entries, for example,
@end smallexample
@noindent
-Similarly, for Islamic and Baha'i entries, add
+Similarly, for Islamic and Bahá'í entries, add
@code{diary-islamic-list-entries} and @code{diary-islamic-mark-entries}, or
@code{diary-bahai-list-entries} and @code{diary-bahai-mark-entries}.
@vindex diary-islamic-entry-symbol
These diary entries have the same formats as Gregorian-date diary
entries; except that @code{diary-bahai-entry-symbol} (default @samp{B})
-must precede a Baha'i date, @code{diary-hebrew-entry-symbol} (default
+must precede a Bahá'í date, @code{diary-hebrew-entry-symbol} (default
@samp{H}) a Hebrew date, and @code{diary-islamic-entry-symbol} (default
@samp{I}) an Islamic date. Moreover, non-Gregorian month names may not
be abbreviated (because the first three letters are often not unique).
Here is a table of commands used in the calendar to create diary
entries that match the selected date and other dates that are similar in
-the Baha'i, Hebrew, or Islamic calendars:
+the Bahá'í, Hebrew, or Islamic calendars:
@table @kbd
@item i h d
days to be shown in the fancy diary buffer, set the variable
@code{diary-list-include-blanks} to @code{t}.@refill
- The fancy diary buffer enables View mode (@pxref{View Mode}).
+ The fancy diary buffer enables View mode
+@iftex
+(@pxref{View Mode,,, emacs, the Emacs Manual}).
+@end iftex
+@ifnottex
+(@pxref{View Mode}).
+@end ifnottex
The alternative display method @code{diary-simple-display} shows the
actual diary buffer, and uses invisible text to hide entries that don't
hidden. After preparing the buffer, it runs the hook
@code{diary-print-entries-hook}. The default value of this hook sends
the data directly to the printer with the command @code{lpr-buffer}
-(@pxref{Printing}). If you want to use a different command to do the
+@iftex
+(@pxref{Printing,,, emacs, the Emacs Manual}).
+@end iftex
+@ifnottex
+(@pxref{Printing}).
+@end ifnottex
+If you want to use a different command to do the
printing, just change the value of this hook. Other uses might include,
for example, rearranging the lines into order by day and time.
@item %%(diary-astro-day-number)
Make a diary entry with today's equivalent astronomical (Julian) day number.
@item %%(diary-bahai-date)
-Make a diary entry with today's equivalent Baha'i calendar date.
+Make a diary entry with today's equivalent Bahá'í calendar date.
@item %%(diary-chinese-date)
Make a diary entry with today's equivalent Chinese calendar date.
@item %%(diary-coptic-date)
-@c This is part of the Emacs manual.
+@c This is part of the Emacs manual. -*- coding: iso-latin-1 -*-
@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
@c Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
A week (or month, or year) is not just a quantity of days; we think of
weeks (months, years) as starting on particular dates. So Calendar mode
-provides commands to move to the beginning or end of a week, month or
-year:
+provides commands to move to the start or end of a week, month or year:
@table @kbd
@kindex C-a @r{(Calendar mode)}
Scroll calendar one month backward (@code{calendar-scroll-right}).
@item C-v
@itemx @key{next}
-Scroll calendar three months forward
-(@code{calendar-scroll-left-three-months}).
+Scroll three months forward (@code{calendar-scroll-left-three-months}).
@item M-v
@itemx @key{prior}
-Scroll calendar three months backward
-(@code{calendar-scroll-right-three-months}).
+Scroll three months backward (@code{calendar-scroll-right-three-months}).
@end table
@kindex > @r{(Calendar mode)}
@kindex M-= @r{(Calendar mode)}
@findex calendar-count-days-region
- To determine the number of days in the region, type @kbd{M-=}
+ To determine the number of days in a range, set the mark on one
+date using @kbd{C-SPC}, move point to another date, and type @kbd{M-=}
(@code{calendar-count-days-region}). The numbers of days shown is
@emph{inclusive}; that is, it includes the days specified by mark and
point.
calendar deletes or iconifies that frame depending on the value of
@code{calendar-remove-frame-by-deleting}.)
+@c FIXME this mentions holidays and diary entries, albeit briefly, so
+@c should it be moved after those sections? Or at least xref them.
@node Writing Calendar Files
@section Writing Calendar Files
Some of these commands print the calendar sideways (in ``landscape
mode''), so it can be wider than it is long. Some of them use Filofax
paper size (3.75in x 6.75in). All of these commands accept a prefix
-argument which specifies how many days, weeks, months or years to print
+argument, which specifies how many days, weeks, months or years to print
(starting always with the selected one).
If the variable @code{cal-tex-holidays} is non-@code{nil} (the default),
and can display them. You can add your own holidays to the default list.
@table @kbd
-@item h
+@item Mouse-3 Holidays
+@itemx h
Display holidays for the selected date
(@code{calendar-cursor-holidays}).
-@item Mouse-3 Holidays
-Display any holidays for the date you click on.
@item x
Mark holidays in the calendar window (@code{calendar-mark-holidays}).
@item u
holidays}, which prompts for the month and year.
The holidays known to Emacs include United States holidays and the
-major Baha'i, Chinese, Christian, Islamic, and Jewish holidays; also the
+major Bahá'í, Chinese, Christian, Islamic, and Jewish holidays; also the
solstices and equinoxes.
@findex list-holidays
times of sunrise and sunset for any date.
@table @kbd
-@item S
+@item Mouse-3 Sunrise/sunset
+@itemx S
Display times of sunrise and sunset for the selected date
(@code{calendar-sunrise-sunset}).
-@item Mouse-3 Sunrise/sunset
-Display times of sunrise and sunset for the date you click on.
@item M-x sunrise-sunset
Display times of sunrise and sunset for today's date.
@item C-u M-x sunrise-sunset
As a user, you might find it convenient to set the calendar location
variables for your usual physical location in your @file{.emacs} file.
-And when you install Emacs on a machine, you can create a
-@file{default.el} file which sets them properly for the typical location
-of most users of that machine. @xref{Init File}.
+If you are a system administrator, you may want to set these variables
+for all users in a @file{default.el} file. @xref{Init File}.
@node Lunar Phases
@section Phases of the Moon
it did not fully displace the Julian calendar and gain universal
acceptance until the early twentieth century. The Emacs calendar can
display any month since January, year 1 of the current era, but the
-calendar displayed is the Gregorian, even for a date at which the
-Gregorian calendar did not exist.
+calendar displayed is always the Gregorian, even for a date at which
+the Gregorian calendar did not exist.
While Emacs cannot display other calendars, it can convert dates to
and from several other calendars.
* Mayan Calendar:: Moving to a date specified in a Mayan calendar.
@end menu
+@c FIXME perhaps most of the details should be moved to cal-xtra.
+@c Just list the major supported systems here?
@node Calendar Systems
@subsection Supported Calendar Systems
@cindex ISO commercial calendar
- The ISO commercial calendar is used largely in Europe.
+ The ISO commercial calendar is often used in business.
@cindex Julian calendar
The Julian calendar, named after Julius Caesar, was the one used in Europe
the astronomical Persian calendar, which is based on astronomical
events. As of this writing the first future discrepancy is projected
to occur on March 20, 2025. It is currently not clear what the
-official calendar of Iran will be that far into the future.
+official calendar of Iran will be at that time.
+@c FIXME not so far in the future now.
@cindex Chinese calendar
The Chinese calendar is a complicated system of lunar months arranged
twelve ``terrestrial branches'' for a total of sixty names that are
repeated in a cycle of sixty.
-@cindex Baha'i calendar
- The Baha'i calendar system is based on a solar cycle of 19 months with
+@cindex Bahá'í calendar
+ The Bahá'í calendar system is based on a solar cycle of 19 months with
19 days each. The four remaining ``intercalary'' days are placed
between the 18th and 19th months.
in various other calendar systems:
@table @kbd
-@item Mouse-3 Other calendars
-Display the date that you click on, expressed in various other calendars.
@kindex p @r{(Calendar mode)}
@findex calendar-print-other-dates
-@item p o
+@item Mouse-3 Other calendars
+@itemx p o
Display the selected date in various other calendars.
(@code{calendar-print-other-dates}).
@findex calendar-iso-print-date
(@code{calendar-french-print-date}).
@findex calendar-bahai-print-date
@item p b
-Display Baha'i date for selected day
+Display Bahá'í date for selected day
(@code{calendar-bahai-print-date}).
@findex calendar-chinese-print-date
@item p C
Display Mayan date for selected day (@code{calendar-mayan-print-date}).
@end table
- If you are using a graphic display, the easiest way to translate a
-date into other calendars is to click on it with @kbd{Mouse-3}, then
-choose @kbd{Other calendars} from the menu that appears. This displays
-the equivalent forms of the date in all the calendars Emacs understands,
-in the form of a menu. (Choosing an alternative from this menu doesn't
-actually do anything---the menu is used only for display.)
-
Otherwise, move point to the date you want to convert, then type the
appropriate command starting with @kbd{p} from the table above. The
prefix @kbd{p} is a mnemonic for ``print,'' since Emacs ``prints'' the
equivalent date in the echo area. @kbd{p o} displays the
-date in all forms known to Emacs.
+date in all forms known to Emacs. You can also use @kbd{Mouse-3} and
+then choose @kbd{Other calendars} from the menu that appears. This
+displays the equivalent forms of the date in all the calendars Emacs
+understands, in the form of a menu. (Choosing an alternative from
+this menu doesn't actually do anything---the menu is used only for
+display.)
@node From Other Calendar
@subsection Converting From Other Calendars
Move to a date specified with an astronomical (Julian) day number
(@code{calendar-astro-goto-day-number}).
@item g b
-Move to a date specified in the Baha'i calendar
+Move to a date specified in the Bahá'í calendar
(@code{calendar-bahai-goto-date}).
@item g h
Move to a date specified in the Hebrew calendar
@c FIXME move?
@findex calendar-hebrew-list-yahrzeits
@cindex yahrzeits
- One common question concerning the Hebrew calendar is the computation
+ One common issue concerning the Hebrew calendar is the computation
of the anniversary of a date of death, called a ``yahrzeit.'' The Emacs
calendar includes a facility for such calculations. If you are in the
calendar, the command @kbd{M-x calendar-hebrew-list-yahrzeits} asks you for
this command first asks you for the date of death and the range of
years, and then displays the list of yahrzeit dates.
+@c FIXME move to emacs-xtra.
@node Mayan Calendar
@subsection Converting from the Mayan Calendar
@findex calendar-mayan-next-haab-date
@cindex Mayan haab calendar
The Mayan haab calendar is a cycle of 365 days arranged as 18 months
-of 20 days each, followed a 5-day monthless period. Like the tzolkin
+of 20 days each, followed by a 5-day monthless period. Like the tzolkin
cycle, this cycle repeats endlessly, and there are commands to move
backward and forward to the previous or next point in the cycle. Type
@kbd{g m p h} to go to the previous haab date; Emacs asks you for a haab
showing what that file looks like:
@example
-12/22/1988 Twentieth wedding anniversary!!
+12/22/2012 Twentieth wedding anniversary!!
&1/1. Happy New Year!
10/22 Ruth's birthday.
* 21, *: Payday
1/13/89 Friday the thirteenth!!
&thu 4pm squash game with Lloyd.
mar 16 Dad's birthday
-April 15, 1989 Income tax due.
+April 15, 2013 Income tax due.
&* 15 time cards due.
@end example
@noindent
-This format is essentially the same as the one used by the system's
-@command{calendar} utility. This example uses extra spaces to align
-the event descriptions of most of the entries. Such formatting is
-purely a matter of taste.
+This format is essentially the same as the one used by the separate
+@command{calendar} utility that is present on some Unix systems. This
+example uses extra spaces to align the event descriptions of most of
+the entries. Such formatting is purely a matter of taste.
Although you probably will start by creating a diary manually, Emacs
provides a number of commands to let you view, add, and change diary
following, key bindings refer to the Calendar buffer.
@table @kbd
-@item d
+@item Mouse-3 Diary
+@itemx d
Display all diary entries for the selected date
(@code{diary-view-entries}).
-@item Mouse-3 Diary
-Display all diary entries for the date you click on.
@item s
Display the entire diary file (@code{diary-show-all-entries}).
@item m
@xref{Calendar Customizing, diary-entry-marker}.
@end ifnottex
- The command applies both to the currently visible months and to
-other months that subsequently become visible by scrolling. To turn
+ This command applies both to the months that are currently visible
+and to those that subsequently become visible after scrolling. To turn
marking off and erase the current marks, type @kbd{u}, which also
turns off holiday marks (@pxref{Holidays}). If the variable
@code{calendar-mark-diary-entries-flag} is non-@code{nil}, creating or
@end ifnottex
If you put @code{(diary)} in your @file{.emacs} file, this
-automatically displays a window with the day's diary entries, when you
-enter Emacs.
+automatically displays a window with the day's diary entries when you
+start Emacs.
@findex diary-mail-entries
@vindex diary-mail-days
- Many users like to receive notice of events in their diary as email.
-To send such mail to yourself, use the command @kbd{M-x
+ Some people like to receive email notifications of events in their
+diary. To send such mail to yourself, use the command @kbd{M-x
diary-mail-entries}. A prefix argument specifies how many days
(starting with today) to check; otherwise, the variable
@code{diary-mail-days} says how many days.
punctuation). For example:
@example
-02/11/1989
+02/11/2012
Bill B. visits Princeton today
2pm Cognitive Studies Committee meeting
2:30-5:30 Liz at Lawrenceville
@vindex diary-nonmarking-symbol
You can inhibit the marking of certain diary entries in the calendar
-window; to do this, insert an ampersand @code{diary-nonmarking-symbol}
-(default @samp{&}) at the beginning of the entry, before the date. This
-has no effect on display of the entry in the diary window; it affects
-only marks on dates in the calendar window. Nonmarking entries are
+window; to do this, insert the string that
+@code{diary-nonmarking-symbol} specifies (default @samp{&}) at the
+beginning of the entry, before the date. This
+has no effect on display of the entry in the diary window; it only
+affects marks on dates in the calendar window. Nonmarking entries are
especially useful for generic entries that would otherwise mark many
different dates.
month, year) and ISO order (year, month, day) as options.
@example
-4/20/93 Switch-over to new tabulation system
+4/20/12 Switch-over to new tabulation system
apr. 25 Start tabulating annual results
4/30 Results for April are due
*/25 Monthly cycle finishes
Friday Don't leave without backing up files
@end example
- The first entry appears only once, on April 20, 1993. The second and
+ The first entry appears only once, on April 20, 2012. The second and
third appear every year on the specified dates, and the fourth uses a
wildcard (asterisk) for the month, so it appears on the 25th of every
month. The final entry appears every week on Friday.
This must be followed by a nondigit. In the date itself, @var{month}
and @var{day} are numbers of one or two digits. The optional @var{year}
is also a number, and may be abbreviated to the last two digits; that
-is, you can use @samp{11/12/1989} or @samp{11/12/89}.
+is, you can use @samp{11/12/2012} or @samp{11/12/12}.
Dates can also have the form @samp{@var{monthname} @var{day}} or
@samp{@var{monthname} @var{day}, @var{year}}, where the month's name can
A date may be @dfn{generic}; that is, partially unspecified. Then the
entry applies to all dates that match the specification. If the date
does not contain a year, it is generic and applies to any year.
-Alternatively, @var{month}, @var{day}, or @var{year} can be a @samp{*};
+Alternatively, @var{month}, @var{day}, or @var{year} can be @samp{*};
this matches any month, day, or year, respectively. Thus, a diary entry
@samp{3/*/*} matches any day in March of any year; so does @samp{march
*}.
yearly diary entry with the @kbd{i y} command.
All of the above commands make marking diary entries by default. To
-make a nonmarking diary entry, give a numeric argument to the command.
+make a nonmarking diary entry, give a prefix argument to the command.
For example, @kbd{C-u i w} makes a nonmarking weekly diary entry.
When you modify the diary file, be sure to save the file before
A @dfn{block} diary entry applies to a specified range of consecutive
dates. Here is a block diary entry that applies to all dates from June
-24, 1990 through July 10, 1990:
+24, 2012 through July 10, 2012:
@findex diary-block
@example
-%%(diary-block 6 24 1990 7 10 1990) Vacation
+%%(diary-block 6 24 2012 7 10 2012) Vacation
@end example
@noindent
-The @samp{6 24 1990} indicates the starting date and the @samp{7 10 1990}
+The @samp{6 24 2012} indicates the starting date and the @samp{7 10 2012}
indicates the stopping date. (Again, if you are using the European or ISO
calendar style, the input order of month, day and year is different.)
@findex diary-cyclic
@example
-%%(diary-cyclic 50 3 1 1990) Renew medication
+%%(diary-cyclic 50 3 1 2012) Renew medication
@end example
@noindent
-This entry applies to March 1, 1990 and every 50th day following;
-@samp{3 1 1990} specifies the starting date. (If you are using the
+This entry applies to March 1, 2012 and every 50th day following;
+@samp{3 1 2012} specifies the starting date. (If you are using the
European or ISO calendar style, the input order of month, day and year
is different.)
All three of these commands make marking diary entries. To insert a
-nonmarking entry, give a numeric argument to the command. For example,
+nonmarking entry, give a prefix argument to the command. For example,
@kbd{C-u i a} makes a nonmarking anniversary diary entry.
- Marking sexp diary entries in the calendar is @emph{extremely}
-time-consuming, since every date visible in the calendar window must be
-individually checked. So it's a good idea to make sexp diary entries
-nonmarking (with @samp{&}) when possible.
+ Marking sexp diary entries in the calendar can be time-consuming,
+since every date visible in the calendar window must be individually
+checked. So it's a good idea to make sexp diary entries nonmarking
+(with @samp{&}) when possible.
Another sophisticated kind of sexp entry, a @dfn{floating} diary entry,
specifies a regularly occurring event by offsets specified in days,
@vindex appt-audible
@vindex appt-display-mode-line
If you have a diary entry for an appointment, and that diary entry
-begins with a recognizable time of day, Emacs can warn you several
-minutes beforehand that that appointment is pending. Emacs alerts you
+begins with a recognizable time of day, Emacs can warn you in advance
+that an appointment is pending. Emacs alerts you
to the appointment by displaying a message in your chosen format, as
specified by the variable @code{appt-display-format}. If the value of
@code{appt-audible} is non-@code{nil}, the warning includes an audible
recognize additional appointment message formats by customizing the
variable @code{diary-outlook-formats}.
+@c FIXME the name of the RFC is hardly very relevant.
@cindex iCalendar support
The icalendar package allows you to transfer data between your Emacs
diary file and iCalendar files, which are defined in ``RFC
@findex icalendar-import-buffer
The command @code{icalendar-import-buffer} extracts
-iCalendar data from the current buffer and adds it to your (default)
+iCalendar data from the current buffer and adds it to your
diary file. This function is also suitable for automatic extraction of
iCalendar data; for example with the Rmail mail client one could use:
Use @code{icalendar-export-file} to interactively export an entire
Emacs diary file to iCalendar format. To export only a part of a diary
file, mark the relevant area, and call @code{icalendar-export-region}.
-In both cases the result is appended to the target file.
+In both cases, Emacs appends the result to the target file.
@node Daylight Saving
@section Daylight Saving Time
@vindex timeclock-ask-before-exiting
Terminating the current Emacs session might or might not mean that
you have stopped working on the project and, by default, Emacs asks
-you. You can, however, set customize the value of the variable
+you. You can, however, customize the value of the variable
@code{timeclock-ask-before-exiting} to @code{nil} to avoid the question;
then, only an explicit @kbd{M-x timeclock-out} or @kbd{M-x
timeclock-change} will tell Emacs that the current interval is over.
@c This is part of the Emacs manual.
-@c Copyright (C) 2004-2012 Free Software Foundation, Inc.
+@c Copyright (C) 2004-2012 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@c
@c This file is included either in emacs-xtra.texi (when producing the
You can insert subdirectories with specified @command{ls} switches in
Dired buffers using @kbd{C-u i}. You can change the @command{ls}
-switches of an already inserted subdirectory using @kbd{C-u l}.
+switches of an already inserted subdirectory at point using @kbd{C-u l}.
Dired preserves the switches if you revert the buffer. Deleting a
subdirectory forgets about its switches.
-Using @code{dired-undo} (@pxref{Marks vs Flags}) to reinsert or delete
+Using @code{dired-undo}
+@iftex
+(@pxref{Marks vs Flags,,, emacs, the Emacs Manual})
+@end iftex
+@ifnottex
+(@pxref{Marks vs Flags})
+@end ifnottex
+to reinsert or delete
subdirectories that were inserted with explicit switches can bypass
Dired's machinery for remembering (or forgetting) switches. Deleting
a subdirectory using @code{dired-undo} does not forget its switches.
@c This is part of the Emacs manual.
-@c Copyright (C) 2004-2012 Free Software Foundation, Inc.
+@c Copyright (C) 2004-2012 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@c
@c This file is included either in emacs-xtra.texi (when producing the
@subsection Motion Commands
In addition to the normal commands for moving by and operating on
-``defuns'' (Fortran subprograms---functions and subroutines, using the
-commands @code{fortran-beginning-of-subprogram} and
-@code{fortran-end-of-subprogram}; as well as modules for F90 mode),
-Fortran mode provides special commands to move by statements and other
-program units.
+``defuns'' (Fortran subprograms---functions and subroutines, as well
+as modules for F90 mode, using the commands @code{fortran-end-of-subprogram}
+and @code{fortran-beginning-of-subprogram}), Fortran mode provides
+special commands to move by statements and other program units.
@table @kbd
@kindex C-c C-n @r{(Fortran mode)}
@findex f90-next-block
@item C-c C-e
Move point forward to the start of the next code block, or the end of
-the current block, whichever is encountered first.
-(@code{f90-next-block}). A code block is a subroutine,
-@code{if}--@code{endif} statement, and so forth. This command exists
-for F90 mode only, not Fortran mode. With a numeric argument, this
-moves forward that many blocks.
+the current one, whichever comes first (@code{f90-next-block}).
+A code block is a subroutine, @code{if}--@code{endif} statement, and
+so forth. This command exists for F90 mode only, not Fortran mode.
+With a numeric argument, it moves forward that many blocks.
@kindex C-c C-a @r{(F90 mode)}
@findex f90-previous-block
@item C-c C-a
-Move point backward to the previous code block
+Move point backward to the previous block
(@code{f90-previous-block}). This is like @code{f90-next-block}, but
moves backwards.
@item M-^
Join this line to the previous line (@code{fortran-join-line}).
@item C-M-q
-Indent all the lines of the subprogram point is in
+Indent all the lines of the subprogram that point is in
(@code{fortran-indent-subprogram}).
@item M-q
Fill a comment block or statement (using @code{fortran-fill-paragraph}
The setting of continuation style affects several other aspects of
editing in Fortran mode. In fixed form mode, the minimum column
number for the body of a statement is 6. Lines inside of Fortran
-blocks that are indented to larger column numbers always use only the
+blocks that are indented to larger column numbers must use only the
space character for whitespace. In tab format mode, the minimum
column number for the statement body is 8, and the whitespace before
-column 8 must always consist of one tab character.
+column 8 must consist of one tab character.
@node ForIndent Num
@subsubsection Line Numbers
If a number is the first non-whitespace in the line, Fortran
indentation assumes it is a line number and moves it to columns 0
-through 4. (Columns always count from 0 in GNU Emacs.)
+through 4. (Columns always count from 0 in Emacs.)
@vindex fortran-line-number-indent
Line numbers of four digits or less are normally indented one space.
@samp{do} that ends there. If you always end @samp{do} statements with
a @samp{continue} line (or if you use the more modern @samp{enddo}),
then you can speed up indentation by setting this variable to
-@code{nil}. The default is @code{nil}.
+@code{nil} (the default).
@item fortran-blink-matching-if
If this is @code{t}, indenting an @samp{endif} (or @samp{enddo}
@item fortran-minimum-statement-indent-fixed
Minimum indentation for Fortran statements when using fixed form
-continuation line style. Statement bodies are never indented less than
-this much. The default is 6.
+continuation line style. Statement bodies are never indented by less than
+this. The default is 6.
@item fortran-minimum-statement-indent-tab
Minimum indentation for Fortran statements for tab format continuation line
-style. Statement bodies are never indented less than this much. The
+style. Statement bodies are never indented by less than this. The
default is 8.
@end table
-The variables controlling the indentation of comments are described in
-the following section.
+The following section describes the variables controlling the
+indentation of comments.
@node Fortran Comments
@subsection Fortran Comments
some Fortran 77 compilers accept this syntax, Fortran mode will not
insert such comments unless you have said in advance to do so. To do
this, set the variable @code{fortran-comment-line-start} to @samp{"!"}.
-If you use an unusual value, you may also need to adjust
+If you use an unusual value, you may need to change
@code{fortran-comment-line-start-skip}.
Align comment or insert new comment (@code{comment-dwim}).
@item C-x ;
-Applies to nonstandard @samp{!} comments only.
+Applies to nonstandard @samp{!} comments only (@code{comment-set-column}).
@item C-c ;
Turn all lines of the region into comments, or (with argument) turn them back
@code{fortran-comment-line-extra-indent} and the minimum statement
indentation. This is the default.
-The minimum statement indentation is
-@code{fortran-minimum-statement-indent-fixed} for fixed form
-continuation line style and @code{fortran-minimum-statement-indent-tab}
-for tab format style.
+The minimum indentation is
+@code{fortran-minimum-statement-indent-tab} for tab format
+continuation line style and @code{fortran-minimum-statement-indent-fixed}
+for fixed form style.
@item relative
Align the text as if it were a line of code, but with an additional
lines are directives. Matching lines are never indented, and receive
distinctive font-locking.
- The normal Emacs comment command @kbd{C-x ;} has not been redefined. If
-you use @samp{!} comments, this command can be used with them. Otherwise
-it is useless in Fortran mode.
+ The normal Emacs comment command @kbd{C-x ;} (@code{comment-set-column})
+has not been redefined. If you use @samp{!} comments, this command
+can be used with them. Otherwise it is useless in Fortran mode.
@kindex C-c ; @r{(Fortran mode)}
@findex fortran-comment-region
@vindex fortran-comment-region
The command @kbd{C-c ;} (@code{fortran-comment-region}) turns all the
-lines of the region into comments by inserting the string @samp{C$$$} at
+lines of the region into comments by inserting the string @samp{c$$$} at
the front of each one. With a numeric argument, it turns the region
-back into live code by deleting @samp{C$$$} from the front of each line
+back into live code by deleting @samp{c$$$} from the front of each line
in it. The string used for these comments can be controlled by setting
the variable @code{fortran-comment-region}. Note that here we have an
example of a command and a variable with the same name; these two uses
Split the current window horizontally temporarily so that it is
@code{fortran-line-length} columns wide
(@code{fortran-window-create-momentarily}). This may help you avoid
-making lines longer than the character limit imposed by your Fortran
-compiler.
+making lines longer than the limit imposed by your Fortran compiler.
@item C-u C-c C-w
Split the current window horizontally so that it is
@code{fortran-line-length} columns wide (@code{fortran-window-create}).
Send mail using the through an external mail host, such as your
Internet service provider's outgoing SMTP mail server. If you have
not told Emacs how to contact the SMTP server, it prompts for this
-information, which is saved in the variables
-@code{smtpmail-smtp-server} and @code{smtpmail-auth-credentials}.
+information, which is saved in the @code{smtpmail-smtp-server} variable
+and the file @file{~/.authinfo}.
@xref{Top,,Emacs SMTP Library, smtpmail, Sending mail via SMTP}.
@item sendmail-send-it
it via the version control system. The file is removed from the
working tree, and in the VC Directory buffer
@iftex
-(@pxref{VC Directory Mode}),
+(@pxref{VC Directory Mode,,, emacs, the Emacs Manual}),
@end iftex
@ifnottex
(@pxref{VC Directory Mode}),
locking-like behavior using its @env{CVSREAD} or @dfn{watch} feature;
see the CVS documentation for details. If that case, you can use
@kbd{C-x v v} in Emacs to toggle locking, as you would for a
-locking-based version control system (@pxref{VC With A Locking VCS}).
+locking-based version control system
+@iftex
+(@pxref{VC With A Locking VCS,,,emacs, the Emacs Manual}).
+@end iftex
+@ifnottex
+(@pxref{VC With A Locking VCS}).
+@end ifnottex
+2012-02-16 Chong Yidong <cyd@gnu.org>
+
+ * syntax.texi (Syntax Tables, Syntax Descriptors)
+ (Syntax Table Functions): Copyedits.
+ (Syntax Basics): Don't repeat the material in the preceding node.
+ (Syntax Class Table): Use a table.
+ (Syntax Properties): Document syntax-propertize-function and
+ syntax-propertize-extend-region-functions.
+ (Motion via Parsing): Clarify scan-lists. Fix indentation.
+ (Parser State): Update for the new "c" comment style. Fix
+ description of item 7 (comment style).
+
+ * modes.texi (Minor Modes): Update how mode commands should treat
+ arguments now.
+ (Mode Line Basics): Clarify force-mode-line-update.
+ (Mode Line Top): Note that the example is not realistic.
+ (Mode Line Variables, Mode Line Data, %-Constructs, Header Lines)
+ (Emulating Mode Line): Use "mode line" instead of "mode-line", and
+ "mode line construct" instead of "mode line specification".
+ (Syntactic Font Lock): Remove mention of obsolete variable
+ font-lock-syntactic-keywords.
+ (Setting Syntax Properties): Node deleted.
+ (Font Lock Mode): Note that Font Lock mode is a minor mode.
+ (Font Lock Basics): Note that syntactic fontification falls back
+ on `syntax-table'.
+ (Search-based Fontification): Emphasize that font-lock-keywords
+ should not be set directly.
+ (Faces for Font Lock): Avoid some confusing terminology.
+ (Syntactic Font Lock): Minor clarifications. Add xref to
+ Syntactic Font Lock node.
+
+2012-02-15 Chong Yidong <cyd@gnu.org>
+
+ * minibuf.texi (Basic Completion): Define "completion table".
+ Move completion-in-region to Completion in Buffers node.
+ (Completion Commands): Use "completion table" terminology.
+ (Completion in Buffers): New node.
+
+ * modes.texi (Hooks): add-hook can be used for abnormal hooks too.
+ (Setting Hooks): Update minor mode usage example.
+ (Major Mode Conventions): Note that completion-at-point-functions
+ should be altered locally. Add xref to Completion in Buffers.
+ Remove duplicate tip about auto-mode-alist.
+ (Minor Modes): Rewrite introduction.
+ (Minor Mode Conventions): Copyedits. Don't recommend
+ variable-only minor modes since few minor modes are like that.
+
+2012-02-15 Glenn Morris <rgm@gnu.org>
+
+ * processes.texi (Network): Document open-network-stream :parameters.
+
2012-02-14 Chong Yidong <cyd@gnu.org>
* keymaps.texi (Format of Keymaps): The CACHE component of keymaps
shell commands.
* Completion Styles:: Specifying rules for performing completion.
* Programmed Completion:: Writing your own completion-function.
+* Completion in Buffers:: Completing text in ordinary buffers.
Command Loop
* Mode Line Format:: Customizing the text that appears in the mode line.
* Imenu:: Providing a menu of definitions made in a buffer.
* Font Lock Mode:: How modes can highlight text according to syntax.
+* Auto-Indentation:: How to teach Emacs to indent for a major mode.
* Desktop Save Mode:: How modes can have buffer state saved between
Emacs sessions.
contents can also specify how to fontify it.
* Faces for Font Lock:: Special faces specifically for Font Lock.
* Syntactic Font Lock:: Fontification based on syntax tables.
-* Setting Syntax Properties:: Defining character syntax based on context
- using the Font Lock mechanism.
* Multiline Font Lock:: How to coerce Font Lock into properly
highlighting multiline constructs.
Within a macro definition, you can use the @code{declare} form
(@pxref{Defining Macros}) to specify how to @key{TAB} should indent
-calls to the macro. An indentation specifiction is written like this:
+calls to the macro. An indentation specification is written like this:
@example
(declare (indent @var{indent-spec}))
shell commands.
* Completion Styles:: Specifying rules for performing completion.
* Programmed Completion:: Writing your own completion-function.
+* Completion in Buffers:: Completing text in ordinary buffers.
@end menu
@node Basic Completion
@defun try-completion string collection &optional predicate
This function returns the longest common substring of all possible
-completions of @var{string} in @var{collection}. The value of
-@var{collection} must be a list of strings, an alist whose keys are
-strings or symbols, an obarray, a hash table, or a completion function
-(@pxref{Programmed Completion}).
+completions of @var{string} in @var{collection}.
+
+@cindex completion table
+The @var{collection} argument is called the @dfn{completion table}.
+Its value must be a list of strings, an alist whose keys are strings
+or symbols, an obarray, a hash table, or a completion function.
Completion compares @var{string} against each of the permissible
completions specified by @var{collection}. If no permissible
If @var{collection} is a hash table, then the keys that are strings
are the possible completions. Other keys are ignored.
-You can also use a function as @var{collection}.
-Then the function is solely responsible for performing completion;
-@code{try-completion} returns whatever this function returns. The
-function is called with three arguments: @var{string}, @var{predicate}
-and @code{nil} (the reason for the third argument is so that the same
-function can be used in @code{all-completions} and do the appropriate
-thing in either case). @xref{Programmed Completion}.
+You can also use a function as @var{collection}. Then the function is
+solely responsible for performing completion; @code{try-completion}
+returns whatever this function returns. The function is called with
+three arguments: @var{string}, @var{predicate} and @code{nil} (the
+reason for the third argument is so that the same function can be used
+in @code{all-completions} and do the appropriate thing in either
+case). @xref{Programmed Completion}.
If the argument @var{predicate} is non-@code{nil}, then it must be a
function of one argument, unless @var{collection} is a hash table, in
It is done by calling @var{fun} with no arguments. The
value @var{fun} returns becomes the permanent value of @var{var}.
-Here is an example of use:
+Here is a usage example:
@smallexample
(defvar foo (lazy-completion-table foo make-my-alist))
@end smallexample
@end defmac
-The function @code{completion-in-region} provides a convenient way to
-perform completion on an arbitrary stretch of text in an Emacs buffer:
-
-@defun completion-in-region start end collection &optional predicate
-This function completes the text in the current buffer between the
-positions @var{start} and @var{end}, using @var{collection}. The
-argument @var{collection} has the same meaning as in
-@code{try-completion} (@pxref{Basic Completion}).
-
-This function inserts the completion text directly into the current
-buffer. Unlike @code{completing-read} (@pxref{Minibuffer
-Completion}), it does not activate the minibuffer.
-
-For this function to work, point must be somewhere between @var{start}
-and @var{end}.
-@end defun
-
@node Minibuffer Completion
@subsection Completion and the Minibuffer
@cindex minibuffer completion
providing completion. It activates the minibuffer with prompt
@var{prompt}, which must be a string.
-The actual completion is done by passing @var{collection} and
-@var{predicate} to the function @code{try-completion} (@pxref{Basic
-Completion}). This happens in certain commands bound in the local
-keymaps used for completion. Some of these commands also call
-@code{test-completion}. Thus, if @var{predicate} is non-@code{nil},
-it should be compatible with @var{collection} and
-@code{completion-ignore-case}. @xref{Definition of test-completion}.
+The actual completion is done by passing the completion table
+@var{collection} and the completion predicate @var{predicate} to the
+function @code{try-completion} (@pxref{Basic Completion}). This
+happens in certain commands bound in the local keymaps used for
+completion. Some of these commands also call @code{test-completion}.
+Thus, if @var{predicate} is non-@code{nil}, it should be compatible
+with @var{collection} and @code{completion-ignore-case}.
+@xref{Definition of test-completion}.
The value of the optional argument @var{require-match} determines how
the user may exit the minibuffer:
in the minibuffer to do completion.
@defvar minibuffer-completion-table
-The value of this variable is the collection used for completion in
-the minibuffer. This is the global variable that contains what
+The value of this variable is the completion table used for completion
+in the minibuffer. This is the global variable that contains what
@code{completing-read} passes to @code{try-completion}. It is used by
-minibuffer completion commands such as @code{minibuffer-complete-word}.
+minibuffer completion commands such as
+@code{minibuffer-complete-word}.
@end defvar
@defvar minibuffer-completion-predicate
(@pxref{Completion Commands}).
@end defvar
+@node Completion in Buffers
+@subsection Completion in Ordinary Buffers
+@cindex inline completion
+
+@findex completion-at-point
+ Although completion is usually done in the minibuffer, the
+completion facility can also be used on the text in ordinary Emacs
+buffers. In many major modes, in-buffer completion is performed by
+the @kbd{C-M-i} or @kbd{M-@key{TAB}} command, bound to
+@code{completion-at-point}. @xref{Symbol Completion,,, emacs, The GNU
+Emacs Manual}. This command uses the abnormal hook variable
+@code{completion-at-point-functions}:
+
+@defvar completion-at-point-functions
+The value of this abnormal hook should be a list of functions, which
+are used to compute a completion table for completing the text at
+point. It can be used by major modes to provide mode-specific
+completion tables (@pxref{Major Mode Conventions}).
+
+When the command @code{completion-at-point} runs, it calls the
+functions in the list one by one, without any argument. Each function
+should return @code{nil} if it is unable to produce a completion table
+for the text at point. Otherwise it should return a list of the form
+
+@example
+(@var{start} @var{end} @var{collection} . @var{props})
+@end example
+
+@noindent
+@var{start} and @var{end} delimit the text to complete (which should
+enclose point). @var{collection} is a completion table for completing
+that text, in a form suitable for passing as the second argument to
+@code{try-completion} (@pxref{Basic Completion}); completion
+alternatives will be generated from this completion table in the usual
+way, via the completion styles defined in @code{completion-styles}
+(@pxref{Completion Styles}). @var{props} is a property list for
+additional information; the following optional properties are
+recognized:
+
+@table @code
+@item :predicate
+The value should be a predicate that completion candidates need to
+satisfy.
+
+@item :exclusive
+If the value is @code{no}, then if the completion table fails to match
+the text at point, then @code{completion-at-point} moves on to the
+next function in @code{completion-at-point-functions} instead of
+reporting a completion failure.
+@end table
+
+A function in @code{completion-at-point-functions} may also return a
+function. In that case, that returned function is called, with no
+argument, and it is entirely responsible for performing the
+completion. We discourage this usage; it is intended to help convert
+old code to using @code{completion-at-point}.
+
+The first function in @code{completion-at-point-functions} to return a
+non-@code{nil} value is used by @code{completion-at-point}. The
+remaining functions are not called. The exception to this is when
+there is a @code{:exclusive} specification, as described above.
+@end defvar
+
+ The following function provides a convenient way to perform
+completion on an arbitrary stretch of text in an Emacs buffer:
+
+@defun completion-in-region start end collection &optional predicate
+This function completes the text in the current buffer between the
+positions @var{start} and @var{end}, using @var{collection}. The
+argument @var{collection} has the same meaning as in
+@code{try-completion} (@pxref{Basic Completion}).
+
+This function inserts the completion text directly into the current
+buffer. Unlike @code{completing-read} (@pxref{Minibuffer
+Completion}), it does not activate the minibuffer.
+
+For this function to work, point must be somewhere between @var{start}
+and @var{end}.
+@end defun
+
+
@node Yes-or-No Queries
@section Yes-or-No Queries
@cindex asking the user questions
possible, so that you can use them in a uniform way.
Every major mode command is supposed to run a normal hook called the
-@dfn{mode hook} as the one of the last steps of initialization. This
-makes it easy for a user to customize the behavior of the mode, by
-overriding the buffer-local variable assignments already made by the
-mode. Most minor mode functions also run a mode hook at the end. But
-hooks are used in other contexts too. For example, the hook
-@code{suspend-hook} runs just before Emacs suspends itself
-(@pxref{Suspending Emacs}).
-
- The recommended way to add a hook function to a normal hook is by
-calling @code{add-hook} (see below). The hook functions may be any of
-the valid kinds of functions that @code{funcall} accepts (@pxref{What
+@dfn{mode hook} as one of the last steps of initialization. This makes
+it easy for a user to customize the behavior of the mode, by overriding
+the buffer-local variable assignments already made by the mode. Most
+minor mode functions also run a mode hook at the end. But hooks are
+used in other contexts too. For example, the hook @code{suspend-hook}
+runs just before Emacs suspends itself (@pxref{Suspending Emacs}).
+
+ The recommended way to add a hook function to a hook is by calling
+@code{add-hook} (@pxref{Setting Hooks}). The hook functions may be any
+of the valid kinds of functions that @code{funcall} accepts (@pxref{What
Is a Function}). Most normal hook variables are initially void;
@code{add-hook} knows how to deal with this. You can add hooks either
globally or buffer-locally with @code{add-hook}.
in Lisp Interaction mode:
@example
-(add-hook 'lisp-interaction-mode-hook 'turn-on-auto-fill)
+(add-hook 'lisp-interaction-mode-hook 'auto-fill-mode)
@end example
@defun add-hook hook function &optional append local
changing major modes) won't delete it from the hook variable's local
value.
-It is best to design your hook functions so that the order in which
-they are executed does not matter. Any dependence on the order is
-asking for trouble. However, the order is predictable: normally,
-@var{function} goes at the front of the hook list, so it will be
-executed first (barring another @code{add-hook} call). If the
-optional argument @var{append} is non-@code{nil}, the new hook
-function goes at the end of the hook list and will be executed last.
+For a normal hook, hook functions should be designed so that the order
+in which they are executed does not matter. Any dependence on the order
+is asking for trouble. However, the order is predictable: normally,
+@var{function} goes at the front of the hook list, so it is executed
+first (barring another @code{add-hook} call). If the optional argument
+@var{append} is non-@code{nil}, the new hook function goes at the end of
+the hook list and is executed last.
@code{add-hook} can handle the cases where @var{hook} is void or its
value is a single function; it sets or changes the value to a list of
If you use the @code{define-derived-mode} macro, it will take care of
many of these conventions automatically. @xref{Derived Modes}. Note
-also that fundamental mode is an exception to many of these conventions,
-because its definition is to present the global state of Emacs.
+also that Fundamental mode is an exception to many of these conventions,
+because it represents the default state of Emacs.
The following list of conventions is only partial. Each major mode
should aim for consistency in general with other Emacs major modes, as
this mode.
@item
-The mode can specify how to complete various keywords by adding
-to the special hook @code{completion-at-point-functions}.
-
-@item
-Use @code{defvar} or @code{defcustom} to set mode-related variables, so
-that they are not reinitialized if they already have a value. (Such
-reinitialization could discard customizations made by the user.)
+The mode can specify how to complete various keywords by adding one or
+more buffer-local entries to the special hook
+@code{completion-at-point-functions}. @xref{Completion in Buffers}.
@item
@cindex buffer-local variables in modes
not autoload the mode command, it is sufficient to add the element in
the file that contains the mode definition.
-@item
-In the comments that document the file, you should provide a sample
-@code{autoload} form and an example of how to add to
-@code{auto-mode-alist}, that users can include in their init files
-(@pxref{Init File}).
-
@item
@cindex mode loading
The top-level forms in the file defining the mode should be written so
that they may be evaluated more than once without adverse consequences.
-Even if you never load the file more than once, someone else will.
+For instance, use @code{defvar} or @code{defcustom} to set mode-related
+variables, so that they are not reinitialized if they already have a
+value (@pxref{Defining Variables}).
+
@end itemize
@node Auto Major Mode
@subsection How Emacs Chooses a Major Mode
@cindex major mode, automatic selection
- Based on information in the file name or in the file itself, Emacs
-automatically selects a major mode for the new buffer when a file is
-visited. It also processes local variables specified in the file text.
+ When Emacs visits a file, it automatically selects a major mode for
+the buffer based on information in the file name or in the file itself.
+It also processes local variables specified in the file text.
@deffn Command normal-mode &optional find-file
This function establishes the proper major mode and buffer-local variable
@section Minor Modes
@cindex minor mode
- A @dfn{minor mode} provides features that users may enable or disable
-independently of the choice of major mode. Minor modes can be enabled
-individually or in combination. Minor modes would be better named
-``generally available, optional feature modes,'' except that such a name
-would be unwieldy.
-
- A minor mode is not usually meant as a variation of a single major mode.
-Usually they are general and can apply to many major modes. For
-example, Auto Fill mode works with any major mode that permits text
-insertion. To be general, a minor mode must be effectively independent
-of the things major modes do.
+ A @dfn{minor mode} provides optional features that users may enable or
+disable independently of the choice of major mode. Minor modes can be
+enabled individually or in combination.
- A minor mode is often much more difficult to implement than a major
-mode. One reason is that you should be able to activate and deactivate
-minor modes in any order. A minor mode should be able to have its
-desired effect regardless of the major mode and regardless of the other
-minor modes in effect.
+ Most minor modes implement features that are independent of the major
+mode, and can thus be used with most major modes. For example, Auto
+Fill mode works with any major mode that permits text insertion. A few
+minor modes, however, are specific to a particular major mode. For
+example, Diff Auto Refine mode is a minor mode that is intended to be
+used only with Diff mode.
- Often the biggest problem in implementing a minor mode is finding a
-way to insert the necessary hook into the rest of Emacs. Minor mode
-keymaps make this easier than it used to be.
+ Ideally, a minor mode should have its desired effect regardless of the
+other minor modes in effect. It should be possible to activate and
+deactivate minor modes in any order.
@defvar minor-mode-list
The value of this variable is a list of all minor mode commands.
@cindex conventions for writing minor modes
There are conventions for writing minor modes just as there are for
-major modes. Several of the major mode conventions apply to minor
-modes as well: those regarding the name of the mode initialization
-function, the names of global symbols, the use of a hook at the end of
-the initialization function, and the use of keymaps and other tables.
-
- In addition, there are several conventions that are specific to
-minor modes. (The easiest way to follow all the conventions is to use
-the macro @code{define-minor-mode}; @ref{Defining Minor Modes}.)
+major modes. These conventions are described below. The easiest way to
+follow them is to use the macro @code{define-minor-mode}.
+@xref{Defining Minor Modes}.
@itemize @bullet
@item
@cindex mode variable
-Make a variable whose name ends in @samp{-mode} to control the minor
-mode. We call this the @dfn{mode variable}. The minor mode command
-should set this variable (@code{nil} to disable; anything else to
-enable).
-
-If possible, implement the mode so that setting the variable
-automatically enables or disables the mode. Then the minor mode command
-does not need to do anything except set the variable.
+Define a variable whose name ends in @samp{-mode}. We call this the
+@dfn{mode variable}. The minor mode command should set this variable.
+The value will be @code{nil} is the mode is disabled, and non-@code{nil}
+if the mode is enabled. The variable should be buffer-local if the
+minor mode is buffer-local.
This variable is used in conjunction with the @code{minor-mode-alist} to
-display the minor mode name in the mode line. It can also enable
-or disable a minor mode keymap. Individual commands or hooks can also
-check the variable's value.
-
-If you want the minor mode to be enabled separately in each buffer,
-make the variable buffer-local.
+display the minor mode name in the mode line. It also determines
+whether the minor mode keymap is active, via @code{minor-mode-map-alist}
+(@pxref{Controlling Active Maps}). Individual commands or hooks can
+also check its value.
@item
-Define a command whose name is the same as the mode variable.
-Its job is to enable and disable the mode by setting the variable.
+Define a command, called the @dfn{mode command}, whose name is the same
+as the mode variable. Its job is to set the value of the mode variable,
+plus anything else that needs to be done to actually enable or disable
+the mode's features.
-The command should accept one optional argument. If the argument is
-@code{nil}, it should toggle the mode (turn it on if it is off, and
-off if it is on). It should turn the mode on if the argument is a
-positive integer, the symbol @code{t}, or a list whose @sc{car} is one
-of those. It should turn the mode off if the argument is a negative
-integer or zero, the symbol @code{-}, or a list whose @sc{car} is a
-negative integer or zero. The meaning of other arguments is not
-specified.
+The mode command should accept one optional argument. If called
+interactively with no prefix argument, it should toggle the mode
+(i.e.@: enable if it is disabled, and disable if it is enabled). If
+called interactively with a prefix argument, it should enable the mode
+if the argument is positive and disable it otherwise.
-Here is an example taken from the definition of @code{transient-mark-mode}.
-It shows the use of @code{transient-mark-mode} as a variable that enables or
-disables the mode's behavior, and also shows the proper way to toggle,
-enable or disable the minor mode based on the raw prefix argument value.
+If the mode command is called from Lisp (i.e.@: non-interactively), it
+should enable the mode if the argument is omitted or @code{nil}; it
+should toggle the mode if the argument is the symbol @code{toggle};
+otherwise it should treat the argument in the same way as for an
+interactive call with a numeric prefix argument, as described above.
-@smallexample
-@group
-(setq transient-mark-mode
- (if (null arg) (not transient-mark-mode)
- (> (prefix-numeric-value arg) 0)))
-@end group
-@end smallexample
+The following example shows how to implement this behavior (it is
+similar to the code generated by the @code{define-minor-mode} macro):
+
+@example
+(interactive (list (or current-prefix-arg 'toggle)))
+(let ((enable (if (eq arg 'toggle)
+ (not foo-mode) ; @r{this mode's mode variable}
+ (> (prefix-numeric-value arg) 0))))
+ (if enable
+ @var{do-enable}
+ @var{do-disable}))
+@end example
+
+The reason for this somewhat complex behavior is that it lets users
+easily toggle the minor mode interactively, and also lets the minor mode
+be easily enabled in a mode hook, like this:
+
+@example
+(add-hook 'text-mode-hook 'foo-mode)
+@end example
+
+@noindent
+This behaves correctly whether or not @code{foo-mode} was already
+enabled, since the @code{foo-mode} mode command unconditionally enables
+the minor mode when it is called from Lisp with no argument. Disabling
+a minor mode in a mode hook is a little uglier:
+
+@example
+(add-hook 'text-mode-hook (lambda () (foo-mode -1)))
+@end example
+
+@noindent
+However, this is not very commonly done.
@item
Add an element to @code{minor-mode-alist} for each minor mode
@smallexample
@group
(unless (assq 'leif-mode minor-mode-alist)
- (setq minor-mode-alist
- (cons '(leif-mode " Leif") minor-mode-alist)))
+ (push '(leif-mode " Leif") minor-mode-alist))
@end group
@end smallexample
@end smallexample
@end itemize
- Global minor modes distributed with Emacs should if possible support
-enabling and disabling via Custom (@pxref{Customization}). To do this,
-the first step is to define the mode variable with @code{defcustom}, and
-specify @code{:type 'boolean}.
+ In addition, several major mode conventions apply to minor modes as
+well: those regarding the names of global symbols, the use of a hook at
+the end of the initialization function, and the use of keymaps and other
+tables.
- If just setting the variable is not sufficient to enable the mode, you
+ The minor mode should, if possible, support enabling and disabling via
+Custom (@pxref{Customization}). To do this, the mode variable should be
+defined with @code{defcustom}, usually with @code{:type 'boolean}. If
+just setting the variable is not sufficient to enable the mode, you
should also specify a @code{:set} method which enables the mode by
-invoking the mode command. Note in the variable's documentation string that
-setting the variable other than via Custom may not take effect.
-
- Also mark the definition with an autoload cookie (@pxref{autoload cookie}),
-and specify a @code{:require} so that customizing the variable will load
-the library that defines the mode. This will copy suitable definitions
-into @file{loaddefs.el} so that users can use @code{customize-option} to
-enable the mode. For example:
+invoking the mode command. Note in the variable's documentation string
+that setting the variable other than via Custom may not take effect.
+Also, mark the definition with an autoload cookie (@pxref{autoload
+cookie}), and specify a @code{:require} so that customizing the variable
+will load the library that defines the mode. For example:
@smallexample
@group
-
;;;###autoload
(defcustom msb-mode nil
"Toggle msb-mode.
@node Mode Line Format
-@section Mode-Line Format
+@section Mode Line Format
@cindex mode line
Each Emacs window (aside from minibuffer windows) typically has a mode
@node Mode Line Basics
@subsection Mode Line Basics
- @code{mode-line-format} is a buffer-local variable that holds a
-@dfn{mode line construct}, a kind of template, which controls what is
-displayed on the mode line of the current buffer. The value of
-@code{header-line-format} specifies the buffer's header line in the
-same way. All windows for the same buffer use the same
+ The contents of each mode line are specified by the buffer-local
+variable @code{mode-line-format} (@pxref{Mode Line Top}). This variable
+holds a @dfn{mode line construct}: a template that controls what is
+displayed on the buffer's mode line. The value of
+@code{header-line-format} specifies the buffer's header line in the same
+way. All windows for the same buffer use the same
@code{mode-line-format} and @code{header-line-format}.
- For efficiency, Emacs does not continuously recompute the mode
-line and header line of a window. It does so when circumstances
-appear to call for it---for instance, if you change the window
-configuration, switch buffers, narrow or widen the buffer, scroll, or
-change the buffer's modification status. If you modify any of the
-variables referenced by @code{mode-line-format} (@pxref{Mode Line
-Variables}), or any other variables and data structures that affect
-how text is displayed (@pxref{Display}), you may want to force an
-update of the mode line so as to display the new information or
-display it in the new way.
+ For efficiency, Emacs does not continuously recompute each window's
+mode line and header line. It does so when circumstances appear to call
+for it---for instance, if you change the window configuration, switch
+buffers, narrow or widen the buffer, scroll, or modify the buffer. If
+you alter any of the variables referenced by @code{mode-line-format} or
+@code{header-line-format} (@pxref{Mode Line Variables}), or any other
+data structures that affect how text is displayed (@pxref{Display}), you
+should use the function @code{force-mode-line-update} to update the
+display.
@defun force-mode-line-update &optional all
-Force redisplay of the current buffer's mode line and header line.
-The next redisplay will update the mode line and header line based on
-the latest values of all relevant variables. With optional
-non-@code{nil} @var{all}, force redisplay of all mode lines and header
-lines.
-
-This function also forces recomputation of the menu bar menus
-and the frame title.
+This function forces Emacs to update the current buffer's mode line and
+header line, based on the latest values of all relevant variables,
+during its next redisplay cycle. If the optional argument @var{all} is
+non-@code{nil}, it forces an update for all mode lines and header lines.
+
+This function also forces an update of the menu bar and frame title.
@end defun
The selected window's mode line is usually displayed in a different
-color using the face @code{mode-line}. Other windows' mode lines
-appear in the face @code{mode-line-inactive} instead. @xref{Faces}.
+color using the face @code{mode-line}. Other windows' mode lines appear
+in the face @code{mode-line-inactive} instead. @xref{Faces}.
@node Mode Line Data
@subsection The Data Structure of the Mode Line
-@cindex mode-line construct
+@cindex mode line construct
- The mode-line contents are controlled by a data structure called a
-@dfn{mode-line construct}, made up of lists, strings, symbols, and
+ The mode line contents are controlled by a data structure called a
+@dfn{mode line construct}, made up of lists, strings, symbols, and
numbers kept in buffer-local variables. Each data type has a specific
-meaning for the mode-line appearance, as described below. The same
-data structure is used for constructing frame titles (@pxref{Frame
-Titles}) and header lines (@pxref{Header Lines}).
+meaning for the mode line appearance, as described below. The same data
+structure is used for constructing frame titles (@pxref{Frame Titles})
+and header lines (@pxref{Header Lines}).
- A mode-line construct may be as simple as a fixed string of text,
+ A mode line construct may be as simple as a fixed string of text,
but it usually specifies how to combine fixed strings with variables'
values to construct the text. Many of these variables are themselves
-defined to have mode-line constructs as their values.
+defined to have mode line constructs as their values.
- Here are the meanings of various data types as mode-line constructs:
+ Here are the meanings of various data types as mode line constructs:
@table @code
@cindex percent symbol in mode line
@item @var{string}
-A string as a mode-line construct appears verbatim except for
+A string as a mode line construct appears verbatim except for
@dfn{@code{%}-constructs} in it. These stand for substitution of
other data; see @ref{%-Constructs}.
special meanings. @xref{Properties in Mode}.
@item @var{symbol}
-A symbol as a mode-line construct stands for its value. The value of
-@var{symbol} is used as a mode-line construct, in place of @var{symbol}.
+A symbol as a mode line construct stands for its value. The value of
+@var{symbol} is used as a mode line construct, in place of @var{symbol}.
However, the symbols @code{t} and @code{nil} are ignored, as is any
symbol whose value is void.
Unless @var{symbol} is marked as ``risky'' (i.e., it has a
non-@code{nil} @code{risky-local-variable} property), all text
-properties specified in @var{symbol}'s value are ignored. This
-includes the text properties of strings in @var{symbol}'s value, as
-well as all @code{:eval} and @code{:propertize} forms in it. (The
-reason for this is security: non-risky variables could be set
-automatically from file variables without prompting the user.)
+properties specified in @var{symbol}'s value are ignored. This includes
+the text properties of strings in @var{symbol}'s value, as well as all
+@code{:eval} and @code{:propertize} forms in it. (The reason for this
+is security: non-risky variables could be set automatically from file
+variables without prompting the user.)
@item (@var{string} @var{rest}@dots{})
@itemx (@var{list} @var{rest}@dots{})
A list whose first element is a string or list means to process all the
elements recursively and concatenate the results. This is the most
-common form of mode-line construct.
+common form of mode line construct.
@item (:eval @var{form})
A list whose first element is the symbol @code{:eval} says to evaluate
@item (:propertize @var{elt} @var{props}@dots{})
A list whose first element is the symbol @code{:propertize} says to
-process the mode-line construct @var{elt} recursively, then add the text
+process the mode line construct @var{elt} recursively, then add the text
properties specified by @var{props} to the result. The argument
@var{props} should consist of zero or more pairs @var{text-property}
-@var{value}. (This feature is new as of Emacs 22.1.)
+@var{value}.
@item (@var{symbol} @var{then} @var{else})
A list whose first element is a symbol that is not a keyword specifies
a conditional. Its meaning depends on the value of @var{symbol}. If
@var{symbol} has a non-@code{nil} value, the second element,
-@var{then}, is processed recursively as a mode-line element.
+@var{then}, is processed recursively as a mode line element.
Otherwise, the third element, @var{else}, is processed recursively.
-You may omit @var{else}; then the mode-line element displays nothing
+You may omit @var{else}; then the mode line element displays nothing
if the value of @var{symbol} is @code{nil} or void.
@item (@var{width} @var{rest}@dots{})
A list whose first element is an integer specifies truncation or
padding of the results of @var{rest}. The remaining elements
-@var{rest} are processed recursively as mode-line constructs and
+@var{rest} are processed recursively as mode line constructs and
concatenated together. When @var{width} is positive, the result is
space filled on the right if its width is less than @var{width}. When
@var{width} is negative, the result is truncated on the right to
@code{mode-line-format}.
@defopt mode-line-format
-The value of this variable is a mode-line construct that controls the
+The value of this variable is a mode line construct that controls the
contents of the mode-line. It is always buffer-local in all buffers.
-If you set this variable to @code{nil} in a buffer, that buffer does
-not have a mode line. (A window that is just one line tall never
-displays a mode line.)
+If you set this variable to @code{nil} in a buffer, that buffer does not
+have a mode line. (A window that is just one line tall also does not
+display a mode line.)
@end defopt
The default value of @code{mode-line-format} is designed to use the
the user or by Lisp programs (such as @code{display-time} and major
modes) via changes to those variables remain effective.
- Here is an example of a @code{mode-line-format} that might be
-useful for @code{shell-mode}, since it contains the host name and default
-directory.
+ Here is a hypothetical example of a @code{mode-line-format} that might
+be useful for Shell mode (in reality, Shell mode does not set
+@code{mode-line-format}):
@example
@group
@end group
@group
;; @r{Note that this is evaluated while making the list.}
- ;; @r{It makes a mode-line construct which is just a string.}
+ ;; @r{It makes a mode line construct which is just a string.}
(getenv "HOST")
@end group
":"
'(which-func-mode ("" which-func-format "--"))
'(line-number-mode "L%l--")
'(column-number-mode "C%c--")
- '(-3 "%p")
- "-%-"))
+ '(-3 "%p")))
@end group
@end example
@node Mode Line Variables
@subsection Variables Used in the Mode Line
- This section describes variables incorporated by the standard value
-of @code{mode-line-format} into the text of the mode line. There is
+ This section describes variables incorporated by the standard value of
+@code{mode-line-format} into the text of the mode line. There is
nothing inherently special about these variables; any other variables
-could have the same effects on the mode line if
-@code{mode-line-format}'s value were changed to use them. However,
-various parts of Emacs set these variables on the understanding that
-they will control parts of the mode line; therefore, practically
-speaking, it is essential for the mode line to use them.
+could have the same effects on the mode line if the value of
+@code{mode-line-format} is changed to use them. However, various parts
+of Emacs set these variables on the understanding that they will control
+parts of the mode line; therefore, practically speaking, it is essential
+for the mode line to use them.
@defvar mode-line-mule-info
-This variable holds the value of the mode-line construct that displays
+This variable holds the value of the mode line construct that displays
information about the language environment, buffer coding system, and
current input method. @xref{Non-ASCII Characters}.
@end defvar
@defvar mode-line-modified
-This variable holds the value of the mode-line construct that displays
+This variable holds the value of the mode line construct that displays
whether the current buffer is modified. Its default value displays
@samp{**} if the buffer is modified, @samp{--} if the buffer is not
modified, @samp{%%} if the buffer is read only, and @samp{%*} if the
@end defvar
@defvar mode-line-process
-This buffer-local variable contains the mode-line information on process
+This buffer-local variable contains the mode line information on process
status in modes used for communicating with subprocesses. It is
displayed immediately following the major mode name, with no intervening
space. For example, its value in the @samp{*shell*} buffer is
(@var{minor-mode-variable} @var{mode-line-string})
@end example
-More generally, @var{mode-line-string} can be any mode-line spec. It
-appears in the mode line when the value of @var{minor-mode-variable}
+More generally, @var{mode-line-string} can be any mode line construct.
+It appears in the mode line when the value of @var{minor-mode-variable}
is non-@code{nil}, and not otherwise. These strings should begin with
spaces so that they don't run together. Conventionally, the
-@var{minor-mode-variable} for a specific mode is set to a
-non-@code{nil} value when that minor mode is activated.
+@var{minor-mode-variable} for a specific mode is set to a non-@code{nil}
+value when that minor mode is activated.
@code{minor-mode-alist} itself is not buffer-local. Each variable
mentioned in the alist should be buffer-local if its minor mode can be
@end defvar
@defvar global-mode-string
-This variable holds a mode-line spec that, by default, appears in the
-mode line just after the @code{which-func-mode} minor mode if set,
-else after @code{mode-line-modes}. The command @code{display-time}
-sets @code{global-mode-string} to refer to the variable
-@code{display-time-string}, which holds a string containing the time
-and load information.
+This variable holds a mode line construct that, by default, appears in
+the mode line just after the @code{which-func-mode} minor mode if set,
+else after @code{mode-line-modes}. The command @code{display-time} sets
+@code{global-mode-string} to refer to the variable
+@code{display-time-string}, which holds a string containing the time and
+load information.
The @samp{%M} construct substitutes the value of
@code{global-mode-string}, but that is obsolete, since the variable is
@node %-Constructs
@subsection @code{%}-Constructs in the Mode Line
- Strings used as mode-line constructs can use certain
+ Strings used as mode line constructs can use certain
@code{%}-constructs to substitute various kinds of data. Here is a
list of the defined @code{%}-constructs, and what they mean. In any
construct except @samp{%%}, you can add a decimal integer after the
@item %p
The percentage of the buffer text above the @strong{top} of window, or
-@samp{Top}, @samp{Bottom} or @samp{All}. Note that the default
-mode-line specification truncates this to three characters.
+@samp{Top}, @samp{Bottom} or @samp{All}. Note that the default mode
+line construct truncates this to three characters.
@item %P
The percentage of the buffer text that is above the @strong{bottom} of
@enumerate
@item
-Put a string with a text property directly into the mode-line data
+Put a string with a text property directly into the mode line data
structure.
@item
-Put a text property on a mode-line %-construct such as @samp{%12b}; then
+Put a text property on a mode line %-construct such as @samp{%12b}; then
the expansion of the %-construct will have that same text property.
@item
give @var{elt} a text property specified by @var{props}.
@item
-Use a list containing @code{:eval @var{form}} in the mode-line data
+Use a list containing @code{:eval @var{form}} in the mode line data
structure, and make @var{form} evaluate to a string that has a text
property.
@end enumerate
@cindex header line (of a window)
@cindex window header line
- A window can have a @dfn{header line} at the
-top, just as it can have a mode line at the bottom. The header line
-feature works just like the mode-line feature, except that it's
-controlled by different variables.
+ A window can have a @dfn{header line} at the top, just as it can have
+a mode line at the bottom. The header line feature works just like the
+mode line feature, except that it's controlled by
+@code{header-line-format}:
@defvar header-line-format
This variable, local in every buffer, specifies how to display the
header line.
@node Emulating Mode Line
-@subsection Emulating Mode-Line Formatting
+@subsection Emulating Mode Line Formatting
- You can use the function @code{format-mode-line} to compute
-the text that would appear in a mode line or header line
-based on a certain mode-line specification.
+ You can use the function @code{format-mode-line} to compute the text
+that would appear in a mode line or header line based on a certain
+mode line construct.
@defun format-mode-line format &optional face window buffer
This function formats a line of text according to @var{format} as if it
@section Font Lock Mode
@cindex Font Lock mode
- @dfn{Font Lock mode} is a feature that automatically attaches
-@code{face} properties to certain parts of the buffer based on their
-syntactic role. How it parses the buffer depends on the major mode;
-most major modes define syntactic criteria for which faces to use in
-which contexts. This section explains how to customize Font Lock for a
-particular major mode.
+ @dfn{Font Lock mode} is a buffer-local minor mode that automatically
+attaches @code{face} properties to certain parts of the buffer based on
+their syntactic role. How it parses the buffer depends on the major
+mode; most major modes define syntactic criteria for which faces to use
+in which contexts. This section explains how to customize Font Lock for
+a particular major mode.
Font Lock mode finds text to highlight in two ways: through
syntactic parsing based on the syntax table, and through searching
contents can also specify how to fontify it.
* Faces for Font Lock:: Special faces specifically for Font Lock.
* Syntactic Font Lock:: Fontification based on syntax tables.
-* Setting Syntax Properties:: Defining character syntax based on context
- using the Font Lock mechanism.
* Multiline Font Lock:: How to coerce Font Lock into properly
highlighting multiline constructs.
@end menu
Lock mode is enabled, to set all the other variables.
@defvar font-lock-defaults
-This variable is set by major modes, as a buffer-local variable, to
-specify how to fontify text in that mode. It automatically becomes
-buffer-local when you set it. If its value is @code{nil}, Font-Lock
-mode does no highlighting, and you can use the @samp{Faces} menu
-(under @samp{Edit} and then @samp{Text Properties} in the menu bar) to
-assign faces explicitly to text in the buffer.
+This variable is set by major modes to specify how to fontify text in
+that mode. It automatically becomes buffer-local when set. If its
+value is @code{nil}, Font Lock mode does no highlighting, and you can
+use the @samp{Faces} menu (under @samp{Edit} and then @samp{Text
+Properties} in the menu bar) to assign faces explicitly to text in the
+buffer.
If non-@code{nil}, the value should look like this:
The second element, @var{keywords-only}, specifies the value of the
variable @code{font-lock-keywords-only}. If this is omitted or
@code{nil}, syntactic fontification (of strings and comments) is also
-performed. If this is non-@code{nil}, such fontification is not
+performed. If this is non-@code{nil}, syntactic fontification is not
performed. @xref{Syntactic Font Lock}.
The third element, @var{case-fold}, specifies the value of
@code{font-lock-keywords-case-fold-search}. If it is non-@code{nil},
-Font Lock mode ignores case when searching as directed by
-@code{font-lock-keywords}.
+Font Lock mode ignores case during search-based fontification.
-If the fourth element, @var{syntax-alist}, is non-@code{nil}, it
-should be a list of cons cells of the form @code{(@var{char-or-string}
-. @var{string})}. These are used to set up a syntax table for
-syntactic fontification (@pxref{Syntax Table Functions}). The
-resulting syntax table is stored in @code{font-lock-syntax-table}.
+If the fourth element, @var{syntax-alist}, is non-@code{nil}, it should
+be a list of cons cells of the form @code{(@var{char-or-string}
+. @var{string})}. These are used to set up a syntax table for syntactic
+fontification; the resulting syntax table is stored in
+@code{font-lock-syntax-table}. If @var{syntax-alist} is omitted or
+@code{nil}, syntactic fontification uses the syntax table returned by
+the @code{syntax-table} function. @xref{Syntax Table Functions}.
The fifth element, @var{syntax-begin}, specifies the value of
@code{font-lock-beginning-of-syntax-function}. We recommend setting
@node Search-based Fontification
@subsection Search-based Fontification
- The most important variable for customizing Font Lock mode is
-@code{font-lock-keywords}. It specifies the search criteria for
-search-based fontification. You should specify the value of this
-variable with @var{keywords} in @code{font-lock-defaults}.
+ The variable which directly controls search-based fontification is
+@code{font-lock-keywords}, which is typically specified via the
+@var{keywords} element in @code{font-lock-defaults}.
@defvar font-lock-keywords
-This variable's value is a list of the keywords to highlight. Be
-careful when composing regular expressions for this list; a poorly
-written pattern can dramatically slow things down!
+The value of this variable is a list of the keywords to highlight. Lisp
+programs should not set this variable directly. Normally, the value is
+automatically set by Font Lock mode, using the @var{keywords} element in
+@code{font-lock-defaults}. The value can also be altered using the
+functions @code{font-lock-add-keywords} and
+@code{font-lock-remove-keywords} (@pxref{Customizing Keywords}).
@end defvar
Each element of @code{font-lock-keywords} specifies how to find
"\\<foo\\>"
@end example
-The function @code{regexp-opt} (@pxref{Regexp Functions}) is useful
-for calculating optimal regular expressions to match a number of
-different keywords.
+Be careful when composing these regular expressions; a poorly written
+pattern can dramatically slow things down! The function
+@code{regexp-opt} (@pxref{Regexp Functions}) is useful for calculating
+optimal regular expressions to match several keywords.
@item @var{function}
Find text by calling @var{function}, and highlight the matches
@code{c-font-lock-extra-types}, @code{c++-font-lock-extra-types},
and @code{java-font-lock-extra-types}, for example.
-@strong{Warning:} major mode commands must not call
+@strong{Warning:} Major mode commands must not call
@code{font-lock-add-keywords} under any circumstances, either directly
or indirectly, except through their mode hooks. (Doing so would lead to
incorrect behavior for some minor modes.) They should set up their
@code{font-lock-add-keywords} apply here too.
@end defun
- For example, this code
+ For example, the following code adds two fontification patterns for C
+mode: one to fontify the word @samp{FIXME}, even in comments, and
+another to fontify the words @samp{and}, @samp{or} and @samp{not} as
+keywords.
@smallexample
(font-lock-add-keywords 'c-mode
@end smallexample
@noindent
-adds two fontification patterns for C mode: one to fontify the word
-@samp{FIXME}, even in comments, and another to fontify the words
-@samp{and}, @samp{or} and @samp{not} as keywords.
-
-@noindent
-That example affects only C mode proper. To add the same patterns to
-C mode @emph{and} all modes derived from it, do this instead:
+This example affects only C mode proper. To add the same patterns to C
+mode @emph{and} all modes derived from it, do this instead:
@smallexample
(add-hook 'c-mode-hook
@node Levels of Font Lock
@subsection Levels of Font Lock
- Many major modes offer three different levels of fontification. You
+ Some major modes offer three different levels of fontification. You
can define multiple levels by using a list of symbols for @var{keywords}
in @code{font-lock-defaults}. Each symbol specifies one level of
fontification; it is up to the user to choose one of these levels,
normally by setting @code{font-lock-maximum-decoration} (@pxref{Font
-Lock,,, emacs, the GNU Emacs Manual}). The chosen level's symbol
-value is used to initialize @code{font-lock-keywords}.
+Lock,,, emacs, the GNU Emacs Manual}). The chosen level's symbol value
+is used to initialize @code{font-lock-keywords}.
Here are the conventions for how to define the levels of
fontification:
@cindex font lock faces
Font Lock mode can highlight using any face, but Emacs defines several
-faces specifically for syntactic highlighting. These @dfn{Font Lock
-faces} are listed below. They can also be used by major modes for
-syntactic highlighting outside of Font Lock mode (@pxref{Major Mode
-Conventions}).
+faces specifically for Font Lock to use to highlight text. These
+@dfn{Font Lock faces} are listed below. They can also be used by major
+modes for syntactic highlighting outside of Font Lock mode (@pxref{Major
+Mode Conventions}).
Each of these symbols is both a face name, and a variable whose
default value is the symbol itself. Thus, the default value of
@subsection Syntactic Font Lock
@cindex syntactic font lock
-Syntactic fontification uses the syntax table to find comments and
-string constants (@pxref{Syntax Tables}). It highlights them using
-@code{font-lock-comment-face} and @code{font-lock-string-face}
-(@pxref{Faces for Font Lock}), or whatever
-@code{font-lock-syntactic-face-function} chooses. There are several
-variables that affect syntactic fontification; you should set them by
-means of @code{font-lock-defaults} (@pxref{Font Lock Basics}).
+Syntactic fontification uses a syntax table (@pxref{Syntax Tables}) to
+find and highlight syntactically relevant text. If enabled, it runs
+prior to search-based fontification. The variable
+@code{font-lock-syntactic-face-function}, documented below, determines
+which syntactic constructs to highlight. There are several variables
+that affect syntactic fontification; you should set them by means of
+@code{font-lock-defaults} (@pxref{Font Lock Basics}).
+
+ Whenever Font Lock mode performs syntactic fontification on a stretch
+of text, it first calls the function specified by
+@code{syntax-propertize-function}. Major modes can use this to apply
+@code{syntax-table} text properties to override the buffer's syntax
+table in special cases. @xref{Syntax Properties}.
@defvar font-lock-keywords-only
-Non-@code{nil} means Font Lock should not do syntactic fontification;
-it should only fontify based on @code{font-lock-keywords}. The normal
-way for a mode to set this variable to @code{t} is with
-@var{keywords-only} in @code{font-lock-defaults}.
+If the value of this variable is non-@code{nil}, Font Lock does not do
+syntactic fontification, only search-based fontification based on
+@code{font-lock-keywords}. It is normally set by Font Lock mode based
+on the @var{keywords-only} element in @code{font-lock-defaults}.
@end defvar
@defvar font-lock-syntax-table
This variable holds the syntax table to use for fontification of
-comments and strings. Specify it using @var{syntax-alist} in
-@code{font-lock-defaults}. If this is @code{nil}, fontification uses
-the buffer's syntax table.
+comments and strings. It is normally set by Font Lock mode based on the
+@var{syntax-alist} element in @code{font-lock-defaults}. If this value
+is @code{nil}, syntactic fontification uses the buffer's syntax table
+(the value returned by the function @code{syntax-table}; @pxref{Syntax
+Table Functions}).
@end defvar
@defvar font-lock-beginning-of-syntax-function
If this variable is non-@code{nil}, it should be a function to move
point back to a position that is syntactically at ``top level'' and
-outside of strings or comments. Font Lock uses this when necessary
-to get the right results for syntactic fontification.
-
-This function is called with no arguments. It should leave point at
-the beginning of any enclosing syntactic block. Typical values are
-@code{beginning-of-line} (used when the start of the line is known to
-be outside a syntactic block), or @code{beginning-of-defun} for
+outside of strings or comments. The value is normally set through an
+@var{other-vars} element in @code{font-lock-defaults}. If it is
+@code{nil}, Font Lock uses @code{syntax-begin-function} to move back
+outside of any comment, string, or sexp (@pxref{Position Parse}).
+
+This variable is semi-obsolete; we usually recommend setting
+@code{syntax-begin-function} instead. One of its uses is to tune the
+behavior of syntactic fontification, e.g.@: to ensure that different
+kinds of strings or comments are highlighted differently.
+
+The specified function is called with no arguments. It should leave
+point at the beginning of any enclosing syntactic block. Typical values
+are @code{beginning-of-line} (used when the start of the line is known
+to be outside a syntactic block), or @code{beginning-of-defun} for
programming modes, or @code{backward-paragraph} for textual modes.
-
-If the value is @code{nil}, Font Lock uses
-@code{syntax-begin-function} to move back outside of any comment,
-string, or sexp. This variable is semi-obsolete; we recommend setting
-@code{syntax-begin-function} instead.
-
-Specify this variable using @var{syntax-begin} in
-@code{font-lock-defaults}.
@end defvar
@defvar font-lock-syntactic-face-function
-A function to determine which face to use for a given syntactic
-element (a string or a comment). The function is called with one
-argument, the parse state at point returned by
-@code{parse-partial-sexp}, and should return a face. The default
-value returns @code{font-lock-comment-face} for comments and
-@code{font-lock-string-face} for strings.
-
-This can be used to highlighting different kinds of strings or
-comments differently. It is also sometimes abused together with
-@code{font-lock-syntactic-keywords} to highlight constructs that span
-multiple lines, but this is too esoteric to document here.
-
-Specify this variable using @var{other-vars} in
+If this variable is non-@code{nil}, it should be a function to determine
+which face to use for a given syntactic element (a string or a comment).
+The value is normally set through an @var{other-vars} element in
@code{font-lock-defaults}.
-@end defvar
-
-@node Setting Syntax Properties
-@subsection Setting Syntax Properties
-
- Font Lock mode can be used to update @code{syntax-table} properties
-automatically (@pxref{Syntax Properties}). This is useful in
-languages for which a single syntax table by itself is not sufficient.
-
-@defvar font-lock-syntactic-keywords
-This variable enables and controls updating @code{syntax-table}
-properties by Font Lock. Its value should be a list of elements of
-this form:
-
-@example
-(@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch})
-@end example
-
-The parts of this element have the same meanings as in the corresponding
-sort of element of @code{font-lock-keywords},
-@example
-(@var{matcher} @var{subexp} @var{facespec} @var{override} @var{laxmatch})
-@end example
-
-However, instead of specifying the value @var{facespec} to use for the
-@code{face} property, it specifies the value @var{syntax} to use for
-the @code{syntax-table} property. Here, @var{syntax} can be a string
-(as taken by @code{modify-syntax-entry}), a syntax table, a cons cell
-(as returned by @code{string-to-syntax}), or an expression whose value
-is one of those two types. @var{override} cannot be @code{prepend} or
-@code{append}.
-
-For example, an element of the form:
-
-@example
-("\\$\\(#\\)" 1 ".")
-@end example
-
-highlights syntactically a hash character when following a dollar
-character, with a SYNTAX of @code{"."} (meaning punctuation syntax).
-Assuming that the buffer syntax table specifies hash characters to
-have comment start syntax, the element will only highlight hash
-characters that do not follow dollar characters as comments
-syntactically.
-
-An element of the form:
-
-@example
- ("\\('\\).\\('\\)"
- (1 "\"")
- (2 "\""))
-@end example
-
-highlights syntactically both single quotes which surround a single
-character, with a SYNTAX of @code{"\""} (meaning string quote syntax).
-Assuming that the buffer syntax table does not specify single quotes
-to have quote syntax, the element will only highlight single quotes of
-the form @samp{'@var{c}'} as strings syntactically. Other forms, such
-as @samp{foo'bar} or @samp{'fubar'}, will not be highlighted as
-strings.
-
-Major modes normally set this variable with @var{other-vars} in
-@code{font-lock-defaults}.
+The function is called with one argument, the parse state at point
+returned by @code{parse-partial-sexp}, and should return a face. The
+default value returns @code{font-lock-comment-face} for comments and
+@code{font-lock-string-face} for strings (@pxref{Faces for Font Lock}).
@end defvar
@node Multiline Font Lock
The @code{font-lock-multiline} property is meant to ensure proper
refontification; it does not automatically identify new multiline
-constructs. Identifying the requires that Font-Lock operate on large
-enough chunks at a time. This will happen by accident on many cases,
-which may give the impression that multiline constructs magically work.
-If you set the @code{font-lock-multiline} variable non-@code{nil},
-this impression will be even stronger, since the highlighting of those
-constructs which are found will be properly updated from then on.
-But that does not work reliably.
-
- To find multiline constructs reliably, you must either manually
-place the @code{font-lock-multiline} property on the text before
-Font-Lock looks at it, or use
-@code{font-lock-fontify-region-function}.
+constructs. Identifying the requires that Font Lock mode operate on
+large enough chunks at a time. This will happen by accident on many
+cases, which may give the impression that multiline constructs magically
+work. If you set the @code{font-lock-multiline} variable
+non-@code{nil}, this impression will be even stronger, since the
+highlighting of those constructs which are found will be properly
+updated from then on. But that does not work reliably.
+
+ To find multiline constructs reliably, you must either manually place
+the @code{font-lock-multiline} property on the text before Font Lock
+mode looks at it, or use @code{font-lock-fontify-region-function}.
@node Region to Refontify
@subsubsection Region to Fontify after a Buffer Change
the following variable:
@defvar font-lock-extend-after-change-region-function
-This buffer-local variable is either @code{nil} or a function for
-Font-Lock to call to determine the region to scan and fontify.
+This buffer-local variable is either @code{nil} or a function for Font
+Lock mode to call to determine the region to scan and fontify.
The function is given three parameters, the standard @var{beg},
@var{end}, and @var{old-len} from @code{after-change-functions}
@end defvar
@node Auto-Indentation
-@section Auto-indentation of code
+@section Automatic Indentation of code
For programming languages, an important feature of a major mode is to
provide automatic indentation. This is controlled in Emacs by
indentation code will want to be somewhat friendly to syntactically
incorrect code.
-Good maintainable indentation functions usually fall into 2 categories:
+Good maintainable indentation functions usually fall into two categories:
either parsing forward from some ``safe'' starting point until the
position of interest, or parsing backward from the position of interest.
Neither of the two is a clearly better choice than the other: parsing
@code{process-command} to determine whether a network connection or
server is stopped; a non-@code{nil} value means yes.
-@defun open-network-stream name buffer-or-name host service
-This function opens a TCP connection, and returns a process object
-that represents the connection.
+@cindex network connection, encrypted
+@cindex encrypted network connections
+@cindex TLS network connections
+@cindex STARTTLS network connections
+@defun open-network-stream name buffer-or-name host service &rest parameters
+This function opens a TCP connection, with optional encryption, and
+returns a process object that represents the connection.
The @var{name} argument specifies the name for the process object. It
is modified as necessary to make it unique.
The arguments @var{host} and @var{service} specify where to connect to;
@var{host} is the host name (a string), and @var{service} is the name of
a defined network service (a string) or a port number (an integer).
+
+@c FIXME? Is this too lengthy for the printed manual?
+The remaining arguments @var{parameters} are keyword/argument pairs
+that are mainly relevant to encrypted connections:
+
+@table @code
+
+@item :nowait @var{boolean}
+If non-@code{nil}, try to make an asynchronous connection.
+
+@item :type @var{type}
+The type of connection. Options are:
+
+@table @code
+@item plain
+An ordinary, unencrypted connection.
+@item tls
+@itemx ssl
+A TLS (``Transport Layer Security'') connection.
+@item nil
+@itemx network
+Start with a plain connection, and if parameters @samp{:success}
+and @samp{:capability-command} are supplied, try to upgrade to an encrypted
+connection via STARTTLS. If that fails, retain the unencrypted connection.
+@item starttls
+As for @code{nil}, but if STARTTLS fails drop the connection.
+@item shell
+A shell connection.
+@end table
+
+@item :always-query-capabilities @var{boolean}
+If non-@code{nil}, always ask for the server's capabilities, even when
+doing a @samp{plain} connection.
+
+@item :capability-command @var{capability-command}
+Command string to query the host capabilities.
+
+@item :end-of-command @var{regexp}
+@itemx :end-of-capability @var{regexp}
+Regular expression matching the end of a command, or the end of the
+command @var{capability-command}. The latter defaults to the former.
+
+@item :starttls-function @var{function}
+Function of one argument (the response to @var{capability-command}),
+which returns either @code{nil}, or the command to activate STARTTLS
+if supported.
+
+@item :success @var{regexp}
+Regular expression matching a successful STARTTLS negotiation.
+
+@item :use-starttls-if-possible @var{boolean}
+If non-@code{nil}, do opportunistic STARTTLS upgrades even if Emacs
+doesn't have built-in TLS support.
+
+@item :client-certificate @var{list-or-t}
+Either a list of the form @code{(@var{key-file} @var{cert-file})},
+naming the certificate key file and certificate file itself, or
+@code{t}, meaning to query @code{auth-source} for this information
+(@pxref{Top,,auth-source, auth, Emacs auth-source Library}).
+Only used for TLS or STARTTLS.
+
+@item :return-list @var{cons-or-nil}
+The return value of this function. If omitted or @code{nil}, return a
+process object. Otherwise, a cons of the form @code{(@var{process-object}
+. @var{plist})}, where @var{plist} has keywords:
+
+@table @code
+@item :greeting @var{string-or-nil}
+If non-@code{nil}, the greeting string returned by the host.
+@item :capabilities @var{string-or-nil}
+If non-@code{nil}, the host's capability string.
+@item :type @var{symbol}
+The connection type: @samp{plain} or @samp{tls}.
+@end table
+
+@end table
+
@end defun
@node Network Servers
@cindex syntax table
@cindex text parsing
- A @dfn{syntax table} specifies the syntactic textual function of each
-character. This information is used by the @dfn{parsing functions}, the
-complex movement commands, and others to determine where words, symbols,
-and other syntactic constructs begin and end. The current syntax table
-controls the meaning of the word motion functions (@pxref{Word Motion})
-and the list motion functions (@pxref{List Motion}), as well as the
-functions in this chapter.
+ A @dfn{syntax table} specifies the syntactic role of each character
+in a buffer. It can be used to determine where words, symbols, and
+other syntactic constructs begin and end. This information is used by
+many Emacs facilities, including Font Lock mode (@pxref{Font Lock
+Mode}) and the various complex movement commands (@pxref{Motion}).
@menu
* Basics: Syntax Basics. Basic concepts of syntax tables.
-* Desc: Syntax Descriptors. How characters are classified.
+* Syntax Descriptors:: How characters are classified.
* Syntax Table Functions:: How to create, examine and alter syntax tables.
* Syntax Properties:: Overriding syntax with text properties.
* Motion and Syntax:: Moving over characters with certain syntaxes.
@node Syntax Basics
@section Syntax Table Concepts
-@ifnottex
- A @dfn{syntax table} provides Emacs with the information that
-determines the syntactic use of each character in a buffer. This
-information is used by the parsing commands, the complex movement
-commands, and others to determine where words, symbols, and other
-syntactic constructs begin and end. The current syntax table controls
-the meaning of the word motion functions (@pxref{Word Motion}) and the
-list motion functions (@pxref{List Motion}) as well as the functions in
-this chapter.
-@end ifnottex
-
A syntax table is a char-table (@pxref{Char-Tables}). The element at
index @var{c} describes the character with code @var{c}. The element's
value should be a list that encodes the syntax of the character in
feature out of Emacs Lisp for simplicity.)
Each buffer has its own major mode, and each major mode has its own
-idea of the syntactic class of various characters. For example, in Lisp
-mode, the character @samp{;} begins a comment, but in C mode, it
+idea of the syntactic class of various characters. For example, in
+Lisp mode, the character @samp{;} begins a comment, but in C mode, it
terminates a statement. To support these variations, Emacs makes the
-choice of syntax table local to each buffer. Typically, each major
-mode has its own syntax table and installs that table in each buffer
-that uses that mode. Changing this table alters the syntax in all
-those buffers as well as in any buffers subsequently put in that mode.
-Occasionally several similar modes share one syntax table.
-@xref{Example Major Modes}, for an example of how to set up a syntax
-table.
+syntax table local to each buffer. Typically, each major mode has its
+own syntax table and installs that table in each buffer that uses that
+mode. Changing this table alters the syntax in all those buffers as
+well as in any buffers subsequently put in that mode. Occasionally
+several similar modes share one syntax table. @xref{Example Major
+Modes}, for an example of how to set up a syntax table.
A syntax table can inherit the data for some characters from the
standard syntax table, while specifying other characters itself. The
@section Syntax Descriptors
@cindex syntax class
- This section describes the syntax classes and flags that denote the
-syntax of a character, and how they are represented as a @dfn{syntax
-descriptor}, which is a Lisp string that you pass to
-@code{modify-syntax-entry} to specify the syntax you want.
-
- The syntax table specifies a syntax class for each character. There
+ The syntactic role of a character is called its @dfn{syntax class}.
+Each syntax table specifies the syntax class of each character. There
is no necessary relationship between the class of a character in one
syntax table and its class in any other table.
- Each class is designated by a mnemonic character, which serves as the
-name of the class when you need to specify a class. Usually the
-designator character is one that is often assigned that class; however,
-its meaning as a designator is unvarying and independent of what syntax
-that character currently has. Thus, @samp{\} as a designator character
-always gives ``escape character'' syntax, regardless of what syntax
-@samp{\} currently has.
+ Each syntax class is designated by a mnemonic character, which
+serves as the name of the class when you need to specify a class.
+Usually, this designator character is one that is often assigned that
+class; however, its meaning as a designator is unvarying and
+independent of what syntax that character currently has. Thus,
+@samp{\} as a designator character always means ``escape character''
+syntax, regardless of whether the @samp{\} character actually has that
+syntax in the current syntax table.
+@ifnottex
+@xref{Syntax Class Table}, for a list of syntax classes.
+@end ifnottex
@cindex syntax descriptor
- A syntax descriptor is a Lisp string that specifies a syntax class, a
-matching character (used only for the parenthesis classes) and flags.
-The first character is the designator for a syntax class. The second
-character is the character to match; if it is unused, put a space there.
-Then come the characters for any desired flags. If no matching
-character or flags are needed, one character is sufficient.
+ A @dfn{syntax descriptor} is a Lisp string that describes the syntax
+classes and other syntactic properties of a character. When you want
+to modify the syntax of a character, that is done by calling the
+function @code{modify-syntax-entry} and passing a syntax descriptor as
+one of its arguments (@pxref{Syntax Table Functions}).
+
+ The first character in a syntax descriptor designates the syntax
+class. The second character specifies a matching character (e.g.@: in
+Lisp, the matching character for @samp{(} is @samp{)}); if there is no
+matching character, put a space there. Then come the characters for
+any desired flags.
+
+ If no matching character or flags are needed, only one character
+(specifying the syntax class) is sufficient.
For example, the syntax descriptor for the character @samp{*} in C
mode is @code{". 23"} (i.e., punctuation, matching character slot
@node Syntax Class Table
@subsection Table of Syntax Classes
- Here is a table of syntax classes, the characters that stand for them,
-their meanings, and examples of their use.
-
-@deffn {Syntax class} @w{whitespace character}
-@dfn{Whitespace characters} (designated by @w{@samp{@ }} or @samp{-})
-separate symbols and words from each other. Typically, whitespace
-characters have no other syntactic significance, and multiple
-whitespace characters are syntactically equivalent to a single one.
-Space, tab, and formfeed are classified as whitespace in almost all
-major modes.
-@end deffn
-
-@deffn {Syntax class} @w{word constituent}
-@dfn{Word constituents} (designated by @samp{w}) are parts of words in
-human languages, and are typically used in variable and command names
-in programs. All upper- and lower-case letters, and the digits, are
-typically word constituents.
-@end deffn
+ Here is a table of syntax classes, the characters that designate
+them, their meanings, and examples of their use.
-@deffn {Syntax class} @w{symbol constituent}
-@dfn{Symbol constituents} (designated by @samp{_}) are the extra
-characters that are used in variable and command names along with word
-constituents. For example, the symbol constituents class is used in
-Lisp mode to indicate that certain characters may be part of symbol
-names even though they are not part of English words. These characters
-are @samp{$&*+-_<>}. In standard C, the only non-word-constituent
+@table @asis
+@item Whitespace characters: @samp{@ } or @samp{-}
+Characters that separate symbols and words from each other.
+Typically, whitespace characters have no other syntactic significance,
+and multiple whitespace characters are syntactically equivalent to a
+single one. Space, tab, and formfeed are classified as whitespace in
+almost all major modes.
+
+This syntax class can be designated by either @w{@samp{@ }} or
+@samp{-}. Both designators are equivalent.
+
+@item Word constituents: @samp{w}
+Parts of words in human languages. These are typically used in
+variable and command names in programs. All upper- and lower-case
+letters, and the digits, are typically word constituents.
+
+@item Symbol constituents: @samp{_}
+Extra characters used in variable and command names along with word
+constituents. Examples include the characters @samp{$&*+-_<>} in Lisp
+mode, which may be part of a symbol name even though they are not part
+of English words. In standard C, the only non-word-constituent
character that is valid in symbols is underscore (@samp{_}).
-@end deffn
-
-@deffn {Syntax class} @w{punctuation character}
-@dfn{Punctuation characters} (designated by @samp{.}) are those
-characters that are used as punctuation in English, or are used in some
-way in a programming language to separate symbols from one another.
-Some programming language modes, such as Emacs Lisp mode, have no
-characters in this class since the few characters that are not symbol or
-word constituents all have other uses. Other programming language modes,
-such as C mode, use punctuation syntax for operators.
-@end deffn
-@deffn {Syntax class} @w{open parenthesis character}
-@deffnx {Syntax class} @w{close parenthesis character}
-@cindex parenthesis syntax
-Open and close @dfn{parenthesis characters} are characters used in
-dissimilar pairs to surround sentences or expressions. Such a grouping
-is begun with an open parenthesis character and terminated with a close.
-Each open parenthesis character matches a particular close parenthesis
-character, and vice versa. Normally, Emacs indicates momentarily the
-matching open parenthesis when you insert a close parenthesis.
-@xref{Blinking}.
-
-The class of open parentheses is designated by @samp{(}, and that of
-close parentheses by @samp{)}.
-
-In English text, and in C code, the parenthesis pairs are @samp{()},
-@samp{[]}, and @samp{@{@}}. In Emacs Lisp, the delimiters for lists and
-vectors (@samp{()} and @samp{[]}) are classified as parenthesis
-characters.
-@end deffn
-
-@deffn {Syntax class} @w{string quote}
-@dfn{String quote characters} (designated by @samp{"}) are used in
-many languages, including Lisp and C, to delimit string constants. The
-same string quote character appears at the beginning and the end of a
-string. Such quoted strings do not nest.
+@item Punctuation characters: @samp{.}
+Characters used as punctuation in a human language, or used in a
+programming language to separate symbols from one another. Some
+programming language modes, such as Emacs Lisp mode, have no
+characters in this class since the few characters that are not symbol
+or word constituents all have other uses. Other programming language
+modes, such as C mode, use punctuation syntax for operators.
+
+@item Open parenthesis characters: @samp{(}
+@itemx Close parenthesis characters: @samp{)}
+Characters used in dissimilar pairs to surround sentences or
+expressions. Such a grouping is begun with an open parenthesis
+character and terminated with a close. Each open parenthesis
+character matches a particular close parenthesis character, and vice
+versa. Normally, Emacs indicates momentarily the matching open
+parenthesis when you insert a close parenthesis. @xref{Blinking}.
+
+In human languages, and in C code, the parenthesis pairs are
+@samp{()}, @samp{[]}, and @samp{@{@}}. In Emacs Lisp, the delimiters
+for lists and vectors (@samp{()} and @samp{[]}) are classified as
+parenthesis characters.
+
+@item String quotes: @samp{"}
+Characters used to delimit string constants. The same string quote
+character appears at the beginning and the end of a string. Such
+quoted strings do not nest.
The parsing facilities of Emacs consider a string as a single token.
The usual syntactic meanings of the characters in the string are
double-quote for strings, and single-quote (@samp{'}) for character
constants.
-English text has no string quote characters because English is not a
-programming language. Although quotation marks are used in English,
-we do not want them to turn off the usual syntactic properties of
-other characters in the quotation.
-@end deffn
+Human text has no string quote characters. We do not want quotation
+marks to turn off the usual syntactic properties of other characters
+in the quotation.
-@deffn {Syntax class} @w{escape-syntax character}
-An @dfn{escape character} (designated by @samp{\}) starts an escape
-sequence such as is used in C string and character constants. The
-character @samp{\} belongs to this class in both C and Lisp. (In C, it
-is used thus only inside strings, but it turns out to cause no trouble
-to treat it this way throughout C code.)
+@item Escape-syntax characters: @samp{\}
+Characters that start an escape sequence, such as is used in string
+and character constants. The character @samp{\} belongs to this class
+in both C and Lisp. (In C, it is used thus only inside strings, but
+it turns out to cause no trouble to treat it this way throughout C
+code.)
Characters in this class count as part of words if
@code{words-include-escapes} is non-@code{nil}. @xref{Word Motion}.
-@end deffn
-@deffn {Syntax class} @w{character quote}
-A @dfn{character quote character} (designated by @samp{/}) quotes the
-following character so that it loses its normal syntactic meaning. This
-differs from an escape character in that only the character immediately
-following is ever affected.
+@item Character quotes: @samp{/}
+Characters used to quote the following character so that it loses its
+normal syntactic meaning. This differs from an escape character in
+that only the character immediately following is ever affected.
Characters in this class count as part of words if
@code{words-include-escapes} is non-@code{nil}. @xref{Word Motion}.
This class is used for backslash in @TeX{} mode.
-@end deffn
-
-@deffn {Syntax class} @w{paired delimiter}
-@dfn{Paired delimiter characters} (designated by @samp{$}) are like
-string quote characters except that the syntactic properties of the
-characters between the delimiters are not suppressed. Only @TeX{} mode
-uses a paired delimiter presently---the @samp{$} that both enters and
-leaves math mode.
-@end deffn
-
-@deffn {Syntax class} @w{expression prefix}
-An @dfn{expression prefix operator} (designated by @samp{'}) is used for
-syntactic operators that are considered as part of an expression if they
-appear next to one. In Lisp modes, these characters include the
-apostrophe, @samp{'} (used for quoting), the comma, @samp{,} (used in
-macros), and @samp{#} (used in the read syntax for certain data types).
-@end deffn
-@deffn {Syntax class} @w{comment starter}
-@deffnx {Syntax class} @w{comment ender}
+@item Paired delimiters: @samp{$}
+Similar to string quote characters, except that the syntactic
+properties of the characters between the delimiters are not
+suppressed. Only @TeX{} mode uses a paired delimiter presently---the
+@samp{$} that both enters and leaves math mode.
+
+@item Expression prefixes: @samp{'}
+Characters used for syntactic operators that are considered as part of
+an expression if they appear next to one. In Lisp modes, these
+characters include the apostrophe, @samp{'} (used for quoting), the
+comma, @samp{,} (used in macros), and @samp{#} (used in the read
+syntax for certain data types).
+
+@item Comment starters: @samp{<}
+@itemx Comment enders: @samp{>}
@cindex comment syntax
-The @dfn{comment starter} and @dfn{comment ender} characters are used in
-various languages to delimit comments. These classes are designated
-by @samp{<} and @samp{>}, respectively.
+Characters used in various languages to delimit comments. Human text
+has no comment characters. In Lisp, the semicolon (@samp{;}) starts a
+comment and a newline or formfeed ends one.
-English text has no comment characters. In Lisp, the semicolon
-(@samp{;}) starts a comment and a newline or formfeed ends one.
-@end deffn
-
-@deffn {Syntax class} @w{inherit standard syntax}
-This syntax class does not specify a particular syntax. It says to look
-in the standard syntax table to find the syntax of this character. The
-designator for this syntax class is @samp{@@}.
-@end deffn
+@item Inherit standard syntax: @samp{@@}
+This syntax class does not specify a particular syntax. It says to
+look in the standard syntax table to find the syntax of this
+character.
-@deffn {Syntax class} @w{generic comment delimiter}
-A @dfn{generic comment delimiter} (designated by @samp{!}) starts
-or ends a special kind of comment. @emph{Any} generic comment delimiter
-matches @emph{any} generic comment delimiter, but they cannot match
-a comment starter or comment ender; generic comment delimiters can only
-match each other.
+@item Generic comment delimiters: @samp{!}
+Characters that start or end a special kind of comment. @emph{Any}
+generic comment delimiter matches @emph{any} generic comment
+delimiter, but they cannot match a comment starter or comment ender;
+generic comment delimiters can only match each other.
This syntax class is primarily meant for use with the
-@code{syntax-table} text property (@pxref{Syntax Properties}). You can
-mark any range of characters as forming a comment, by giving the first
-and last characters of the range @code{syntax-table} properties
+@code{syntax-table} text property (@pxref{Syntax Properties}). You
+can mark any range of characters as forming a comment, by giving the
+first and last characters of the range @code{syntax-table} properties
identifying them as generic comment delimiters.
-@end deffn
-@deffn {Syntax class} @w{generic string delimiter}
-A @dfn{generic string delimiter} (designated by @samp{|}) starts or ends
-a string. This class differs from the string quote class in that @emph{any}
-generic string delimiter can match any other generic string delimiter; but
-they do not match ordinary string quote characters.
+@item Generic string delimiters: @samp{|}
+Characters that start or end a string. This class differs from the
+string quote class in that @emph{any} generic string delimiter can
+match any other generic string delimiter; but they do not match
+ordinary string quote characters.
This syntax class is primarily meant for use with the
-@code{syntax-table} text property (@pxref{Syntax Properties}). You can
-mark any range of characters as forming a string constant, by giving the
-first and last characters of the range @code{syntax-table} properties
-identifying them as generic string delimiters.
-@end deffn
+@code{syntax-table} text property (@pxref{Syntax Properties}). You
+can mark any range of characters as forming a string constant, by
+giving the first and last characters of the range @code{syntax-table}
+properties identifying them as generic string delimiters.
+@end table
@node Syntax Flags
@subsection Syntax Flags
@deffn Command modify-syntax-entry char syntax-descriptor &optional table
This function sets the syntax entry for @var{char} according to
-@var{syntax-descriptor}. @var{char} can be a character, or a cons
+@var{syntax-descriptor}. @var{char} must be a character, or a cons
cell of the form @code{(@var{min} . @var{max})}; in the latter case,
the function sets the syntax entries for all characters in the range
between @var{min} and @var{max}, inclusive.
The syntax is changed only for @var{table}, which defaults to the
-current buffer's syntax table, and not in any other syntax table. The
-argument @var{syntax-descriptor} specifies the desired syntax; this is
-a string beginning with a class designator character, and optionally
-containing a matching character and flags as well. @xref{Syntax
-Descriptors}.
+current buffer's syntax table, and not in any other syntax table.
+
+The argument @var{syntax-descriptor} is a syntax descriptor for the
+desired syntax (i.e.@: a string beginning with a class designator
+character, and optionally containing a matching character and syntax
+flags). An error is signaled if the first character is not one of the
+seventeen syntax class designators. @xref{Syntax Descriptors}.
This function always returns @code{nil}. The old syntax information in
the table for this character is discarded.
-An error is signaled if the first character of the syntax descriptor is not
-one of the seventeen syntax class designator characters. An error is also
-signaled if @var{char} is not a character.
-
@example
@group
@exdent @r{Examples:}
@kindex syntax-table @r{(text property)}
When the syntax table is not flexible enough to specify the syntax of
-a language, you can use @code{syntax-table} text properties to
-override the syntax table for specific character occurrences in the
-buffer. @xref{Text Properties}. You can use Font Lock mode to set
-@code{syntax-table} text properties. @xref{Setting Syntax
-Properties}.
+a language, you can override the syntax table for specific character
+occurrences in the buffer, by applying a @code{syntax-table} text
+property. @xref{Text Properties}, for how to apply text properties.
-The valid values of @code{syntax-table} text property are:
+ The valid values of @code{syntax-table} text property are:
@table @asis
@item @var{syntax-table}
If the property value is a syntax table, that table is used instead of
-the current buffer's syntax table to determine the syntax for this
-occurrence of the character.
+the current buffer's syntax table to determine the syntax for the
+underlying text character.
@item @code{(@var{syntax-code} . @var{matching-char})}
-A cons cell of this format specifies the syntax for this
-occurrence of the character. (@pxref{Syntax Table Internals})
+A cons cell of this format specifies the syntax for the underlying
+text character. (@pxref{Syntax Table Internals})
@item @code{nil}
If the property is @code{nil}, the character's syntax is determined from
@end table
@defvar parse-sexp-lookup-properties
-If this is non-@code{nil}, the syntax scanning functions pay attention
-to syntax text properties. Otherwise they use only the current syntax
-table.
+If this is non-@code{nil}, the syntax scanning functions, like
+@code{forward-sexp}, pay attention to syntax text properties.
+Otherwise they use only the current syntax table.
+@end defvar
+
+@defvar syntax-propertize-function
+This variable, if non-@code{nil}, should store a function for applying
+@code{syntax-table} properties to a specified stretch of text. It is
+intended to be used by major modes to install a function which applies
+@code{syntax-table} properties in some mode-appropriate way.
+
+The function is called by @code{syntax-ppss} (@pxref{Position Parse}),
+and by Font Lock mode during syntactic fontification (@pxref{Syntactic
+Font Lock}). It is called with two arguments, @var{start} and
+@var{end}, which are the starting and ending positions of the text on
+which it should act. It is allowed to call @code{syntax-ppss} on any
+position before @var{end}. However, it should not call
+@code{syntax-ppss-flush-cache}; so, it is not allowed to call
+@code{syntax-ppss} on some position and later modify the buffer at an
+earlier position.
+@end defvar
+
+@defvar syntax-propertize-extend-region-functions
+This abnormal hook is run by the syntax parsing code prior to calling
+@code{syntax-propertize-function}. Its role is to help locate safe
+starting and ending buffer positions for passing to
+@code{syntax-propertize-function}. For example, a major mode can add
+a function to this hook to identify multi-line syntactic constructs,
+and ensure that the boundaries do not fall in the middle of one.
+
+Each function in this hook should accept two arguments, @var{start}
+and @var{end}. It should return either a cons cell of two adjusted
+buffer positions, @code{(@var{new-start} . @var{new-end})}, or
+@code{nil} if no adjustment is necessary. The hook functions are run
+in turn, repeatedly, until they all return @code{nil}.
@end defvar
@node Motion and Syntax
on languages other than Lisp. Basically, a sexp is either a balanced
parenthetical grouping, a string, or a ``symbol'' (i.e.@: a sequence
of characters whose syntax is either word constituent or symbol
-constituent). However, characters whose syntax is expression prefix
-are treated as part of the sexp if they appear next to it.
+constituent). However, characters in the expression prefix syntax
+class (@pxref{Syntax Class Table}) are treated as part of the sexp if
+they appear next to it.
The syntax table controls the interpretation of characters, so these
functions can be used for Lisp expressions when in Lisp mode and for C
from position @var{from}. It returns the position where the scan stops.
If @var{count} is negative, the scan moves backwards.
-If @var{depth} is nonzero, parenthesis depth counting begins from that
-value. The only candidates for stopping are places where the depth in
-parentheses becomes zero; @code{scan-lists} counts @var{count} such
-places and then stops. Thus, a positive value for @var{depth} means go
-out @var{depth} levels of parenthesis.
+If @var{depth} is nonzero, assume that the starting point is already
+@var{depth} parentheses deep. This function counts out @var{count}
+number of points where the parenthesis depth goes back to zero, then
+stops. Thus, a positive value for @var{depth} has the effect of
+moving out @var{depth} levels of parenthesis, whereas a negative
+@var{depth} has the effect of moving deeper by @var{-depth} levels of
+parenthesis.
Scanning ignores comments if @code{parse-sexp-ignore-comments} is
non-@code{nil}.
This function cannot tell whether the ``comments'' it traverses are
embedded within a string. If they look like comments, it treats them
as comments.
-@end defun
To move forward over all comments and whitespace following point, use
-@code{(forward-comment (buffer-size))}. @code{(buffer-size)} is a good
-argument to use, because the number of comments in the buffer cannot
-exceed that many.
+@code{(forward-comment (buffer-size))}. @code{(buffer-size)} is a
+good argument to use, because the number of comments in the buffer
+cannot exceed that many.
+@end defun
@node Position Parse
@subsection Finding the Parse State for a Position
position. This function does that conveniently.
@defun syntax-ppss &optional pos
-This function returns the parser state (see next section) that the
-parser would reach at position @var{pos} starting from the beginning
-of the buffer. This is equivalent to @code{(parse-partial-sexp
-(point-min) @var{pos})}, except that @code{syntax-ppss} uses a cache
-to speed up the computation. Due to this optimization, the 2nd value
-(previous complete subexpression) and 6th value (minimum parenthesis
-depth) of the returned parser state are not meaningful.
-@end defun
-
- @code{syntax-ppss} automatically hooks itself to
-@code{before-change-functions} to keep its cache consistent. But
-updating can fail if @code{syntax-ppss} is called while
+This function returns the parser state that the parser would reach at
+position @var{pos} starting from the beginning of the buffer.
+@iftex
+See the next section for
+@end iftex
+@ifnottex
+@xref{Parser State},
+@end ifnottex
+for a description of the parser state.
+
+The return value is the same as if you call the low-level parsing
+function @code{parse-partial-sexp} to parse from the beginning of the
+buffer to @var{pos} (@pxref{Low-Level Parsing}). However,
+@code{syntax-ppss} uses a cache to speed up the computation. Due to
+this optimization, the second value (previous complete subexpression)
+and sixth value (minimum parenthesis depth) in the returned parser
+state are not meaningful.
+
+This function has a side effect: it adds a buffer-local entry to
+@code{before-change-functions} (@pxref{Change Hooks}) for
+@code{syntax-ppss-flush-cache} (see below). This entry keeps the
+cache consistent as the buffer is modified. However, the cache might
+not be updated if @code{syntax-ppss} is called while
@code{before-change-functions} is temporarily let-bound, or if the
-buffer is modified without obeying the hook, such as when using
-@code{inhibit-modification-hooks}. For this reason, it is sometimes
-necessary to flush the cache manually.
+buffer is modified without running the hook, such as when using
+@code{inhibit-modification-hooks}. In those cases, it is necessary to
+call @code{syntax-ppss-flush-cache} explicitly.
+@end defun
@defun syntax-ppss-flush-cache beg &rest ignored-args
This function flushes the cache used by @code{syntax-ppss}, starting
@subsection Parser State
@cindex parser state
- A @dfn{parser state} is a list of ten elements describing the final
-state of parsing text syntactically as part of an expression. The
-parsing functions in the following sections return a parser state as
-the value, and in some cases accept one as an argument also, so that
-you can resume parsing after it stops. Here are the meanings of the
-elements of the parser state:
+ A @dfn{parser state} is a list of ten elements describing the state
+of the syntactic parser, after it parses the text between a specified
+starting point and a specified end point in the buffer. Parsing
+functions such as @code{syntax-ppss}
+@ifnottex
+(@pxref{Position Parse})
+@end ifnottex
+return a parser state as the value. Some parsing functions accept a
+parser state as an argument, for resuming parsing.
+
+ Here are the meanings of the elements of the parser state:
@enumerate 0
@item
The depth in parentheses, counting from 0. @strong{Warning:} this can
be negative if there are more close parens than open parens between
-the start of the defun and point.
+the parser's starting point and end point.
@item
@cindex innermost containing parentheses
@item
@cindex inside comment
-@code{t} if inside a comment (of either style),
-or the comment nesting level if inside a kind of comment
-that can be nested.
+@code{t} if inside a non-nestable comment (of any comment style;
+@pxref{Syntax Flags}); or the comment nesting level if inside a
+comment that can be nested.
@item
@cindex quote character
-@code{t} if point is just after a quote character.
+@code{t} if the end point is just after a quote character.
@item
The minimum parenthesis depth encountered during this scan.
@item
-What kind of comment is active: @code{nil} for a comment of style
-``a'' or when not inside a comment, @code{t} for a comment of style
-``b,'' and @code{syntax-table} for a comment that should be ended by a
-generic comment delimiter character.
+What kind of comment is active: @code{nil} if not in a comment or in a
+comment of style @samp{a}; 1 for a comment of style @samp{b}; 2 for a
+comment of style @samp{c}; and @code{syntax-table} for a comment that
+should be ended by a generic comment delimiter character.
@item
The string or comment start position. While inside a comment, this is
Elements 1, 2, and 6 are ignored in a state which you pass as an
argument to continue parsing, and elements 8 and 9 are used only in
-trivial cases. Those elements serve primarily to convey information
-to the Lisp program which does the parsing.
+trivial cases. Those elements are mainly used internally by the
+parser code.
One additional piece of useful information is available from a
parser state using this function:
Under lexical binding rules, the value cell only holds the
variable's global value, i.e.@: the value outside of any lexical
-binding contruct. When a variable is lexically bound, the local value
+binding construct. When a variable is lexically bound, the local value
is determined by the lexical environment; the variable may have a
local value if its symbol's value cell is unassigned.
shell commands.
* Completion Styles:: Specifying rules for performing completion.
* Programmed Completion:: Writing your own completion-function.
+* Completion in Buffers:: Completing text in ordinary buffers.
Command Loop
* Mode Line Format:: Customizing the text that appears in the mode line.
* Imenu:: Providing a menu of definitions made in a buffer.
* Font Lock Mode:: How modes can highlight text according to syntax.
+* Auto-Indentation:: How to teach Emacs to indent for a major mode.
* Desktop Save Mode:: How modes can have buffer state saved between
Emacs sessions.
contents can also specify how to fontify it.
* Faces for Font Lock:: Special faces specifically for Font Lock.
* Syntactic Font Lock:: Fontification based on syntax tables.
-* Setting Syntax Properties:: Defining character syntax based on context
- using the Font Lock mechanism.
* Multiline Font Lock:: How to coerce Font Lock into properly
highlighting multiline constructs.
shell commands.
* Completion Styles:: Specifying rules for performing completion.
* Programmed Completion:: Writing your own completion-function.
+* Completion in Buffers:: Completing text in ordinary buffers.
Command Loop
* Mode Line Format:: Customizing the text that appears in the mode line.
* Imenu:: Providing a menu of definitions made in a buffer.
* Font Lock Mode:: How modes can highlight text according to syntax.
+* Auto-Indentation:: How to teach Emacs to indent for a major mode.
* Desktop Save Mode:: How modes can have buffer state saved between
Emacs sessions.
contents can also specify how to fontify it.
* Faces for Font Lock:: Special faces specifically for Font Lock.
* Syntactic Font Lock:: Fontification based on syntax tables.
-* Setting Syntax Properties:: Defining character syntax based on context
- using the Font Lock mechanism.
* Multiline Font Lock:: How to coerce Font Lock into properly
highlighting multiline constructs.
+2012-02-15 Glenn Morris <rgm@gnu.org>
+
+ * smtpmail.texi (Emacs Speaks SMTP): General update for 24.1.
+ (Encryption): New chapter, split out from previous.
+
2012-02-13 Lars Ingebrigtsen <larsi@gnus.org>
* gnus.texi (Customizing the IMAP Connection): Mention
* How Mail Works:: Brief introduction to mail concepts.
* Emacs Speaks SMTP:: How to use the SMTP library in Emacs.
* Authentication:: Authenticating yourself to the server.
+* Encryption:: Protecting your connection to the server.
* Queued delivery:: Sending mail without an internet connection.
* Server workarounds:: Mail servers with special requirements.
* Debugging:: Tracking down problems.
machine is often disconnected from the internet.
Sending mail via SMTP requires configuring your mail user agent
-(@pxref{Mail Methods,,,emacs}) to use the SMTP library. How to do
-this should be described for each mail user agent; for the default
-mail user agent the variable @code{send-mail-function} (@pxref{Mail
-Sending,,,emacs}) is used; for the Message and Gnus user agents the
-variable @code{message-send-mail-function} (@pxref{Mail
-Variables,,,message}) is used.
-
-@example
-;; If you use the default mail user agent.
+(@pxref{Mail Methods,,,emacs}) to use the SMTP library. If you
+have not configured anything, then in Emacs 24.1 and later the first
+time you try to send a mail Emacs will ask how you want to send
+mail. To use this library, answer @samp{smtp} when prompted. Emacs
+then asks for the name of the SMTP server.
+
+ If you prefer, or if you are using a non-standard mail user agent,
+you can configure this yourself. The normal way to do this is to set
+the variable @code{send-mail-function} (@pxref{Mail
+Sending,,,emacs}) to the value you want to use. To use this library:
+
+@smallexample
(setq send-mail-function 'smtpmail-send-it)
-;; If you use Message or Gnus.
-(setq message-send-mail-function 'smtpmail-send-it)
-@end example
+@end smallexample
+
+@noindent
+The default value for this variable is @code{sendmail-query-once},
+which interactively asks how you want to send mail.
+
+Your mail user agent might use a different variable for this purpose.
+It should inherit from @code{send-mail-function}, but if it does not,
+or if you prefer, you can set that variable directly. Consult your
+mail user agent's documentation for more details. For example,
+(@pxref{Mail Variables,,,message}).
Before using SMTP you must find out the hostname of the SMTP server
-to use. Your system administrator should provide you with this
-information, but often it is the same as the server you receive mail
-from.
+to use. Your system administrator or mail service provider should
+supply this information. Often it is some variant of the server you
+receive mail from. If your email address is
+@samp{yourname@@example.com}, then the name of the SMTP server is
+may be something like @samp{smtp.example.com}.
@table @code
@item smtpmail-smtp-server
@node Authentication
@chapter Authentication
+@cindex password
+@cindex user name
+Most SMTP servers require clients to authenticate themselves before
+they are allowed to send mail. Authentication usually involves
+supplying a user name and password.
+
+If you have not configured anything, then the first time you try to
+send mail via a server, Emacs (version 24.1 and later) prompts you
+for the user name and password to use, and then offers to save the
+information. By default, Emacs stores authentication information in
+a file @file{~/.authinfo}.
+
+@cindex authinfo
+The basic format of the @file{~/.authinfo} file is one line for each
+set of credentials. Each line consists of pairs of variables and
+values. A simple example would be:
+
+@smallexample
+machine mail.example.org port 25 login myuser password mypassword
+@end smallexample
+
+@noindent
+This specifies that when using the SMTP server called @samp{mail.example.org}
+on port 25, Emacs should send the user name @samp{myuser} and the
+password @samp{mypassword}. Either or both of the login and password
+fields may be absent, in which case Emacs prompts for the information
+when you try to send mail. (This replaces the old
+@code{smtpmail-auth-credentials} variable used prior to Emacs 24.1.)
+
+@vindex smtpmail-smtp-user
+ When the SMTP library connects to a host on a certain port, it
+searches the @file{~/.authinfo} file for a matching entry. If an
+entry is found, the authentication process is invoked and the
+credentials are used. If the variable @code{smtpmail-smtp-user} is
+set to a non-@code{nil} value, then only entries for that user are
+considered. For more information on the @file{~/.authinfo}
+file, @pxref{Top,,auth-source, auth, Emacs auth-source Library}.
+
@cindex SASL
@cindex CRAM-MD5
+@cindex PLAIN
@cindex LOGIN
+The process by which the SMTP library authenticates you to the server
+is known as ``Simple Authentication and Security Layer'' (SASL).
+There are various SASL mechanisms, and this library supports three of
+them: CRAM-MD5, PLAIN, and LOGIN. It tries each of them, in that order,
+until one succeeds. The first uses a form of encryption to obscure
+your password, while the other two do not.
+
+
+@node Encryption
+@chapter Encryption
+
@cindex STARTTLS
@cindex TLS
@cindex SSL
-Many environments require SMTP clients to authenticate themselves
-before they are allowed to route mail via a server. The two following
-variables contains the authentication information needed for this.
-
-The first variable, @code{smtpmail-auth-credentials}, instructs the
-SMTP library to use a SASL authentication step, currently only the
-CRAM-MD5 and LOGIN mechanisms are supported and will be selected in
-that order if the server support both.
-
-The second variable, @code{smtpmail-starttls-credentials}, instructs
-the SMTP library to connect to the server using STARTTLS. This means
-the protocol exchange may be integrity protected and confidential by
-using the Transport Layer Security (TLS) protocol, and optionally also
-authentication of the client and server.
-
-TLS is a security protocol that is also known as SSL, although
-strictly speaking, SSL is an older variant of TLS. TLS is backwards
-compatible with SSL. In most mundane situations, the two terms are
-equivalent.
-
-The TLS feature uses the elisp package @file{starttls.el} (see it for
-more information on customization), which in turn require that at
-least one of the following external tools are installed:
+For greater security, you can encrypt your connection to the SMTP
+server. If this is to work, both Emacs and the server must support it.
+
+The SMTP library supports the ``Transport Layer Security'' (TLS), and
+the older ``Secure Sockets Layer'' (SSL) encryption mechanisms.
+It also supports STARTTLS, which is a variant of TLS in which the
+initial connection to the server is made in plain text, requesting a
+switch to an encrypted channel for the rest of the process.
+
+@vindex smtpmail-stream-type
+The variable @code{smtpmail-stream-type} controls what form of
+connection the SMTP library uses. The default value is @code{nil},
+which means to use a plain connection, but try to switch to a STARTTLS
+encrypted connection if the server supports it. Other possible values
+are: @code{starttls} - insist on STARTTLS; @code{ssl} - use TLS/SSL;
+and @code{plain} - no encryption.
+
+Use of any form of TLS/SSL requires support in Emacs. You can either
+use the built-in support (in Emacs 24.1 and later), or the
+@file{starttls.el} Lisp library. The built-in support uses the GnuTLS
+@footnote{@url{http://www.gnu.org/software/gnutls/}} library.
+If your Emacs has GnuTLS support built-in, the function
+@code{gnutls-available-p} is defined and returns non-@code{nil}.
+Otherwise, you must use the @file{starttls.el} library (see that file for
+more information on customization options, etc.). The Lisp library
+requires one of the following external tools to be installed:
@enumerate
@item
-The GnuTLS command line tool @samp{gnutls-cli}, you can get it from
+The GnuTLS command line tool @samp{gnutls-cli}, which you can get from
@url{http://www.gnu.org/software/gnutls/}. This is the recommended
-tool, mainly because it can verify the server certificates.
+tool, mainly because it can verify server certificates.
@item
-The @samp{starttls} external program, you can get it from
+The @samp{starttls} external program, which you can get from
@file{starttls-*.tar.gz} from @uref{ftp://ftp.opaopa.org/pub/elisp/}.
@end enumerate
-It is not uncommon to use both these mechanisms, e.g., to use STARTTLS
-to achieve integrity and confidentiality and then use SASL for client
-authentication.
+@cindex certificates
+@cindex keys
+The SMTP server may also request that you verify your identity by
+sending a certificate and the associated encryption key to the server.
+If you need to do this, you can use an @file{~/.authinfo} entry like this:
-@table @code
-@item smtpmail-auth-credentials
-@vindex smtpmail-auth-credentials
- The variable @code{smtpmail-auth-credentials} contains a list of
-hostname, port, username and password tuples. When the SMTP library
-connects to a host on a certain port, this variable is searched to
-find a matching entry for that hostname and port. If an entry is
-found, the authentication process is invoked and the credentials are
-used.
-
-The hostname field follows the same format as
-@code{smtpmail-smtp-server} (i.e., a string) and the port field the
-same format as @code{smtpmail-smtp-service} (i.e., a string or an
-integer). The username and password fields, which either can be
-@code{nil} to indicate that the user is prompted for the value
-interactively, should be strings with the username and password,
-respectively, information that is normally provided by system
-administrators.
-
-@item smtpmail-starttls-credentials
-@vindex smtpmail-starttls-credentials
- The variable @code{smtpmail-starttls-credentials} contains a list of
-tuples with hostname, port, name of file containing client key, and
-name of file containing client certificate. The processing is similar
-to the previous variable. The client key and certificate may be
-@code{nil} if you do not wish to use client authentication.
-@end table
+@smallexample
+machine mail.example.org port 25 key "~/.my_smtp_tls.key" cert "~/.my_smtp_tls.cert"
+@end smallexample
-The following example illustrates what you could put in
-@file{~/.emacs} to enable both SASL authentication and STARTTLS. The
-server name (@code{smtpmail-smtp-server}) is @var{hostname}, the
-server port (@code{smtpmail-smtp-service}) is @var{port}, and the
-username and password are @var{username} and @var{password}
-respectively.
+@noindent
+(This replaces the old @code{smtpmail-starttls-credentials} variable used
+prior to Emacs 24.1.)
-@example
-;; Authenticate using this username and password against my server.
-(setq smtpmail-auth-credentials
- '(("@var{hostname}" "@var{port}" "@var{username}" "@var{password}")))
-
-;; Note that if @var{port} is an integer, you must not quote it as a
-;; string. Normally @var{port} should be the integer 25, and the example
-;; become:
-(setq smtpmail-auth-credentials
- '(("@var{hostname}" 25 "@var{username}" "@var{password}")))
-
-;; Use STARTTLS without authentication against the server.
-(setq smtpmail-starttls-credentials
- '(("@var{hostname}" "@var{port}" nil nil)))
-@end example
@node Queued delivery
@chapter Queued delivery
*** smtpmail
-**** smtpmail now uses encrypted connections (via STARTTLS) if the
-mail server supports them. It also uses the auth-source framework for
-getting credentials.
++++
+**** smtpmail now uses encrypted connections (via STARTTLS) by default
+if the mail server supports them. This uses either built-in GnuTLS
+support, or the starttls.el library. Customize `smtpmail-stream-type'
+to change this.
++++
**** The variable `smtpmail-auth-credentials' has been removed.
-That variable used to have the default value "~/.authinfo", in which
-case you won't see any difference. But if you changed it to be a list
-of user names and passwords, that setting is now ignored; you will be
-prompted for the user name and the password, which will then be saved
-to ~/.authinfo. (To control where and how the credentials are stored,
-see the auth-source manual. You may want to change the auth-source
-preferences if you want to store the credentials encrypted, for
-instance.)
-
-You can also manually copy the credentials to your ~/.authinfo file.
-For example, if you had
+By default, the information is now stored in the file ~/.authinfo.
+This was the default value of smtpmail-auth-credentials.
+If you had customized smtpmail-auth-credentials to a list of user
+names and passwords, those settings will not be used. Your first
+connection to the smtp server will prompt for the user name and password,
+and then offer to save them to the ~/.authinfo file. Or you can
+manually copy the credentials to your ~/.authinfo files. For example,
+if you had
(setq smtpmail-auth-credentials
'(("mail.example.org" 25 "jim" "s!cret")))
machine mail.example.org port 25 login jim password s!cret
+See the auth-source manual for more information, e.g. on encrypting
+the credentials file.
+
++++
**** The variable `smtpmail-starttls-credentials' has been removed.
If you had that set, then you need to put
** The following obsolete files were removed:
sc.el, x-menu.el, rnews.el, rnewspost.el
-** FIXME finder-inf.el changes.
+---
+** The format of the finder-inf.el file has changed, since the finder
+mechanism is now based on the package concept. The variable
+finder-package-info is replaced by package--builtins and finder-keywords-hash.
\f
* Lisp changes in Emacs 24.1
** `glyphless-char-display' can now distinguish between graphical and
text terminal display, via a char-table entry that is a cons cell.
++++
** `open-network-stream' can now be used to open an encrypted stream.
It now accepts an optional `:type' parameter for initiating a TLS
connection, directly or via STARTTLS. To do STARTTLS, additional
not just image libraries. The previous name is still available as an
obsolete alias.
++++
** New variable `syntax-propertize-function'.
This replaces `font-lock-syntactic-keywords' which is now obsolete.
This allows syntax-table properties to be set independently from font-lock:
+++
*** Image mode can view any image type that ImageMagick supports.
This requires Emacs to be built with ImageMagick support.
-Then the function `imagemagick-types' returns a list of image file
+If your Emacs has ImageMagick support, then the function
+`imagemagick-types' is defined, and returns a list of image file
extensions that your installation of ImageMagick supports. The
function `imagemagick-register-types' enables ImageMagick support for
these image types, minus those listed in `imagemagick-types-inhibit'.
*** New library `gnutls.el'.
This requires Emacs to have been built with GnuTLS support.
-The main functions are `open-gnutls-stream' and `gnutls-negotiate'.
-It's easiest to use these functions through `open-network-stream'
-because it can upgrade connections through STARTTLS opportunistically
-or use plain SSL, depending on your needs. For debugging, set
-`gnutls-log-level' greater than 0.
+If your Emacs has GnuTLS support, the function gnutls-available-p is
+defined and returns non-nil. The main functions are `open-gnutls-stream'
+and `gnutls-negotiate'. It's easiest to use these functions through
+`open-network-stream' because it can upgrade connections through
+STARTTLS opportunistically or use plain SSL, depending on your needs.
+For debugging, set `gnutls-log-level' greater than 0.
** Isearch
-2012-02-16 Kenichi Handa <handa@m17n.org>
+2012-02-17 Kenichi Handa <handa@m17n.org>
* international/charprop.el:
* international/uni-name.el:
* international/uni-old-name.el:
* international/uni-comment.el: Regenerate.
+2012-02-16 Glenn Morris <rgm@gnu.org>
+
+ * calendar/cal-hebrew.el (calendar-hebrew-list-yahrzeits):
+ Interactively in calendar buffer, give an error if not on a date.
+
+2012-02-15 Glenn Morris <rgm@gnu.org>
+
+ * shell.el (shell-delimiter-argument-list):
+ Revert 2011-02-17 change. (Bug#8027)
+
+2012-02-15 Chong Yidong <cyd@gnu.org>
+
+ * minibuffer.el (completion-at-point-functions): Doc fix.
+
+ * custom.el (defcustom): Doc fix; note use of defvar.
+
+2012-02-15 Glenn Morris <rgm@gnu.org>
+
+ * mail/smtpmail.el (smtpmail-smtp-user, smtpmail-stream-type):
+ Doc fixes.
+
2012-02-14 Glenn Morris <rgm@gnu.org>
* mail/smtpmail.el (smtpmail-query-smtp-server): Give it a doc.
(interactive
(let* ((death-date
(if (equal (current-buffer) (get-buffer calendar-buffer))
- (calendar-cursor-to-date)
+ (calendar-cursor-to-date t)
(let* ((today (calendar-current-date))
(year (calendar-read
"Year of death (>0): "
Customize can re-evaluate it later to get the standard value.
DOC is the variable documentation.
-The remaining arguments should have the form
+This macro uses `defvar' as a subroutine, which also marks the
+variable as \"special\", so that it is always dynamically bound
+even when `lexical-binding' is t.
+
+The remaining arguments to `defcustom' should have the form
[KEYWORD VALUE]...
+2012-02-16 Leo Liu <sdl.web@gmail.com>
+
+ * gnus-start.el (gnus-1): Avoid duplicate entries.
+
+2012-02-15 Lars Ingebrigtsen <larsi@gnus.org>
+
+ * shr.el (shr-remove-trailing-whitespace): Really delete the padding on
+ too-wide lines.
+
+2012-02-15 Paul Eggert <eggert@cs.ucla.edu>
+
+ * shr.el (shr-rescale-image): Undo previous change; see
+ <http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00540.html>.
+
2012-02-13 Lars Ingebrigtsen <larsi@gnus.org>
* nnimap.el (nnimap-record-commands): New variable.
;; Add "native" to gnus-predefined-server-alist just to have a
;; name for the native select method.
(when gnus-select-method
- (push (cons "native" gnus-select-method)
- gnus-predefined-server-alist))
+ (add-to-list 'gnus-predefined-server-alist
+ (cons "native" gnus-select-method)))
(if gnus-agent
(gnus-agentize))
(goto-char start)
(while (not (eobp))
(end-of-line)
- (when (> (current-column) width)
+ (when (> (shr-previous-newline-padding-width (current-column)) width)
(dolist (overlay (overlays-at (point)))
(when (overlay-get overlay 'before-string)
(overlay-put overlay 'before-string nil))))
(insert alt)))
(defun shr-rescale-image (data)
- (let* ((max-image-size nil)
- (image (create-image data nil t :ascent 100)))
+ (let ((image (create-image data nil t :ascent 100)))
(if (or (not (fboundp 'imagemagick-types))
(not (get-buffer-window (current-buffer))))
image
:group 'smtpmail)
(defcustom smtpmail-smtp-user nil
- "User name to use when looking up credentials."
+ "User name to use when looking up credentials in the authinfo file.
+If non-nil, only consider credentials for the specified user."
:version "24.1"
:type '(choice (const nil) string)
:group 'smtpmail)
:group 'smtpmail)
(defcustom smtpmail-stream-type nil
- "Connection type SMTP connections.
-This may be either nil (possibly upgraded to STARTTLS if
-possible), or `starttls' (refuse to send if STARTTLS isn't
-available), or `plain' (never use STARTTLS), or `ssl' (to use
-TLS/SSL)."
+ "Type of SMTP connections to use.
+This may be either nil (possibly upgraded to STARTTLS if possible),
+or `starttls' (refuse to send if STARTTLS isn't available), or `plain'
+\(never use STARTTLS), or `ssl' (to use TLS/SSL)."
:version "24.1"
:group 'smtpmail
:type '(choice (const :tag "Possibly upgrade to STARTTLS" nil)
Each function on this hook is called in turns without any argument and should
return either nil to mean that it is not applicable at point,
or a function of no argument to perform completion (discouraged),
-or a list of the form (START END COLLECTION &rest PROPS) where
+or a list of the form (START END COLLECTION . PROPS) where
START and END delimit the entity to complete and should include point,
COLLECTION is the completion table to use to complete it, and
PROPS is a property list for additional information.
Currently supported properties are all the properties that can appear in
`completion-extra-properties' plus:
`:predicate' a predicate that completion candidates need to satisfy.
- `:exclusive' If `no', means that if the completion data does not match the
- text at point failure, then instead of reporting a completion failure,
- the completion should try the next completion function.")
+ `:exclusive' If `no', means that if the completion table fails to
+ match the text at point, then instead of reporting a completion
+ failure, the completion should try the next completion function.")
(defvar completion--capf-misbehave-funs nil
"List of functions found on `completion-at-point-functions' that misbehave.
:type '(repeat (string :tag "Suffix"))
:group 'shell)
-(defcustom shell-delimiter-argument-list nil ; '(?\| ?& ?< ?> ?\( ?\) ?\;)
+(defcustom shell-delimiter-argument-list '(?\| ?& ?< ?> ?\( ?\) ?\;)
"List of characters to recognize as separate arguments.
This variable is used to initialize `comint-delimiter-argument-list' in the
shell buffer. The value may depend on the operating system or shell."
:type '(choice (const nil)
(repeat :tag "List of characters" character))
- :version "24.1" ; changed to nil (bug#8027)
+ ;; Reverted.
+;; :version "24.1" ; changed to nil (bug#8027)
:group 'shell)
(defvar shell-file-name-chars
+2012-02-15 Paul Eggert <eggert@cs.ucla.edu>
+
+ * image.c (MAX_IMAGE_SIZE): Increase from 6.0 to 10.0; see
+ <http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00540.html>.
+
+2012-02-15 Chong Yidong <cyd@gnu.org>
+
+ * eval.c (Fdefvar, Fdefconst): Doc fix; note that the variable is
+ marked as special. Also, starting docstrings with * is obsolete.
+
2012-02-13 Andreas Schwab <schwab@linux-m68k.org>
* gnutls.c (emacs_gnutls_write): Fix last change.
DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
doc: /* Define SYMBOL as a variable, and return SYMBOL.
-You are not required to define a variable in order to use it,
-but the definition can supply documentation and an initial value
-in a way that tags can recognize.
-
-INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void.
-If SYMBOL is buffer-local, its default value is what is set;
- buffer-local values are not affected.
-INITVALUE and DOCSTRING are optional.
-If DOCSTRING starts with *, this variable is identified as a user option.
- This means that M-x set-variable recognizes it.
- See also `user-variable-p'.
+You are not required to define a variable in order to use it, but
+defining it lets you supply an initial value and documentation, which
+can be referred to by the Emacs help facilities and other programming
+tools. The `defvar' form also declares the variable as \"special\",
+so that it is always dynamically bound even if `lexical-binding' is t.
+
+The optional argument INITVALUE is evaluated, and used to set SYMBOL,
+only if SYMBOL's value is void. If SYMBOL is buffer-local, its
+default value is what is set; buffer-local values are not affected.
If INITVALUE is missing, SYMBOL's value is not set.
If SYMBOL has a local binding, then this form affects the local
`defcustom', you should always load that file _outside_ any bindings
for these variables. \(`defconst' and `defcustom' behave similarly in
this respect.)
+
+The optional argument DOCSTRING is a documentation string for the
+variable.
+
+To define a user option, use `defcustom' instead of `defvar'.
+The function `user-variable-p' also identifies a variable as a user
+option if its DOCSTRING starts with *, but this behavior is obsolete.
usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
(Lisp_Object args)
{
DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0,
doc: /* Define SYMBOL as a constant variable.
-The intent is that neither programs nor users should ever change this value.
-Always sets the value of SYMBOL to the result of evalling INITVALUE.
-If SYMBOL is buffer-local, its default value is what is set;
- buffer-local values are not affected.
-DOCSTRING is optional.
-
-If SYMBOL has a local binding, then this form sets the local binding's
-value. However, you should normally not make local bindings for
-variables defined with this form.
+This declares that neither programs nor users should ever change the
+value. This constancy is not actually enforced by Emacs Lisp, but
+SYMBOL is marked as a special variable so that it is never lexically
+bound.
+
+The `defconst' form always sets the value of SYMBOL to the result of
+evalling INITVALUE. If SYMBOL is buffer-local, its default value is
+what is set; buffer-local values are not affected. If SYMBOL has a
+local binding, then this form sets the local binding's value.
+However, you should normally not make local bindings for variables
+defined with this form.
+
+The optional DOCSTRING specifies the variable's documentation string.
usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
(Lisp_Object args)
{
static void free_image (struct frame *f, struct image *img);
-#define MAX_IMAGE_SIZE 6.0
+#define MAX_IMAGE_SIZE 10.0
/* Allocate and return a new image structure for image specification
SPEC. SPEC has a hash value of HASH. */