aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-07-06 16:34:39 -0700
committerPaul Eggert2011-07-06 16:34:39 -0700
commit59361254a6ea5fcfc2f1ec344665aa719fbb936f (patch)
tree6471eaf76563f8b2f7aab90bf07ff0dd73470599
parent9cfdb3ec08672f13088ebd133bbc794c04a66b05 (diff)
parent8a5c77bba5e38c62605f0f053670a7955130fcc7 (diff)
downloademacs-59361254a6ea5fcfc2f1ec344665aa719fbb936f.tar.gz
emacs-59361254a6ea5fcfc2f1ec344665aa719fbb936f.zip
Merge from trunk.
-rw-r--r--ChangeLog6
-rwxr-xr-xautogen/configure6
-rw-r--r--configure.in6
-rw-r--r--doc/lispref/ChangeLog15
-rw-r--r--doc/lispref/customize.texi212
-rw-r--r--doc/lispref/display.texi5
-rw-r--r--doc/lispref/elisp.texi3
-rw-r--r--doc/lispref/functions.texi6
-rw-r--r--doc/misc/ChangeLog7
-rw-r--r--doc/misc/gnus.texi15
-rw-r--r--etc/ChangeLog12
-rw-r--r--etc/NEWS16
-rw-r--r--etc/themes/manoj-dark-theme.el700
-rw-r--r--lib-src/ChangeLog2
-rw-r--r--lisp/ChangeLog220
-rw-r--r--lisp/abbrev.el2
-rw-r--r--lisp/allout-widgets.el10
-rw-r--r--lisp/allout.el12
-rw-r--r--lisp/arc-mode.el2
-rw-r--r--lisp/autoinsert.el2
-rw-r--r--lisp/bindings.el3
-rw-r--r--lisp/bookmark.el7
-rw-r--r--lisp/bs.el6
-rw-r--r--lisp/button.el5
-rw-r--r--lisp/custom.el2
-rw-r--r--lisp/dabbrev.el3
-rw-r--r--lisp/dired-aux.el5
-rw-r--r--lisp/dired-x.el2
-rw-r--r--lisp/dired.el19
-rw-r--r--lisp/dynamic-setting.el2
-rw-r--r--lisp/emacs-lisp/derived.el5
-rw-r--r--lisp/emacs-lisp/lisp-mode.el39
-rw-r--r--lisp/emacs-lock.el277
-rw-r--r--lisp/gnus/ChangeLog34
-rw-r--r--lisp/gnus/gnus-group.el27
-rw-r--r--lisp/gnus/gnus-msg.el8
-rw-r--r--lisp/gnus/gnus-start.el17
-rw-r--r--lisp/gnus/gnus.el6
-rw-r--r--lisp/gnus/message.el2
-rw-r--r--lisp/gnus/mm-decode.el14
-rw-r--r--lisp/gnus/nnir.el101
-rw-r--r--lisp/gnus/pop3.el2
-rw-r--r--lisp/info.el2
-rw-r--r--lisp/mail/feedmail.el2
-rw-r--r--lisp/mail/rmailmm.el41
-rw-r--r--lisp/mail/sendmail.el14
-rw-r--r--lisp/mail/smtpmail.el6
-rw-r--r--lisp/net/network-stream.el14
-rw-r--r--lisp/net/tramp-cmds.el4
-rw-r--r--lisp/net/tramp-compat.el29
-rw-r--r--lisp/obsolete/old-emacs-lock.el102
-rw-r--r--lisp/progmodes/compile.el4
-rw-r--r--lisp/progmodes/gdb-mi.el1053
-rw-r--r--lisp/progmodes/grep.el3
-rw-r--r--lisp/progmodes/gud.el3
-rw-r--r--lisp/progmodes/sql.el1155
-rw-r--r--lisp/progmodes/which-func.el3
-rw-r--r--lisp/register.el2
-rw-r--r--lisp/simple.el3
-rw-r--r--lisp/textmodes/bibtex.el1257
-rw-r--r--lisp/textmodes/rst.el2
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-cache.el1
-rw-r--r--lisp/window.el51
-rw-r--r--m4/alloca.m426
-rw-r--r--src/ChangeLog62
-rw-r--r--src/alloc.c3
-rw-r--r--src/buffer.c12
-rw-r--r--src/buffer.h4
-rw-r--r--src/eval.c2
-rw-r--r--src/gnutls.c2
-rw-r--r--src/xsettings.c372
72 files changed, 4373 insertions, 1711 deletions
diff --git a/ChangeLog b/ChangeLog
index 17b6bae02cc..01fee7035b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
12011-07-05 Paul Eggert <eggert@cs.ucla.edu> 12011-07-06 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Assume support for memcmp, memcpy, memmove, memset. 3 Assume support for memcmp, memcpy, memmove, memset.
4 This simplifies the code a bit. All current platforms have these, 4 This simplifies the code a bit. All current platforms have these,
@@ -6,6 +6,10 @@
6 can add the gnulib modules for these (a 1-line change to Makefile.in). 6 can add the gnulib modules for these (a 1-line change to Makefile.in).
7 * configure.in: Don't check for memcmp, memcpy, memmove, memset. 7 * configure.in: Don't check for memcmp, memcpy, memmove, memset.
8 8
92011-07-05 Jan Djärv <jan.h.d@swipnet.se>
10
11 * configure.in (HAVE_GCONF): Allow both HAVE_GCONF and HAVE_GSETTINGS.
12
92011-07-01 Glenn Morris <rgm@gnu.org> 132011-07-01 Glenn Morris <rgm@gnu.org>
10 14
11 * configure.in (SETTINGS_CFLAGS, SETTINGS_LIBS) [HAVE_GCONF]: Fix typo. 15 * configure.in (SETTINGS_CFLAGS, SETTINGS_LIBS) [HAVE_GCONF]: Fix typo.
diff --git a/autogen/configure b/autogen/configure
index 76128388c8b..9b9e915f759 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -11166,7 +11166,7 @@ $as_echo "#define HAVE_GSETTINGS 1" >>confdefs.h
11166fi 11166fi
11167 11167
11168HAVE_GCONF=no 11168HAVE_GCONF=no
11169if test "${HAVE_GSETTINGS}" = "no" && test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then 11169if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
11170 11170
11171 succeeded=no 11171 succeeded=no
11172 11172
@@ -11265,8 +11265,8 @@ $as_echo "no" >&6; }
11265 11265
11266$as_echo "#define HAVE_GCONF 1" >>confdefs.h 11266$as_echo "#define HAVE_GCONF 1" >>confdefs.h
11267 11267
11268 SETTINGS_CFLAGS="$GCONF_CFLAGS" 11268 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
11269 SETTINGS_LIBS="$GCONF_LIBS" 11269 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
11270 fi 11270 fi
11271fi 11271fi
11272 11272
diff --git a/configure.in b/configure.in
index f23493811fa..e8a0b56d268 100644
--- a/configure.in
+++ b/configure.in
@@ -1996,13 +1996,13 @@ fi
1996dnl GConf has been tested under GNU/Linux only. 1996dnl GConf has been tested under GNU/Linux only.
1997dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6. 1997dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
1998HAVE_GCONF=no 1998HAVE_GCONF=no
1999if test "${HAVE_GSETTINGS}" = "no" && test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then 1999if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
2000 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no) 2000 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no)
2001 if test "$HAVE_GCONF" = yes; then 2001 if test "$HAVE_GCONF" = yes; then
2002 AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.]) 2002 AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
2003 dnl Newer GConf doesn't link with g_objects, so this is not defined. 2003 dnl Newer GConf doesn't link with g_objects, so this is not defined.
2004 SETTINGS_CFLAGS="$GCONF_CFLAGS" 2004 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
2005 SETTINGS_LIBS="$GCONF_LIBS" 2005 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
2006 fi 2006 fi
2007fi 2007fi
2008 2008
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 807313c8632..23ddf0c5ad1 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,18 @@
12011-07-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * functions.texi (Calling Functions): Link to the "Interactive
4 Call" node (bug#1001).
5
62011-07-06 Chong Yidong <cyd@stupidchicken.com>
7
8 * customize.texi (Composite Types): Move alist and plist to here
9 from Simple Types (Bug#7545).
10
11 * elisp.texi (Top): Update menu description.
12
13 * display.texi (Face Attributes): Document negative line widths
14 (Bug#6113).
15
12011-07-03 Tobias C. Rittweiler <tcr@freebits.de> (tiny change) 162011-07-03 Tobias C. Rittweiler <tcr@freebits.de> (tiny change)
2 17
3 * searching.texi (Match Data): Note that match data can be 18 * searching.texi (Match Data): Note that match data can be
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index ff658eb81f8..868edaa5bd4 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -513,8 +513,7 @@ equivalent to @code{(string)}.
513Introduction, widget, The Emacs Widget Library}, for details. 513Introduction, widget, The Emacs Widget Library}, for details.
514 514
515@menu 515@menu
516* Simple Types:: Simple customization types: sexp, integer, number, 516* Simple Types:: Simple customization types: sexp, integer, etc.
517 string, file, directory, alist.
518* Composite Types:: Build new types from other types or data. 517* Composite Types:: Build new types from other types or data.
519* Splicing into Lists:: Splice elements into list with @code{:inline}. 518* Splicing into Lists:: Splice elements into list with @code{:inline}.
520* Type Keywords:: Keyword-argument pairs in a customization type. 519* Type Keywords:: Keyword-argument pairs in a customization type.
@@ -577,22 +576,103 @@ You can use the @code{:options} keyword in a hook variable's
577@code{defcustom} to specify a list of functions recommended for use in 576@code{defcustom} to specify a list of functions recommended for use in
578the hook; see @ref{Variable Definitions}. 577the hook; see @ref{Variable Definitions}.
579 578
580@item alist 579@item symbol
581The value must be a list of cons-cells, the @sc{car} of each cell 580The value must be a symbol. It appears in the customization buffer as
582representing a key, and the @sc{cdr} of the same cell representing an 581the name of the symbol.
583associated value. The user can add and delete key/value pairs, and
584edit both the key and the value of each pair.
585 582
586You can specify the key and value types like this: 583@item function
584The value must be either a lambda expression or a function name. When
585it is a function name, you can do completion with @kbd{M-@key{TAB}}.
587 586
588@smallexample 587@item variable
589(alist :key-type @var{key-type} :value-type @var{value-type}) 588The value must be a variable name, and you can do completion with
590@end smallexample 589@kbd{M-@key{TAB}}.
590
591@item face
592The value must be a symbol which is a face name, and you can do
593completion with @kbd{M-@key{TAB}}.
594
595@item boolean
596The value is boolean---either @code{nil} or @code{t}. Note that by
597using @code{choice} and @code{const} together (see the next section),
598you can specify that the value must be @code{nil} or @code{t}, but also
599specify the text to describe each value in a way that fits the specific
600meaning of the alternative.
601
602@item coding-system
603The value must be a coding-system name, and you can do completion with
604@kbd{M-@key{TAB}}.
605
606@item color
607The value must be a valid color name, and you can do completion with
608@kbd{M-@key{TAB}}. A sample is provided.
609@end table
610
611@node Composite Types
612@subsection Composite Types
613@cindex composite types (customization)
614
615 When none of the simple types is appropriate, you can use composite
616types, which build new types from other types or from specified data.
617The specified types or data are called the @dfn{arguments} of the
618composite type. The composite type normally looks like this:
619
620@example
621(@var{constructor} @var{arguments}@dots{})
622@end example
591 623
592@noindent 624@noindent
593where @var{key-type} and @var{value-type} are customization type 625but you can also add keyword-value pairs before the arguments, like
594specifications. The default key type is @code{sexp}, and the default 626this:
595value type is @code{sexp}. 627
628@example
629(@var{constructor} @r{@{}@var{keyword} @var{value}@r{@}}@dots{} @var{arguments}@dots{})
630@end example
631
632 Here is a table of constructors and how to use them to write
633composite types:
634
635@table @code
636@item (cons @var{car-type} @var{cdr-type})
637The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
638its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string
639symbol)} is a customization type which matches values such as
640@code{("foo" . foo)}.
641
642In the customization buffer, the @sc{car} and the @sc{cdr} are
643displayed and edited separately, each according to the type
644that you specify for it.
645
646@item (list @var{element-types}@dots{})
647The value must be a list with exactly as many elements as the
648@var{element-types} given; and each element must fit the
649corresponding @var{element-type}.
650
651For example, @code{(list integer string function)} describes a list of
652three elements; the first element must be an integer, the second a
653string, and the third a function.
654
655In the customization buffer, each element is displayed and edited
656separately, according to the type specified for it.
657
658@item (group @var{element-types}@dots{})
659This works like @code{list} except for the formatting
660of text in the Custom buffer. @code{list} labels each
661element value with its tag; @code{group} does not.
662
663@item (vector @var{element-types}@dots{})
664Like @code{list} except that the value must be a vector instead of a
665list. The elements work the same as in @code{list}.
666
667@item (alist :key-type @var{key-type} :value-type @var{value-type})
668The value must be a list of cons-cells, the @sc{car} of each cell
669representing a key of customization type @var{key-type}, and the
670@sc{cdr} of the same cell representing a value of customization type
671@var{value-type}. The user can add and delete key/value pairs, and
672edit both the key and the value of each pair.
673
674If omitted, @var{key-type} and @var{value-type} default to
675@code{sexp}.
596 676
597The user can add any key matching the specified key type, but you can 677The user can add any key matching the specified key type, but you can
598give some keys a preferential treatment by specifying them with the 678give some keys a preferential treatment by specifying them with the
@@ -687,105 +767,11 @@ and the VALUE is a list of that person's pets."
687 :type '(alist :value-type (repeat string))) 767 :type '(alist :value-type (repeat string)))
688@end smallexample 768@end smallexample
689 769
690@item plist 770@item (plist :key-type @var{key-type} :value-type @var{value-type})
691The @code{plist} custom type is similar to the @code{alist} (see above), 771This customization type is similar to @code{alist} (see above), except
692except that the information is stored as a property list, i.e. a list of 772that (i) the information is stored as a property list,
693this form: 773(@pxref{Property Lists}), and (ii) @var{key-type}, if omitted,
694 774defaults to @code{symbol} rather than @code{sexp}.
695@smallexample
696(@var{key} @var{value} @var{key} @var{value} @var{key} @var{value} @dots{})
697@end smallexample
698
699The default @code{:key-type} for @code{plist} is @code{symbol},
700rather than @code{sexp}.
701
702@item symbol
703The value must be a symbol. It appears in the customization buffer as
704the name of the symbol.
705
706@item function
707The value must be either a lambda expression or a function name. When
708it is a function name, you can do completion with @kbd{M-@key{TAB}}.
709
710@item variable
711The value must be a variable name, and you can do completion with
712@kbd{M-@key{TAB}}.
713
714@item face
715The value must be a symbol which is a face name, and you can do
716completion with @kbd{M-@key{TAB}}.
717
718@item boolean
719The value is boolean---either @code{nil} or @code{t}. Note that by
720using @code{choice} and @code{const} together (see the next section),
721you can specify that the value must be @code{nil} or @code{t}, but also
722specify the text to describe each value in a way that fits the specific
723meaning of the alternative.
724
725@item coding-system
726The value must be a coding-system name, and you can do completion with
727@kbd{M-@key{TAB}}.
728
729@item color
730The value must be a valid color name, and you can do completion with
731@kbd{M-@key{TAB}}. A sample is provided.
732@end table
733
734@node Composite Types
735@subsection Composite Types
736@cindex composite types (customization)
737
738 When none of the simple types is appropriate, you can use composite
739types, which build new types from other types or from specified data.
740The specified types or data are called the @dfn{arguments} of the
741composite type. The composite type normally looks like this:
742
743@example
744(@var{constructor} @var{arguments}@dots{})
745@end example
746
747@noindent
748but you can also add keyword-value pairs before the arguments, like
749this:
750
751@example
752(@var{constructor} @r{@{}@var{keyword} @var{value}@r{@}}@dots{} @var{arguments}@dots{})
753@end example
754
755 Here is a table of constructors and how to use them to write
756composite types:
757
758@table @code
759@item (cons @var{car-type} @var{cdr-type})
760The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
761its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string
762symbol)} is a customization type which matches values such as
763@code{("foo" . foo)}.
764
765In the customization buffer, the @sc{car} and the @sc{cdr} are
766displayed and edited separately, each according to the type
767that you specify for it.
768
769@item (list @var{element-types}@dots{})
770The value must be a list with exactly as many elements as the
771@var{element-types} given; and each element must fit the
772corresponding @var{element-type}.
773
774For example, @code{(list integer string function)} describes a list of
775three elements; the first element must be an integer, the second a
776string, and the third a function.
777
778In the customization buffer, each element is displayed and edited
779separately, according to the type specified for it.
780
781@item (group @var{element-types}@dots{})
782This works like @code{list} except for the formatting
783of text in the Custom buffer. @code{list} labels each
784element value with its tag; @code{group} does not.
785
786@item (vector @var{element-types}@dots{})
787Like @code{list} except that the value must be a vector instead of a
788list. The elements work the same as in @code{list}.
789 775
790@item (choice @var{alternative-types}@dots{}) 776@item (choice @var{alternative-types}@dots{})
791The value must fit at least one of @var{alternative-types}. 777The value must fit at least one of @var{alternative-types}.
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 6d19d73545e..bc81c59f05f 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2092,7 +2092,10 @@ Draw a box with lines of width 1, in color @var{color}.
2092 2092
2093@item @code{(:line-width @var{width} :color @var{color} :style @var{style})} 2093@item @code{(:line-width @var{width} :color @var{color} :style @var{style})}
2094This way you can explicitly specify all aspects of the box. The value 2094This way you can explicitly specify all aspects of the box. The value
2095@var{width} specifies the width of the lines to draw; it defaults to 1. 2095@var{width} specifies the width of the lines to draw; it defaults to
20961. A negative width @var{-n} means to draw a line of width @var{n}
2097that occupies the space of the underlying text, thus avoiding any
2098increase in the character height or width.
2096 2099
2097The value @var{color} specifies the color to draw with. The default is 2100The value @var{color} specifies the color to draw with. The default is
2098the foreground color of the face for simple boxes, and the background 2101the foreground color of the face for simple boxes, and the background
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 264d63511bc..29b3e398f4b 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -508,8 +508,7 @@ Writing Customization Definitions
508 508
509Customization Types 509Customization Types
510 510
511* Simple Types:: Simple customization types: sexp, integer, number, 511* Simple Types:: Simple customization types: sexp, integer, etc.
512 string, file, directory, alist.
513* Composite Types:: Build new types from other types or data. 512* Composite Types:: Build new types from other types or data.
514* Splicing into Lists:: Splice elements into list with @code{:inline}. 513* Splicing into Lists:: Splice elements into list with @code{:inline}.
515* Type Keywords:: Keyword-argument pairs in a customization type. 514* Type Keywords:: Keyword-argument pairs in a customization type.
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 519957f8921..f3b2375b61d 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -790,6 +790,12 @@ This function returns @var{arg} and has no side effects.
790This function ignores any arguments and returns @code{nil}. 790This function ignores any arguments and returns @code{nil}.
791@end defun 791@end defun
792 792
793 Emacs Lisp functions can also be user-visible @dfn{commands}. A
794command is a function that has an @dfn{interactive} specification.
795You may want to call these functions as if they were called
796interactively. See @ref{Interactive Call} for details on how to do
797that.
798
793@node Mapping Functions 799@node Mapping Functions
794@section Mapping Functions 800@section Mapping Functions
795@cindex mapping functions 801@cindex mapping functions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index e388b54b7c2..ff5831caa12 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,10 @@
12011-07-05 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus.texi (Expiring Mail): Document gnus-auto-expirable-marks.
4 (Filtering New Groups): Clarify how simple the "options -n" format is.
5 (Agent Expiry): Remove mention of `gnus-request-expire-articles', which
6 is internal.
7
12011-07-04 Michael Albinus <michael.albinus@gmx.de> 82011-07-04 Michael Albinus <michael.albinus@gmx.de>
2 9
3 * tramp.texi (Cleanup remote connections): Add 10 * tramp.texi (Cleanup remote connections): Add
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 3bce492d831..439ff7fbc55 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -1302,6 +1302,10 @@ subscribing these groups.
1302@code{gnus-subscribe-options-newsgroup-method} is used instead. This 1302@code{gnus-subscribe-options-newsgroup-method} is used instead. This
1303variable defaults to @code{gnus-subscribe-alphabetically}. 1303variable defaults to @code{gnus-subscribe-alphabetically}.
1304 1304
1305The ``options -n'' format is very simplistic. The syntax above is all
1306that is supports -- you can force-subscribe hierarchies, or you can
1307deny hierarchies, and that's it.
1308
1305@vindex gnus-options-not-subscribe 1309@vindex gnus-options-not-subscribe
1306@vindex gnus-options-subscribe 1310@vindex gnus-options-subscribe
1307If you don't want to mess with your @file{.newsrc} file, you can just 1311If you don't want to mess with your @file{.newsrc} file, you can just
@@ -15648,14 +15652,16 @@ will remain on your system until hell freezes over. This bears
15648repeating one more time, with some spurious capitalizations: IF you do 15652repeating one more time, with some spurious capitalizations: IF you do
15649NOT mark articles as EXPIRABLE, Gnus will NEVER delete those ARTICLES. 15653NOT mark articles as EXPIRABLE, Gnus will NEVER delete those ARTICLES.
15650 15654
15655@vindex gnus-auto-expirable-marks
15651You do not have to mark articles as expirable by hand. Gnus provides 15656You do not have to mark articles as expirable by hand. Gnus provides
15652two features, called ``auto-expire'' and ``total-expire'', that can help you 15657two features, called ``auto-expire'' and ``total-expire'', that can help you
15653with this. In a nutshell, ``auto-expire'' means that Gnus hits @kbd{E} 15658with this. In a nutshell, ``auto-expire'' means that Gnus hits @kbd{E}
15654for you when you select an article. And ``total-expire'' means that Gnus 15659for you when you select an article. And ``total-expire'' means that Gnus
15655considers all articles as expirable that are read. So, in addition to 15660considers all articles as expirable that are read. So, in addition to
15656the articles marked @samp{E}, also the articles marked @samp{r}, 15661the articles marked @samp{E}, also the articles marked @samp{r},
15657@samp{R}, @samp{O}, @samp{K}, @samp{Y} and so on are considered 15662@samp{R}, @samp{O}, @samp{K}, @samp{Y} (and so on) are considered
15658expirable. 15663expirable. @code{gnus-auto-expirable-marks} has the full list of
15664these marks.
15659 15665
15660When should either auto-expire or total-expire be used? Most people 15666When should either auto-expire or total-expire be used? Most people
15661who are subscribed to mailing lists split each list into its own group 15667who are subscribed to mailing lists split each list into its own group
@@ -19004,9 +19010,8 @@ that you're running out of space. Neither are particularly fast or
19004efficient, and it's not a particularly good idea to interrupt them (with 19010efficient, and it's not a particularly good idea to interrupt them (with
19005@kbd{C-g} or anything else) once you've started one of them. 19011@kbd{C-g} or anything else) once you've started one of them.
19006 19012
19007Note that other functions, e.g. @code{gnus-request-expire-articles}, 19013Note that other functions might run @code{gnus-agent-expire} for you
19008might run @code{gnus-agent-expire} for you to keep the agent 19014to keep the agent synchronized with the group.
19009synchronized with the group.
19010 19015
19011The agent parameter @code{agent-enable-expiration} may be used to 19016The agent parameter @code{agent-enable-expiration} may be used to
19012prevent expiration in selected groups. 19017prevent expiration in selected groups.
diff --git a/etc/ChangeLog b/etc/ChangeLog
index ea3ef2767a9..5e80b5029ff 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,15 @@
12011-07-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * NEWS: Clarify that `smtpmail-starttls-credentials' doesn't exist.
4
52011-07-05 Juanma Barranquero <lekktu@gmail.com>
6
7 * NEWS: Document new emacs-lock.el and renaming of old one.
8
92011-07-05 Manoj Srivastava <srivasta@ieee.org>
10
11 * themes/manoj-dark-theme.el (manoj-dark): New file.
12
12011-03-29 Kevin Ryde <user42@zip.com.au> 132011-03-29 Kevin Ryde <user42@zip.com.au>
2 14
3 * compilation.txt (perl-Test2): New samples. 15 * compilation.txt (perl-Test2): New samples.
diff --git a/etc/NEWS b/etc/NEWS
index d123073bd79..66b173751bf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -130,8 +130,8 @@ difference), but if it were a direct list of user names and passwords,
130you will be prompted for the user name and the password instead, and 130you will be prompted for the user name and the password instead, and
131they will then be saved to ~/.authinfo. 131they will then be saved to ~/.authinfo.
132 132
133** Similarly, if you had `smtpmail-starttls-credentials' set, then 133** Similarly, `smtpmail-starttls-credentials' no longer exists. If
134then you need to put 134you had thet set, then then you need to put
135 135
136machine smtp.whatever.foo port 25 key "~/.my_smtp_tls.key" cert "~/.my_smtp_tls.cert" 136machine smtp.whatever.foo port 25 key "~/.my_smtp_tls.key" cert "~/.my_smtp_tls.cert"
137 137
@@ -475,6 +475,11 @@ Just set shell-dir-cookie-re to an appropriate regexp.
475 475
476** BibTeX mode 476** BibTeX mode
477 477
478*** BibTeX mode now supports biblatex.
479Use the variable bibtex-dialect to select support for different BibTeX dialects.
480bibtex-entry-field-alist is now an obsolete alias for
481bibtex-BibTeX-entry-alist.
482
478*** New command `bibtex-search-entries' bound to C-c C-a. 483*** New command `bibtex-search-entries' bound to C-c C-a.
479 484
480*** New `bibtex-entry-format' option `sort-fields', disabled by default. 485*** New `bibtex-entry-format' option `sort-fields', disabled by default.
@@ -857,6 +862,13 @@ soap-inspect.el is an interactive inspector for SOAP WSDL structures.
857 862
858** xmodmap-generic-mode for xmodmap files. 863** xmodmap-generic-mode for xmodmap files.
859 864
865** New emacs-lock.el package.
866(The pre-existing one has been renamed to old-emacs-lock.el and moved
867to obsolete/.) Now, Emacs Lock is a proper minor mode
868`emacs-lock-mode'. Protection against exiting Emacs and killing the
869buffer can be set separately. The mechanism for auto turning off
870protection for buffers with inferior processes has been generalized.
871
860 872
861* Incompatible Lisp Changes in Emacs 24.1 873* Incompatible Lisp Changes in Emacs 24.1
862 874
diff --git a/etc/themes/manoj-dark-theme.el b/etc/themes/manoj-dark-theme.el
new file mode 100644
index 00000000000..bd6bbaa88a2
--- /dev/null
+++ b/etc/themes/manoj-dark-theme.el
@@ -0,0 +1,700 @@
1;;; manoj-dark.el --- A dark theme from Manoj
2
3;; Copyright (C) 2011 Free Software Foundation, Inc.
4
5;; Author: Manoj Srivastava <srivasta@ieee.org>
6;; Keywords: lisp, faces
7
8;; This program is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; This program is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21;;; Commentary:
22
23;; I spend a lot of time workin in front of a screen (many hours in a
24;; dimly lit room) and eye fatigue is an issue. This is a dark color
25;; theme for emacs, which is easier on the eyes than light themes.
26
27;; It does not help that I am blue-green color blind, so subtle
28;; variations are often lost on me. I do want to use color contrast to
29;; increase productivity, but I also want to avoid the jarring angry
30;; fruit salad look, and so I am in the process of crafting a logical
31;; color scheme that is high contrast enough for me, without being too
32;; unpleasing.
33
34;; In circumstances where there a lot of related faces that can be
35;; viewed, for example, the Gnus group buffer, consistent and logical
36;; color choices are the only sane option. Gnus groups can be newa
37;; (blueish) or mail (greenish), have states (large number of under
38;; messages, normal, and empty). The large number unread groups have
39;; highest luminance (appear brighter), and the empty one have lower
40;; luminance (appear greyer), but have the same chroma and saturation.
41;; Sub states and group priorities are rendered using a color series
42;; which has constant luminance and saturation, and vary in hue by a
43;; constant separation -- so all the related groups have the same
44;; brightness ({mail,news}/{unread,normal,empty}), and a graded
45;; selection of foreground colors. It sounds more complicated that it
46;; looks. The eye is drawn naturally to the unread groups, and first
47;; to the mail, then USENET groups (which is my preference).
48
49;; Similar color variations occur for individual messages in a group;
50;; high scoring messages bubble to the top, and have a higher
51;; luminance. This color schema has made me slightly faster at
52;; reading mail/USENET.
53
54;; In the message itself, quoted mail messages from different people
55;; are color coordinated, with high contrast beteen citations that are
56;; close to each other in the heirarchy, so it is less likely that one
57;; misunderstands who said what in a long conversation.
58
59;; The following scheme covers programming languages, Gnus, Erc, mail,
60;; org-mode, CUA-mode, apt-utils, bbdb, compilation buffers, changelog
61;; mode, diff and ediff, eshell, and more. You need emacs-goodies
62;; package on Debian to use this. See the wiki page at
63;; http://www.emacswiki.org/cgi-bin/wiki?ColorTheme for details. The
64;; project home page is at https://gna.org/projects/color-theme.
65
66;;; Code:
67
68(deftheme manoj-dark
69 "Very high contrast faces with a black background.
70This theme avoids subtle color variations, while avoiding the
71jarring angry fruit salad look to reduce eye fatigue.")
72
73(custom-theme-set-faces
74 'manoj-dark
75 '(default ((t (:background "black" :foreground "WhiteSmoke"))))
76 ;; Font lock faces
77 '(font-lock-builtin-face ((t (:foreground "LightSteelBlue"))))
78 '(font-lock-constant-face ((t (:foreground "LightSlateBlue" :bold t))))
79 '(font-lock-preprocessor-face ((t (:foreground "CornFlowerBlue" :italic t))))
80 '(font-lock-keyword-face ((t (:foreground "cyan1"))))
81 '(font-lock-type-face ((t (:foreground "SteelBlue1"))))
82 '(font-lock-regexp-grouping-backslash ((t (:bold t :weight bold))))
83 '(font-lock-regexp-grouping-construct ((t (:bold t :weight bold))))
84 '(font-lock-variable-name-face ((t (:foreground "Aquamarine"))))
85 '(font-lock-function-name-face ((t (:foreground "mediumspringgreen"
86 :weight bold :height 1.1))))
87 '(font-lock-string-face ((t (:foreground "RosyBrown1"))))
88 '(font-lock-comment-face ((t (:italic t :slant oblique :foreground "chocolate1"))))
89 '(font-lock-comment-delimiter-face ((t (:foreground "Salmon"))))
90 '(font-lock-doc-face ((t (:italic t :slant oblique :foreground "LightCoral"))))
91 '(font-lock-doc-string-face ((t (:foreground "Plum"))))
92 '(font-lock-warning-face ((t (:bold t :foreground "Pink" :weight bold))))
93
94 '(cperl-array-face ((t (:foreground "LawnGreen" :background "B;ack" :bold t))))
95 '(cperl-hash-face ((t (:foreground "SpringGreen" :background "B;ack" :bold t :italic t))))
96 '(cperl-nonoverridable-face ((t (:foreground "chartreuse3"))))
97
98 '(gnus-button ((t (:bold t :weight bold :background "#191932" :box (:line-width 2 :style released-button)))))
99 '(gnus-cite-attribution-face ((t (:italic t))))
100 '(gnus-cite-face-1 ((t (:foreground "CornflowerBlue"))))
101 '(gnus-cite-face-2 ((t (:foreground "PaleGreen"))))
102 '(gnus-cite-face-3 ((t (:foreground "LightGoldenrod"))))
103 '(gnus-cite-face-4 ((t (:foreground "LightPink"))))
104 '(gnus-cite-face-5 ((t (:foreground "turquoise"))))
105 '(gnus-cite-face-6 ((t (:foreground "khaki"))))
106 '(gnus-cite-face-7 ((t (:foreground "plum"))))
107 '(gnus-cite-face-8 ((t (:foreground "DeepSkyBlue1"))))
108 '(gnus-cite-face-9 ((t (:foreground "chartreuse1"))))
109 '(gnus-cite-face-10 ((t (:foreground "thistle1"))))
110 '(gnus-cite-face-11 ((t (:foreground "LightYellow1"))))
111 '(gnus-emphasis-bold ((t (:bold t :weight bold))))
112 '(gnus-emphasis-bold-italic ((t (:italic t :bold t :slant italic :weight bold))))
113 '(gnus-emphasis-highlight-words ((t (:background "black" :foreground "yellow"))))
114 '(gnus-emphasis-italic ((t (:italic t :slant italic))))
115 '(gnus-emphasis-strikethru ((t (:strike-through t))))
116 '(gnus-emphasis-underline ((t (:underline t))))
117 '(gnus-emphasis-underline-bold ((t (:bold t :underline t :weight bold))))
118 '(gnus-emphasis-underline-bold-italic ((t (:italic t :bold t :underline t :slant italic :weight bold))))
119 '(gnus-emphasis-underline-italic ((t (:italic t :underline t :slant italic))))
120
121 '(gnus-header-content ((t (:italic t :foreground "DarkKhaki" :slant italic))))
122 '(gnus-header-content-face ((t (:italic t :foreground "DarkKhaki" :slant italic))))
123 '(gnus-header-from ((t (:foreground "PaleGreen1"))))
124 '(gnus-header-from-face ((t (:foreground "PaleGreen1"))))
125 '(gnus-header-name ((t (:bold t :foreground "BlanchedAlmond" :weight bold))))
126 '(gnus-header-name-face ((t (:bold t :foreground "BlanchedAlmond" :weight bold))))
127 '(gnus-header-newsgroups ((t (:italic t :foreground "yellow" :slant italic))))
128 '(gnus-header-newsgroups-face ((t (:italic t :foreground "yellow" :slant italic))))
129 '(gnus-header-subject ((t (:foreground "coral1"))))
130 '(gnus-header-subject-face ((t (:foreground "coral1"))))
131 '(gnus-signature ((t (:italic t :slant italic))))
132 '(gnus-signature-face ((t (:italic t :slant italic))))
133 '(gnus-splash ((t (:foreground "#cccccc"))))
134 '(gnus-summary-cancelled ((t (:background "black" :foreground "yellow"))))
135 '(gnus-summary-cancelled-face ((t (:background "black" :foreground "yellow"))))
136 '(gnus-summary-high-ancient ((t (:bold t :foreground "CornflowerBlue" :weight bold))))
137 '(gnus-summary-high-ancient-face ((t (:bold t :foreground "CornflowerBlue" :weight bold))))
138 '(gnus-summary-normal-ancient ((t (:foreground "SkyBlue"))))
139 '(gnus-summary-normal-ancient-face ((t (:foreground "SkyBlue"))))
140 '(gnus-summary-low-ancient ((t (:italic t :foreground "LightSteelBlue" :slant italic))))
141 '(gnus-summary-low-ancien-facet ((t (:italic t :foreground "LightSteelBlue" :slant italic))))
142
143 '(gnus-summary-high-read ((t (:bold t :foreground "grey60" :weight bold))))
144 '(gnus-summary-high-read-face ((t (:bold t :foreground "grey60" :weight bold))))
145 '(gnus-summary-normal-read ((t (:foreground "grey50"))))
146 '(gnus-summary-normal-read-face ((t (:foreground "grey50"))))
147 '(gnus-summary-low-read ((t (:italic t :foreground "LightSlateGray" :slant italic))))
148 '(gnus-summary-low-read-face ((t (:italic t :foreground "LightSlateGray" :slant italic))))
149
150 '(gnus-summary-high-ticked ((t (:bold t :foreground "RosyBrown" :weight bold))))
151 '(gnus-summary-high-ticked-face ((t (:bold t :foreground "RosyBrown" :weight bold))))
152 '(gnus-summary-normal-ticked ((t (:foreground "LightSalmon"))))
153 '(gnus-summary-normal-ticked-face ((t (:foreground "LightSalmon"))))
154 '(gnus-summary-low-ticked ((t (:italic t :foreground "pink" :slant italic))))
155 '(gnus-summary-low-ticked-face ((t (:italic t :foreground "pink" :slant italic))))
156
157 '(gnus-summary-high-undownloaded ((t (:bold t :foreground "ivory3" :weight bold))))
158 '(gnus-summary-normal-undownloaded ((t (:foreground "LightGray" :weight normal))))
159 '(gnus-summary-low-undownloaded ((t (:italic t :foreground "grey75" :slant italic :weight normal))))
160
161 '(gnus-summary-high-unread ((t (:bold t :foreground "PaleGreen" :weight bold))))
162 '(gnus-summary-high-unread-face ((t (:bold t :foreground "PaleGreen" :weight bold))))
163 '(gnus-summary-normal-unread ((t (:foreground "YellowGreen"))))
164 '(gnus-summary-normal-unread-face ((t (:foreground "YellowGreen"))))
165 '(gnus-summary-low-unread ((t (:italic t :foreground "MediumSeaGreen" :slant italic))))
166 '(gnus-summary-low-unread-face ((t (:italic t :foreground "MediumSeaGreen" :slant italic))))
167 '(gnus-summary-root-face ((t (:bold t :foreground "Red" :weight bold))))
168 '(gnus-summary-selected ((t (:underline t :foreground "LemonChiffon"))))
169 '(gnus-summary-selected-face ((t (:underline t :foreground "LemonChiffon"))))
170 '(gnus-user-agent-bad-face ((t (:bold t :background "black" :foreground "red" :weight bold))))
171 '(gnus-user-agent-good-face ((t (:background "black" :foreground "green"))))
172 '(gnus-user-agent-unknown-face ((t (:bold t :background "black" :foreground "orange" :weight bold))))
173 '(gnus-x-face ((t (:background "white" :foreground "black"))))
174
175 '(gnus-group-mail-1 ((t (:bold t :foreground "#3BFF00" :weight normal))))
176 '(gnus-group-mail-1-face ((t (:bold t :foreground "#3BFF00" :weight normal))))
177 '(gnus-group-mail-2 ((t (:bold t :foreground "#5EFF00" :weight normal))))
178 '(gnus-group-mail-2-face ((t (:bold t :foreground "#5EFF00" :weight normal))))
179 '(gnus-group-mail-3 ((t (:bold t :foreground "#80FF00" :weight normal))))
180 '(gnus-group-mail-3-face ((t (:bold t :foreground "#A1FF00" :weight normal))))
181
182
183 '(gnus-group-mail-1-empty ((t (:foreground "#249900"))))
184 '(gnus-group-mail-1-empty-face ((t (:foreground "#249900"))))
185 '(gnus-group-mail-2-empty ((t (:foreground "#389900"))))
186 '(gnus-group-mail-2-empty-face ((t (:foreground "#389900"))))
187 '(gnus-group-mail-3-empty ((t (:foreground "#4D9900"))))
188 '(gnus-group-mail-3-empty-face ((t (:foreground "#4D9900"))))
189
190 '(gnus-group-mail-low ((t (:bold t :foreground "aquamarine2" :weight bold))))
191 '(gnus-group-mail-low-face ((t (:bold t :foreground "aquamarine2" :weight bold))))
192 '(gnus-group-mail-low-empty ((t (:foreground "aquamarine2"))))
193 '(gnus-group-mail-low-empty-face ((t (:foreground "aquamarine2"))))
194
195 '(gnus-group-news-1 ((t (:bold t :foreground "#8480FF" :weight bold))))
196 '(gnus-group-news-1-face ((t (:bold t :foreground "#8480FF" :weight bold))))
197 '(gnus-group-news-2 ((t (:bold t :foreground "#8088FF" :weight bold))))
198 '(gnus-group-news-2-face ((t (:bold t :foreground "#8088FF" :weight bold))))
199 '(gnus-group-news-3 ((t (:bold t :foreground "#8095FF" :weight bold))))
200 '(gnus-group-news-3-face ((t (:bold t :foreground "#8095FF" :weight bold))))
201 '(gnus-group-news-4 ((t (:bold t :foreground "#80A1FF" :weight bold))))
202 '(gnus-group-news-4-face ((t (:bold t :foreground "#80A1FF" :weight bold))))
203 '(gnus-group-news-5 ((t (:bold t :foreground "#80AEFF" :weight bold))))
204 '(gnus-group-news-5-face ((t (:bold t :foreground "#80AEFF" :weight bold))))
205 '(gnus-group-news-6 ((t (:bold t :foreground "#80BBFF" :weight bold))))
206 '(gnus-group-news-6-face ((t (:bold t :foreground "#80BBFF" :weight bold))))
207
208 '(gnus-group-news-1-empty ((t (:foreground "#524DFF"))))
209 '(gnus-group-news-1-empty-face ((t (:foreground "#524DFF"))))
210 '(gnus-group-news-2-empty ((t (:foreground "#4D58FF"))))
211 '(gnus-group-news-2-empty-face ((t (:foreground "#4D58FF"))))
212 '(gnus-group-news-3-empty ((t (:foreground "#4D6AFF"))))
213 '(gnus-group-news-3-empty-face ((t (:foreground "#4D6AFF"))))
214 '(gnus-group-news-4-empty ((t (:foreground "#4D7CFF"))))
215 '(gnus-group-news-4-empty-face ((t (:foreground "#4D7CFF"))))
216 '(gnus-group-news-5-empty ((t (:foreground "#4D8EFF"))))
217 '(gnus-group-news-5-empty-face ((t (:foreground "#4D8EFF"))))
218 '(gnus-group-news-6-empty ((t (:foreground "#4DA0FF"))))
219 '(gnus-group-news-6-empty-face ((t (:foreground "#4DA0FF"))))
220
221 '(gnus-group-news-low ((t (:bold t :foreground "DarkTurquoise" :weight bold))))
222 '(gnus-group-news-low-face ((t (:bold t :foreground "DarkTurquoise" :weight bold))))
223 '(gnus-group-news-low-empty ((t (:foreground "DarkTurquoise"))))
224 '(gnus-group-news-low-empty-face ((t (:foreground "DarkTurquoise"))))
225
226 ;;message faces
227 '(message-cited-text ((t (:foreground "red3"))))
228 '(message-header-cc ((t (:bold t :foreground "chartreuse1" :weight bold))))
229 '(message-header-cc-face ((t (:bold t :foreground "chartreuse1" :weight bold))))
230 '(message-header-name ((t (:foreground "green"))))
231 '(message-header-name-face ((t (:foreground "green"))))
232 '(message-header-newsgroups ((t (:italic t :bold t :foreground "papaya whip" :slant italic :weight bold))))
233 '(message-header-newsgroups-face ((t (:italic t :bold t :foreground "papaya whip" :slant italic :weight bold))))
234 '(message-header-other ((t (:foreground "ivory"))))
235 '(message-header-other-face ((t (:foreground "ivory"))))
236 '(message-header-subject ((t (:foreground "OliveDrab1"))))
237 '(message-header-subject-face ((t (:foreground "OliveDrab1"))))
238 '(message-header-to ((t (:bold t :foreground "floral white" :weight bold))))
239 '(message-header-to-face ((t (:bold t :foreground "floral white" :weight bold))))
240 '(message-header-xheader ((t (:foreground "DeepSkyBlue1"))))
241 '(message-header-xheader-face ((t (:foreground "DeepSkyBlue1"))))
242 '(message-mml ((t (:foreground "MediumSpringGreen"))))
243 '(message-mml-face ((t (:foreground "MediumSpringGreen"))))
244 '(message-separator ((t (:foreground "LightSkyBlue1"))))
245 '(message-separator-face ((t (:foreground "LightSkyBlue1"))))
246 '(message-url ((t (:bold t :foreground "blue" :weight bold))))
247
248 '(bg:erc-color-face0 ((t (:background "saddle brown"))))
249 '(bg:erc-color-face1 ((t (:background "black"))))
250 '(bg:erc-color-face10 ((t (:background "DodgerBlue4"))))
251 '(bg:erc-color-face11 ((t (:background "cyan4"))))
252 '(bg:erc-color-face12 ((t (:background "blue"))))
253 '(bg:erc-color-face13 ((t (:background "deeppink"))))
254 '(bg:erc-color-face14 ((t (:background "gray50"))))
255 '(bg:erc-color-face15 ((t (:background "grey15"))))
256 '(bg:erc-color-face2 ((t (:background "blue4"))))
257 '(bg:erc-color-face3 ((t (:background "green4"))))
258 '(bg:erc-color-face4 ((t (:background "red"))))
259 '(bg:erc-color-face5 ((t (:background "brown"))))
260 '(bg:erc-color-face6 ((t (:background "purple"))))
261 '(bg:erc-color-face7 ((t (:background "orange"))))
262 '(bg:erc-color-face8 ((t (:background "yellow4"))))
263 '(bg:erc-color-face9 ((t (:background "green"))))
264 '(erc-action-face ((t (:bold t :weight bold :foreground "turquoise1"))))
265 '(erc-bold-face ((t (:bold t :weight bold))))
266 '(erc-button ((t (:bold t :weight bold :foreground "RoyalBlue1" :box (:line-width 2 :style released-button)))))
267 '(erc-button-face ((t (:bold t :weight bold :foreground "RoyalBlue1" :box (:line-width 2 :style released-button)))))
268 '(erc-command-indicator-face ((t (:bold t :weight bold))))
269 '(erc-current-nick-face ((t (:bold t :foreground "DarkTurquoise" :weight bold))))
270 '(erc-dangerous-host-face ((t (:foreground "red"))))
271 '(erc-direct-msg-face ((t (:foreground "sandybrown"))))
272 '(erc-error-face ((t (:foreground "red"))))
273 '(erc-fool-face ((t (:foreground "dim gray"))))
274 '(erc-header-line ((t (:background "grey95" :foreground "ConFlowerBlue"))))
275 '(erc-input-face ((t (:foreground "brown"))))
276 '(erc-inverse-face ((t (:background "Black" :foreground "White"))))
277 '(erc-keyword-face ((t (:bold t :foreground "pale green" :weight bold))))
278 '(erc-my-nick-face ((t (:bold t :foreground "brown" :weight bold))))
279 '(erc-nick-default-face ((t (:bold t :weight bold :foreground "DodgerBlue1"))))
280 '(erc-button-nickname-face ((t (:bold t :weight bold :background "lightgrey" :foreground "black" :box (:line-width 2 :style released-button) ))))
281 '(erc-nick-msg-face ((t (:bold t :foreground "IndianRed" :weight bold))))
282 '(erc-notice-face ((t (:bold t :foreground "SlateBlue" :weight bold))))
283 '(erc-pal-face ((t (:bold t :foreground "Magenta" :weight bold))))
284 '(erc-prompt-face ((t (:bold t :background "Navy" :foreground "lightBlue2" :weight bold))))
285 '(erc-timestamp-face ((t (:bold t :foreground "SeaGreen1" :weight bold))))
286 '(erc-underline-face ((t (:underline t))))
287 '(fg:erc-color-face0 ((t (:foreground "BlanchedAlmond"))))
288 '(fg:erc-color-face1 ((t (:foreground "beige"))))
289 '(fg:erc-color-face10 ((t (:foreground "pale goldenrod"))))
290 '(fg:erc-color-face11 ((t (:foreground "cyan"))))
291 '(fg:erc-color-face12 ((t (:foreground "lightblue1"))))
292 '(fg:erc-color-face13 ((t (:foreground "deeppink"))))
293 '(fg:erc-color-face14 ((t (:foreground "gray50"))))
294 '(fg:erc-color-face15 ((t (:foreground "gray90"))))
295 '(fg:erc-color-face2 ((t (:foreground "blue4"))))
296 '(fg:erc-color-face3 ((t (:foreground "green4"))))
297 '(fg:erc-color-face4 ((t (:foreground "red"))))
298 '(fg:erc-color-face5 ((t (:foreground "brown"))))
299 '(fg:erc-color-face6 ((t (:foreground "purple"))))
300 '(fg:erc-color-face7 ((t (:foreground "orange"))))
301 '(fg:erc-color-face8 ((t (:foreground "yellow"))))
302 '(fg:erc-color-face9 ((t (:foreground "green"))))
303
304 '(org-agenda-date ((t (:foreground "LightSkyBlue"))))
305 '(org-agenda-date-weekend ((t (:bold t :foreground "LightSkyBlue" :weight bold))))
306 '(org-agenda-restriction-lock ((t (:background "skyblue4"))))
307 '(org-agenda-structure ((t (:foreground "LightSkyBlue"))))
308 '(org-archived ((t (:foreground "grey70"))))
309 '(org-code ((t (:foreground "grey70"))))
310 '(org-column ((t (:background "grey30" :slant normal :weight normal :height 81 :family "unknown-DejaVu Sans Mono"))))
311 '(org-column-title ((t (:bold t :background "grey30" :underline t :weight bold))))
312 '(org-date ((t (:foreground "Cyan" :underline t))))
313 '(org-done ((t (:bold t :foreground "PaleGreen" :weight bold))))
314 '(org-drawer ((t (:foreground "LightSkyBlue"))))
315 '(org-ellipsis ((t (:foreground "LightGoldenrod" :underline t))))
316 '(org-formula ((t (:foreground "chocolate1"))))
317 '(org-headline-done ((t (:foreground "LightSalmon"))))
318 '(org-hide ((t (:foreground "black"))))
319 '(org-latex-and-export-specials ((t (:foreground "burlywood"))))
320 '(org-level-1 ((t (:foreground "LightSkyBlue"))))
321 '(org-level-2 ((t (:foreground "LightGoldenrod"))))
322 '(org-level-3 ((t (:foreground "Cyan1"))))
323 '(org-level-4 ((t (:foreground "chocolate1"))))
324 '(org-level-5 ((t (:foreground "PaleGreen"))))
325 '(org-level-6 ((t (:foreground "Aquamarine"))))
326 '(org-level-7 ((t (:foreground "LightSteelBlue"))))
327 '(org-level-8 ((t (:foreground "LightSalmon"))))
328 '(org-link ((t (:foreground "Cyan" :underline t))))
329 '(org-mode-line-clock ((t (:foreground "DarkGreen" :underline t))))
330 '(org-scheduled-previously ((t (:foreground "chocolate1"))))
331 '(org-scheduled-today ((t (:foreground "PaleGreen"))))
332 '(org-sexp-date ((t (:foreground "Cyan"))))
333 '(org-special-keyword ((t (:foreground "LightSalmon"))))
334 '(org-table ((t (:foreground "LightSkyBlue"))))
335 '(org-tag ((t (:bold t :weight bold))))
336 '(org-target ((t (:underline t))))
337 '(org-time-grid ((t (:foreground "LightGoldenrod"))))
338 '(org-todo ((t (:bold t :foreground "Pink" :weight bold))))
339 '(org-upcoming-deadline ((t (:foreground "chocolate1"))))
340 '(org-verbatim ((t (:foreground "grey70" :underline t))))
341 '(org-warning ((t (:bold t :weight bold :foreground "Pink"))))
342 '(outline-1 ((t (:foreground "LightSkyBlue"))))
343 '(outline-2 ((t (:foreground "LightGoldenrod"))))
344 '(outline-3 ((t (:foreground "Cyan1"))))
345 '(outline-4 ((t (:foreground "chocolate1"))))
346 '(outline-5 ((t (:foreground "PaleGreen"))))
347 '(outline-6 ((t (:foreground "Aquamarine"))))
348 '(outline-7 ((t (:foreground "LightSteelBlue"))))
349 '(outline-8 ((t (:foreground "LightSalmon"))))
350
351
352 '(CUA-global-mark-face ((t (:background "cyan" :foreground "black"))))
353 '(CUA-rectangle-face ((t (:background "maroon" :foreground "white"))))
354 '(CUA-rectangle-noselect-face ((t (:background "dimgray" :foreground "white"))))
355 '(Info-title-1-face ((t (:bold t :weight bold :family "helv" :height 1.728))))
356 '(Info-title-2-face ((t (:bold t :family "helv" :weight bold :height 1.44))))
357 '(Info-title-3-face ((t (:bold t :weight bold :family "helv" :height 1.2))))
358 '(Info-title-4-face ((t (:bold t :family "helv" :weight bold))))
359 '(align-highlight-nochange-face ((t (:background "SkyBlue4"))))
360
361 '(antlr-font-lock-keyword-face ((t (:foreground "SteelBlue")))) ;%
362 '(antlr-font-lock-literal-face ((t (:foreground "PaleVioletRed"))))
363 '(antlr-font-lock-ruledef-face ((t (:foreground "DarkGreen"))))
364 '(antlr-font-lock-ruleref-face ((t (:foreground "SteelBlue"))))
365 '(antlr-font-lock-tokendef-face ((t (:foreground "khaki"))))
366 '(antlr-font-lock-tokenref-face ((t (:foreground "LightSteelBlue4"))))
367
368 '(bbdb-company ((t (:italic t :slant italic :foreground "indian red"))))
369 '(bbdb-field-name ((t (:bold t :weight bold :foreground "steel blue"))))
370 '(bbdb-field-value ((t (:foreground "AntiqueWhite2"))))
371 '(bbdb-name ((t (:underline t :foreground "cadet blue"))))
372
373 '(bold ((t (:bold t :weight bold))))
374 '(bold-italic ((t (:bold t :italic t :slant italic :weight bold))))
375 '(border ((t (:background "gold" :foreground "black" ))))
376 '(buffer-menu-buffer ((t (:bold t :weight bold))))
377 '(button ((t (:underline t :box (:line-width 2 :color "grey"
378 :style released-button)
379 :foreground "black" :background "grey"
380 :weight bold ))))
381 '(calendar-today-face ((t (:underline t :bold t :foreground "cornsilk"))))
382 '(change-log-acknowledgement-face ((t (:italic t :slant oblique :foreground "AntiqueWhite3"))))
383 '(change-log-conditionals-face ((t (:foreground "Aquamarine"))))
384 '(change-log-date-face ((t (:italic t :slant oblique :foreground "BurlyWood"))))
385 '(change-log-email-face ((t (:foreground "Aquamarine"))))
386 '(change-log-file-face ((t (:bold t :family "Verdana" :weight bold :foreground "LightSkyBlue" :height 0.9))))
387 '(change-log-function-face ((t (:foreground "Aquamarine"))))
388 '(change-log-list-face ((t (:foreground "LightSkyBlue"))))
389 '(change-log-name-face ((t (:bold t :weight bold :foreground "Gold"))))
390
391 '(comint-highlight-input ((t (:bold t :weight bold))))
392 '(comint-highlight-prompt ((t (:foreground "cyan1"))))
393 '(compilation-column-number ((t (:foreground "PaleGreen"))))
394 '(compilation-error ((t (:bold t :weight bold :foreground "Brown1"))))
395 '(compilation-info ((t (:bold t :foreground "LightPink1" :weight bold))))
396 '(compilation-line-number ((t (:foreground "LightGoldenrod"))))
397 '(compilation-message-face ((t (:underline t))))
398 '(compilation-warning ((t (:bold t :foreground "Orange" :weight bold))))
399 '(compilation-warning-face ((t (:bold t :foreground "Orange" :weight bold))))
400 '(completions-common-part ((t (:family "unknown-DejaVu Sans Mono"
401 :width normal :weight normal
402 :slant normal :foreground "WhiteSmoke"
403 :background "black" :height 81))))
404 '(completions-first-difference ((t (:bold t :weight bold))))
405
406 '(css-selector ((t (:foreground "LightSteelBlue"))))
407 '(css-property ((t (:foreground "light sea green"))))
408
409 '(cursor ((t (:background "orchid"))))
410 '(custom-button-face ((t (:background "lightgrey" :foreground "black"
411 :box '(:line-width 2 :style released-button)))))
412 '(custom-button-pressed-face ((t (:background "lightgrey"
413 :foreground "black"
414 :box '(:line-width 2 :style pressed-button)))))
415 '(custom-changed-face ((t (:foreground "wheat" :background "blue"))))
416 '(custom-comment-face ((t (:background "dim gray"))))
417 '(custom-comment-tag-face ((t (:foreground "gray80"))))
418 '(custom-face-tag-face ((t (:bold t :family "helv" :weight bold :height 1.1))))
419 '(custom-group-tag-face ((t (:bold t :family "helv" :foreground "light blue" :weight bold :height 1.1))))
420 '(custom-group-tag-face-1 ((t (:bold t :family "helv" :foreground "pink" :weight bold :height 1.1))))
421 '(custom-invalid-face ((t (:background "red" :foreground "yellow"))))
422 '(custom-modified-face ((t (:background "blue" :foreground "white"))))
423 '(custom-rogue-face ((t (:background "black" :foreground "pink"))))
424 '(custom-saved-face ((t (:underline t))))
425 '(custom-set-face ((t (:background "white" :foreground "blue"))))
426 '(custom-state-face ((t (:foreground "lime green"))))
427 '(custom-variable-button-face ((t (:bold t :underline t :weight bold
428 :background "lightgrey"
429 :foreground "black"
430 :box '(:line-width 2 :style released-button)))))
431 '(custom-variable-tag-face ((t (:bold t :family "helv"
432 :foreground "light blue"
433 :weight bold :height 1.2))))
434
435 '(diary ((t (:foreground "IndianRed"))))
436 '(diary-anniversary ((t (:foreground "Cyan1"))))
437 '(diary-button ((t (:background "lightgrey" :foreground "black" :box (:line-width 2 :style released-button)))))
438 '(diary-face ((t (:foreground "IndianRed"))))
439 '(diary-time ((t (:foreground "LightGoldenrod"))))
440 '(diff-added ((t (:foreground "Green"))))
441 '(diff-added-face ((t (:foreground "Green"))))
442 '(diff-changed-face ((t (:foreground "Khaki"))))
443 '(diff-context-face ((t (:foreground "grey70"))))
444 '(diff-file-header ((t (:bold t :background "grey20" :foreground "ivory1" :weight bold))))
445 '(diff-file-header-face ((t (:bold t :background "grey20" :foreground "ivory1" :weight bold))))
446 '(diff-function-face ((t (:foreground "SpringGreen1"))))
447 '(diff-header-face ((t (:background "SlateBlue4"))))
448 '(diff-hunk-header ((t (:slant italic :background "DodgerBlue4"))))
449 '(diff-hunk-header-face ((t (:slant italic :background "DodgerBlue4"))))
450 '(diff-index-face ((t (:bold t :weight bold :background "SteelBlue4" :foreground "linen" ))))
451 '(diff-nonexistent ((t (:bold t :weight bold :background "Black" :foreground "Wheat1"))))
452 '(diff-nonexistent-face ((t (:bold t :weight bold :background "Black" :foreground "Wheat1"))))
453 '(diff-removed ((t (:foreground "salmon1"))))
454 '(diff-removed-face ((t (:foreground "salmon1"))))
455 '(diff-refine-change-face ((t (:background "MidnightBlue"))))
456 '(diff-refine-change ((t (:background "MidnightBlue"))))
457
458 '(ediff-current-diff-face-A ((t (:foreground "firebrick" :background "pale green"))))
459 '(ediff-current-diff-face-Ancestor ((t (:foreground "Black" :background "VioletRed"))))
460 '(ediff-current-diff-face-B ((t (:foreground "DarkOrchid" :background "Yellow"))))
461 '(ediff-current-diff-face-C ((t (:foreground "Navy" :background "Pink"))))
462 '(ediff-even-diff-face-A ((t (:foreground "Black" :background "light grey"))))
463 '(ediff-even-diff-face-Ancestor ((t (:foreground "White" :background "Grey"))))
464 '(ediff-even-diff-face-B ((t (:foreground "White" :background "Grey"))))
465 '(ediff-even-diff-face-C ((t (:foreground "Black" :background "light grey"))))
466 '(ediff-fine-diff-face-A ((t (:foreground "Navy" :background "sky blue"))))
467 '(ediff-fine-diff-face-Ancestor ((t (:foreground "Black" :background "Green"))))
468 '(ediff-fine-diff-face-B ((t (:foreground "Black" :background "cyan"))))
469 '(ediff-fine-diff-face-C ((t (:foreground "Black" :background "Turquoise"))))
470 '(ediff-odd-diff-face-A ((t (:foreground "White" :background "Grey"))))
471 '(ediff-odd-diff-face-Ancestor ((t (:foreground "Black" :background "light grey"))))
472 '(ediff-odd-diff-face-B ((t (:foreground "Black" :background "light grey"))))
473 '(ediff-odd-diff-face-C ((t (:foreground "White" :background "Grey"))))
474
475 '(eieio-custom-slot-tag-face ((t (:foreground "light blue"))))
476 '(eldoc-highlight-function-argument ((t (:bold t :weight bold))))
477 '(epa-field-body ((t (:italic t :foreground "turquoise" :slant italic))))
478 '(epa-field-name ((t (:bold t :foreground "PaleTurquoise" :weight bold))))
479 '(epa-mark ((t (:bold t :foreground "orange" :weight bold))))
480 '(epa-string ((t (:foreground "lightyellow"))))
481 '(epa-validity-disabled ((t (:italic t :slant italic))))
482 '(epa-validity-high ((t (:bold t :foreground "PaleTurquoise" :weight bold))))
483 '(epa-validity-low ((t (:italic t :slant italic))))
484 '(epa-validity-medium ((t (:italic t :foreground "PaleTurquoise" :slant italic))))
485
486 '(escape-glyph ((t (:foreground "cyan"))))
487
488 '(eshell-ls-archive-face ((t (:bold t :foreground "IndianRed"))))
489 '(eshell-ls-backup-face ((t (:foreground "Grey"))))
490 '(eshell-ls-clutter-face ((t (:foreground "DimGray"))))
491 '(eshell-ls-directory-face ((t (:bold t :foreground "MediumSlateBlue"))))
492 '(eshell-ls-executable-face ((t (:foreground "Coral"))))
493 '(eshell-ls-missing-face ((t (:foreground "black"))))
494 '(eshell-ls-picture-face ((t (:foreground "Violet"))))
495 '(eshell-ls-product-face ((t (:foreground "sandybrown"))))
496 '(eshell-ls-readonly-face ((t (:foreground "Aquamarine"))))
497 '(eshell-ls-special-face ((t (:foreground "Gold"))))
498 '(eshell-ls-symlink-face ((t (:foreground "DarkCyan" :bold t))))
499 '(eshell-ls-symlink-face ((t (:foreground "White"))))
500 '(eshell-ls-unreadable-face ((t (:foreground "DimGray"))))
501 '(eshell-prompt-face ((t (:foreground "MediumAquamarine"))))
502 '(eshell-test-failed-face ((t (:foreground "OrangeRed" :bold t))))
503 '(eshell-test-ok-face ((t (:foreground "Green" :bold t))))
504
505 '(excerpt ((t (:italic t))))
506 '(file-name-shadow ((t (:foreground "grey70"))))
507 '(fixed ((t (:bold t))))
508 '(fixed-pitch ((t (:family "courier"))))
509 '(flyspell-duplicate-face ((t (:foreground "IndianRed" :bold t :underline t))))
510 '(flyspell-incorrect-face ((t (:foreground "Pink" :bold t :underline t))))
511
512 '(fringe ((t (:background "grey30" :foreground "Wheat"))))
513 '(header-line ((t (:box (:line-width -1 :color "grey20" :style released-button) :background "grey20" :foreground "grey90" :height 0.9))))
514 '(help-argument-name ((t (:italic t :slant italic))))
515 '(highlight ((t (:background "gray10" :foreground "Old Lace"))))
516 '(hl-line ((t (:background "grey10" :foreground "Old Lace"))))
517 '(gnus-mouse-face ((t (:background "darkseagreen2" :foreground "blue"))))
518 '(erc-button-mouse-face ((t (:background "darkseagreen2" :foreground "blue"))))
519 '(align-highlight-change-face ((t (:background "darkseagreen2" :foreground "blue"))))
520 '(goto-address-url-mouse-face ((t (:background "darkseagreen2" :foreground "blue"))))
521 '(goto-address-url-mouse-face ((t (:background "darkseagreen2" :foreground "blue"))))
522 '(ispell-highlight-face ((t (:background "darkseagreen2" :foreground "blue"))))
523 '(ispell-highlight-face ((t (:background "darkseagreen2" :foreground "blue"))))
524 '(widget-mouse-face ((t (:background "darkseagreen2" :foreground "blue"))))
525
526 '(highlight-beyond-fill-column-face ((t (:underline t))))
527 '(highlight-changes ((t (:foreground nil :background "#382f2f"))))
528 '(highlight-changes-delete ((t (:foreground nil :background "#916868"))))
529
530 '(holiday ((t (:background "chocolate4"))))
531 '(holiday-face ((t (:background "chocolate4"))))
532
533 '(ibuffer-dired-buffer-face ((t (:foreground "mediumspringgreen" :weight bold :height 1.1))))
534 '(ibuffer-help-buffer-face ((t (:italic t :slant oblique :foreground "chocolate1"))))
535 '(ibuffer-hidden-buffer-face ((t (:bold t :foreground "Pink" :weight bold))))
536 '(ibuffer-occur-match-face ((t (:bold t :foreground "Pink" :weight bold))))
537 '(ibuffer-read-only-buffer-face ((t (:foreground "SteelBlue1"))))
538 '(ibuffer-special-buffer-face ((t (:foreground "SteelBlue1"))))
539
540 '(ido-first-match ((t (:bold t :weight bold))))
541 '(ido-incomplete-regexp ((t (:bold t :weight bold :foreground "Pink"))))
542 '(ido-indicator ((t (:background "red1" :foreground "yellow1" :width condensed))))
543 '(ido-only-match ((t (:foreground "ForestGreen"))))
544 '(ido-subdir ((t (:foreground "red1"))))
545 '(info-menu-5 ((t (:underline t))))
546 '(info-menu-header ((t (:bold t :family "helv" :weight bold))))
547 '(info-node ((t (:bold t :italic t :foreground "yellow"))))
548 '(info-node ((t (:italic t :bold t :foreground "white" :slant italic :weight bold))))
549 '(info-xref ((t (:bold t :foreground "DodgerBlue1"))))
550 '(info-xref ((t (:bold t :foreground "cyan" :weight bold))))
551 '(isearch ((t (:background "palevioletred2" :foreground "brown4"))))
552 '(isearch-fail ((t (:background "red4"))))
553 '(isearch-lazy-highlight-face ((t (:background "paleturquoise4"))))
554 '(isearch-secondary ((t (:foreground "red3"))))
555 '(italic ((t (:italic t))))
556
557 '(js2-builtin-face ((t (:foreground "sandy brown"))))
558 '(js2-comment-face ((t (:foreground "dark orchid"))))
559 '(js2-constant-face ((t (:foreground "pale violet red"))))
560 '(js2-error-face ((t (:background "indian red" :foreground "green" :bold t))))
561 '(js2-function-name-face ((t (:foreground "cadet blue"))))
562 '(js2-function-param-face ((t (:foreground "IndianRed1"))))
563 '(js2-instance-member-face ((t (:foreground "IndianRed1"))))
564 '(js2-jsdoc-tag-face ((t (:foreground "medium orchid"))))
565 '(js2-jsdoc-type-face ((t (:foreground "medium orchid"))))
566 '(js2-jsdoc-value-face ((t (:foreground "medium orchid"))))
567 '(js2-keyword-face ((t (:foreground "steel blue"))))
568 '(js2-private-function-call-face ((t (:foreground "cadet blue"))))
569 '(js2-private-member-face ((t (:foreground "IndianRed1"))))
570 '(js2-regexp-face ((t (:foreground "khaki"))))
571 '(js2-string-face ((t (:foreground "lemon chiffon"))))
572 '(js2-type-face ((t (:foreground "medium sea green"))))
573 '(js2-variable-name-face ((t (:foreground "IndianRed1"))))
574 '(js2-warning-face ((t (:background "indian red" :foreground "green"))))
575
576 '(lazy-highlight ((t (:background "paleturquoise4"))))
577 '(link ((t (:foreground "cyan1" :underline t))))
578 '(link-visited ((t (:underline t :foreground "violet"))))
579
580 '(makefile-space ((t (:background "hotpink"))))
581 '(man-bold ((t (:bold t))))
582 '(man-heading ((t (:bold t))))
583 '(man-italic ((t (:foreground "yellow"))))
584 '(man-xref ((t (:underline t))))
585 '(match ((t (:background "RoyalBlue3"))))
586 '(minibuffer-prompt ((t (:foreground "cyan"))))
587 '(mode-line ((t (:background "grey75" :foreground "Blue"
588 :box '(:line-width -1 :style released-button)
589 :height 0.9))))
590 '(mode-line-buffer-id ((t (:background "grey65" :foreground "red"
591 :bold t :weight bold :height 0.9))))
592 '(mode-line-emphasis ((t (:bold t :weight bold))))
593 '(mode-line-highlight ((t (:box (:line-width 2 :color "grey40"
594 :style released-button :height 0.9)))))
595 '(mode-line-inactive ((t (:background "grey30" :foreground "grey80"
596 :box '(:line-width -1 :color "grey40")
597 :weight light :height 0.9))))
598 '(mouse ((t (:background "OrangeRed"))))
599
600 '(next-error ((t (:background "blue3"))))
601 '(nobreak-space ((t (:foreground "cyan" :underline t))))
602 '(paren-blink-off ((t (:foreground "black"))))
603 '(paren-mismatch-face ((t (:bold t :background "white" :foreground "red"))))
604 '(paren-no-match-face ((t (:bold t :background "white" :foreground "red"))))
605 '(query-replace ((t (:foreground "brown4" :background "palevioletred2"))))
606 '(region ((t (:background "blue3"))))
607 '(scroll-bar ((t (:background "grey75" :foreground "WhiteSmoke"))))
608 '(secondary-selection ((t (:background "SkyBlue4"))))
609 '(semantic-dirty-token-face ((t (:background "lightyellow"))))
610 '(semantic-highlight-edits-face ((t (:background "gray20"))))
611 '(semantic-unmatched-syntax-face ((t (:underline "red"))))
612 '(senator-intangible-face ((t (:foreground "gray75"))))
613 '(senator-momentary-highlight-face ((t (:background "gray30"))))
614 '(senator-read-only-face ((t (:background "#664444"))))
615 '(sgml-doctype-face ((t (:foreground "orange"))))
616 '(sgml-end-tag-face ((t (:foreground "greenyellow"))))
617 '(sgml-entity-face ((t (:foreground "gold"))))
618 '(sgml-ignored-face ((t (:foreground "gray20" :background "gray60"))))
619 '(sgml-sgml-face ((t (:foreground "yellow"))))
620 '(sgml-start-tag-face ((t (:foreground "mediumspringgreen"))))
621 '(shadow ((t (:foreground "grey70"))))
622
623 '(show-paren-match ((t (:background "steelblue3"))))
624 '(show-paren-match-face ((t (:background "steelblue3"))))
625 '(show-paren-mismatch ((t (:background "purple" :foreground "white"))))
626 '(smerge-base ((t (:foreground "orange"))))
627 '(smerge-markers ((t (:background "grey30"))))
628 '(smerge-mine ((t (:foreground "cyan"))))
629 '(smerge-other ((t (:foreground "lightgreen"))))
630 '(smerge-refined-change ((t (:background "blue4"))))
631 '(speedbar-button-face ((t (:foreground "green3"))))
632 '(speedbar-directory-face ((t (:foreground "light blue"))))
633 '(speedbar-file-face ((t (:foreground "cyan"))))
634 '(speedbar-highlight-face ((t (:background "sea green"))))
635 '(speedbar-selected-face ((t (:foreground "red" :underline t))))
636 '(speedbar-separator-face ((t (:background "blue" :foreground "white" :overline "gray"))))
637 '(speedbar-tag-face ((t (:foreground "yellow"))))
638 '(table-cell ((t (:background "blue1" :foreground "gray90"))))
639
640 '(tool-bar ((t (:background "grey75" :foreground "black" :box (:line-width 1 :style released-button)))))
641 '(tooltip ((t (:family "helv" :background "lightyellow" :foreground "black"))))
642 '(trailing-whitespace ((t (:background "red1"))))
643 '(underline ((t (:underline t))))
644 '(variable-pitch ((t (:family "helv"))))
645 '(vcursor ((t (:foreground "blue" :background "cyan" :underline t))))
646 '(vertical-border ((t (:background "dim gray"))))
647 '(vhdl-font-lock-attribute-face ((t (:foreground "Orchid"))))
648 '(vhdl-font-lock-directive-face ((t (:foreground "CadetBlue"))))
649 '(vhdl-font-lock-enumvalue-face ((t (:foreground "Gold4"))))
650 '(vhdl-font-lock-function-face ((t (:foreground "Orchid4"))))
651 '(vhdl-font-lock-prompt-face ((t (:foreground "Red" :bold t))))
652 '(vhdl-font-lock-reserved-words-face ((t (:foreground "Orange" :bold t))))
653 '(vhdl-font-lock-translate-off-face ((t (:background "LightGray"))))
654 '(vhdl-speedbar-architecture-face ((t (:foreground "Blue"))))
655 '(vhdl-speedbar-architecture-selected-face ((t (:foreground "Blue" :underline t))))
656 '(vhdl-speedbar-configuration-face ((t (:foreground "DarkGoldenrod"))))
657 '(vhdl-speedbar-configuration-selected-face ((t (:foreground "DarkGoldenrod" :underline t))))
658 '(vhdl-speedbar-entity-face ((t (:foreground "ForestGreen"))))
659 '(vhdl-speedbar-entity-selected-face ((t (:foreground "ForestGreen" :underline t))))
660 '(vhdl-speedbar-instantiation-face ((t (:foreground "Brown"))))
661 '(vhdl-speedbar-instantiation-selected-face ((t (:foreground "Brown" :underline t))))
662 '(vhdl-speedbar-package-face ((t (:foreground "Grey50"))))
663 '(vhdl-speedbar-package-selected-face ((t (:foreground "Grey50" :underline t))))
664
665 '(viper-minibuffer-emacs-face ((t (:foreground "Black" :background "darkseagreen2"))))
666 '(viper-minibuffer-insert-face ((t (:foreground "Black" :background "pink"))))
667 '(viper-minibuffer-vi-face ((t (:foreground "DarkGreen" :background "grey"))))
668 '(viper-replace-overlay-face ((t (:foreground "Black" :background "darkseagreen2"))))
669 '(viper-search-face ((t (:foreground "Black" :background "khaki"))))
670 '(vm-highlight-url-face ((t (:bold t :italic t :slant italic :weight bold))))
671 '(vm-highlighted-header-face ((t (:bold t :weight bold))))
672 '(vm-mime-button-face ((t (:background "grey75" :foreground "black" :box (:line-width 2 :style released-button)))))
673 '(vm-summary-highlight-face ((t (:bold t :weight bold))))
674 '(vm-xface ((t (:background "white" :foreground "black"))))
675
676 '(which-func ((t (:foreground "Blue1"))))
677 '(widget ((t (:height 1.2 :background "Gray80" :foreground "black"))))
678 '(widget-button ((t (:bold t :weight bold :box (:line-width 2 :style released-button)))))
679 '(widget-button-face ((t (:bold t :weight bold :box (:line-width 2 :style released-button)))))
680 '(widget-button-pressed ((t (:foreground "red1" :background "lightgrey" :box (:line-width 2 :style pressed-button)))))
681 '(widget-button-pressed-face ((t (:foreground "red1" :background "lightgrey" :box (:line-width 2 :style pressed-button)))))
682 '(widget-documentation ((t (:foreground "lime green"))))
683 '(widget-documentation-face ((t (:foreground "lime green"))))
684 '(widget-field ((t (:background "dim gray"))))
685 '(widget-field-face ((t (:background "dim gray"))))
686 '(widget-inactive ((t (:foreground "grey70"))))
687 '(widget-inactive-face ((t (:foreground "grey70"))))
688 '(widget-single-line-field ((t (:background "dim gray"))))
689 '(widget-single-line-field-face ((t (:background "dim gray"))))
690 '(woman-bold-face ((t (:bold t))))
691 '(woman-italic-face ((t (:foreground "beige"))))
692 '(woman-unknown-face ((t (:foreground "LightSalmon")))))
693
694(provide-theme 'manoj-dark)
695
696;; Local Variables:
697;; no-byte-compile: t
698;; End:
699
700;;; manoj-dark.el ends here
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index c2b1b106c15..393cac2c8a0 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,4 +1,4 @@
12011-07-05 Paul Eggert <eggert@cs.ucla.edu> 12011-07-06 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Assume support for memcmp, memcpy, memmove, memset. 3 Assume support for memcmp, memcpy, memmove, memset.
4 * etags.c (absolute_filename): Assume memmove exists. 4 * etags.c (absolute_filename): Assume memmove exists.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6ec351d98c5..26e8bec7937 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,219 @@
12011-07-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * mail/smtpmail.el (smtpmail-default-smtp-server): Made into a
4 defcustom again for backwards compatibility.
5
6 * simple.el (shell-command-on-region): Fill.
7
8 * dired-aux.el (dired-kill-line): Add a doc string.
9
10 * dabbrev.el (dabbrev-abbrev-char-regexp): Note that nil defaults
11 to "\\sw\\|\\s_" (bug#358).
12
13 * dired.el (dired-mode): Clarify "unmark or unflag" (bug#8770).
14 (dired-unmark-backward): Ditto.
15 (dired-flag-backup-files): Ditto.
16
17 * dired-x.el (dired-mark-sexp): Ditto.
18
192011-07-06 Richard Stallman <rms@gnu.org>
20
21 * mail/rmailmm.el: Give entity a new slot, TRUNCATED.
22 (rmail-mime-entity): New arg TRUNCATED.
23 (rmail-mime-entity-truncated, rmail-mime-entity-set-truncated):
24 New functions.
25 (rmail-mime-save): Warn if entity is truncated.
26 (rmail-mime-toggle-hidden): Likewise, for showing.
27 (rmail-mime-process-multipart): Record when an entity is truncated.
28
29 * mail/rmailmm.el (rmail-search-mime-message): Don't get confused
30 if ENTITY is a string.
31
322011-07-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
33
34 * emacs-lisp/lisp-mode.el (eval-defun-1): Update the documentation
35 of faces when `M-C-x'-ing their definitions (bug#8378). Also
36 clean up the code slightly.
37
38 * progmodes/grep.el (rgrep): Don't bind `process-connection-type',
39 because that makes the colours go away.
40
41 * mail/sendmail.el (send-mail-function): Change the default to
42 `sendmail-query-once'.
43 (sendmail-query-once): Add an autoload cookie.
44
45 * net/network-stream.el (network-stream-open-starttls): Try using
46 a plain connection even if the server offered STARTTLS, and we
47 kinda wanted to use it, if Emacs doesn't have any STARTTLS
48 capability. This should make smtpmail.el work in slightly more
49 configurations.
50
512011-07-06 Michael Albinus <michael.albinus@gmx.de>
52
53 * net/tramp-compat.el (tramp-compat-pop-to-buffer-same-window):
54 New defun.
55 * net/tramp-cmds.el (tramp-append-tramp-buffers): Use it.
56
572011-07-06 Michael R. Mauger <mmaug@yahoo.com>
58
59 * progmodes/sql.el: Version 3.0
60 (sql-product-alist): Added product :completion-object,
61 :completion-column, and :statement attributes.
62 (sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
63 (sql-mode-syntax-table): Mark all punctuation.
64 (sql-font-lock-keywords-builder): Temporarily removed fallback on
65 ansi keywords.
66 (sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
67 (sql-mode-oracle-font-lock-keywords): Improved.
68 (sql-oracle-show-reserved-words): New function for development.
69 (sql-product-font-lock): Simplify for source code buffers.
70 (sql-product-syntax-table, sql-product-font-lock-syntax-alist):
71 New functions.
72 (sql-highlight-product): Set product specific syntax table.
73 (sql-mode-map): Added statement movement functions.
74 (sql-ansi-statement-starters, sql-oracle-statement-starters): New
75 variable.
76 (sql-statement-regexp, sql-beginning-of-statement)
77 (sql-end-of-statement, sql-signum): New functions.
78 (sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
79 parameter.
80 (sql-show-sqli-buffer): Bug fix.
81 (sql-interactive-mode): Store connection data as buffer local.
82 (sql-connect): Added NEW-NAME parameter. Redesigned interaction
83 with sql-interactive-mode.
84 (sql-save-connection): Save buffer local settings.
85 (sql-connection-menu-filter): Changed menu entry name.
86 (sql-product-interactive): Bug fix.
87 (sql-preoutput-hold): New variable.
88 (sql-interactive-remove-continuation-prompt): Bug fixes.
89 (sql-debug-redirect): New variable.
90 (sql-str-literal): New function.
91 (sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
92 Redesigned.
93 (sql-oracle-save-settings, sql-oracle-restore-settings)
94 (sql-oracle-list-all, sql-oracle-list-table): New functions.
95 (sql-completion-object, sql-completion-column)
96 (sql-completion-sqlbuf): New variables.
97 (sql-build-completions-1, sql-build-completions)
98 (sql-try-completion): New functions.
99 (sql-read-table-name): Use them.
100 (sql-contains-names): New buffer local variable.
101 (sql-list-all, sql-list-table): Use it.
102 (sql-oracle-completion-types): New variable.
103 (sql-oracle-completion-object, sql-sqlite-completion-object)
104 (sql-postgres-completion-object): New functions.
105
1062011-07-06 Glenn Morris <rgm@gnu.org>
107
108 * window.el (pop-to-buffer): Doc fix.
109
1102011-07-06 Markus Heiser <markus.heiser@darmarit.de> (tiny change)
111
112 * progmodes/gud.el (gud-pdb-marker-regexp): Accept \r char (Bug#5653).
113
1142011-07-06 Chong Yidong <cyd@stupidchicken.com>
115
116 * window.el (special-display-popup-frame): Doc fix (Bug#8853).
117
118 * info.el (Info-directory-toc-nodes): Minor doc fix (Bug#8833).
119
1202011-07-05 Chong Yidong <cyd@stupidchicken.com>
121
122 * button.el (button): Inherit from link face. Suggested by Dan
123 Nicolaescu.
124
1252011-07-05 Stefan Monnier <monnier@iro.umontreal.ca>
126
127 * progmodes/gdb-mi.el: Fit in 80 columns.
128 (gdb-setup-windows, gdb-restore-windows): Avoid other-window and
129 switch-to-buffer.
130
131 * progmodes/which-func.el (which-func-ff-hook): Don't output a message
132 if imenu is simply not configured (bug#8941).
133
1342011-07-05 Ken Manheimer <ken.manheimer@gmail.com>
135
136 * allout.el (allout-post-undo-hook): New allout outline-change
137 event hook to signal undo activity.
138 (allout-post-command-business): Run allout-post-undo-hook if an
139 undo just occurred.
140 (allout-after-copy-or-kill-hook, allout-mode): Minor docstring changes.
141 * allout-widgets.el (allout-widgets-after-undo-function):
142 Ensure the integrity of the current item's decoration after it has been
143 in the vicinity of an undo.
144 (allout-widgets-mode): Include allout-widgets-after-undo-function
145 on the new allout-post-undo-hook.
146
1472011-07-05 Stefan Monnier <monnier@iro.umontreal.ca>
148
149 * emacs-lisp/lisp-mode.el (lisp-interaction-mode-abbrev-table):
150 Let define-derived-mode define it.
151 * emacs-lisp/derived.el (define-derived-mode): Try to avoid creating
152 cycles of abbrev-table inheritance (bug#8998).
153
1542011-07-05 Roland Winkler <winkler@gnu.org>
155
156 * textmodes/bibtex.el: Add support for biblatex.
157 (bibtex-BibTeX-entry-alist, bibtex-biblatex-entry-alist)
158 (bibtex-BibTeX-field-alist, bibtex-biblatex-field-alist)
159 (bibtex-dialect-list, bibtex-dialect, bibtex-no-opt-remove-re)
160 (bibtex-entry-alist, bibtex-field-alist): New variables.
161 (bibtex-entry-field-alist): Obsolete alias for
162 bibtex-BibTeX-entry-alist.
163 (bibtex-entry-alist, bibtex-field-alist): New widgets.
164 (bibtex-set-dialect): New command.
165 (bibtex-entry-type, bibtex-entry-head)
166 (bibtex-entry-maybe-empty-head, bibtex-any-valid-entry-type):
167 Bind via bibtex-set-dialect.
168 (bibtex-Article, bibtex-Book, bibtex-Booklet, bibtex-InBook)
169 (bibtex-InCollection, bibtex-InProceedings, bibtex-Manual)
170 (bibtex-MastersThesis, bibtex-Misc, bibtex-PhdThesis)
171 (bibtex-Proceedings, bibtex-TechReport, bibtex-Unpublished):
172 Define via bibtex-set-dialect.
173 (bibtex-name-in-field, bibtex-remove-OPT-or-ALT):
174 Obey bibtex-no-opt-remove-re.
175 (bibtex-vec-push, bibtex-vec-incr): New functions.
176 (bibtex-format-entry, bibtex-field-list)
177 (bibtex-print-help-message, bibtex-validate)
178 (bibtex-search-entries): Use new format of bibtex-entry-alist.
179
1802011-07-05 Stefan Monnier <monnier@iro.umontreal.ca>
181
182 * progmodes/compile.el (compilation-goto-locus):
183 * net/tramp-cmds.el (tramp-append-tramp-buffers):
184 * bs.el (bs-cycle-next, bs-cycle-previous):
185 * bookmark.el (bookmark-bmenu-list, bookmark-bmenu-2-window):
186 * bindings.el (mode-line-other-buffer):
187 * autoinsert.el (auto-insert):
188 * arc-mode.el (archive-extract):
189 * abbrev.el (edit-abbrevs): Fix some uses of switch-to-buffer.
190
1912011-07-05 Juanma Barranquero <lekktu@gmail.com>
192
193 * emacs-lock.el (emacs-lock-mode): Fix typo in variable name.
194 Fix check of `emacs-lock-unlockable-modes'.
195 Coerce true values of `emacs-lock--try-unlocking' to t.
196
1972011-07-05 Juanma Barranquero <lekktu@gmail.com>
198
199 * obsolete/old-emacs-lock.el: Rename from emacs-lock.el.
200 * emacs-lock.el: New file.
201
2022011-07-05 Julien Danjou <julien@danjou.info>
203
204 * textmodes/rst.el (rst-define-level-faces): Use `facep' rather
205 than `boundp' to check if face is set.
206
2072011-07-05 Juanma Barranquero <lekktu@gmail.com>
208
209 * register.el (registerv-make):
210 * window.el (window-min-height): Fix typos in docstrings.
211
2122011-07-05 Jan Djärv <jan.h.d@swipnet.se>
213
214 * dynamic-setting.el (dynamic-setting-handle-config-changed-event):
215 Update doc string.
216
12011-07-04 Juanma Barranquero <lekktu@gmail.com> 2172011-07-04 Juanma Barranquero <lekktu@gmail.com>
2 218
3 * server.el (server-execute): Catch quit and call 219 * server.el (server-execute): Catch quit and call
@@ -38,8 +254,8 @@
38 according to whether there are or aren't any plain-text topics 254 according to whether there are or aren't any plain-text topics
39 pending encryption. 255 pending encryption.
40 256
41 (allout-inhibit-auto-save-info-for-decryption): Adjust 257 (allout-inhibit-auto-save-info-for-decryption):
42 buffer-saved-size and some allout state to inhibit auto-saves if 258 Adjust buffer-saved-size and some allout state to inhibit auto-saves if
43 there are plain-text topics pending encryption. 259 there are plain-text topics pending encryption.
44 260
45 (allout-maybe-resume-auto-save-info-after-encryption): Adjust 261 (allout-maybe-resume-auto-save-info-after-encryption): Adjust
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 9445cf9675c..2122f43bbad 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -159,7 +159,7 @@ where NAME and EXPANSION are strings with quotes,
159USECOUNT is an integer, and HOOK is any valid function 159USECOUNT is an integer, and HOOK is any valid function
160or may be omitted (it is usually omitted)." 160or may be omitted (it is usually omitted)."
161 (interactive) 161 (interactive)
162 (switch-to-buffer (prepare-abbrev-list-buffer))) 162 (pop-to-buffer-same-window (prepare-abbrev-list-buffer)))
163 163
164(defun edit-abbrevs-redefine () 164(defun edit-abbrevs-redefine ()
165 "Redefine abbrevs according to current buffer contents." 165 "Redefine abbrevs according to current buffer contents."
diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index 8dab7411750..ef75e7157e6 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -561,6 +561,8 @@ outline hot-spot navigation \(see `allout-mode')."
561 'allout-widgets-shifts-recorder nil 'local) 561 'allout-widgets-shifts-recorder nil 'local)
562 (add-hook 'allout-after-copy-or-kill-hook 562 (add-hook 'allout-after-copy-or-kill-hook
563 'allout-widgets-after-copy-or-kill-function nil 'local) 563 'allout-widgets-after-copy-or-kill-function nil 'local)
564 (add-hook 'allout-post-undo-hook
565 'allout-widgets-after-undo-function nil 'local)
564 566
565 (add-hook 'before-change-functions 'allout-widgets-before-change-handler 567 (add-hook 'before-change-functions 'allout-widgets-before-change-handler
566 nil 'local) 568 nil 'local)
@@ -1130,6 +1132,14 @@ Dispatched by `allout-widgets-post-command-business' in response to
1130Intended for use on allout-after-copy-or-kill-hook." 1132Intended for use on allout-after-copy-or-kill-hook."
1131 (if (car kill-ring) 1133 (if (car kill-ring)
1132 (setcar kill-ring (allout-widgets-undecorate-text (car kill-ring))))) 1134 (setcar kill-ring (allout-widgets-undecorate-text (car kill-ring)))))
1135;;;_ > allout-widgets-after-undo-function ()
1136(defun allout-widgets-after-undo-function ()
1137 "Do allout-widgets processing of text after an undo.
1138
1139Intended for use on allout-post-undo-hook."
1140 (save-excursion
1141 (if (allout-goto-prefix)
1142 (allout-redecorate-item (allout-get-or-create-item-widget)))))
1133 1143
1134;;;_ > allout-widgets-exposure-undo-recorder (widget from-state) 1144;;;_ > allout-widgets-exposure-undo-recorder (widget from-state)
1135(defun allout-widgets-exposure-undo-recorder (widget) 1145(defun allout-widgets-exposure-undo-recorder (widget)
diff --git a/lisp/allout.el b/lisp/allout.el
index 5b8a7a7de1a..592a64c647a 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -1461,7 +1461,15 @@ This hook might be invoked multiple times by a single command.")
1461(defvar allout-after-copy-or-kill-hook nil 1461(defvar allout-after-copy-or-kill-hook nil
1462 "*Hook that's run after copying outline text. 1462 "*Hook that's run after copying outline text.
1463 1463
1464Functions on the hook should not take any arguments.") 1464Functions on the hook should not require any arguments.")
1465;;;_ = allout-post-undo-hook
1466(defvar allout-post-undo-hook nil
1467 "*Hook that's run after undo activity.
1468
1469The item that's current when the hook is run *may* be the one
1470that was affected by the undo.
1471
1472Functions on the hook should not require any arguments.")
1465;;;_ = allout-outside-normal-auto-fill-function 1473;;;_ = allout-outside-normal-auto-fill-function
1466(defvar allout-outside-normal-auto-fill-function nil 1474(defvar allout-outside-normal-auto-fill-function nil
1467 "Value of normal-auto-fill-function outside of allout mode. 1475 "Value of normal-auto-fill-function outside of allout mode.
@@ -1874,6 +1882,7 @@ without changes to the allout core. Here are key ones:
1874`allout-structure-deleted-hook' 1882`allout-structure-deleted-hook'
1875`allout-structure-shifted-hook' 1883`allout-structure-shifted-hook'
1876`allout-after-copy-or-kill-hook' 1884`allout-after-copy-or-kill-hook'
1885`allout-post-undo-hook'
1877 1886
1878 Terminology 1887 Terminology
1879 1888
@@ -3313,6 +3322,7 @@ coordinating with allout activity.")
3313 3322
3314 (when allout-just-did-undo 3323 (when allout-just-did-undo
3315 (setq allout-just-did-undo nil) 3324 (setq allout-just-did-undo nil)
3325 (run-hooks 'allout-post-undo-hook)
3316 (cond ((and (= buffer-saved-size -1) 3326 (cond ((and (= buffer-saved-size -1)
3317 allout-auto-save-temporarily-disabled) 3327 allout-auto-save-temporarily-disabled)
3318 ;; user possibly undid a decryption, deinhibit auto-save: 3328 ;; user possibly undid a decryption, deinhibit auto-save:
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index e0a587c7607..70f43aebaff 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1083,7 +1083,7 @@ using `make-temp-file', and the generated name is returned."
1083 (view-buffer buffer (and just-created 'kill-buffer-if-not-modified))) 1083 (view-buffer buffer (and just-created 'kill-buffer-if-not-modified)))
1084 ((eq other-window-p 'display) (display-buffer buffer)) 1084 ((eq other-window-p 'display) (display-buffer buffer))
1085 (other-window-p (switch-to-buffer-other-window buffer)) 1085 (other-window-p (switch-to-buffer-other-window buffer))
1086 (t (switch-to-buffer buffer)))))) 1086 (t (pop-to-buffer-same-window buffer))))))
1087 1087
1088(defun archive-*-extract (archive name command) 1088(defun archive-*-extract (archive name command)
1089 (let* ((default-directory (file-name-as-directory archive-tmpdir)) 1089 (let* ((default-directory (file-name-as-directory archive-tmpdir))
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index 5793c3180be..3b849cece22 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -360,7 +360,7 @@ Matches the visited file name against the elements of `auto-insert-alist'."
360 (save-window-excursion 360 (save-window-excursion
361 ;; make buffer visible before skeleton or function 361 ;; make buffer visible before skeleton or function
362 ;; which might ask the user for something 362 ;; which might ask the user for something
363 (switch-to-buffer (current-buffer)) 363 (pop-to-buffer-same-window (current-buffer))
364 (if (and (consp action) 364 (if (and (consp action)
365 (not (eq (car action) 'lambda))) 365 (not (eq (car action) 'lambda)))
366 (skeleton-insert action) 366 (skeleton-insert action)
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 383223dc0d7..2f035608528 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -471,7 +471,8 @@ Like `bury-buffer', but temporarily select EVENT's window."
471(defun mode-line-other-buffer () "\ 471(defun mode-line-other-buffer () "\
472Switch to the most recently selected buffer other than the current one." 472Switch to the most recently selected buffer other than the current one."
473 (interactive) 473 (interactive)
474 (switch-to-buffer (other-buffer))) 474 (with-no-warnings ; We really do want to call `switch-to-buffer' here.
475 (switch-to-buffer (other-buffer))))
475 476
476(defun mode-line-next-buffer (event) 477(defun mode-line-next-buffer (event)
477 "Like `next-buffer', but temporarily select EVENT's window." 478 "Like `next-buffer', but temporarily select EVENT's window."
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 184cecb9e9c..9f90ecedc4d 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1539,9 +1539,7 @@ deletion, or > if it is flagged for displaying."
1539 (bookmark-maybe-load-default-file) 1539 (bookmark-maybe-load-default-file)
1540 (let ((buf (get-buffer-create "*Bookmark List*"))) 1540 (let ((buf (get-buffer-create "*Bookmark List*")))
1541 (if (called-interactively-p 'interactive) 1541 (if (called-interactively-p 'interactive)
1542 (if (or (window-dedicated-p) (window-minibuffer-p)) 1542 (pop-to-buffer-same-window buf)
1543 (pop-to-buffer buf)
1544 (switch-to-buffer buf))
1545 (set-buffer buf))) 1543 (set-buffer buf)))
1546 (let ((inhibit-read-only t)) 1544 (let ((inhibit-read-only t))
1547 (erase-buffer) 1545 (erase-buffer)
@@ -1843,7 +1841,8 @@ With a prefix arg, prompts for a file to save them in."
1843 (menu (current-buffer)) 1841 (menu (current-buffer))
1844 (pop-up-windows t)) 1842 (pop-up-windows t))
1845 (delete-other-windows) 1843 (delete-other-windows)
1846 (switch-to-buffer (other-buffer)) 1844 (with-no-warnings ; We really do want to call `switch-to-buffer' here.
1845 (switch-to-buffer (other-buffer)))
1847 (bookmark--jump-via bmrk 'pop-to-buffer) 1846 (bookmark--jump-via bmrk 'pop-to-buffer)
1848 (bury-buffer menu))) 1847 (bury-buffer menu)))
1849 1848
diff --git a/lisp/bs.el b/lisp/bs.el
index 94fbd0e04f9..c7326eedd26 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -1215,7 +1215,8 @@ by buffer configuration `bs-cycle-configuration-name'."
1215 ;; We don't want the frame iconified if the only window in the frame 1215 ;; We don't want the frame iconified if the only window in the frame
1216 ;; happens to be dedicated. 1216 ;; happens to be dedicated.
1217 (bury-buffer (current-buffer)) 1217 (bury-buffer (current-buffer))
1218 (switch-to-buffer next) 1218 (with-no-warnings ; We really do want to call `switch-to-buffer' here.
1219 (switch-to-buffer next))
1219 (setq bs--cycle-list (append (cdr cycle-list) 1220 (setq bs--cycle-list (append (cdr cycle-list)
1220 (list (car cycle-list)))) 1221 (list (car cycle-list))))
1221 (bs-message-without-log "Next buffers: %s" 1222 (bs-message-without-log "Next buffers: %s"
@@ -1244,7 +1245,8 @@ by buffer configuration `bs-cycle-configuration-name'."
1244 bs--cycle-list))) 1245 bs--cycle-list)))
1245 (prev-buffer (car tupel)) 1246 (prev-buffer (car tupel))
1246 (cycle-list (cdr tupel))) 1247 (cycle-list (cdr tupel)))
1247 (switch-to-buffer prev-buffer) 1248 (with-no-warnings ; We really do want to call `switch-to-buffer' here.
1249 (switch-to-buffer prev-buffer))
1248 (setq bs--cycle-list (append (last cycle-list) 1250 (setq bs--cycle-list (append (last cycle-list)
1249 (reverse (cdr (reverse cycle-list))))) 1251 (reverse (cdr (reverse cycle-list)))))
1250 (bs-message-without-log "Previous buffers: %s" 1252 (bs-message-without-log "Previous buffers: %s"
diff --git a/lisp/button.el b/lisp/button.el
index 2e485547745..6ef79532ae7 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -54,10 +54,7 @@
54;; Use color for the MS-DOS port because it doesn't support underline. 54;; Use color for the MS-DOS port because it doesn't support underline.
55;; FIXME if MS-DOS correctly answers the (supports) question, it need 55;; FIXME if MS-DOS correctly answers the (supports) question, it need
56;; no longer be a special case. 56;; no longer be a special case.
57(defface button '((((type pc) (class color)) 57(defface button '((t :inherit link))
58 (:foreground "lightblue"))
59 (((supports :underline t)) :underline t)
60 (t (:foreground "lightblue")))
61 "Default face used for buttons." 58 "Default face used for buttons."
62 :group 'basic-faces) 59 :group 'basic-faces)
63 60
diff --git a/lisp/custom.el b/lisp/custom.el
index 11dc1859c00..a5c0065036a 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1407,7 +1407,7 @@ This function returns nil if no custom theme specifies a value for VARIABLE."
1407 (face-spec-recalc face frame))) 1407 (face-spec-recalc face frame)))
1408 1408
1409 1409
1410;;; XEmacs compability functions 1410;;; XEmacs compatibility functions
1411 1411
1412;; In XEmacs, when you reset a Custom Theme, you have to specify the 1412;; In XEmacs, when you reset a Custom Theme, you have to specify the
1413;; theme to reset it to. We just apply the next available theme, so 1413;; theme to reset it to. We just apply the next available theme, so
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 00e2ec802e2..540b93faad8 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -206,7 +206,8 @@ starting with or containing `no-'. If you set this variable to
206expanding `yes-or-no-' signals an error because `-' is not part of a word; 206expanding `yes-or-no-' signals an error because `-' is not part of a word;
207but expanding `yes-or-no' looks for a word starting with `no'. 207but expanding `yes-or-no' looks for a word starting with `no'.
208 208
209The recommended value is \"\\\\sw\\\\|\\\\s_\"." 209The recommended value is nil, which will make dabbrev default to
210using \"\\\\sw\\\\|\\\\s_\"."
210 :type '(choice (const nil) 211 :type '(choice (const nil)
211 regexp) 212 regexp)
212 :group 'dabbrev) 213 :group 'dabbrev)
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index c7dd183ba49..5ab4146383b 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -699,6 +699,9 @@ can be produced by `dired-get-marked-files', for example."
699;; Commands that delete or redisplay part of the dired buffer. 699;; Commands that delete or redisplay part of the dired buffer.
700 700
701(defun dired-kill-line (&optional arg) 701(defun dired-kill-line (&optional arg)
702 "Kill the current line (not the files).
703With a prefix argument, kill that many lines starting with the current line.
704\(A negative argument kills backward.)"
702 (interactive "P") 705 (interactive "P")
703 (setq arg (prefix-numeric-value arg)) 706 (setq arg (prefix-numeric-value arg))
704 (let (buffer-read-only file) 707 (let (buffer-read-only file)
@@ -1008,7 +1011,7 @@ See Info node `(emacs)Subdir switches' for more details."
1008 (dired-uncache 1011 (dired-uncache
1009 (if (consp dired-directory) (car dired-directory) dired-directory)) 1012 (if (consp dired-directory) (car dired-directory) dired-directory))
1010 (dired-map-over-marks (let ((fname (dired-get-filename)) 1013 (dired-map-over-marks (let ((fname (dired-get-filename))
1011 ;; Postphone readin hook till we map 1014 ;; Postpone readin hook till we map
1012 ;; over all marked files (Bug#6810). 1015 ;; over all marked files (Bug#6810).
1013 (dired-after-readin-hook nil)) 1016 (dired-after-readin-hook nil))
1014 (message "Redisplaying... %s" fname) 1017 (message "Redisplaying... %s" fname)
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index ca89d07ea7f..8395a8b905f 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -1406,7 +1406,7 @@ Considers buffers closer to the car of `buffer-list' to be more recent."
1406 1406
1407(defun dired-mark-sexp (predicate &optional unflag-p) 1407(defun dired-mark-sexp (predicate &optional unflag-p)
1408 "Mark files for which PREDICATE returns non-nil. 1408 "Mark files for which PREDICATE returns non-nil.
1409With a prefix arg, unflag those files instead. 1409With a prefix arg, unmark or unflag those files instead.
1410 1410
1411PREDICATE is a lisp expression that can refer to the following symbols: 1411PREDICATE is a lisp expression that can refer to the following symbols:
1412 1412
diff --git a/lisp/dired.el b/lisp/dired.el
index 2f40913aae6..62bab489fbc 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1812,7 +1812,7 @@ Type \\[dired-mark] to Mark a file or subdirectory for later commands.
1812 Mark-using commands display a list of failures afterwards. Type \\[dired-summary] 1812 Mark-using commands display a list of failures afterwards. Type \\[dired-summary]
1813 to see why something went wrong. 1813 to see why something went wrong.
1814Type \\[dired-unmark] to Unmark a file or all files of an inserted subdirectory. 1814Type \\[dired-unmark] to Unmark a file or all files of an inserted subdirectory.
1815Type \\[dired-unmark-backward] to back up one line and unflag. 1815Type \\[dired-unmark-backward] to back up one line and unmark or unflag.
1816Type \\[dired-do-flagged-delete] to delete (eXecute) the files flagged `D'. 1816Type \\[dired-do-flagged-delete] to delete (eXecute) the files flagged `D'.
1817Type \\[dired-find-file] to Find the current line's file 1817Type \\[dired-find-file] to Find the current line's file
1818 (or dired it in another buffer, if it is a directory). 1818 (or dired it in another buffer, if it is a directory).
@@ -3028,8 +3028,9 @@ If on a subdir headerline, mark all its files except `.' and `..'."
3028 (dired-mark arg))) 3028 (dired-mark arg)))
3029 3029
3030(defun dired-unmark-backward (arg) 3030(defun dired-unmark-backward (arg)
3031 "In Dired, move up lines and remove deletion flag there. 3031 "In Dired, move up lines and remove marks or deletion flags there.
3032Optional prefix ARG says how many lines to unflag; default is one line." 3032Optional prefix ARG says how many lines to unmark/unflag; default
3033is one line."
3033 (interactive "p") 3034 (interactive "p")
3034 (dired-unmark (- arg))) 3035 (dired-unmark (- arg)))
3035 3036
@@ -3123,14 +3124,14 @@ The match is against the non-directory part of the filename. Use `^'
3123 3124
3124(defun dired-mark-symlinks (unflag-p) 3125(defun dired-mark-symlinks (unflag-p)
3125 "Mark all symbolic links. 3126 "Mark all symbolic links.
3126With prefix argument, unflag all those files." 3127With prefix argument, unmark or unflag all those files."
3127 (interactive "P") 3128 (interactive "P")
3128 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char))) 3129 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
3129 (dired-mark-if (looking-at dired-re-sym) "symbolic link"))) 3130 (dired-mark-if (looking-at dired-re-sym) "symbolic link")))
3130 3131
3131(defun dired-mark-directories (unflag-p) 3132(defun dired-mark-directories (unflag-p)
3132 "Mark all directory file lines except `.' and `..'. 3133 "Mark all directory file lines except `.' and `..'.
3133With prefix argument, unflag all those files." 3134With prefix argument, unmark or unflag all those files."
3134 (interactive "P") 3135 (interactive "P")
3135 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char))) 3136 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
3136 (dired-mark-if (and (looking-at dired-re-dir) 3137 (dired-mark-if (and (looking-at dired-re-dir)
@@ -3139,7 +3140,7 @@ With prefix argument, unflag all those files."
3139 3140
3140(defun dired-mark-executables (unflag-p) 3141(defun dired-mark-executables (unflag-p)
3141 "Mark all executable files. 3142 "Mark all executable files.
3142With prefix argument, unflag all those files." 3143With prefix argument, unmark or unflag all those files."
3143 (interactive "P") 3144 (interactive "P")
3144 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char))) 3145 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
3145 (dired-mark-if (looking-at dired-re-exe) "executable file"))) 3146 (dired-mark-if (looking-at dired-re-exe) "executable file")))
@@ -3149,7 +3150,7 @@ With prefix argument, unflag all those files."
3149 3150
3150(defun dired-flag-auto-save-files (&optional unflag-p) 3151(defun dired-flag-auto-save-files (&optional unflag-p)
3151 "Flag for deletion files whose names suggest they are auto save files. 3152 "Flag for deletion files whose names suggest they are auto save files.
3152A prefix argument says to unflag those files instead." 3153A prefix argument says to unmark or unflag those files instead."
3153 (interactive "P") 3154 (interactive "P")
3154 (let ((dired-marker-char (if unflag-p ?\040 dired-del-marker))) 3155 (let ((dired-marker-char (if unflag-p ?\040 dired-del-marker)))
3155 (dired-mark-if 3156 (dired-mark-if
@@ -3189,7 +3190,7 @@ A prefix argument says to unflag those files instead."
3189 3190
3190(defun dired-flag-backup-files (&optional unflag-p) 3191(defun dired-flag-backup-files (&optional unflag-p)
3191 "Flag all backup files (names ending with `~') for deletion. 3192 "Flag all backup files (names ending with `~') for deletion.
3192With prefix argument, unflag these files." 3193With prefix argument, unmark or unflag these files."
3193 (interactive "P") 3194 (interactive "P")
3194 (let ((dired-marker-char (if unflag-p ?\s dired-del-marker))) 3195 (let ((dired-marker-char (if unflag-p ?\s dired-del-marker)))
3195 (dired-mark-if 3196 (dired-mark-if
@@ -3642,7 +3643,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
3642;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command 3643;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
3643;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown 3644;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown
3644;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff 3645;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
3645;;;;;; dired-diff) "dired-aux" "dired-aux.el" "65e65633e08c3e4b4a4b1c735f2f48b8") 3646;;;;;; dired-diff) "dired-aux" "dired-aux.el" "d7b197829c8d456cc5bc6c5fdab7c4b0")
3646;;; Generated autoloads from dired-aux.el 3647;;; Generated autoloads from dired-aux.el
3647 3648
3648(autoload 'dired-diff "dired-aux" "\ 3649(autoload 'dired-diff "dired-aux" "\
diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el
index 81531c4a21f..167da69d1ca 100644
--- a/lisp/dynamic-setting.el
+++ b/lisp/dynamic-setting.el
@@ -86,7 +86,9 @@ current form for the frame (i.e. hinting or somesuch changed)."
86Changes can be 86Changes can be
87 The monospace font. If `font-use-system-font' is nil, the font 87 The monospace font. If `font-use-system-font' is nil, the font
88 is not changed. 88 is not changed.
89 The normal font.
89 Xft parameters, like DPI and hinting. 90 Xft parameters, like DPI and hinting.
91 The Gtk+ theme name.
90 The tool bar style." 92 The tool bar style."
91 (interactive "e") 93 (interactive "e")
92 (let ((type (nth 1 event)) 94 (let ((type (nth 1 event))
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index e8f799b9afc..4fda2bf1d52 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -255,7 +255,10 @@ No problems result if this variable is not bound.
255 (not (eq parent (standard-syntax-table)))) 255 (not (eq parent (standard-syntax-table))))
256 (set-char-table-parent ,syntax (syntax-table))))) 256 (set-char-table-parent ,syntax (syntax-table)))))
257 ,(when declare-abbrev 257 ,(when declare-abbrev
258 `(unless (abbrev-table-get ,abbrev :parents) 258 `(unless (or (abbrev-table-get ,abbrev :parents)
259 ;; This can happen if the major mode defines
260 ;; the abbrev-table to be its parent's.
261 (eq ,abbrev local-abbrev-table))
259 (abbrev-table-put ,abbrev :parents 262 (abbrev-table-put ,abbrev :parents
260 (list local-abbrev-table)))))) 263 (list local-abbrev-table))))))
261 (use-local-map ,map) 264 (use-local-map ,map)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 114e9755039..c8620aaa439 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -525,7 +525,6 @@ if that value is non-nil."
525 "Keymap for Lisp Interaction mode. 525 "Keymap for Lisp Interaction mode.
526All commands in `lisp-mode-shared-map' are inherited by this map.") 526All commands in `lisp-mode-shared-map' are inherited by this map.")
527 527
528(defvar lisp-interaction-mode-abbrev-table lisp-mode-abbrev-table)
529(define-derived-mode lisp-interaction-mode emacs-lisp-mode "Lisp Interaction" 528(define-derived-mode lisp-interaction-mode emacs-lisp-mode "Lisp Interaction"
530 "Major mode for typing and evaluating Lisp forms. 529 "Major mode for typing and evaluating Lisp forms.
531Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression 530Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression
@@ -790,25 +789,25 @@ Reinitialize the face according to the `defface' specification."
790 ;; `defface' is macroexpanded to `custom-declare-face'. 789 ;; `defface' is macroexpanded to `custom-declare-face'.
791 ((eq (car form) 'custom-declare-face) 790 ((eq (car form) 'custom-declare-face)
792 ;; Reset the face. 791 ;; Reset the face.
793 (setq face-new-frame-defaults 792 (let ((face-symbol (eval (nth 1 form) lexical-binding)))
794 (assq-delete-all (eval (nth 1 form) lexical-binding) 793 (setq face-new-frame-defaults
795 face-new-frame-defaults)) 794 (assq-delete-all face-symbol face-new-frame-defaults))
796 (put (eval (nth 1 form) lexical-binding) 'face-defface-spec nil) 795 (put face-symbol 'face-defface-spec nil)
797 ;; Setting `customized-face' to the new spec after calling 796 (put face-symbol 'face-documentation (nth 3 form))
798 ;; the form, but preserving the old saved spec in `saved-face', 797 ;; Setting `customized-face' to the new spec after calling
799 ;; imitates the situation when the new face spec is set 798 ;; the form, but preserving the old saved spec in `saved-face',
800 ;; temporarily for the current session in the customize 799 ;; imitates the situation when the new face spec is set
801 ;; buffer, thus allowing `face-user-default-spec' to use the 800 ;; temporarily for the current session in the customize
802 ;; new customized spec instead of the saved spec. 801 ;; buffer, thus allowing `face-user-default-spec' to use the
803 ;; Resetting `saved-face' temporarily to nil is needed to let 802 ;; new customized spec instead of the saved spec.
804 ;; `defface' change the spec, regardless of a saved spec. 803 ;; Resetting `saved-face' temporarily to nil is needed to let
805 (prog1 `(prog1 ,form 804 ;; `defface' change the spec, regardless of a saved spec.
806 (put ,(nth 1 form) 'saved-face 805 (prog1 `(prog1 ,form
807 ',(get (eval (nth 1 form) lexical-binding) 806 (put ,(nth 1 form) 'saved-face
808 'saved-face)) 807 ',(get face-symbol 'saved-face))
809 (put ,(nth 1 form) 'customized-face 808 (put ,(nth 1 form) 'customized-face
810 ,(nth 2 form))) 809 ,(nth 2 form)))
811 (put (eval (nth 1 form) lexical-binding) 'saved-face nil))) 810 (put face-symbol 'saved-face nil))))
812 ((eq (car form) 'progn) 811 ((eq (car form) 'progn)
813 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) 812 (cons 'progn (mapcar 'eval-defun-1 (cdr form))))
814 (t form))) 813 (t form)))
diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el
index 1553aeae0d5..18411f7d2ef 100644
--- a/lisp/emacs-lock.el
+++ b/lisp/emacs-lock.el
@@ -1,9 +1,10 @@
1;;; emacs-lock.el --- prevents you from exiting Emacs if a buffer is locked 1;;; emacs-lock.el --- protect buffers against killing or exiting -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1994, 1997, 2001-2011 Free Software Foundation, Inc 3;; Copyright (C) 2011 Free Software Foundation, Inc
4 4
5;; Author: Tom Wurgler <twurgler@goodyear.com> 5;; Author: Juanma Barranquero <lekktu@gmail.com>
6;; Created: 12/8/94 6;; Inspired by emacs-lock.el by Tom Wurgler <twurgler@goodyear.com>
7;; Maintainer: FSF
7;; Keywords: extensions, processes 8;; Keywords: extensions, processes
8 9
9;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
@@ -23,78 +24,220 @@
23 24
24;;; Commentary: 25;;; Commentary:
25 26
26;; This code sets a buffer-local variable to t if toggle-emacs-lock is run, 27;; This package defines a minor mode Emacs Lock to mark a buffer as
27;; then if the user attempts to exit Emacs, the locked buffer name will be 28;; protected against accidental killing, or exiting Emacs, or both.
28;; displayed and the exit aborted. This is just a way of protecting 29;; Buffers associated with inferior modes, like shell or telnet, can
29;; yourself from yourself. For example, if you have a shell running a big 30;; be treated specially, by auto-unlocking them if their interior
30;; program and exiting Emacs would abort that program, you may want to lock 31;; processes are dead.
31;; that buffer, then if you forget about it after a while, you won't
32;; accidentally exit Emacs. To unlock the buffer, just goto the buffer and
33;; run toggle-emacs-lock again.
34 32
35;;; Code: 33;;; Code:
36 34
37(defvar emacs-lock-from-exiting nil 35(defgroup emacs-lock nil
38 "Whether Emacs is locked to prevent exiting. See `check-emacs-lock'.") 36 "Emacs-Lock mode."
39(make-variable-buffer-local 'emacs-lock-from-exiting) 37 :version "24.1"
40 38 :group 'convenience)
41(defvar emacs-lock-buffer-locked nil 39
42 "Whether a shell or telnet buffer was locked when its process was killed.") 40(defcustom emacs-lock-default-locking-mode 'all
43(make-variable-buffer-local 'emacs-lock-buffer-locked) 41 "Default locking mode of Emacs-Locked buffers.
44(put 'emacs-lock-buffer-locked 'permanent-local t) 42
43Its value is used as the default for `emacs-lock-mode' (which
44see) the first time that Emacs Lock mode is turned on in a buffer
45without passing an explicit locking mode.
46
47Possible values are:
48 exit -- Emacs cannot exit while the buffer is locked
49 kill -- the buffer cannot be killed, but Emacs can exit as usual
50 all -- the buffer is locked against both actions
51 nil -- the buffer is not locked"
52 :type '(choice
53 (const :tag "Do not allow Emacs to exit" exit)
54 (const :tag "Do not allow killing the buffer" kill)
55 (const :tag "Do not allow killing the buffer or exiting Emacs" all)
56 (const :tag "Do not lock the buffer" nil))
57 :group 'emacs-lock
58 :version "24.1")
59
60;; Note: as auto-unlocking can lead to data loss, it would be better
61;; to default to nil; but the value below is for compatibility with
62;; the old emacs-lock.el.
63(defcustom emacs-lock-unlockable-modes '((shell-mode . all)
64 (telnet-mode . all))
65 "Alist of auto-unlockable modes.
66Each element is a pair (MAJOR-MODE . ACTION), where ACTION is
67one of `kill', `exit' or `all'. Buffers with matching major
68modes are auto-unlocked for the specific action if their
69inferior processes are not alive. If this variable is t, all
70buffers associated to inferior processes are auto-unlockable
71for both actions (NOT RECOMMENDED)."
72 :type '(choice
73 (const :tag "All buffers with inferior processes" t)
74 (repeat :tag "Selected modes"
75 (cons :tag "Set auto-unlock for"
76 (symbol :tag "Major mode")
77 (radio
78 (const :tag "Allow exiting" exit)
79 (const :tag "Allow killing" kill)
80 (const :tag "Allow both" all)))))
81 :group 'emacs-lock
82 :version "24.1")
83
84(defvar emacs-lock-mode nil
85 "If non-nil, the current buffer is locked.
86It can be one of the following values:
87 exit -- Emacs cannot exit while the buffer is locked
88 kill -- the buffer cannot be killed, but Emacs can exit as usual
89 all -- the buffer is locked against both actions
90 nil -- the buffer is not locked")
91(make-variable-buffer-local 'emacs-lock-mode)
92(put 'emacs-lock-mode 'permanent-local t)
93
94(defvar emacs-lock--old-mode nil
95 "Most recent locking mode set on the buffer.
96Internal use only.")
97(make-variable-buffer-local 'emacs-lock--old-mode)
98(put 'emacs-lock--old-mode 'permanent-local t)
99
100(defvar emacs-lock--try-unlocking nil
101 "Non-nil if current buffer should be checked for auto-unlocking.
102Internal use only.")
103(make-variable-buffer-local 'emacs-lock--try-unlocking)
104(put 'emacs-lock--try-unlocking 'permanent-local t)
105
106(defun emacs-lock-live-process-p (buffer-or-name)
107 "Return t if BUFFER-OR-NAME is associated with a live process."
108 (let ((proc (get-buffer-process buffer-or-name)))
109 (and proc (process-live-p proc))))
110
111(defun emacs-lock--can-auto-unlock (action)
112 "Return t if the current buffer can auto-unlock for ACTION.
113ACTION must be one of `kill' or `exit'.
114See `emacs-lock-unlockable-modes'."
115 (and emacs-lock--try-unlocking
116 (not (emacs-lock-live-process-p (current-buffer)))
117 (or (eq emacs-lock-unlockable-modes t)
118 (let ((unlock (cdr (assq major-mode emacs-lock-unlockable-modes))))
119 (or (eq unlock 'all) (eq unlock action))))))
120
121(defun emacs-lock--exit-locked-buffer ()
122 "Return the name of the first exit-locked buffer found."
123 (save-current-buffer
124 (catch :found
125 (dolist (buffer (buffer-list))
126 (set-buffer buffer)
127 (unless (or (emacs-lock--can-auto-unlock 'exit)
128 (memq emacs-lock-mode '(nil kill)))
129 (throw :found (buffer-name))))
130 nil)))
131
132(defun emacs-lock--kill-emacs-hook ()
133 "Signal an error if any buffer is exit-locked.
134Used from `kill-emacs-hook' (which see)."
135 (let ((buffer-name (emacs-lock--exit-locked-buffer)))
136 (when buffer-name
137 (error "Emacs cannot exit because buffer %S is locked" buffer-name))))
138
139(defun emacs-lock--kill-emacs-query-functions ()
140 "Display a message if any buffer is exit-locked.
141Return a value appropriate for `kill-emacs-query-functions' (which see)."
142 (let ((locked (emacs-lock--exit-locked-buffer)))
143 (or (not locked)
144 (progn
145 (message "Emacs cannot exit because buffer %S is locked" locked)
146 nil))))
147
148(defun emacs-lock--kill-buffer-query-functions ()
149 "Display a message if the current buffer is kill-locked.
150Return a value appropriate for `kill-buffer-query-functions' (which see)."
151 (or (emacs-lock--can-auto-unlock 'kill)
152 (memq emacs-lock-mode '(nil exit))
153 (progn
154 (message "Buffer %S is locked and cannot be killed" (buffer-name))
155 nil)))
156
157(defun emacs-lock--set-mode (mode arg)
158 "Setter function for `emacs-lock-mode'."
159 (setq emacs-lock-mode
160 (cond ((memq arg '(all exit kill))
161 ;; explicit locking mode arg, use it
162 arg)
163 ((and (eq arg current-prefix-arg) (consp current-prefix-arg))
164 ;; called with C-u M-x emacs-lock-mode, so ask the user
165 (intern (completing-read "Locking mode: "
166 '("all" "exit" "kill")
167 nil t nil nil
168 (symbol-name
169 emacs-lock-default-locking-mode))))
170 ((eq mode t)
171 ;; turn on, so use previous setting, or customized default
172 (or emacs-lock--old-mode emacs-lock-default-locking-mode))
173 (t
174 ;; anything else (turn off)
175 mode))))
176
177;;;###autoload
178(define-minor-mode emacs-lock-mode
179 "Toggle Emacs Lock mode in the current buffer.
180
181With \\[universal-argument], ask for the locking mode to be used.
182With other prefix ARG, turn mode on if ARG is positive, off otherwise.
183
184Initially, if the user does not pass an explicit locking mode, it defaults
185to `emacs-lock-default-locking-mode' (which see); afterwards, the locking
186mode most recently set on the buffer is used instead.
187
188When called from Elisp code, ARG can be any locking mode:
189
190 exit -- Emacs cannot exit while the buffer is locked
191 kill -- the buffer cannot be killed, but Emacs can exit as usual
192 all -- the buffer is locked against both actions
193
194Other values are interpreted as usual."
195 :init-value nil
196 :lighter (""
197 (emacs-lock--try-unlocking " locked:" " Locked:")
198 (:eval (symbol-name emacs-lock-mode)))
199 :group 'emacs-lock
200 :variable (emacs-lock-mode .
201 (lambda (mode)
202 (emacs-lock--set-mode mode arg)))
203 (when emacs-lock-mode
204 (setq emacs-lock--old-mode emacs-lock-mode)
205 (setq emacs-lock--try-unlocking
206 (and (if (eq emacs-lock-unlockable-modes t)
207 (emacs-lock-live-process-p (current-buffer))
208 (assq major-mode emacs-lock-unlockable-modes))
209 t))))
45 210
46(defun check-emacs-lock () 211(unless noninteractive
47 "Check if variable `emacs-lock-from-exiting' is t for any buffer. 212 (add-hook 'kill-buffer-query-functions 'emacs-lock--kill-buffer-query-functions)
48If any locked buffer is found, signal error and display the buffer's name." 213 ;; We set a hook in both kill-emacs-hook and kill-emacs-query-functions because
49 (save-excursion 214 ;; we really want to use k-e-q-f to stop as soon as possible, but don't want to
215 ;; be caught by surprise if someone calls `kill-emacs' instead.
216 (add-hook 'kill-emacs-hook 'emacs-lock--kill-emacs-hook)
217 (add-hook 'kill-emacs-query-functions 'emacs-lock--kill-emacs-query-functions))
218
219(defun emacs-lock-unload-function ()
220 "Unload the Emacs Lock library."
221 (catch :continue
50 (dolist (buffer (buffer-list)) 222 (dolist (buffer (buffer-list))
51 (set-buffer buffer) 223 (set-buffer buffer)
52 (when emacs-lock-from-exiting 224 (when emacs-lock-mode
53 (error "Emacs is locked from exit due to buffer: %s" (buffer-name)))))) 225 (if (y-or-n-p (format "Buffer %S is locked, unlock it? " (buffer-name)))
226 (emacs-lock-mode -1)
227 (message "Unloading of feature `emacs-lock' aborted.")
228 (throw :continue t))))
229 ;; continue standard unloading
230 nil))
54 231
55(defun toggle-emacs-lock () 232;;; Compatibility
56 "Toggle `emacs-lock-from-exiting' for the current buffer.
57See `check-emacs-lock'."
58 (interactive)
59 (setq emacs-lock-from-exiting (not emacs-lock-from-exiting))
60 (if emacs-lock-from-exiting
61 (message "Buffer is now locked")
62 (message "Buffer is now unlocked")))
63
64(defun emacs-lock-check-buffer-lock ()
65 "Check if variable `emacs-lock-from-exiting' is t for a buffer.
66If the buffer is locked, signal error and display its name."
67 (when emacs-lock-from-exiting
68 (error "Buffer `%s' is locked, can't delete it" (buffer-name))))
69
70; These next defuns make it so if you exit a shell that is locked, the lock
71; is shut off for that shell so you can exit Emacs. Same for telnet.
72; Also, if a shell or a telnet buffer was locked and the process killed,
73; turn the lock back on again if the process is restarted.
74
75(defun emacs-lock-shell-sentinel ()
76 (set-process-sentinel
77 (get-buffer-process (buffer-name)) (function emacs-lock-clear-sentinel)))
78
79(defun emacs-lock-clear-sentinel (_proc _str)
80 (if emacs-lock-from-exiting
81 (progn
82 (setq emacs-lock-from-exiting nil)
83 (setq emacs-lock-buffer-locked t)
84 (message "Buffer is now unlocked"))
85 (setq emacs-lock-buffer-locked nil)))
86 233
87(defun emacs-lock-was-buffer-locked () 234(define-obsolete-variable-alias 'emacs-lock-from-exiting 'emacs-lock-mode "24.1")
88 (if emacs-lock-buffer-locked
89 (setq emacs-lock-from-exiting t)))
90 235
91(unless noninteractive 236(defun toggle-emacs-lock ()
92 (add-hook 'kill-emacs-hook 'check-emacs-lock)) 237 "Toggle `emacs-lock-from-exiting' for the current buffer."
93(add-hook 'kill-buffer-hook 'emacs-lock-check-buffer-lock) 238 (interactive)
94(add-hook 'shell-mode-hook 'emacs-lock-was-buffer-locked) 239 (call-interactively 'emacs-lock-mode))
95(add-hook 'shell-mode-hook 'emacs-lock-shell-sentinel) 240(make-obsolete 'toggle-emacs-lock 'emacs-lock-mode "24.1")
96(add-hook 'telnet-mode-hook 'emacs-lock-was-buffer-locked)
97(add-hook 'telnet-mode-hook 'emacs-lock-shell-sentinel)
98 241
99(provide 'emacs-lock) 242(provide 'emacs-lock)
100 243
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 01efb9bcc21..6b3e10691d0 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,37 @@
12011-07-06 Glenn Morris <rgm@gnu.org>
2
3 * gnus-group.el (gnus-read-ephemeral-emacs-bug-group): Silence compiler.
4
52011-07-05 Lars Magne Ingebrigtsen <larsi@gnus.org>
6
7 * gnus.el (gnus-refer-article-method): Remove mention of nnspool, which
8 no longer is much used.
9 (gnus-summary-line-format): Link to "Marking Articles" instead of "Read
10 Articles".
11
122011-04-03 Kan-Ru Chen <kanru@kanru.info>
13
14 * nnir.el (nnir-notmuch-program, nnir-notmuch-additional-switches)
15 (nnir-notmuch-remove-prefix, nnir-engines, nnir-run-notmuch): New nnir
16 `notmuch' backend.
17
182011-07-05 Lars Magne Ingebrigtsen <larsi@gnus.org>
19
20 * mm-decode.el (mm-text-html-renderer): Doc fix.
21
22 * gnus-msg.el (gnus-bug): Fix the MML tag.
23
24 * pop3.el (pop3-open-server): -ERR is a valid response to CAPA.
25
262011-07-05 Daiki Ueno <ueno@unixuser.org>
27
28 * gnus-start.el (gnus-get-unread-articles): Don't connect to the
29 secondary methods if started with `gnus-no-server'.
30
312011-07-05 Juanma Barranquero <lekktu@gmail.com>
32
33 * message.el (message-return-action): Fix typo in docstring.
34
12011-07-04 Lars Magne Ingebrigtsen <larsi@gnus.org> 352011-07-04 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 36
3 * nnimap.el (nnimap-request-scan): Say that splitting has finished. 37 * nnimap.el (nnimap-request-scan): Say that splitting has finished.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 83383186ca9..da925700bd2 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2428,25 +2428,28 @@ the bug number, and browsing the URL must return mbox output."
2428 :version "24.1" 2428 :version "24.1"
2429 :type '(repeat (cons (symbol) (string :tag "URL format string")))) 2429 :type '(repeat (cons (symbol) (string :tag "URL format string"))))
2430 2430
2431(defun gnus-read-ephemeral-bug-group (number mbox-url &optional window-conf) 2431(defun gnus-read-ephemeral-bug-group (ids mbox-url &optional window-conf)
2432 "Browse bug NUMBER as ephemeral group." 2432 "Browse bug NUMBER as ephemeral group."
2433 (interactive (list (read-string "Enter bug number: " 2433 (interactive (list (read-string "Enter bug number: "
2434 (thing-at-point 'word) nil) 2434 (thing-at-point 'word) nil)
2435 ;; FIXME: Add completing-read from 2435 ;; FIXME: Add completing-read from
2436 ;; `gnus-emacs-bug-group-download-format' ... 2436 ;; `gnus-emacs-bug-group-download-format' ...
2437 (cdr (assoc 'emacs gnus-bug-group-download-format-alist)))) 2437 (cdr (assoc 'emacs gnus-bug-group-download-format-alist))))
2438 (when (stringp number) 2438 (when (stringp ids)
2439 (setq number (string-to-number number))) 2439 (setq ids (string-to-number ids)))
2440 (unless (listp ids)
2441 (setq ids (list ids)))
2440 (let ((tmpfile (mm-make-temp-file "gnus-temp-group-")) 2442 (let ((tmpfile (mm-make-temp-file "gnus-temp-group-"))
2441 (coding-system-for-write 'binary) 2443 (coding-system-for-write 'binary)
2442 (coding-system-for-read 'binary)) 2444 (coding-system-for-read 'binary))
2443 (with-temp-file tmpfile 2445 (with-temp-file tmpfile
2444 (url-insert-file-contents (format mbox-url number)) 2446 (dolist (id ids)
2447 (url-insert-file-contents (format mbox-url id)))
2445 (goto-char (point-min)) 2448 (goto-char (point-min))
2446 ;; Add the debbugs address so that we can respond to reports easily. 2449 ;; Add the debbugs address so that we can respond to reports easily.
2447 (while (re-search-forward "^To: " nil t) 2450 (while (re-search-forward "^To: " nil t)
2448 (end-of-line) 2451 (end-of-line)
2449 (insert (format ", %s@%s" number 2452 (insert (format ", %s@%s" (car ids)
2450 (gnus-replace-in-string 2453 (gnus-replace-in-string
2451 (gnus-replace-in-string mbox-url "^http://" "") 2454 (gnus-replace-in-string mbox-url "^http://" "")
2452 "/.*$" "")))) 2455 "/.*$" ""))))
@@ -2466,19 +2469,23 @@ the bug number, and browsing the URL must return mbox output."
2466 number 2469 number
2467 (cdr (assoc 'debian gnus-bug-group-download-format-alist)))) 2470 (cdr (assoc 'debian gnus-bug-group-download-format-alist))))
2468 2471
2469(defun gnus-read-ephemeral-emacs-bug-group (number &optional window-conf) 2472(defvar debbugs-bug-number) ; debbugs-gnu
2470 "Browse Emacs bug NUMBER as ephemeral group." 2473
2474(defun gnus-read-ephemeral-emacs-bug-group (ids &optional window-conf)
2475 "Browse Emacs bugs IDS as an ephemeral group."
2471 (interactive (list (string-to-number 2476 (interactive (list (string-to-number
2472 (read-string "Enter bug number: " 2477 (read-string "Enter bug number: "
2473 (thing-at-point 'word) nil)))) 2478 (thing-at-point 'word) nil))))
2479 (unless (listp ids)
2480 (setq ids (list ids)))
2474 (gnus-read-ephemeral-bug-group 2481 (gnus-read-ephemeral-bug-group
2475 number 2482 ids
2476 (cdr (assoc 'emacs gnus-bug-group-download-format-alist)) 2483 (cdr (assoc 'emacs gnus-bug-group-download-format-alist))
2477 window-conf) 2484 window-conf)
2478 (when (boundp 'debbugs-summary-mode) 2485 (when (fboundp 'debbugs-summary-mode)
2479 (with-current-buffer (window-buffer (selected-window)) 2486 (with-current-buffer (window-buffer (selected-window))
2480 (debbugs-summary-mode 1) 2487 (debbugs-summary-mode 1)
2481 (set (make-local-variable 'debbugs-bug-number) number)))) 2488 (set (make-local-variable 'debbugs-bug-number) (car ids)))))
2482 2489
2483(defun gnus-group-jump-to-group (group &optional prompt) 2490(defun gnus-group-jump-to-group (group &optional prompt)
2484 "Jump to newsgroup GROUP. 2491 "Jump to newsgroup GROUP.
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index b265a681eb8..bad474b4057 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1480,10 +1480,10 @@ If YANK is non-nil, include the original article."
1480 (erase-buffer) 1480 (erase-buffer)
1481 (gnus-debug) 1481 (gnus-debug)
1482 (setq text (buffer-string))) 1482 (setq text (buffer-string)))
1483 (insert (concat "<#part type=application/emacs-lisp" 1483 (insert "<#part type=application/emacs-lisp "
1484 "disposition=inline description=\"User settings\">\n" 1484 "disposition=inline description=\"User settings\">\n"
1485 text 1485 text
1486 "\n<#/part>"))) 1486 "\n<#/part>"))
1487 (goto-char (point-min)) 1487 (goto-char (point-min))
1488 (search-forward "Subject: " nil t) 1488 (search-forward "Subject: " nil t)
1489 (message ""))) 1489 (message "")))
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index aa9af012a1c..7c63d5e2653 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -1043,7 +1043,7 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
1043 1043
1044 ;; Find the number of unread articles in each non-dead group. 1044 ;; Find the number of unread articles in each non-dead group.
1045 (let ((gnus-read-active-file (and (not level) gnus-read-active-file))) 1045 (let ((gnus-read-active-file (and (not level) gnus-read-active-file)))
1046 (gnus-get-unread-articles level)))) 1046 (gnus-get-unread-articles level dont-connect))))
1047 1047
1048(defun gnus-call-subscribe-functions (method group) 1048(defun gnus-call-subscribe-functions (method group)
1049 "Call METHOD to subscribe GROUP. 1049 "Call METHOD to subscribe GROUP.
@@ -1606,7 +1606,7 @@ If SCAN, request a scan of that group as well."
1606 1606
1607;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb' 1607;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
1608;; and compute how many unread articles there are in each group. 1608;; and compute how many unread articles there are in each group.
1609(defun gnus-get-unread-articles (&optional level) 1609(defun gnus-get-unread-articles (&optional level dont-connect)
1610 (setq gnus-server-method-cache nil) 1610 (setq gnus-server-method-cache nil)
1611 (require 'gnus-agent) 1611 (require 'gnus-agent)
1612 (let* ((newsrc (cdr gnus-newsrc-alist)) 1612 (let* ((newsrc (cdr gnus-newsrc-alist))
@@ -1702,12 +1702,13 @@ If SCAN, request a scan of that group as well."
1702 1702
1703 ;; If we have primary/secondary select methods, but no groups from 1703 ;; If we have primary/secondary select methods, but no groups from
1704 ;; them, we still want to issue a retrieval request from them. 1704 ;; them, we still want to issue a retrieval request from them.
1705 (dolist (method (cons gnus-select-method 1705 (unless dont-connect
1706 gnus-secondary-select-methods)) 1706 (dolist (method (cons gnus-select-method
1707 (when (and (not (assoc method type-cache)) 1707 gnus-secondary-select-methods))
1708 (gnus-check-backend-function 'request-list (car method))) 1708 (when (and (not (assoc method type-cache))
1709 (with-current-buffer nntp-server-buffer 1709 (gnus-check-backend-function 'request-list (car method)))
1710 (gnus-read-active-file-1 method nil)))) 1710 (with-current-buffer nntp-server-buffer
1711 (gnus-read-active-file-1 method nil)))))
1711 1712
1712 ;; Start early async retrieval of data. 1713 ;; Start early async retrieval of data.
1713 (let ((done-methods nil) 1714 (let ((done-methods nil)
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 98a2684dd61..ac7db0e1d69 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -1423,10 +1423,6 @@ no need to set this variable."
1423 1423
1424(defcustom gnus-refer-article-method 'current 1424(defcustom gnus-refer-article-method 'current
1425 "Preferred method for fetching an article by Message-ID. 1425 "Preferred method for fetching an article by Message-ID.
1426If you are reading news from the local spool (with nnspool), fetching
1427articles by Message-ID is painfully slow. By setting this method to an
1428nntp method, you might get acceptable results.
1429
1430The value of this variable must be a valid select method as discussed 1426The value of this variable must be a valid select method as discussed
1431in the documentation of `gnus-select-method'. 1427in the documentation of `gnus-select-method'.
1432 1428
@@ -2967,7 +2963,7 @@ with some simple extensions.
2967%R \"A\" if this article has been replied to, \" \" 2963%R \"A\" if this article has been replied to, \" \"
2968 otherwise (character) 2964 otherwise (character)
2969%U \"Read\" status of this article. 2965%U \"Read\" status of this article.
2970 See Info node `(gnus)Read Articles' 2966 See Info node `(gnus)Marking Articles'
2971%[ Opening bracket (character, \"[\" or \"<\") 2967%[ Opening bracket (character, \"[\" or \"<\")
2972%] Closing bracket (character, \"]\" or \">\") 2968%] Closing bracket (character, \"]\" or \">\")
2973%> Spaces of length thread-level (string) 2969%> Spaces of length thread-level (string)
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 567eb33cf05..7d7cc01225b 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1185,7 +1185,7 @@ It is a vector of the following headers:
1185(defvar message-send-actions nil 1185(defvar message-send-actions nil
1186 "A list of actions to be performed upon successful sending of a message.") 1186 "A list of actions to be performed upon successful sending of a message.")
1187(defvar message-return-action nil 1187(defvar message-return-action nil
1188 "Action to return to the caller after sending or postphoning a message.") 1188 "Action to return to the caller after sending or postponing a message.")
1189(defvar message-exit-actions nil 1189(defvar message-exit-actions nil
1190 "A list of actions to be performed upon exiting after sending a message.") 1190 "A list of actions to be performed upon exiting after sending a message.")
1191(defvar message-kill-actions nil 1191(defvar message-kill-actions nil
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index f543920446b..a51c6630ac5 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -114,14 +114,14 @@
114 "Render of HTML contents. 114 "Render of HTML contents.
115It is one of defined renderer types, or a rendering function. 115It is one of defined renderer types, or a rendering function.
116The defined renderer types are: 116The defined renderer types are:
117`shr': use Gnus simple HTML renderer; 117`shr': use the built-in Gnus HTML renderer;
118`gnus-w3m' : use Gnus renderer based on w3m; 118`gnus-w3m': use Gnus renderer based on w3m;
119`w3m' : use emacs-w3m; 119`w3m': use emacs-w3m;
120`w3m-standalone': use w3m; 120`w3m-standalone': use plain w3m;
121`links': use links; 121`links': use links;
122`lynx' : use lynx; 122`lynx': use lynx;
123`w3' : use Emacs/W3; 123`w3': use Emacs/W3;
124`html2text' : use html2text; 124`html2text': use html2text;
125nil : use external viewer (default web browser)." 125nil : use external viewer (default web browser)."
126 :version "24.1" 126 :version "24.1"
127 :type '(choice (const shr) 127 :type '(choice (const shr)
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 71b85183e0f..8099cc2a7cc 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -499,6 +499,31 @@ arrive at the correct group name, \"mail.misc\"."
499 :type '(directory) 499 :type '(directory)
500 :group 'nnir) 500 :group 'nnir)
501 501
502(defcustom nnir-notmuch-program "notmuch"
503 "*Name of notmuch search executable."
504 :type '(string)
505 :group 'nnir)
506
507(defcustom nnir-notmuch-additional-switches '()
508 "*A list of strings, to be given as additional arguments to notmuch.
509
510Note that this should be a list. Ie, do NOT use the following:
511 (setq nnir-notmuch-additional-switches \"-i -w\") ; wrong
512Instead, use this:
513 (setq nnir-notmuch-additional-switches '(\"-i\" \"-w\"))"
514 :type '(repeat (string))
515 :group 'nnir)
516
517(defcustom nnir-notmuch-remove-prefix (concat (getenv "HOME") "/Mail/")
518 "*The prefix to remove from each file name returned by notmuch
519in order to get a group name (albeit with / instead of .). This is a
520regular expression.
521
522This variable is very similar to `nnir-namazu-remove-prefix', except
523that it is for notmuch, not Namazu."
524 :type '(regexp)
525 :group 'nnir)
526
502;;; Developer Extension Variable: 527;;; Developer Extension Variable:
503 528
504(defvar nnir-engines 529(defvar nnir-engines
@@ -519,6 +544,8 @@ arrive at the correct group name, \"mail.misc\"."
519 ((group . "Swish-e Group spec: "))) 544 ((group . "Swish-e Group spec: ")))
520 (namazu nnir-run-namazu 545 (namazu nnir-run-namazu
521 ()) 546 ())
547 (notmuch nnir-run-notmuch
548 ())
522 (hyrex nnir-run-hyrex 549 (hyrex nnir-run-hyrex
523 ((group . "Hyrex Group spec: "))) 550 ((group . "Hyrex Group spec: ")))
524 (find-grep nnir-run-find-grep 551 (find-grep nnir-run-find-grep
@@ -1338,6 +1365,80 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
1338 (> (nnir-artitem-rsv x) 1365 (> (nnir-artitem-rsv x)
1339 (nnir-artitem-rsv y))))))))) 1366 (nnir-artitem-rsv y)))))))))
1340 1367
1368(defun nnir-run-notmuch (query server &optional group)
1369 "Run QUERY against notmuch.
1370Returns a vector of (group name, file name) pairs (also vectors,
1371actually)."
1372
1373 ;; (when group
1374 ;; (error "The notmuch backend cannot search specific groups"))
1375
1376 (save-excursion
1377 (let ( (qstring (cdr (assq 'query query)))
1378 (groupspec (cdr (assq 'group query)))
1379 (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server))
1380 artlist
1381 (article-pattern (if (string= (gnus-group-server server) "nnmaildir")
1382 ":[0-9]+"
1383 "^[0-9]+$"))
1384 artno dirnam filenam)
1385
1386 (when (equal "" qstring)
1387 (error "notmuch: You didn't enter anything"))
1388
1389 (set-buffer (get-buffer-create nnir-tmp-buffer))
1390 (erase-buffer)
1391
1392 (if groupspec
1393 (message "Doing notmuch query %s on %s..." qstring groupspec)
1394 (message "Doing notmuch query %s..." qstring))
1395
1396 (let* ((cp-list `( ,nnir-notmuch-program
1397 nil ; input from /dev/null
1398 t ; output
1399 nil ; don't redisplay
1400 "search"
1401 "--format=text"
1402 "--output=files"
1403 ,@(nnir-read-server-parm 'nnir-notmuch-additional-switches server)
1404 ,qstring ; the query, in notmuch format
1405 ))
1406 (exitstatus
1407 (progn
1408 (message "%s args: %s" nnir-notmuch-program
1409 (mapconcat 'identity (cddddr cp-list) " ")) ;; ???
1410 (apply 'call-process cp-list))))
1411 (unless (or (null exitstatus)
1412 (zerop exitstatus))
1413 (nnheader-report 'nnir "Couldn't run notmuch: %s" exitstatus)
1414 ;; notmuch failure reason is in this buffer, show it if
1415 ;; the user wants it.
1416 (when (> gnus-verbose 6)
1417 (display-buffer nnir-tmp-buffer))))
1418
1419 ;; The results are output in the format of:
1420 ;; absolute-path-name
1421 (goto-char (point-min))
1422 (while (not (eobp))
1423 (setq filenam (buffer-substring-no-properties (line-beginning-position)
1424 (line-end-position))
1425 artno (file-name-nondirectory filenam)
1426 dirnam (file-name-directory filenam))
1427 (forward-line 1)
1428
1429 ;; don't match directories
1430 (when (string-match article-pattern artno)
1431 (when (not (null dirnam))
1432
1433 ;; maybe limit results to matching groups.
1434 (when (or (not groupspec)
1435 (string-match groupspec dirnam))
1436 (nnir-add-result dirnam artno "" prefix server artlist)))))
1437
1438 (message "Massaging notmuch output...done")
1439
1440 artlist)))
1441
1341(defun nnir-run-find-grep (query server &optional grouplist) 1442(defun nnir-run-find-grep (query server &optional grouplist)
1342 "Run find and grep to obtain matching articles." 1443 "Run find and grep to obtain matching articles."
1343 (let* ((method (gnus-server-to-method server)) 1444 (let* ((method (gnus-server-to-method server))
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el
index b485ac39f60..e29ddb0d44e 100644
--- a/lisp/gnus/pop3.el
+++ b/lisp/gnus/pop3.el
@@ -307,7 +307,7 @@ Returns the process associated with the connection."
307 (or pop3-stream-type 'network))) 307 (or pop3-stream-type 'network)))
308 :capability-command "CAPA\r\n" 308 :capability-command "CAPA\r\n"
309 :end-of-command "^\\(-ERR\\|+OK \\).*\n" 309 :end-of-command "^\\(-ERR\\|+OK \\).*\n"
310 :end-of-capability "^\\.\r?\n" 310 :end-of-capability "^\\.\r?\n\\|^-ERR"
311 :success "^\\+OK.*\n" 311 :success "^\\+OK.*\n"
312 :return-list t 312 :return-list t
313 :starttls-function 313 :starttls-function
diff --git a/lisp/info.el b/lisp/info.el
index dca3df21d5c..047a1b340a0 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2092,7 +2092,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
2092 )) 2092 ))
2093 2093
2094(defun Info-directory-toc-nodes (filename) 2094(defun Info-directory-toc-nodes (filename)
2095 "Directory-specific implementation of `Info-directory-toc-nodes'." 2095 "Directory-specific implementation of `Info-toc-nodes'."
2096 `(,filename 2096 `(,filename
2097 ("Top" nil nil nil))) 2097 ("Top" nil nil nil)))
2098 2098
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index bc9a0604279..f4b29958aab 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -351,7 +351,7 @@
351;; systems with non-classic /bin/[r]mail behavior 351;; systems with non-classic /bin/[r]mail behavior
352;; guard against nil user-mail-address in generating MESSAGE-ID: 352;; guard against nil user-mail-address in generating MESSAGE-ID:
353;; feedmail-queue-slug-suspect-regexp is now a variable to 353;; feedmail-queue-slug-suspect-regexp is now a variable to
354;; accomodate non-ASCII environments (thanks to 354;; accommodate non-ASCII environments (thanks to
355;; Makoto.Nakagawa@jp.compaq.com for this suggestion) 355;; Makoto.Nakagawa@jp.compaq.com for this suggestion)
356;; feedmail-buffer-to-smtp, to parallel feedmail-buffer-to-smtpmail 356;; feedmail-buffer-to-smtp, to parallel feedmail-buffer-to-smtpmail
357;; patchlevel 10, 22 April 2001 357;; patchlevel 10, 22 April 2001
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 651defeaf46..6f1bce03ee9 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -153,20 +153,21 @@ MIME entities.")
153;;; MIME-entity object 153;;; MIME-entity object
154 154
155(defun rmail-mime-entity (type disposition transfer-encoding 155(defun rmail-mime-entity (type disposition transfer-encoding
156 display header tagline body children handler) 156 display header tagline body children handler
157 &optional truncated)
157 "Retrun a newly created MIME-entity object from arguments. 158 "Retrun a newly created MIME-entity object from arguments.
158 159
159A MIME-entity is a vector of 9 elements: 160A MIME-entity is a vector of 10 elements:
160 161
161 [TYPE DISPOSITION TRANSFER-ENCODING DISPLAY HEADER TAGLINE BODY 162 [TYPE DISPOSITION TRANSFER-ENCODING DISPLAY HEADER TAGLINE BODY
162 CHILDREN HANDLER] 163 CHILDREN HANDLER TRUNCATED]
163 164
164TYPE and DISPOSITION correspond to MIME headers Content-Type and 165TYPE and DISPOSITION correspond to MIME headers Content-Type and
165Cotent-Disposition respectively, and has this format: 166Content-Disposition respectively, and have this format:
166 167
167 \(VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...) 168 \(VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...)
168 169
169VALUE is a string and ATTRIBUTE is a symbol. 170Each VALUE is a string and each ATTRIBUTE is a string.
170 171
171Consider the following header, for example: 172Consider the following header, for example:
172 173
@@ -208,9 +209,12 @@ entity have one or more children. A \"message/rfc822\" entity
208has just one child. Any other entity has no child. 209has just one child. Any other entity has no child.
209 210
210HANDLER is a function to insert the entity according to DISPLAY. 211HANDLER is a function to insert the entity according to DISPLAY.
211It is called with one argument ENTITY." 212It is called with one argument ENTITY.
213
214TRUNCATED is non-nil if the text of this entity was truncated."
215
212 (vector type disposition transfer-encoding 216 (vector type disposition transfer-encoding
213 display header tagline body children handler)) 217 display header tagline body children handler truncated))
214 218
215;; Accessors for a MIME-entity object. 219;; Accessors for a MIME-entity object.
216(defsubst rmail-mime-entity-type (entity) (aref entity 0)) 220(defsubst rmail-mime-entity-type (entity) (aref entity 0))
@@ -222,6 +226,9 @@ It is called with one argument ENTITY."
222(defsubst rmail-mime-entity-body (entity) (aref entity 6)) 226(defsubst rmail-mime-entity-body (entity) (aref entity 6))
223(defsubst rmail-mime-entity-children (entity) (aref entity 7)) 227(defsubst rmail-mime-entity-children (entity) (aref entity 7))
224(defsubst rmail-mime-entity-handler (entity) (aref entity 8)) 228(defsubst rmail-mime-entity-handler (entity) (aref entity 8))
229(defsubst rmail-mime-entity-truncated (entity) (aref entity 9))
230(defsubst rmail-mime-entity-set-truncated (entity truncated)
231 (aset entity 9 truncated))
225 232
226(defsubst rmail-mime-message-p () 233(defsubst rmail-mime-message-p ()
227 "Non-nil if and only if the current message is a MIME." 234 "Non-nil if and only if the current message is a MIME."
@@ -237,6 +244,10 @@ It is called with one argument ENTITY."
237 (directory (button-get button 'directory)) 244 (directory (button-get button 'directory))
238 (data (button-get button 'data)) 245 (data (button-get button 'data))
239 (ofilename filename)) 246 (ofilename filename))
247 (if (and (not (stringp data))
248 (rmail-mime-entity-truncated data))
249 (unless (y-or-n-p "This entity is truncated; save anyway? ")
250 (error "Aborted")))
240 (setq filename (expand-file-name 251 (setq filename (expand-file-name
241 (read-file-name (format "Save as (default: %s): " filename) 252 (read-file-name (format "Save as (default: %s): " filename)
242 directory 253 directory
@@ -387,6 +398,11 @@ The value is a vector [ INDEX HEADER TAGLINE BODY END], where
387 (if (and rmail-mime-mbox-buffer (= (aref segment 1) (point-min))) 398 (if (and rmail-mime-mbox-buffer (= (aref segment 1) (point-min)))
388 (let ((new (aref (rmail-mime-entity-display entity) 1))) 399 (let ((new (aref (rmail-mime-entity-display entity) 1)))
389 (aset new 0 t)))) 400 (aset new 0 t))))
401 ;; Query as a warning before showing if truncated.
402 (if (and (not (stringp entity))
403 (rmail-mime-entity-truncated entity))
404 (unless (y-or-n-p "This entity is truncated; show anyway? ")
405 (error "Aborted")))
390 ;; Enter the shown mode. 406 ;; Enter the shown mode.
391 (rmail-mime-shown-mode entity) 407 (rmail-mime-shown-mode entity)
392 ;; Force this body shown. 408 ;; Force this body shown.
@@ -816,7 +832,7 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
816 (let ((boundary (cdr (assq 'boundary content-type))) 832 (let ((boundary (cdr (assq 'boundary content-type)))
817 (subtype (cadr (split-string (car content-type) "/"))) 833 (subtype (cadr (split-string (car content-type) "/")))
818 (index 0) 834 (index 0)
819 beg end next entities) 835 beg end next entities truncated)
820 (unless boundary 836 (unless boundary
821 (rmail-mm-get-boundary-error-message 837 (rmail-mm-get-boundary-error-message
822 "No boundary defined" content-type content-disposition 838 "No boundary defined" content-type content-disposition
@@ -845,7 +861,7 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
845 (setq beg (point-min)) 861 (setq beg (point-min))
846 862
847 (while (or (and (search-forward boundary nil t) 863 (while (or (and (search-forward boundary nil t)
848 (setq end (match-beginning 0))) 864 (setq truncated nil end (match-beginning 0)))
849 ;; If the boundary does not appear at all, 865 ;; If the boundary does not appear at all,
850 ;; the message was truncated. 866 ;; the message was truncated.
851 ;; Handle the rest of the truncated message 867 ;; Handle the rest of the truncated message
@@ -854,7 +870,7 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
854 (and (save-excursion 870 (and (save-excursion
855 (skip-chars-forward "\n") 871 (skip-chars-forward "\n")
856 (> (point-max) (point))) 872 (> (point-max) (point)))
857 (setq end (point-max)))) 873 (setq truncated t end (point-max))))
858 ;; If this is the last boundary according to RFC 2046, hide the 874 ;; If this is the last boundary according to RFC 2046, hide the
859 ;; epilogue, else hide the boundary only. Use a marker for 875 ;; epilogue, else hide the boundary only. Use a marker for
860 ;; `next' because `rmail-mime-show' may change the buffer. 876 ;; `next' because `rmail-mime-show' may change the buffer.
@@ -862,7 +878,7 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
862 (setq next (point-max-marker))) 878 (setq next (point-max-marker)))
863 ((looking-at "[ \t]*\n") 879 ((looking-at "[ \t]*\n")
864 (setq next (copy-marker (match-end 0) t))) 880 (setq next (copy-marker (match-end 0) t)))
865 ((= end (point-max)) 881 (truncated
866 ;; We're handling what's left of a truncated message. 882 ;; We're handling what's left of a truncated message.
867 (setq next (point-max-marker))) 883 (setq next (point-max-marker)))
868 (t 884 (t
@@ -886,6 +902,7 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
886 ;; Display a tagline. 902 ;; Display a tagline.
887 (aset (aref (rmail-mime-entity-display child) 1) 1 903 (aset (aref (rmail-mime-entity-display child) 1) 1
888 (aset (rmail-mime-entity-tagline child) 2 t)) 904 (aset (rmail-mime-entity-tagline child) 2 t))
905 (rmail-mime-entity-set-truncated child truncated)
889 (push child entities))) 906 (push child entities)))
890 907
891 (delete-region end next) 908 (delete-region end next)
@@ -1391,6 +1408,8 @@ This is the usual value of `rmail-insert-mime-forwarded-message-function'."
1391 (re-search-forward regexp nil t)) 1408 (re-search-forward regexp nil t))
1392 ;; Next, search the body. 1409 ;; Next, search the body.
1393 (if (and entity 1410 (if (and entity
1411 ;; RMS: I am not sure why, but sometimes this is a string.
1412 (not (stringp entity))
1394 (let* ((content-type (rmail-mime-entity-type entity)) 1413 (let* ((content-type (rmail-mime-entity-type entity))
1395 (charset (cdr (assq 'charset (cdr content-type))))) 1414 (charset (cdr (assq 'charset (cdr content-type)))))
1396 (or (not (string-match "text/.*" (car content-type))) 1415 (or (not (string-match "text/.*" (car content-type)))
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 13da0627fff..6480d6a393f 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -144,19 +144,11 @@ Otherwise, let mailer send back a message to report errors."
144;;;###autoload 144;;;###autoload
145(put 'send-mail-function 'standard-value 145(put 'send-mail-function 'standard-value
146 ;; MS-Windows can access the clipboard even under -nw. 146 ;; MS-Windows can access the clipboard even under -nw.
147 '((if (or (and window-system (eq system-type 'darwin)) 147 '('sendmail-query-once))
148 (eq system-type 'windows-nt))
149 'mailclient-send-it
150 'sendmail-send-it)))
151 148
152;; Useful to set in site-init.el 149;; Useful to set in site-init.el
153;;;###autoload 150;;;###autoload
154(defcustom send-mail-function 151(defcustom send-mail-function 'sendmail-query-once
155 (if (or (and window-system (eq system-type 'darwin))
156 ;; MS-Windows can access the clipboard even under -nw.
157 (eq system-type 'windows-nt))
158 'mailclient-send-it
159 'sendmail-send-it)
160 "Function to call to send the current buffer as mail. 152 "Function to call to send the current buffer as mail.
161The headers should be delimited by a line which is 153The headers should be delimited by a line which is
162not a valid RFC822 header or continuation line, 154not a valid RFC822 header or continuation line,
@@ -170,11 +162,13 @@ This is used by the default mail-sending commands. See also
170 (function-item mailclient-send-it :tag "Use Mailclient package") 162 (function-item mailclient-send-it :tag "Use Mailclient package")
171 function) 163 function)
172 :initialize 'custom-initialize-delay 164 :initialize 'custom-initialize-delay
165 :version "24.1"
173 :group 'sendmail) 166 :group 'sendmail)
174 167
175(defvar sendmail-query-once-function 'query 168(defvar sendmail-query-once-function 'query
176 "Either a function to send email, or the symbol `query'.") 169 "Either a function to send email, or the symbol `query'.")
177 170
171;;;###autoload
178(defun sendmail-query-once () 172(defun sendmail-query-once ()
179 "Send an email via `sendmail-query-once-function'. 173 "Send an email via `sendmail-query-once-function'.
180If `sendmail-query-once-function' is `query', ask the user what 174If `sendmail-query-once-function' is `query', ask the user what
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 3fd2d9ddf21..1b53b47499b 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -71,9 +71,11 @@
71 :group 'mail) 71 :group 'mail)
72 72
73 73
74(defvar smtpmail-default-smtp-server nil 74(defcustom smtpmail-default-smtp-server nil
75 "Specify default SMTP server. 75 "Specify default SMTP server.
76This only has effect if you specify it before loading the smtpmail library.") 76This only has effect if you specify it before loading the smtpmail library."
77 :type '(choice (const nil) string)
78 :group 'smtpmail)
77 79
78(defcustom smtpmail-smtp-server 80(defcustom smtpmail-smtp-server
79 (or (getenv "SMTPSERVER") smtpmail-default-smtp-server) 81 (or (getenv "SMTPSERVER") smtpmail-default-smtp-server)
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index effba41c564..038794e117d 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -281,18 +281,14 @@ functionality.
281 (network-stream-command stream capability-command eo-capa)))) 281 (network-stream-command stream capability-command eo-capa))))
282 282
283 ;; If TLS is mandatory, close the connection if it's unencrypted. 283 ;; If TLS is mandatory, close the connection if it's unencrypted.
284 (when (and (or require-tls 284 (when (and require-tls
285 ;; The server said it was possible to do STARTTLS,
286 ;; and we wanted to use it...
287 (and starttls-command
288 (plist-get parameters :use-starttls-if-possible)))
289 ;; ... but Emacs wasn't able to -- either no built-in 285 ;; ... but Emacs wasn't able to -- either no built-in
290 ;; support, or no gnutls-cli installed. 286 ;; support, or no gnutls-cli installed.
291 (eq resulting-type 'plain)) 287 (eq resulting-type 'plain))
292 (setq error 288 (setq error
293 (if require-tls 289 (if require-tls
294 "Server does not support TLS" 290 "Server does not support TLS"
295 "Server supports STARTTLS, but Emacs does not have support for it")) 291 "Server supports STARTTLS, but Emacs does not have support for it"))
296 (delete-process stream) 292 (delete-process stream)
297 (setq stream nil)) 293 (setq stream nil))
298 ;; Return value: 294 ;; Return value:
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index fcf523a7068..f20040e8a9a 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -308,7 +308,7 @@ buffer in your bug report.
308 308
309 ;; There is at least one Tramp buffer. 309 ;; There is at least one Tramp buffer.
310 (when buffer-list 310 (when buffer-list
311 (switch-to-buffer (list-buffers-noselect nil)) 311 (tramp-compat-pop-to-buffer-same-window (list-buffers-noselect nil))
312 (delete-other-windows) 312 (delete-other-windows)
313 (setq buffer-read-only nil) 313 (setq buffer-read-only nil)
314 (goto-char (point-min)) 314 (goto-char (point-min))
@@ -343,7 +343,7 @@ the debug buffer(s).")
343 ;; OK, let's send. First we delete the buffer list. 343 ;; OK, let's send. First we delete the buffer list.
344 (progn 344 (progn
345 (kill-buffer nil) 345 (kill-buffer nil)
346 (switch-to-buffer curbuf) 346 (tramp-compat-pop-to-buffer-same-window curbuf)
347 (goto-char (point-max)) 347 (goto-char (point-max))
348 (insert "\n\ 348 (insert "\n\
349This is a special notion of the `gnus/message' package. If you 349This is a special notion of the `gnus/message' package. If you
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 3c0642c3c78..e7ea4354b51 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -23,9 +23,9 @@
23 23
24;;; Commentary: 24;;; Commentary:
25 25
26;; Tramp's main Emacs version for development is GNU Emacs 24. This 26;; Tramp's main Emacs version for development is Emacs 24. This
27;; package provides compatibility functions for GNU Emacs 22, GNU 27;; package provides compatibility functions for Emacs 22, Emacs 23,
28;; Emacs 23 and XEmacs 21.4+. 28;; XEmacs 21.4+ and SXEmacs 22.
29 29
30;;; Code: 30;;; Code:
31 31
@@ -286,9 +286,8 @@ Not actually used. Use `(format \"%o\" i)' instead?"
286 (tramp-compat-funcall 'file-attributes filename id-format) 286 (tramp-compat-funcall 'file-attributes filename id-format)
287 (wrong-number-of-arguments (file-attributes filename)))))) 287 (wrong-number-of-arguments (file-attributes filename))))))
288 288
289;; PRESERVE-UID-GID has been introduced with Emacs 23. It does not 289;; PRESERVE-UID-GID does not exist in XEmacs.
290;; hurt to ignore it for other (X)Emacs versions. 290;; PRESERVE-SELINUX-CONTEXT has been introduced with Emacs 24.1.
291;; PRESERVE-SELINUX-CONTEXT has been introduced with Emacs 24.
292(defun tramp-compat-copy-file 291(defun tramp-compat-copy-file
293 (filename newname &optional ok-if-already-exists keep-date 292 (filename newname &optional ok-if-already-exists keep-date
294 preserve-uid-gid preserve-selinux-context) 293 preserve-uid-gid preserve-selinux-context)
@@ -484,10 +483,7 @@ exiting if process is running."
484 (tramp-compat-funcall 'set-process-query-on-exit-flag process flag) 483 (tramp-compat-funcall 'set-process-query-on-exit-flag process flag)
485 (tramp-compat-funcall 'process-kill-without-query process flag))) 484 (tramp-compat-funcall 'process-kill-without-query process flag)))
486 485
487(add-hook 'tramp-unload-hook 486;; There exist different implementations for this function.
488 (lambda ()
489 (unload-feature 'tramp-compat 'force)))
490
491(defun tramp-compat-coding-system-change-eol-conversion (coding-system eol-type) 487(defun tramp-compat-coding-system-change-eol-conversion (coding-system eol-type)
492 "Return a coding system like CODING-SYSTEM but with given EOL-TYPE. 488 "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.
493EOL-TYPE can be one of `dos', `unix', or `mac'." 489EOL-TYPE can be one of `dos', `unix', or `mac'."
@@ -506,6 +502,19 @@ EOL-TYPE can be one of `dos', `unix', or `mac'."
506 "`dos', `unix', or `mac'"))))) 502 "`dos', `unix', or `mac'")))))
507 (t (error "Can't change EOL conversion -- is MULE missing?")))) 503 (t (error "Can't change EOL conversion -- is MULE missing?"))))
508 504
505;; `pop-to-buffer-same-window' has been introduced with Emacs 24.1.
506(defun tramp-compat-pop-to-buffer-same-window
507 (&optional buffer-or-name norecord label)
508 "Pop to buffer specified by BUFFER-OR-NAME in the selected window."
509 (if (fboundp 'pop-to-buffer-same-window)
510 (tramp-compat-funcall
511 'pop-to-buffer-same-window buffer-or-name norecord label)
512 (tramp-compat-funcall 'switch-to-buffer buffer-or-name norecord)))
513
514(add-hook 'tramp-unload-hook
515 (lambda ()
516 (unload-feature 'tramp-compat 'force)))
517
509(provide 'tramp-compat) 518(provide 'tramp-compat)
510 519
511;;; TODO: 520;;; TODO:
diff --git a/lisp/obsolete/old-emacs-lock.el b/lisp/obsolete/old-emacs-lock.el
new file mode 100644
index 00000000000..b45003fcecc
--- /dev/null
+++ b/lisp/obsolete/old-emacs-lock.el
@@ -0,0 +1,102 @@
1;;; emacs-lock.el --- prevents you from exiting Emacs if a buffer is locked
2
3;; Copyright (C) 1994, 1997, 2001-2011 Free Software Foundation, Inc
4
5;; Author: Tom Wurgler <twurgler@goodyear.com>
6;; Created: 12/8/94
7;; Keywords: extensions, processes
8;; Obsolete-since: 24.1
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software: you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation, either version 3 of the License, or
15;; (at your option) any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24
25;;; Commentary:
26
27;; This code sets a buffer-local variable to t if toggle-emacs-lock is run,
28;; then if the user attempts to exit Emacs, the locked buffer name will be
29;; displayed and the exit aborted. This is just a way of protecting
30;; yourself from yourself. For example, if you have a shell running a big
31;; program and exiting Emacs would abort that program, you may want to lock
32;; that buffer, then if you forget about it after a while, you won't
33;; accidentally exit Emacs. To unlock the buffer, just goto the buffer and
34;; run toggle-emacs-lock again.
35
36;;; Code:
37
38(defvar emacs-lock-from-exiting nil
39 "Whether Emacs is locked to prevent exiting. See `check-emacs-lock'.")
40(make-variable-buffer-local 'emacs-lock-from-exiting)
41
42(defvar emacs-lock-buffer-locked nil
43 "Whether a shell or telnet buffer was locked when its process was killed.")
44(make-variable-buffer-local 'emacs-lock-buffer-locked)
45(put 'emacs-lock-buffer-locked 'permanent-local t)
46
47(defun check-emacs-lock ()
48 "Check if variable `emacs-lock-from-exiting' is t for any buffer.
49If any locked buffer is found, signal error and display the buffer's name."
50 (save-excursion
51 (dolist (buffer (buffer-list))
52 (set-buffer buffer)
53 (when emacs-lock-from-exiting
54 (error "Emacs is locked from exit due to buffer: %s" (buffer-name))))))
55
56(defun toggle-emacs-lock ()
57 "Toggle `emacs-lock-from-exiting' for the current buffer.
58See `check-emacs-lock'."
59 (interactive)
60 (setq emacs-lock-from-exiting (not emacs-lock-from-exiting))
61 (if emacs-lock-from-exiting
62 (message "Buffer is now locked")
63 (message "Buffer is now unlocked")))
64
65(defun emacs-lock-check-buffer-lock ()
66 "Check if variable `emacs-lock-from-exiting' is t for a buffer.
67If the buffer is locked, signal error and display its name."
68 (when emacs-lock-from-exiting
69 (error "Buffer `%s' is locked, can't delete it" (buffer-name))))
70
71; These next defuns make it so if you exit a shell that is locked, the lock
72; is shut off for that shell so you can exit Emacs. Same for telnet.
73; Also, if a shell or a telnet buffer was locked and the process killed,
74; turn the lock back on again if the process is restarted.
75
76(defun emacs-lock-shell-sentinel ()
77 (set-process-sentinel
78 (get-buffer-process (buffer-name)) (function emacs-lock-clear-sentinel)))
79
80(defun emacs-lock-clear-sentinel (_proc _str)
81 (if emacs-lock-from-exiting
82 (progn
83 (setq emacs-lock-from-exiting nil)
84 (setq emacs-lock-buffer-locked t)
85 (message "Buffer is now unlocked"))
86 (setq emacs-lock-buffer-locked nil)))
87
88(defun emacs-lock-was-buffer-locked ()
89 (if emacs-lock-buffer-locked
90 (setq emacs-lock-from-exiting t)))
91
92(unless noninteractive
93 (add-hook 'kill-emacs-hook 'check-emacs-lock))
94(add-hook 'kill-buffer-hook 'emacs-lock-check-buffer-lock)
95(add-hook 'shell-mode-hook 'emacs-lock-was-buffer-locked)
96(add-hook 'shell-mode-hook 'emacs-lock-shell-sentinel)
97(add-hook 'telnet-mode-hook 'emacs-lock-was-buffer-locked)
98(add-hook 'telnet-mode-hook 'emacs-lock-shell-sentinel)
99
100(provide 'emacs-lock)
101
102;;; emacs-lock.el ends here
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 0b9390af6c9..3a9463f0f97 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2410,9 +2410,7 @@ and overlay is highlighted between MK and END-MK."
2410 ;; display the source in another window. 2410 ;; display the source in another window.
2411 (let ((pop-up-windows t)) 2411 (let ((pop-up-windows t))
2412 (pop-to-buffer (marker-buffer mk) 'other-window)) 2412 (pop-to-buffer (marker-buffer mk) 'other-window))
2413 (if (window-dedicated-p (selected-window)) 2413 (pop-to-buffer-same-window (marker-buffer mk)))
2414 (pop-to-buffer (marker-buffer mk))
2415 (switch-to-buffer (marker-buffer mk))))
2416 (unless (eq (goto-char mk) (point)) 2414 (unless (eq (goto-char mk) (point))
2417 ;; If narrowing gets in the way of going to the right place, widen. 2415 ;; If narrowing gets in the way of going to the right place, widen.
2418 (widen) 2416 (widen)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 225d1eb8604..87209a78ffb 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -104,7 +104,8 @@
104(require 'bindat) 104(require 'bindat)
105(eval-when-compile (require 'cl)) 105(eval-when-compile (require 'cl))
106 106
107(declare-function speedbar-change-initial-expansion-list "speedbar" (new-default)) 107(declare-function speedbar-change-initial-expansion-list
108 "speedbar" (new-default))
108(declare-function speedbar-timer-fn "speedbar" ()) 109(declare-function speedbar-timer-fn "speedbar" ())
109(declare-function speedbar-line-text "speedbar" (&optional p)) 110(declare-function speedbar-line-text "speedbar" (&optional p))
110(declare-function speedbar-change-expand-button-char "speedbar" (char)) 111(declare-function speedbar-change-expand-button-char "speedbar" (char))
@@ -190,7 +191,8 @@ as returned from \"-break-list\" by `gdb-json-partial-output'
190(defvar gdb-current-language nil) 191(defvar gdb-current-language nil)
191(defvar gdb-var-list nil 192(defvar gdb-var-list nil
192 "List of variables in watch window. 193 "List of variables in watch window.
193Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS HAS_MORE FP) 194Each element has the form
195 (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS HAS_MORE FP)
194where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame 196where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame
195address for root variables.") 197address for root variables.")
196(defvar gdb-main-file nil "Source file from which program execution begins.") 198(defvar gdb-main-file nil "Source file from which program execution begins.")
@@ -329,7 +331,7 @@ valid signal handlers.")
329 "Maximum size of `gdb-debug-log'. If nil, size is unlimited." 331 "Maximum size of `gdb-debug-log'. If nil, size is unlimited."
330 :group 'gdb 332 :group 'gdb
331 :type '(choice (integer :tag "Number of elements") 333 :type '(choice (integer :tag "Number of elements")
332 (const :tag "Unlimited" nil)) 334 (const :tag "Unlimited" nil))
333 :version "22.1") 335 :version "22.1")
334 336
335(defcustom gdb-non-stop-setting t 337(defcustom gdb-non-stop-setting t
@@ -367,13 +369,18 @@ Emacs always switches to the thread which caused the stop."
367 (set :tag "Selection of reasons..." 369 (set :tag "Selection of reasons..."
368 (const :tag "A breakpoint was reached." "breakpoint-hit") 370 (const :tag "A breakpoint was reached." "breakpoint-hit")
369 (const :tag "A watchpoint was triggered." "watchpoint-trigger") 371 (const :tag "A watchpoint was triggered." "watchpoint-trigger")
370 (const :tag "A read watchpoint was triggered." "read-watchpoint-trigger") 372 (const :tag "A read watchpoint was triggered."
371 (const :tag "An access watchpoint was triggered." "access-watchpoint-trigger") 373 "read-watchpoint-trigger")
374 (const :tag "An access watchpoint was triggered."
375 "access-watchpoint-trigger")
372 (const :tag "Function finished execution." "function-finished") 376 (const :tag "Function finished execution." "function-finished")
373 (const :tag "Location reached." "location-reached") 377 (const :tag "Location reached." "location-reached")
374 (const :tag "Watchpoint has gone out of scope" "watchpoint-scope") 378 (const :tag "Watchpoint has gone out of scope"
375 (const :tag "End of stepping range reached." "end-stepping-range") 379 "watchpoint-scope")
376 (const :tag "Signal received (like interruption)." "signal-received")) 380 (const :tag "End of stepping range reached."
381 "end-stepping-range")
382 (const :tag "Signal received (like interruption)."
383 "signal-received"))
377 (const :tag "None" nil)) 384 (const :tag "None" nil))
378 :group 'gdb-non-stop 385 :group 'gdb-non-stop
379 :version "23.2" 386 :version "23.2"
@@ -488,17 +495,17 @@ predefined macros."
488 :group 'gdb 495 :group 'gdb
489 :version "22.1") 496 :version "22.1")
490 497
491 (defcustom gdb-create-source-file-list t 498(defcustom gdb-create-source-file-list t
492 "Non-nil means create a list of files from which the executable was built. 499 "Non-nil means create a list of files from which the executable was built.
493 Set this to nil if the GUD buffer displays \"initializing...\" in the mode 500 Set this to nil if the GUD buffer displays \"initializing...\" in the mode
494 line for a long time when starting, possibly because your executable was 501 line for a long time when starting, possibly because your executable was
495 built from a large number of files. This allows quicker initialization 502 built from a large number of files. This allows quicker initialization
496 but means that these files are not automatically enabled for debugging, 503 but means that these files are not automatically enabled for debugging,
497 e.g., you won't be able to click in the fringe to set a breakpoint until 504 e.g., you won't be able to click in the fringe to set a breakpoint until
498 execution has already stopped there." 505 execution has already stopped there."
499 :type 'boolean 506 :type 'boolean
500 :group 'gdb 507 :group 'gdb
501 :version "23.1") 508 :version "23.1")
502 509
503(defcustom gdb-show-main nil 510(defcustom gdb-show-main nil
504 "Non-nil means display source file containing the main routine at startup. 511 "Non-nil means display source file containing the main routine at startup.
@@ -644,12 +651,12 @@ detailed description of this mode.
644 (interactive (list (gud-query-cmdline 'gdb))) 651 (interactive (list (gud-query-cmdline 'gdb)))
645 652
646 (when (and gud-comint-buffer 653 (when (and gud-comint-buffer
647 (buffer-name gud-comint-buffer) 654 (buffer-name gud-comint-buffer)
648 (get-buffer-process gud-comint-buffer) 655 (get-buffer-process gud-comint-buffer)
649 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))) 656 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
650 (gdb-restore-windows) 657 (gdb-restore-windows)
651 (error 658 (error
652 "Multiple debugging requires restarting in text command mode")) 659 "Multiple debugging requires restarting in text command mode"))
653 ;; 660 ;;
654 (gud-common-init command-line nil 'gud-gdbmi-marker-filter) 661 (gud-common-init command-line nil 'gud-gdbmi-marker-filter)
655 (set (make-local-variable 'gud-minor-mode) 'gdbmi) 662 (set (make-local-variable 'gud-minor-mode) 'gdbmi)
@@ -663,7 +670,7 @@ detailed description of this mode.
663 (hsize (getenv "HISTSIZE"))) 670 (hsize (getenv "HISTSIZE")))
664 (dolist (file (append '("~/.gdbinit") 671 (dolist (file (append '("~/.gdbinit")
665 (unless (string-equal (expand-file-name ".") 672 (unless (string-equal (expand-file-name ".")
666 (expand-file-name "~")) 673 (expand-file-name "~"))
667 '(".gdbinit")))) 674 '(".gdbinit"))))
668 (if (file-readable-p (setq file (expand-file-name file))) 675 (if (file-readable-p (setq file (expand-file-name file)))
669 (with-temp-buffer 676 (with-temp-buffer
@@ -763,7 +770,7 @@ detailed description of this mode.
763 'gdb-mouse-set-clear-breakpoint) 770 'gdb-mouse-set-clear-breakpoint)
764 (define-key gud-minor-mode-map [left-fringe mouse-1] 771 (define-key gud-minor-mode-map [left-fringe mouse-1]
765 'gdb-mouse-set-clear-breakpoint) 772 'gdb-mouse-set-clear-breakpoint)
766 (define-key gud-minor-mode-map [left-margin C-mouse-1] 773 (define-key gud-minor-mode-map [left-margin C-mouse-1]
767 'gdb-mouse-toggle-breakpoint-margin) 774 'gdb-mouse-toggle-breakpoint-margin)
768 (define-key gud-minor-mode-map [left-fringe C-mouse-1] 775 (define-key gud-minor-mode-map [left-fringe C-mouse-1]
769 'gdb-mouse-toggle-breakpoint-fringe) 776 'gdb-mouse-toggle-breakpoint-fringe)
@@ -849,11 +856,11 @@ detailed description of this mode.
849 856
850 ;; find source file and compilation directory here 857 ;; find source file and compilation directory here
851 (gdb-input 858 (gdb-input
852 ; Needs GDB 6.2 onwards. 859 ; Needs GDB 6.2 onwards.
853 (list "-file-list-exec-source-files" 'gdb-get-source-file-list)) 860 (list "-file-list-exec-source-files" 'gdb-get-source-file-list))
854 (if gdb-create-source-file-list 861 (if gdb-create-source-file-list
855 (gdb-input 862 (gdb-input
856 ; Needs GDB 6.0 onwards. 863 ; Needs GDB 6.0 onwards.
857 (list "-file-list-exec-source-file" 'gdb-get-source-file))) 864 (list "-file-list-exec-source-file" 'gdb-get-source-file)))
858 (gdb-input 865 (gdb-input
859 (list "-gdb-show prompt" 'gdb-get-prompt))) 866 (list "-gdb-show prompt" 'gdb-get-prompt)))
@@ -862,7 +869,8 @@ detailed description of this mode.
862 (goto-char (point-min)) 869 (goto-char (point-min))
863 (if (re-search-forward "No symbol" nil t) 870 (if (re-search-forward "No symbol" nil t)
864 (progn 871 (progn
865 (message "This version of GDB doesn't support non-stop mode. Turning it off.") 872 (message
873 "This version of GDB doesn't support non-stop mode. Turning it off.")
866 (setq gdb-non-stop nil) 874 (setq gdb-non-stop nil)
867 (setq gdb-version "pre-7.0")) 875 (setq gdb-version "pre-7.0"))
868 (setq gdb-version "7.0+") 876 (setq gdb-version "7.0+")
@@ -885,8 +893,8 @@ detailed description of this mode.
885 (list t nil) nil "-c" 893 (list t nil) nil "-c"
886 (concat gdb-cpp-define-alist-program " " 894 (concat gdb-cpp-define-alist-program " "
887 gdb-cpp-define-alist-flags)))))) 895 gdb-cpp-define-alist-flags))))))
888 (define-list (split-string output "\n" t)) 896 (define-list (split-string output "\n" t))
889 (name)) 897 (name))
890 (setq gdb-define-alist nil) 898 (setq gdb-define-alist nil)
891 (dolist (define define-list) 899 (dolist (define define-list)
892 (setq name (nth 1 (split-string define "[( ]"))) 900 (setq name (nth 1 (split-string define "[( ]")))
@@ -896,13 +904,13 @@ detailed description of this mode.
896(defvar tooltip-use-echo-area) 904(defvar tooltip-use-echo-area)
897 905
898(defun gdb-tooltip-print (expr) 906(defun gdb-tooltip-print (expr)
899 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) 907 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
900 (goto-char (point-min)) 908 (goto-char (point-min))
901 (if (re-search-forward ".*value=\\(\".*\"\\)" nil t) 909 (if (re-search-forward ".*value=\\(\".*\"\\)" nil t)
902 (tooltip-show 910 (tooltip-show
903 (concat expr " = " (read (match-string 1))) 911 (concat expr " = " (read (match-string 1)))
904 (or gud-tooltip-echo-area tooltip-use-echo-area 912 (or gud-tooltip-echo-area tooltip-use-echo-area
905 (not (display-graphic-p))))))) 913 (not (display-graphic-p)))))))
906 914
907;; If expr is a macro for a function don't print because of possible dangerous 915;; If expr is a macro for a function don't print because of possible dangerous
908;; side-effects. Also printing a function within a tooltip generates an 916;; side-effects. Also printing a function within a tooltip generates an
@@ -926,13 +934,13 @@ detailed description of this mode.
926 934
927(defmacro gdb-if-arrow (arrow-position &rest body) 935(defmacro gdb-if-arrow (arrow-position &rest body)
928 `(if ,arrow-position 936 `(if ,arrow-position
929 (let ((buffer (marker-buffer ,arrow-position)) (line)) 937 (let ((buffer (marker-buffer ,arrow-position)) (line))
930 (if (equal buffer (window-buffer (posn-window end))) 938 (if (equal buffer (window-buffer (posn-window end)))
931 (with-current-buffer buffer 939 (with-current-buffer buffer
932 (when (or (equal start end) 940 (when (or (equal start end)
933 (equal (posn-point start) 941 (equal (posn-point start)
934 (marker-position ,arrow-position))) 942 (marker-position ,arrow-position)))
935 ,@body)))))) 943 ,@body))))))
936 944
937(defun gdb-mouse-until (event) 945(defun gdb-mouse-until (event)
938 "Continue running until a source line past the current line. 946 "Continue running until a source line past the current line.
@@ -1063,7 +1071,7 @@ With arg, enter name of variable to be watched in the minibuffer."
1063 (bindat-get-field result 'value) 1071 (bindat-get-field result 'value)
1064 nil 1072 nil
1065 (bindat-get-field result 'has_more) 1073 (bindat-get-field result 'has_more)
1066 gdb-frame-address))) 1074 gdb-frame-address)))
1067 (push var gdb-var-list) 1075 (push var gdb-var-list)
1068 (speedbar 1) 1076 (speedbar 1)
1069 (unless (string-equal 1077 (unless (string-equal
@@ -1094,20 +1102,20 @@ With arg, enter name of variable to be watched in the minibuffer."
1094 (setcar (nthcdr 4 var) (read (match-string 1))))) 1102 (setcar (nthcdr 4 var) (read (match-string 1)))))
1095 (gdb-speedbar-update)) 1103 (gdb-speedbar-update))
1096 1104
1097; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. 1105 ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards.
1098(defun gdb-var-list-children (varnum) 1106(defun gdb-var-list-children (varnum)
1099 (gdb-input 1107 (gdb-input
1100 (list (concat "-var-update " varnum) 'ignore)) 1108 (list (concat "-var-update " varnum) 'ignore))
1101 (gdb-input 1109 (gdb-input
1102 (list (concat "-var-list-children --all-values " 1110 (list (concat "-var-list-children --all-values "
1103 varnum) 1111 varnum)
1104 `(lambda () (gdb-var-list-children-handler ,varnum))))) 1112 `(lambda () (gdb-var-list-children-handler ,varnum)))))
1105 1113
1106(defun gdb-var-list-children-handler (varnum) 1114(defun gdb-var-list-children-handler (varnum)
1107 (let* ((var-list nil) 1115 (let* ((var-list nil)
1108 (output (bindat-get-field (gdb-json-partial-output "child"))) 1116 (output (bindat-get-field (gdb-json-partial-output "child")))
1109 (children (bindat-get-field output 'children))) 1117 (children (bindat-get-field output 'children)))
1110 (catch 'child-already-watched 1118 (catch 'child-already-watched
1111 (dolist (var gdb-var-list) 1119 (dolist (var gdb-var-list)
1112 (if (string-equal varnum (car var)) 1120 (if (string-equal varnum (car var))
1113 (progn 1121 (progn
@@ -1150,11 +1158,11 @@ With arg, enter name of variable to be watched in the minibuffer."
1150 (interactive) 1158 (interactive)
1151 (let ((text (speedbar-line-text))) 1159 (let ((text (speedbar-line-text)))
1152 (string-match "\\(\\S-+\\)" text) 1160 (string-match "\\(\\S-+\\)" text)
1153 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) 1161 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
1154 (varnum (car var))) 1162 (varnum (car var)))
1155 (if (string-match "\\." (car var)) 1163 (if (string-match "\\." (car var))
1156 (message-box "Can only delete a root expression") 1164 (message-box "Can only delete a root expression")
1157 (gdb-var-delete-1 var varnum))))) 1165 (gdb-var-delete-1 var varnum)))))
1158 1166
1159(defun gdb-var-delete-children (varnum) 1167(defun gdb-var-delete-children (varnum)
1160 "Delete children of variable object at point from the speedbar." 1168 "Delete children of variable object at point from the speedbar."
@@ -1177,7 +1185,7 @@ With arg, enter name of variable to be watched in the minibuffer."
1177 (if (re-search-forward gdb-error-regexp nil t) 1185 (if (re-search-forward gdb-error-regexp nil t)
1178 (message-box "Invalid number or expression (%s)" value))) 1186 (message-box "Invalid number or expression (%s)" value)))
1179 1187
1180; Uses "-var-update --all-values". Needs GDB 6.4 onwards. 1188 ; Uses "-var-update --all-values". Needs GDB 6.4 onwards.
1181(defun gdb-var-update () 1189(defun gdb-var-update ()
1182 (if (not (gdb-pending-p 'gdb-var-update)) 1190 (if (not (gdb-pending-p 'gdb-var-update))
1183 (gdb-input 1191 (gdb-input
@@ -1213,38 +1221,38 @@ With arg, enter name of variable to be watched in the minibuffer."
1213 (gdb-var-delete-1 var varnum))))) 1221 (gdb-var-delete-1 var varnum)))))
1214 (let ((var-list nil) var1 1222 (let ((var-list nil) var1
1215 (children (bindat-get-field change 'new_children))) 1223 (children (bindat-get-field change 'new_children)))
1216 (if new-num 1224 (when new-num
1217 (progn 1225 (setq var1 (pop temp-var-list))
1218 (setq var1 (pop temp-var-list)) 1226 (while var1
1219 (while var1 1227 (if (string-equal varnum (car var1))
1220 (if (string-equal varnum (car var1)) 1228 (let ((new (string-to-number new-num))
1221 (let ((new (string-to-number new-num)) 1229 (previous (string-to-number (nth 2 var1))))
1222 (previous (string-to-number (nth 2 var1)))) 1230 (setcar (nthcdr 2 var1) new-num)
1223 (setcar (nthcdr 2 var1) new-num) 1231 (push var1 var-list)
1224 (push var1 var-list) 1232 (cond
1225 (cond ((> new previous) 1233 ((> new previous)
1226 ;; Add new children to list. 1234 ;; Add new children to list.
1227 (dotimes (dummy previous) 1235 (dotimes (dummy previous)
1228 (push (pop temp-var-list) var-list)) 1236 (push (pop temp-var-list) var-list))
1229 (dolist (child children) 1237 (dolist (child children)
1230 (let ((varchild 1238 (let ((varchild
1231 (list (bindat-get-field child 'name) 1239 (list (bindat-get-field child 'name)
1232 (bindat-get-field child 'exp) 1240 (bindat-get-field child 'exp)
1233 (bindat-get-field child 'numchild) 1241 (bindat-get-field child 'numchild)
1234 (bindat-get-field child 'type) 1242 (bindat-get-field child 'type)
1235 (bindat-get-field child 'value) 1243 (bindat-get-field child 'value)
1236 'changed 1244 'changed
1237 (bindat-get-field child 'has_more)))) 1245 (bindat-get-field child 'has_more))))
1238 (push varchild var-list)))) 1246 (push varchild var-list))))
1239 ;; Remove deleted children from list. 1247 ;; Remove deleted children from list.
1240 ((< new previous) 1248 ((< new previous)
1241 (dotimes (dummy new) 1249 (dotimes (dummy new)
1242 (push (pop temp-var-list) var-list)) 1250 (push (pop temp-var-list) var-list))
1243 (dotimes (dummy (- previous new)) 1251 (dotimes (dummy (- previous new))
1244 (pop temp-var-list))))) 1252 (pop temp-var-list)))))
1245 (push var1 var-list)) 1253 (push var1 var-list))
1246 (setq var1 (pop temp-var-list))) 1254 (setq var1 (pop temp-var-list)))
1247 (setq gdb-var-list (nreverse var-list))))))))) 1255 (setq gdb-var-list (nreverse var-list))))))))
1248 (setq gdb-pending-triggers 1256 (setq gdb-pending-triggers
1249 (delq 'gdb-var-update gdb-pending-triggers)) 1257 (delq 'gdb-var-update gdb-pending-triggers))
1250 (gdb-speedbar-update)) 1258 (gdb-speedbar-update))
@@ -1372,7 +1380,8 @@ this trigger is subscribed to `gdb-buf-publisher' and called with
1372 (when trigger 1380 (when trigger
1373 (gdb-add-subscriber gdb-buf-publisher 1381 (gdb-add-subscriber gdb-buf-publisher
1374 (cons (current-buffer) 1382 (cons (current-buffer)
1375 (gdb-bind-function-to-buffer trigger (current-buffer)))) 1383 (gdb-bind-function-to-buffer
1384 trigger (current-buffer))))
1376 (funcall trigger 'start)) 1385 (funcall trigger 'start))
1377 (current-buffer)))))) 1386 (current-buffer))))))
1378 1387
@@ -1786,8 +1795,8 @@ is running."
1786;; visited breakpoint is, use that window. 1795;; visited breakpoint is, use that window.
1787(defun gdb-display-source-buffer (buffer) 1796(defun gdb-display-source-buffer (buffer)
1788 (let* ((last-window (if gud-last-last-frame 1797 (let* ((last-window (if gud-last-last-frame
1789 (get-buffer-window 1798 (get-buffer-window
1790 (gud-find-file (car gud-last-last-frame))))) 1799 (gud-find-file (car gud-last-last-frame)))))
1791 (source-window (or last-window 1800 (source-window (or last-window
1792 (if (and gdb-source-window 1801 (if (and gdb-source-window
1793 (window-live-p gdb-source-window)) 1802 (window-live-p gdb-source-window))
@@ -1860,7 +1869,7 @@ is running."
1860 ;; Suppress "No registers." since GDB 6.8 and earlier duplicates MI 1869 ;; Suppress "No registers." since GDB 6.8 and earlier duplicates MI
1861 ;; error message on internal stream. Don't print to GUD buffer. 1870 ;; error message on internal stream. Don't print to GUD buffer.
1862 (unless (and (eq record-type 'gdb-internals) 1871 (unless (and (eq record-type 'gdb-internals)
1863 (string-equal (read arg1) "No registers.\n")) 1872 (string-equal (read arg1) "No registers.\n"))
1864 (funcall record-type arg1)))))) 1873 (funcall record-type arg1))))))
1865 1874
1866 (setq gdb-output-sink 'user) 1875 (setq gdb-output-sink 'user)
@@ -1884,15 +1893,15 @@ is running."
1884(defun gdb-thread-exited (output-field) 1893(defun gdb-thread-exited (output-field)
1885 "Handle =thread-exited async record: unset `gdb-thread-number' 1894 "Handle =thread-exited async record: unset `gdb-thread-number'
1886 if current thread exited and update threads list." 1895 if current thread exited and update threads list."
1887 (let* ((thread-id (bindat-get-field (gdb-json-string output-field) 'id))) 1896 (let* ((thread-id (bindat-get-field (gdb-json-string output-field) 'id)))
1888 (if (string= gdb-thread-number thread-id) 1897 (if (string= gdb-thread-number thread-id)
1889 (gdb-setq-thread-number nil)) 1898 (gdb-setq-thread-number nil))
1890 ;; When we continue current thread and it quickly exits, 1899 ;; When we continue current thread and it quickly exits,
1891 ;; gdb-pending-triggers left after gdb-running disallow us to 1900 ;; gdb-pending-triggers left after gdb-running disallow us to
1892 ;; properly call -thread-info without --thread option. Thus we 1901 ;; properly call -thread-info without --thread option. Thus we
1893 ;; need to use gdb-wait-for-pending. 1902 ;; need to use gdb-wait-for-pending.
1894 (gdb-wait-for-pending 1903 (gdb-wait-for-pending
1895 (gdb-emit-signal gdb-buf-publisher 'update-threads)))) 1904 (gdb-emit-signal gdb-buf-publisher 'update-threads))))
1896 1905
1897(defun gdb-thread-selected (output-field) 1906(defun gdb-thread-selected (output-field)
1898 "Handler for =thread-selected MI output record. 1907 "Handler for =thread-selected MI output record.
@@ -1912,7 +1921,8 @@ Sets `gdb-thread-number' to new id."
1912 (gdb-update)))) 1921 (gdb-update))))
1913 1922
1914(defun gdb-running (output-field) 1923(defun gdb-running (output-field)
1915 (let* ((thread-id (bindat-get-field (gdb-json-string output-field) 'thread-id))) 1924 (let* ((thread-id
1925 (bindat-get-field (gdb-json-string output-field) 'thread-id)))
1916 ;; We reset gdb-frame-number to nil if current thread has gone 1926 ;; We reset gdb-frame-number to nil if current thread has gone
1917 ;; running. This can't be done in gdb-thread-list-handler-custom 1927 ;; running. This can't be done in gdb-thread-list-handler-custom
1918 ;; because we need correct gdb-frame-number by the time 1928 ;; because we need correct gdb-frame-number by the time
@@ -1987,23 +1997,23 @@ current thread and update GDB buffers."
1987 ;; reasons 1997 ;; reasons
1988 (if (or (eq gdb-switch-reasons t) 1998 (if (or (eq gdb-switch-reasons t)
1989 (member reason gdb-switch-reasons)) 1999 (member reason gdb-switch-reasons))
1990 (when (not (string-equal gdb-thread-number thread-id)) 2000 (when (not (string-equal gdb-thread-number thread-id))
1991 (message (concat "Switched to thread " thread-id)) 2001 (message (concat "Switched to thread " thread-id))
1992 (gdb-setq-thread-number thread-id)) 2002 (gdb-setq-thread-number thread-id))
1993 (message (format "Thread %s stopped" thread-id))))) 2003 (message (format "Thread %s stopped" thread-id)))))
1994 2004
1995 ;; Print "(gdb)" to GUD console 2005 ;; Print "(gdb)" to GUD console
1996 (when gdb-first-done-or-error 2006 (when gdb-first-done-or-error
1997 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) 2007 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
1998 2008
1999 ;; In non-stop, we update information as soon as another thread gets 2009 ;; In non-stop, we update information as soon as another thread gets
2000 ;; stopped 2010 ;; stopped
2001 (when (or gdb-first-done-or-error 2011 (when (or gdb-first-done-or-error
2002 gdb-non-stop) 2012 gdb-non-stop)
2003 ;; In all-stop this updates gud-running properly as well. 2013 ;; In all-stop this updates gud-running properly as well.
2004 (gdb-update) 2014 (gdb-update)
2005 (setq gdb-first-done-or-error nil)) 2015 (setq gdb-first-done-or-error nil))
2006 (run-hook-with-args 'gdb-stopped-hooks result))) 2016 (run-hook-with-args 'gdb-stopped-hooks result)))
2007 2017
2008;; Remove the trimmings from log stream containing debugging messages 2018;; Remove the trimmings from log stream containing debugging messages
2009;; being produced by GDB's internals, use warning face and send to GUD 2019;; being produced by GDB's internals, use warning face and send to GUD
@@ -2023,7 +2033,7 @@ current thread and update GDB buffers."
2023;; Remove the trimmings from the console stream and send to GUD buffer 2033;; Remove the trimmings from the console stream and send to GUD buffer
2024;; (frontend MI commands should not print to this stream) 2034;; (frontend MI commands should not print to this stream)
2025(defun gdb-console (output-field) 2035(defun gdb-console (output-field)
2026 (setq gdb-filter-output 2036 (setq gdb-filter-output
2027 (gdb-concat-output 2037 (gdb-concat-output
2028 gdb-filter-output 2038 gdb-filter-output
2029 (read output-field)))) 2039 (read output-field))))
@@ -2036,11 +2046,11 @@ current thread and update GDB buffers."
2036 (setq token-number nil) 2046 (setq token-number nil)
2037 ;; MI error - send to minibuffer 2047 ;; MI error - send to minibuffer
2038 (when (eq type 'error) 2048 (when (eq type 'error)
2039 ;; Skip "msg=" from `output-field' 2049 ;; Skip "msg=" from `output-field'
2040 (message (read (substring output-field 4))) 2050 (message (read (substring output-field 4)))
2041 ;; Don't send to the console twice. (If it is a console error 2051 ;; Don't send to the console twice. (If it is a console error
2042 ;; it is also in the console stream.) 2052 ;; it is also in the console stream.)
2043 (setq output-field nil))) 2053 (setq output-field nil)))
2044 ;; Output from command from frontend. 2054 ;; Output from command from frontend.
2045 (setq gdb-output-sink 'emacs)) 2055 (setq gdb-output-sink 'emacs))
2046 2056
@@ -2218,11 +2228,11 @@ calling `gdb-table-string'."
2218 (append row-properties (list properties))) 2228 (append row-properties (list properties)))
2219 (setf (gdb-table-column-sizes table) 2229 (setf (gdb-table-column-sizes table)
2220 (gdb-mapcar* (lambda (x s) 2230 (gdb-mapcar* (lambda (x s)
2221 (let ((new-x 2231 (let ((new-x
2222 (max (abs x) (string-width (or s ""))))) 2232 (max (abs x) (string-width (or s "")))))
2223 (if right-align new-x (- new-x)))) 2233 (if right-align new-x (- new-x))))
2224 (gdb-table-column-sizes table) 2234 (gdb-table-column-sizes table)
2225 row)) 2235 row))
2226 ;; Avoid trailing whitespace at eol 2236 ;; Avoid trailing whitespace at eol
2227 (if (not (gdb-table-right-align table)) 2237 (if (not (gdb-table-right-align table))
2228 (setcar (last (gdb-table-column-sizes table)) 0)))) 2238 (setcar (last (gdb-table-column-sizes table)) 0))))
@@ -2311,8 +2321,8 @@ If NOPRESERVE is non-nil, window point is not restored after CUSTOM-DEFUN."
2311 '(set-window-point window p))))) 2321 '(set-window-point window p)))))
2312 2322
2313(defmacro def-gdb-trigger-and-handler (trigger-name gdb-command 2323(defmacro def-gdb-trigger-and-handler (trigger-name gdb-command
2314 handler-name custom-defun 2324 handler-name custom-defun
2315 &optional signal-list) 2325 &optional signal-list)
2316 "Define trigger and handler. 2326 "Define trigger and handler.
2317 2327
2318TRIGGER-NAME trigger is defined to send GDB-COMMAND. See 2328TRIGGER-NAME trigger is defined to send GDB-COMMAND. See
@@ -2356,29 +2366,29 @@ HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See
2356 (pending (bindat-get-field breakpoint 'pending)) 2366 (pending (bindat-get-field breakpoint 'pending))
2357 (func (bindat-get-field breakpoint 'func)) 2367 (func (bindat-get-field breakpoint 'func))
2358 (type (bindat-get-field breakpoint 'type))) 2368 (type (bindat-get-field breakpoint 'type)))
2359 (gdb-table-add-row table 2369 (gdb-table-add-row table
2360 (list 2370 (list
2361 (bindat-get-field breakpoint 'number) 2371 (bindat-get-field breakpoint 'number)
2362 type 2372 type
2363 (bindat-get-field breakpoint 'disp) 2373 (bindat-get-field breakpoint 'disp)
2364 (let ((flag (bindat-get-field breakpoint 'enabled))) 2374 (let ((flag (bindat-get-field breakpoint 'enabled)))
2365 (if (string-equal flag "y") 2375 (if (string-equal flag "y")
2366 (propertize "y" 'font-lock-face font-lock-warning-face) 2376 (propertize "y" 'font-lock-face font-lock-warning-face)
2367 (propertize "n" 'font-lock-face font-lock-comment-face))) 2377 (propertize "n" 'font-lock-face font-lock-comment-face)))
2368 (bindat-get-field breakpoint 'addr) 2378 (bindat-get-field breakpoint 'addr)
2369 (bindat-get-field breakpoint 'times) 2379 (bindat-get-field breakpoint 'times)
2370 (if (string-match ".*watchpoint" type) 2380 (if (string-match ".*watchpoint" type)
2371 (bindat-get-field breakpoint 'what) 2381 (bindat-get-field breakpoint 'what)
2372 (or pending at 2382 (or pending at
2373 (concat "in " 2383 (concat "in "
2374 (propertize (or func "unknown") 2384 (propertize (or func "unknown")
2375 'font-lock-face font-lock-function-name-face) 2385 'font-lock-face font-lock-function-name-face)
2376 (gdb-frame-location breakpoint))))) 2386 (gdb-frame-location breakpoint)))))
2377 ;; Add clickable properties only for breakpoints with file:line 2387 ;; Add clickable properties only for breakpoints with file:line
2378 ;; information 2388 ;; information
2379 (append (list 'gdb-breakpoint breakpoint) 2389 (append (list 'gdb-breakpoint breakpoint)
2380 (when func '(help-echo "mouse-2, RET: visit breakpoint" 2390 (when func '(help-echo "mouse-2, RET: visit breakpoint"
2381 mouse-face highlight)))))) 2391 mouse-face highlight))))))
2382 (insert (gdb-table-string table " ")) 2392 (insert (gdb-table-string table " "))
2383 (gdb-place-breakpoints))) 2393 (gdb-place-breakpoints)))
2384 2394
@@ -2392,7 +2402,7 @@ HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See
2392 (gdb-remove-breakpoint-icons (point-min) (point-max))))) 2402 (gdb-remove-breakpoint-icons (point-min) (point-max)))))
2393 (dolist (breakpoint gdb-breakpoints-list) 2403 (dolist (breakpoint gdb-breakpoints-list)
2394 (let* ((breakpoint (cdr breakpoint)) ; gdb-breakpoints-list is 2404 (let* ((breakpoint (cdr breakpoint)) ; gdb-breakpoints-list is
2395 ; an associative list 2405 ; an associative list
2396 (line (bindat-get-field breakpoint 'line))) 2406 (line (bindat-get-field breakpoint 'line)))
2397 (when line 2407 (when line
2398 (let ((file (bindat-get-field breakpoint 'fullname)) 2408 (let ((file (bindat-get-field breakpoint 'fullname))
@@ -2414,7 +2424,7 @@ HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See
2414 (gdb-input 2424 (gdb-input
2415 (list "-file-list-exec-source-file" 2425 (list "-file-list-exec-source-file"
2416 `(lambda () (gdb-get-location 2426 `(lambda () (gdb-get-location
2417 ,bptno ,line ,flag)))))))))) 2427 ,bptno ,line ,flag))))))))))
2418 2428
2419(defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"") 2429(defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"")
2420 2430
@@ -2425,7 +2435,7 @@ Put in buffer and place breakpoint icon."
2425 (catch 'file-not-found 2435 (catch 'file-not-found
2426 (if (re-search-forward gdb-source-file-regexp nil t) 2436 (if (re-search-forward gdb-source-file-regexp nil t)
2427 (delete (cons bptno "File not found") gdb-location-alist) 2437 (delete (cons bptno "File not found") gdb-location-alist)
2428 (push (cons bptno (match-string 1)) gdb-location-alist) 2438 (push (cons bptno (match-string 1)) gdb-location-alist)
2429 (gdb-resync) 2439 (gdb-resync)
2430 (unless (assoc bptno gdb-location-alist) 2440 (unless (assoc bptno gdb-location-alist)
2431 (push (cons bptno "File not found") gdb-location-alist) 2441 (push (cons bptno "File not found") gdb-location-alist)
@@ -2513,20 +2523,20 @@ If not in a source or disassembly buffer just set point."
2513 (if (get-text-property 0 'gdb-enabled obj) 2523 (if (get-text-property 0 'gdb-enabled obj)
2514 "-break-disable " 2524 "-break-disable "
2515 "-break-enable ") 2525 "-break-enable ")
2516 (get-text-property 0 'gdb-bptno obj))))))))) 2526 (get-text-property 0 'gdb-bptno obj)))))))))
2517 2527
2518(defun gdb-breakpoints-buffer-name () 2528(defun gdb-breakpoints-buffer-name ()
2519 (concat "*breakpoints of " (gdb-get-target-string) "*")) 2529 (concat "*breakpoints of " (gdb-get-target-string) "*"))
2520 2530
2521(def-gdb-display-buffer 2531(def-gdb-display-buffer
2522 gdb-display-breakpoints-buffer 2532 gdb-display-breakpoints-buffer
2523 'gdb-breakpoints-buffer 2533 'gdb-breakpoints-buffer
2524 "Display status of user-settable breakpoints.") 2534 "Display status of user-settable breakpoints.")
2525 2535
2526(def-gdb-frame-for-buffer 2536(def-gdb-frame-for-buffer
2527 gdb-frame-breakpoints-buffer 2537 gdb-frame-breakpoints-buffer
2528 'gdb-breakpoints-buffer 2538 'gdb-breakpoints-buffer
2529 "Display status of user-settable breakpoints in a new frame.") 2539 "Display status of user-settable breakpoints in a new frame.")
2530 2540
2531(defvar gdb-breakpoints-mode-map 2541(defvar gdb-breakpoints-mode-map
2532 (let ((map (make-sparse-keymap)) 2542 (let ((map (make-sparse-keymap))
@@ -2543,9 +2553,9 @@ If not in a source or disassembly buffer just set point."
2543 (define-key map "q" 'gdb-delete-frame-or-window) 2553 (define-key map "q" 'gdb-delete-frame-or-window)
2544 (define-key map "\r" 'gdb-goto-breakpoint) 2554 (define-key map "\r" 'gdb-goto-breakpoint)
2545 (define-key map "\t" (lambda () 2555 (define-key map "\t" (lambda ()
2546 (interactive) 2556 (interactive)
2547 (gdb-set-window-buffer 2557 (gdb-set-window-buffer
2548 (gdb-get-buffer-create 'gdb-threads-buffer) t))) 2558 (gdb-get-buffer-create 'gdb-threads-buffer) t)))
2549 (define-key map [mouse-2] 'gdb-goto-breakpoint) 2559 (define-key map [mouse-2] 'gdb-goto-breakpoint)
2550 (define-key map [follow-link] 'mouse-face) 2560 (define-key map [follow-link] 'mouse-face)
2551 map)) 2561 map))
@@ -2588,14 +2598,14 @@ corresponding to the mode line clicked."
2588 (concat "*threads of " (gdb-get-target-string) "*")) 2598 (concat "*threads of " (gdb-get-target-string) "*"))
2589 2599
2590(def-gdb-display-buffer 2600(def-gdb-display-buffer
2591 gdb-display-threads-buffer 2601 gdb-display-threads-buffer
2592 'gdb-threads-buffer 2602 'gdb-threads-buffer
2593 "Display GDB threads.") 2603 "Display GDB threads.")
2594 2604
2595(def-gdb-frame-for-buffer 2605(def-gdb-frame-for-buffer
2596 gdb-frame-threads-buffer 2606 gdb-frame-threads-buffer
2597 'gdb-threads-buffer 2607 'gdb-threads-buffer
2598 "Display GDB threads in a new frame.") 2608 "Display GDB threads in a new frame.")
2599 2609
2600(def-gdb-trigger-and-handler 2610(def-gdb-trigger-and-handler
2601 gdb-invalidate-threads (gdb-current-context-command "-thread-info") 2611 gdb-invalidate-threads (gdb-current-context-command "-thread-info")
@@ -2629,18 +2639,20 @@ corresponding to the mode line clicked."
2629 (define-key map "i" 'gdb-interrupt-thread) 2639 (define-key map "i" 'gdb-interrupt-thread)
2630 (define-key map "c" 'gdb-continue-thread) 2640 (define-key map "c" 'gdb-continue-thread)
2631 (define-key map "s" 'gdb-step-thread) 2641 (define-key map "s" 'gdb-step-thread)
2632 (define-key map "\t" (lambda () 2642 (define-key map "\t"
2633 (interactive) 2643 (lambda ()
2634 (gdb-set-window-buffer 2644 (interactive)
2635 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t))) 2645 (gdb-set-window-buffer
2646 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t)))
2636 (define-key map [mouse-2] 'gdb-select-thread) 2647 (define-key map [mouse-2] 'gdb-select-thread)
2637 (define-key map [follow-link] 'mouse-face) 2648 (define-key map [follow-link] 'mouse-face)
2638 map)) 2649 map))
2639 2650
2640(defvar gdb-threads-header 2651(defvar gdb-threads-header
2641 (list 2652 (list
2642 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer 2653 (gdb-propertize-header
2643 "mouse-1: select" mode-line-highlight mode-line-inactive) 2654 "Breakpoints" gdb-breakpoints-buffer
2655 "mouse-1: select" mode-line-highlight mode-line-inactive)
2644 " " 2656 " "
2645 (gdb-propertize-header "Threads" gdb-threads-buffer 2657 (gdb-propertize-header "Threads" gdb-threads-buffer
2646 nil nil mode-line))) 2658 nil nil mode-line)))
@@ -2664,44 +2676,45 @@ corresponding to the mode line clicked."
2664 (set-marker gdb-thread-position nil) 2676 (set-marker gdb-thread-position nil)
2665 2677
2666 (dolist (thread (reverse threads-list)) 2678 (dolist (thread (reverse threads-list))
2667 (let ((running (string-equal (bindat-get-field thread 'state) "running"))) 2679 (let ((running (equal (bindat-get-field thread 'state) "running")))
2668 (add-to-list 'gdb-threads-list 2680 (add-to-list 'gdb-threads-list
2669 (cons (bindat-get-field thread 'id) 2681 (cons (bindat-get-field thread 'id)
2670 thread)) 2682 thread))
2671 (if running 2683 (if running
2672 (incf gdb-running-threads-count) 2684 (incf gdb-running-threads-count)
2673 (incf gdb-stopped-threads-count)) 2685 (incf gdb-stopped-threads-count))
2674 2686
2675 (gdb-table-add-row table 2687 (gdb-table-add-row table
2676 (list 2688 (list
2677 (bindat-get-field thread 'id) 2689 (bindat-get-field thread 'id)
2678 (concat 2690 (concat
2679 (if gdb-thread-buffer-verbose-names 2691 (if gdb-thread-buffer-verbose-names
2680 (concat (bindat-get-field thread 'target-id) " ") "") 2692 (concat (bindat-get-field thread 'target-id) " ") "")
2681 (bindat-get-field thread 'state) 2693 (bindat-get-field thread 'state)
2682 ;; Include frame information for stopped threads 2694 ;; Include frame information for stopped threads
2683 (if (not running) 2695 (if (not running)
2684 (concat 2696 (concat
2685 " in " (bindat-get-field thread 'frame 'func) 2697 " in " (bindat-get-field thread 'frame 'func)
2686 (if gdb-thread-buffer-arguments 2698 (if gdb-thread-buffer-arguments
2687 (concat 2699 (concat
2688 " (" 2700 " ("
2689 (let ((args (bindat-get-field thread 'frame 'args))) 2701 (let ((args (bindat-get-field thread 'frame 'args)))
2690 (mapconcat 2702 (mapconcat
2691 (lambda (arg) 2703 (lambda (arg)
2692 (apply 'format `("%s=%s" ,@(gdb-get-many-fields arg 'name 'value)))) 2704 (apply #'format "%s=%s"
2693 args ",")) 2705 (gdb-get-many-fields arg 'name 'value)))
2694 ")") 2706 args ","))
2695 "") 2707 ")")
2696 (if gdb-thread-buffer-locations 2708 "")
2697 (gdb-frame-location (bindat-get-field thread 'frame)) "") 2709 (if gdb-thread-buffer-locations
2698 (if gdb-thread-buffer-addresses 2710 (gdb-frame-location (bindat-get-field thread 'frame)) "")
2699 (concat " at " (bindat-get-field thread 'frame 'addr)) "")) 2711 (if gdb-thread-buffer-addresses
2700 ""))) 2712 (concat " at " (bindat-get-field thread 'frame 'addr)) ""))
2701 (list 2713 "")))
2702 'gdb-thread thread 2714 (list
2703 'mouse-face 'highlight 2715 'gdb-thread thread
2704 'help-echo "mouse-2, RET: select thread"))) 2716 'mouse-face 'highlight
2717 'help-echo "mouse-2, RET: select thread")))
2705 (when (string-equal gdb-thread-number 2718 (when (string-equal gdb-thread-number
2706 (bindat-get-field thread 'id)) 2719 (bindat-get-field thread 'id))
2707 (setq marked-line (length gdb-threads-list)))) 2720 (setq marked-line (length gdb-threads-list))))
@@ -2730,7 +2743,8 @@ be the value of 'gdb-thread property of the current line. If
2730 ,custom-defun 2743 ,custom-defun
2731 (error "Not recognized as thread line")))))) 2744 (error "Not recognized as thread line"))))))
2732 2745
2733(defmacro def-gdb-thread-buffer-simple-command (name buffer-command &optional doc) 2746(defmacro def-gdb-thread-buffer-simple-command (name buffer-command
2747 &optional doc)
2734 "Define a NAME which will call BUFFER-COMMAND with id of thread 2748 "Define a NAME which will call BUFFER-COMMAND with id of thread
2735on the current line." 2749on the current line."
2736 `(def-gdb-thread-buffer-command ,name 2750 `(def-gdb-thread-buffer-command ,name
@@ -2833,19 +2847,19 @@ line."
2833(defcustom gdb-memory-format "x" 2847(defcustom gdb-memory-format "x"
2834 "Display format of data items in memory window." 2848 "Display format of data items in memory window."
2835 :type '(choice (const :tag "Hexadecimal" "x") 2849 :type '(choice (const :tag "Hexadecimal" "x")
2836 (const :tag "Signed decimal" "d") 2850 (const :tag "Signed decimal" "d")
2837 (const :tag "Unsigned decimal" "u") 2851 (const :tag "Unsigned decimal" "u")
2838 (const :tag "Octal" "o") 2852 (const :tag "Octal" "o")
2839 (const :tag "Binary" "t")) 2853 (const :tag "Binary" "t"))
2840 :group 'gud 2854 :group 'gud
2841 :version "22.1") 2855 :version "22.1")
2842 2856
2843(defcustom gdb-memory-unit 4 2857(defcustom gdb-memory-unit 4
2844 "Unit size of data items in memory window." 2858 "Unit size of data items in memory window."
2845 :type '(choice (const :tag "Byte" 1) 2859 :type '(choice (const :tag "Byte" 1)
2846 (const :tag "Halfword" 2) 2860 (const :tag "Halfword" 2)
2847 (const :tag "Word" 4) 2861 (const :tag "Word" 4)
2848 (const :tag "Giant word" 8)) 2862 (const :tag "Giant word" 8))
2849 :group 'gud 2863 :group 'gud
2850 :version "23.2") 2864 :version "23.2")
2851 2865
@@ -2896,14 +2910,14 @@ in `gdb-memory-format'."
2896 (setq gdb-memory-next-page (bindat-get-field res 'next-page)) 2910 (setq gdb-memory-next-page (bindat-get-field res 'next-page))
2897 (setq gdb-memory-prev-page (bindat-get-field res 'prev-page)) 2911 (setq gdb-memory-prev-page (bindat-get-field res 'prev-page))
2898 (setq gdb-memory-last-address gdb-memory-address) 2912 (setq gdb-memory-last-address gdb-memory-address)
2899 (dolist (row memory) 2913 (dolist (row memory)
2900 (insert (concat (bindat-get-field row 'addr) ":")) 2914 (insert (concat (bindat-get-field row 'addr) ":"))
2901 (dolist (column (bindat-get-field row 'data)) 2915 (dolist (column (bindat-get-field row 'data))
2902 (insert (gdb-pad-string column 2916 (insert (gdb-pad-string column
2903 (+ 2 (gdb-memory-column-width 2917 (+ 2 (gdb-memory-column-width
2904 gdb-memory-unit 2918 gdb-memory-unit
2905 gdb-memory-format))))) 2919 gdb-memory-format)))))
2906 (newline))) 2920 (newline)))
2907 ;; Show last page instead of empty buffer when out of bounds 2921 ;; Show last page instead of empty buffer when out of bounds
2908 (progn 2922 (progn
2909 (let ((gdb-memory-address gdb-memory-last-address)) 2923 (let ((gdb-memory-address gdb-memory-last-address))
@@ -2928,7 +2942,7 @@ in `gdb-memory-format'."
2928 (define-key map "g" 'gdb-memory-unit-giant) 2942 (define-key map "g" 'gdb-memory-unit-giant)
2929 (define-key map "R" 'gdb-memory-set-rows) 2943 (define-key map "R" 'gdb-memory-set-rows)
2930 (define-key map "C" 'gdb-memory-set-columns) 2944 (define-key map "C" 'gdb-memory-set-columns)
2931 map)) 2945 map))
2932 2946
2933(defun gdb-memory-set-address-event (event) 2947(defun gdb-memory-set-address-event (event)
2934 "Handle a click on address field in memory buffer header." 2948 "Handle a click on address field in memory buffer header."
@@ -3118,8 +3132,8 @@ DOC is an optional documentation string."
3118 3132
3119(defvar gdb-memory-font-lock-keywords 3133(defvar gdb-memory-font-lock-keywords
3120 '(;; <__function.name+n> 3134 '(;; <__function.name+n>
3121 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face)) 3135 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
3122 ) 3136 (1 font-lock-function-name-face)))
3123 "Font lock keywords used in `gdb-memory-mode'.") 3137 "Font lock keywords used in `gdb-memory-mode'.")
3124 3138
3125(defvar gdb-memory-header 3139(defvar gdb-memory-header
@@ -3127,52 +3141,52 @@ DOC is an optional documentation string."
3127 (concat 3141 (concat
3128 "Start address[" 3142 "Start address["
3129 (propertize "-" 3143 (propertize "-"
3130 'face font-lock-warning-face 3144 'face font-lock-warning-face
3131 'help-echo "mouse-1: decrement address" 3145 'help-echo "mouse-1: decrement address"
3132 'mouse-face 'mode-line-highlight 3146 'mouse-face 'mode-line-highlight
3133 'local-map (gdb-make-header-line-mouse-map 3147 'local-map (gdb-make-header-line-mouse-map
3134 'mouse-1 3148 'mouse-1
3135 #'gdb-memory-show-previous-page)) 3149 #'gdb-memory-show-previous-page))
3136 "|" 3150 "|"
3137 (propertize "+" 3151 (propertize "+"
3138 'face font-lock-warning-face 3152 'face font-lock-warning-face
3139 'help-echo "mouse-1: increment address" 3153 'help-echo "mouse-1: increment address"
3140 'mouse-face 'mode-line-highlight 3154 'mouse-face 'mode-line-highlight
3141 'local-map (gdb-make-header-line-mouse-map 3155 'local-map (gdb-make-header-line-mouse-map
3142 'mouse-1 3156 'mouse-1
3143 #'gdb-memory-show-next-page)) 3157 #'gdb-memory-show-next-page))
3144 "]: " 3158 "]: "
3145 (propertize gdb-memory-address 3159 (propertize gdb-memory-address
3146 'face font-lock-warning-face 3160 'face font-lock-warning-face
3147 'help-echo "mouse-1: set start address" 3161 'help-echo "mouse-1: set start address"
3148 'mouse-face 'mode-line-highlight 3162 'mouse-face 'mode-line-highlight
3149 'local-map (gdb-make-header-line-mouse-map 3163 'local-map (gdb-make-header-line-mouse-map
3150 'mouse-1 3164 'mouse-1
3151 #'gdb-memory-set-address-event)) 3165 #'gdb-memory-set-address-event))
3152 " Rows: " 3166 " Rows: "
3153 (propertize (number-to-string gdb-memory-rows) 3167 (propertize (number-to-string gdb-memory-rows)
3154 'face font-lock-warning-face 3168 'face font-lock-warning-face
3155 'help-echo "mouse-1: set number of columns" 3169 'help-echo "mouse-1: set number of columns"
3156 'mouse-face 'mode-line-highlight 3170 'mouse-face 'mode-line-highlight
3157 'local-map (gdb-make-header-line-mouse-map 3171 'local-map (gdb-make-header-line-mouse-map
3158 'mouse-1 3172 'mouse-1
3159 #'gdb-memory-set-rows)) 3173 #'gdb-memory-set-rows))
3160 " Columns: " 3174 " Columns: "
3161 (propertize (number-to-string gdb-memory-columns) 3175 (propertize (number-to-string gdb-memory-columns)
3162 'face font-lock-warning-face 3176 'face font-lock-warning-face
3163 'help-echo "mouse-1: set number of columns" 3177 'help-echo "mouse-1: set number of columns"
3164 'mouse-face 'mode-line-highlight 3178 'mouse-face 'mode-line-highlight
3165 'local-map (gdb-make-header-line-mouse-map 3179 'local-map (gdb-make-header-line-mouse-map
3166 'mouse-1 3180 'mouse-1
3167 #'gdb-memory-set-columns)) 3181 #'gdb-memory-set-columns))
3168 " Display Format: " 3182 " Display Format: "
3169 (propertize gdb-memory-format 3183 (propertize gdb-memory-format
3170 'face font-lock-warning-face 3184 'face font-lock-warning-face
3171 'help-echo "mouse-3: select display format" 3185 'help-echo "mouse-3: select display format"
3172 'mouse-face 'mode-line-highlight 3186 'mouse-face 'mode-line-highlight
3173 'local-map gdb-memory-format-map) 3187 'local-map gdb-memory-format-map)
3174 " Unit Size: " 3188 " Unit Size: "
3175 (propertize (number-to-string gdb-memory-unit) 3189 (propertize (number-to-string gdb-memory-unit)
3176 'face font-lock-warning-face 3190 'face font-lock-warning-face
3177 'help-echo "mouse-3: select unit size" 3191 'help-echo "mouse-3: select unit size"
3178 'mouse-face 'mode-line-highlight 3192 'mouse-face 'mode-line-highlight
@@ -3213,18 +3227,18 @@ DOC is an optional documentation string."
3213 (concat "disassembly of " (gdb-get-target-string)))) 3227 (concat "disassembly of " (gdb-get-target-string))))
3214 3228
3215(def-gdb-display-buffer 3229(def-gdb-display-buffer
3216 gdb-display-disassembly-buffer 3230 gdb-display-disassembly-buffer
3217 'gdb-disassembly-buffer 3231 'gdb-disassembly-buffer
3218 "Display disassembly for current stack frame.") 3232 "Display disassembly for current stack frame.")
3219 3233
3220(def-gdb-preempt-display-buffer 3234(def-gdb-preempt-display-buffer
3221 gdb-preemptively-display-disassembly-buffer 3235 gdb-preemptively-display-disassembly-buffer
3222 'gdb-disassembly-buffer) 3236 'gdb-disassembly-buffer)
3223 3237
3224(def-gdb-frame-for-buffer 3238(def-gdb-frame-for-buffer
3225 gdb-frame-disassembly-buffer 3239 gdb-frame-disassembly-buffer
3226 'gdb-disassembly-buffer 3240 'gdb-disassembly-buffer
3227 "Display disassembly in a new frame.") 3241 "Display disassembly in a new frame.")
3228 3242
3229(def-gdb-auto-update-trigger gdb-invalidate-disassembly 3243(def-gdb-auto-update-trigger gdb-invalidate-disassembly
3230 (let* ((frame (gdb-current-buffer-frame)) 3244 (let* ((frame (gdb-current-buffer-frame))
@@ -3269,7 +3283,7 @@ DOC is an optional documentation string."
3269 (let ((map (make-sparse-keymap))) 3283 (let ((map (make-sparse-keymap)))
3270 (suppress-keymap map) 3284 (suppress-keymap map)
3271 (define-key map "q" 'kill-this-buffer) 3285 (define-key map "q" 'kill-this-buffer)
3272 map)) 3286 map))
3273 3287
3274(define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly" 3288(define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly"
3275 "Major mode for GDB disassembly information." 3289 "Major mode for GDB disassembly information."
@@ -3286,12 +3300,13 @@ DOC is an optional documentation string."
3286 (address (bindat-get-field (gdb-current-buffer-frame) 'addr)) 3300 (address (bindat-get-field (gdb-current-buffer-frame) 'addr))
3287 (table (make-gdb-table)) 3301 (table (make-gdb-table))
3288 (marked-line nil)) 3302 (marked-line nil))
3289 (dolist (instr instructions) 3303 (dolist (instr instructions)
3290 (gdb-table-add-row table 3304 (gdb-table-add-row table
3291 (list 3305 (list
3292 (bindat-get-field instr 'address) 3306 (bindat-get-field instr 'address)
3293 (apply 'format `("<%s+%s>:" ,@(gdb-get-many-fields instr 'func-name 'offset))) 3307 (apply #'format "<%s+%s>:"
3294 (bindat-get-field instr 'inst))) 3308 (gdb-get-many-fields instr 'func-name 'offset))
3309 (bindat-get-field instr 'inst)))
3295 (when (string-equal (bindat-get-field instr 'address) 3310 (when (string-equal (bindat-get-field instr 'address)
3296 address) 3311 address)
3297 (progn 3312 (progn
@@ -3300,17 +3315,18 @@ DOC is an optional documentation string."
3300 (if (string-equal gdb-frame-number "0") 3315 (if (string-equal gdb-frame-number "0")
3301 nil 3316 nil
3302 '((overlay-arrow . hollow-right-triangle))))))) 3317 '((overlay-arrow . hollow-right-triangle)))))))
3303 (insert (gdb-table-string table " ")) 3318 (insert (gdb-table-string table " "))
3304 (gdb-disassembly-place-breakpoints) 3319 (gdb-disassembly-place-breakpoints)
3305 ;; Mark current position with overlay arrow and scroll window to 3320 ;; Mark current position with overlay arrow and scroll window to
3306 ;; that point 3321 ;; that point
3307 (when marked-line 3322 (when marked-line
3308 (let ((window (get-buffer-window (current-buffer) 0))) 3323 (let ((window (get-buffer-window (current-buffer) 0)))
3309 (set-window-point window (gdb-mark-line marked-line gdb-disassembly-position)))) 3324 (set-window-point window (gdb-mark-line marked-line
3310 (setq mode-name 3325 gdb-disassembly-position))))
3311 (gdb-current-context-mode-name 3326 (setq mode-name
3312 (concat "Disassembly: " 3327 (gdb-current-context-mode-name
3313 (bindat-get-field (gdb-current-buffer-frame) 'func)))))) 3328 (concat "Disassembly: "
3329 (bindat-get-field (gdb-current-buffer-frame) 'func))))))
3314 3330
3315(defun gdb-disassembly-place-breakpoints () 3331(defun gdb-disassembly-place-breakpoints ()
3316 (gdb-remove-breakpoint-icons (point-min) (point-max)) 3332 (gdb-remove-breakpoint-icons (point-min) (point-max))
@@ -3331,7 +3347,8 @@ DOC is an optional documentation string."
3331 nil nil mode-line) 3347 nil nil mode-line)
3332 " " 3348 " "
3333 (gdb-propertize-header "Threads" gdb-threads-buffer 3349 (gdb-propertize-header "Threads" gdb-threads-buffer
3334 "mouse-1: select" mode-line-highlight mode-line-inactive))) 3350 "mouse-1: select" mode-line-highlight
3351 mode-line-inactive)))
3335 3352
3336;;; Breakpoints view 3353;;; Breakpoints view
3337(define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints" 3354(define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints"
@@ -3347,7 +3364,7 @@ DOC is an optional documentation string."
3347 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) 3364 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
3348 (if breakpoint 3365 (if breakpoint
3349 (gud-basic-call 3366 (gud-basic-call
3350 (concat (if (string-equal "y" (bindat-get-field breakpoint 'enabled)) 3367 (concat (if (equal "y" (bindat-get-field breakpoint 'enabled))
3351 "-break-disable " 3368 "-break-disable "
3352 "-break-enable ") 3369 "-break-enable ")
3353 (bindat-get-field breakpoint 'number))) 3370 (bindat-get-field breakpoint 'number)))
@@ -3357,11 +3374,12 @@ DOC is an optional documentation string."
3357 "Delete the breakpoint at current line of breakpoints buffer." 3374 "Delete the breakpoint at current line of breakpoints buffer."
3358 (interactive) 3375 (interactive)
3359 (save-excursion 3376 (save-excursion
3360 (beginning-of-line) 3377 (beginning-of-line)
3361 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) 3378 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
3362 (if breakpoint 3379 (if breakpoint
3363 (gud-basic-call (concat "-break-delete " (bindat-get-field breakpoint 'number))) 3380 (gud-basic-call (concat "-break-delete "
3364 (error "Not recognized as break/watchpoint line"))))) 3381 (bindat-get-field breakpoint 'number)))
3382 (error "Not recognized as break/watchpoint line")))))
3365 3383
3366(defun gdb-goto-breakpoint (&optional event) 3384(defun gdb-goto-breakpoint (&optional event)
3367 "Go to the location of breakpoint at current line of 3385 "Go to the location of breakpoint at current line of
@@ -3372,24 +3390,24 @@ breakpoints buffer."
3372 (let ((window (get-buffer-window gud-comint-buffer))) 3390 (let ((window (get-buffer-window gud-comint-buffer)))
3373 (if window (save-selected-window (select-window window)))) 3391 (if window (save-selected-window (select-window window))))
3374 (save-excursion 3392 (save-excursion
3375 (beginning-of-line) 3393 (beginning-of-line)
3376 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) 3394 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
3377 (if breakpoint 3395 (if breakpoint
3378 (let ((bptno (bindat-get-field breakpoint 'number)) 3396 (let ((bptno (bindat-get-field breakpoint 'number))
3379 (file (bindat-get-field breakpoint 'fullname)) 3397 (file (bindat-get-field breakpoint 'fullname))
3380 (line (bindat-get-field breakpoint 'line))) 3398 (line (bindat-get-field breakpoint 'line)))
3381 (save-selected-window 3399 (save-selected-window
3382 (let* ((buffer (find-file-noselect 3400 (let* ((buffer (find-file-noselect
3383 (if (file-exists-p file) file 3401 (if (file-exists-p file) file
3384 (cdr (assoc bptno gdb-location-alist))))) 3402 (cdr (assoc bptno gdb-location-alist)))))
3385 (window (or (gdb-display-source-buffer buffer) 3403 (window (or (gdb-display-source-buffer buffer)
3386 (display-buffer buffer)))) 3404 (display-buffer buffer))))
3387 (setq gdb-source-window window) 3405 (setq gdb-source-window window)
3388 (with-current-buffer buffer 3406 (with-current-buffer buffer
3389 (goto-char (point-min)) 3407 (goto-char (point-min))
3390 (forward-line (1- (string-to-number line))) 3408 (forward-line (1- (string-to-number line)))
3391 (set-window-point window (point)))))) 3409 (set-window-point window (point))))))
3392 (error "Not recognized as break/watchpoint line"))))) 3410 (error "Not recognized as break/watchpoint line")))))
3393 3411
3394 3412
3395;; Frames buffer. This displays a perpetually correct bactrack trace. 3413;; Frames buffer. This displays a perpetually correct bactrack trace.
@@ -3421,21 +3439,21 @@ member."
3421 (let ((stack (bindat-get-field (gdb-json-partial-output "frame") 'stack)) 3439 (let ((stack (bindat-get-field (gdb-json-partial-output "frame") 'stack))
3422 (table (make-gdb-table))) 3440 (table (make-gdb-table)))
3423 (set-marker gdb-stack-position nil) 3441 (set-marker gdb-stack-position nil)
3424 (dolist (frame stack) 3442 (dolist (frame stack)
3425 (gdb-table-add-row table 3443 (gdb-table-add-row table
3426 (list 3444 (list
3427 (bindat-get-field frame 'level) 3445 (bindat-get-field frame 'level)
3428 "in" 3446 "in"
3429 (concat 3447 (concat
3430 (bindat-get-field frame 'func) 3448 (bindat-get-field frame 'func)
3431 (if gdb-stack-buffer-locations 3449 (if gdb-stack-buffer-locations
3432 (gdb-frame-location frame) "") 3450 (gdb-frame-location frame) "")
3433 (if gdb-stack-buffer-addresses 3451 (if gdb-stack-buffer-addresses
3434 (concat " at " (bindat-get-field frame 'addr)) ""))) 3452 (concat " at " (bindat-get-field frame 'addr)) "")))
3435 `(mouse-face highlight 3453 `(mouse-face highlight
3436 help-echo "mouse-2, RET: Select frame" 3454 help-echo "mouse-2, RET: Select frame"
3437 gdb-frame ,frame))) 3455 gdb-frame ,frame)))
3438 (insert (gdb-table-string table " "))) 3456 (insert (gdb-table-string table " ")))
3439 (when (and gdb-frame-number 3457 (when (and gdb-frame-number
3440 (gdb-buffer-shows-main-thread-p)) 3458 (gdb-buffer-shows-main-thread-p))
3441 (gdb-mark-line (1+ (string-to-number gdb-frame-number)) 3459 (gdb-mark-line (1+ (string-to-number gdb-frame-number))
@@ -3448,18 +3466,18 @@ member."
3448 (concat "stack frames of " (gdb-get-target-string)))) 3466 (concat "stack frames of " (gdb-get-target-string))))
3449 3467
3450(def-gdb-display-buffer 3468(def-gdb-display-buffer
3451 gdb-display-stack-buffer 3469 gdb-display-stack-buffer
3452 'gdb-stack-buffer 3470 'gdb-stack-buffer
3453 "Display backtrace of current stack.") 3471 "Display backtrace of current stack.")
3454 3472
3455(def-gdb-preempt-display-buffer 3473(def-gdb-preempt-display-buffer
3456 gdb-preemptively-display-stack-buffer 3474 gdb-preemptively-display-stack-buffer
3457 'gdb-stack-buffer nil t) 3475 'gdb-stack-buffer nil t)
3458 3476
3459(def-gdb-frame-for-buffer 3477(def-gdb-frame-for-buffer
3460 gdb-frame-stack-buffer 3478 gdb-frame-stack-buffer
3461 'gdb-stack-buffer 3479 'gdb-stack-buffer
3462 "Display backtrace of current stack in a new frame.") 3480 "Display backtrace of current stack in a new frame.")
3463 3481
3464(defvar gdb-frames-mode-map 3482(defvar gdb-frames-mode-map
3465 (let ((map (make-sparse-keymap))) 3483 (let ((map (make-sparse-keymap)))
@@ -3492,7 +3510,8 @@ member."
3492 (if (gdb-buffer-shows-main-thread-p) 3510 (if (gdb-buffer-shows-main-thread-p)
3493 (let ((new-level (bindat-get-field frame 'level))) 3511 (let ((new-level (bindat-get-field frame 'level)))
3494 (setq gdb-frame-number new-level) 3512 (setq gdb-frame-number new-level)
3495 (gdb-input (list (concat "-stack-select-frame " new-level) 'ignore)) 3513 (gdb-input (list (concat "-stack-select-frame " new-level)
3514 'ignore))
3496 (gdb-update)) 3515 (gdb-update))
3497 (error "Could not select frame for non-current thread")) 3516 (error "Could not select frame for non-current thread"))
3498 (error "Not recognized as frame line")))) 3517 (error "Not recognized as frame line"))))
@@ -3502,7 +3521,8 @@ member."
3502;; uses "-stack-list-locals --simple-values". Needs GDB 6.1 onwards. 3521;; uses "-stack-list-locals --simple-values". Needs GDB 6.1 onwards.
3503(def-gdb-trigger-and-handler 3522(def-gdb-trigger-and-handler
3504 gdb-invalidate-locals 3523 gdb-invalidate-locals
3505 (concat (gdb-current-context-command "-stack-list-locals") " --simple-values") 3524 (concat (gdb-current-context-command "-stack-list-locals")
3525 " --simple-values")
3506 gdb-locals-handler gdb-locals-handler-custom 3526 gdb-locals-handler gdb-locals-handler-custom
3507 '(start update)) 3527 '(start update))
3508 3528
@@ -3518,7 +3538,7 @@ member."
3518 (define-key map "\r" 'gud-watch) 3538 (define-key map "\r" 'gud-watch)
3519 (define-key map [mouse-2] 'gud-watch) 3539 (define-key map [mouse-2] 'gud-watch)
3520 map) 3540 map)
3521 "Keymap to create watch expression of a complex data type local variable.") 3541 "Keymap to create watch expression of a complex data type local variable.")
3522 3542
3523(defvar gdb-edit-locals-map-1 3543(defvar gdb-edit-locals-map-1
3524 (let ((map (make-sparse-keymap))) 3544 (let ((map (make-sparse-keymap)))
@@ -3526,7 +3546,7 @@ member."
3526 (define-key map "\r" 'gdb-edit-locals-value) 3546 (define-key map "\r" 'gdb-edit-locals-value)
3527 (define-key map [mouse-2] 'gdb-edit-locals-value) 3547 (define-key map [mouse-2] 'gdb-edit-locals-value)
3528 map) 3548 map)
3529 "Keymap to edit value of a simple data type local variable.") 3549 "Keymap to edit value of a simple data type local variable.")
3530 3550
3531(defun gdb-edit-locals-value (&optional event) 3551(defun gdb-edit-locals-value (&optional event)
3532 "Assign a value to a variable displayed in the locals buffer." 3552 "Assign a value to a variable displayed in the locals buffer."
@@ -3552,14 +3572,14 @@ member."
3552 (if (or (not value) 3572 (if (or (not value)
3553 (string-match "\\0x" value)) 3573 (string-match "\\0x" value))
3554 (add-text-properties 0 (length name) 3574 (add-text-properties 0 (length name)
3555 `(mouse-face highlight 3575 `(mouse-face highlight
3556 help-echo "mouse-2: create watch expression" 3576 help-echo "mouse-2: create watch expression"
3557 local-map ,gdb-locals-watch-map) 3577 local-map ,gdb-locals-watch-map)
3558 name) 3578 name)
3559 (add-text-properties 0 (length value) 3579 (add-text-properties 0 (length value)
3560 `(mouse-face highlight 3580 `(mouse-face highlight
3561 help-echo "mouse-2: edit value" 3581 help-echo "mouse-2: edit value"
3562 local-map ,gdb-edit-locals-map-1) 3582 local-map ,gdb-edit-locals-map-1)
3563 value)) 3583 value))
3564 (gdb-table-add-row 3584 (gdb-table-add-row
3565 table 3585 table
@@ -3571,7 +3591,8 @@ member."
3571 (insert (gdb-table-string table " ")) 3591 (insert (gdb-table-string table " "))
3572 (setq mode-name 3592 (setq mode-name
3573 (gdb-current-context-mode-name 3593 (gdb-current-context-mode-name
3574 (concat "Locals: " (bindat-get-field (gdb-current-buffer-frame) 'func)))))) 3594 (concat "Locals: "
3595 (bindat-get-field (gdb-current-buffer-frame) 'func))))))
3575 3596
3576(defvar gdb-locals-header 3597(defvar gdb-locals-header
3577 (list 3598 (list
@@ -3579,19 +3600,20 @@ member."
3579 nil nil mode-line) 3600 nil nil mode-line)
3580 " " 3601 " "
3581 (gdb-propertize-header "Registers" gdb-registers-buffer 3602 (gdb-propertize-header "Registers" gdb-registers-buffer
3582 "mouse-1: select" mode-line-highlight mode-line-inactive))) 3603 "mouse-1: select" mode-line-highlight
3604 mode-line-inactive)))
3583 3605
3584(defvar gdb-locals-mode-map 3606(defvar gdb-locals-mode-map
3585 (let ((map (make-sparse-keymap))) 3607 (let ((map (make-sparse-keymap)))
3586 (suppress-keymap map) 3608 (suppress-keymap map)
3587 (define-key map "q" 'kill-this-buffer) 3609 (define-key map "q" 'kill-this-buffer)
3588 (define-key map "\t" (lambda () 3610 (define-key map "\t" (lambda ()
3589 (interactive) 3611 (interactive)
3590 (gdb-set-window-buffer 3612 (gdb-set-window-buffer
3591 (gdb-get-buffer-create 3613 (gdb-get-buffer-create
3592 'gdb-registers-buffer 3614 'gdb-registers-buffer
3593 gdb-thread-number) t))) 3615 gdb-thread-number) t)))
3594 map)) 3616 map))
3595 3617
3596(define-derived-mode gdb-locals-mode gdb-parent-mode "Locals" 3618(define-derived-mode gdb-locals-mode gdb-parent-mode "Locals"
3597 "Major mode for gdb locals." 3619 "Major mode for gdb locals."
@@ -3603,18 +3625,18 @@ member."
3603 (concat "locals of " (gdb-get-target-string)))) 3625 (concat "locals of " (gdb-get-target-string))))
3604 3626
3605(def-gdb-display-buffer 3627(def-gdb-display-buffer
3606 gdb-display-locals-buffer 3628 gdb-display-locals-buffer
3607 'gdb-locals-buffer 3629 'gdb-locals-buffer
3608 "Display local variables of current stack and their values.") 3630 "Display local variables of current stack and their values.")
3609 3631
3610(def-gdb-preempt-display-buffer 3632(def-gdb-preempt-display-buffer
3611 gdb-preemptively-display-locals-buffer 3633 gdb-preemptively-display-locals-buffer
3612 'gdb-locals-buffer nil t) 3634 'gdb-locals-buffer nil t)
3613 3635
3614(def-gdb-frame-for-buffer 3636(def-gdb-frame-for-buffer
3615 gdb-frame-locals-buffer 3637 gdb-frame-locals-buffer
3616 'gdb-locals-buffer 3638 'gdb-locals-buffer
3617 "Display local variables of current stack and their values in a new frame.") 3639 "Display local variables of current stack and their values in a new frame.")
3618 3640
3619 3641
3620;; Registers buffer. 3642;; Registers buffer.
@@ -3634,7 +3656,8 @@ member."
3634 3656
3635(defun gdb-registers-handler-custom () 3657(defun gdb-registers-handler-custom ()
3636 (when gdb-register-names 3658 (when gdb-register-names
3637 (let ((register-values (bindat-get-field (gdb-json-partial-output) 'register-values)) 3659 (let ((register-values
3660 (bindat-get-field (gdb-json-partial-output) 'register-values))
3638 (table (make-gdb-table))) 3661 (table (make-gdb-table)))
3639 (dolist (register register-values) 3662 (dolist (register register-values)
3640 (let* ((register-number (bindat-get-field register 'number)) 3663 (let* ((register-number (bindat-get-field register 'number))
@@ -3644,7 +3667,8 @@ member."
3644 (gdb-table-add-row 3667 (gdb-table-add-row
3645 table 3668 table
3646 (list 3669 (list
3647 (propertize register-name 'font-lock-face font-lock-variable-name-face) 3670 (propertize register-name
3671 'font-lock-face font-lock-variable-name-face)
3648 (if (member register-number gdb-changed-registers) 3672 (if (member register-number gdb-changed-registers)
3649 (propertize value 'font-lock-face font-lock-warning-face) 3673 (propertize value 'font-lock-face font-lock-warning-face)
3650 value)) 3674 value))
@@ -3674,17 +3698,18 @@ member."
3674 (define-key map [mouse-2] 'gdb-edit-register-value) 3698 (define-key map [mouse-2] 'gdb-edit-register-value)
3675 (define-key map "q" 'kill-this-buffer) 3699 (define-key map "q" 'kill-this-buffer)
3676 (define-key map "\t" (lambda () 3700 (define-key map "\t" (lambda ()
3677 (interactive) 3701 (interactive)
3678 (gdb-set-window-buffer 3702 (gdb-set-window-buffer
3679 (gdb-get-buffer-create 3703 (gdb-get-buffer-create
3680 'gdb-locals-buffer 3704 'gdb-locals-buffer
3681 gdb-thread-number) t))) 3705 gdb-thread-number) t)))
3682 map)) 3706 map))
3683 3707
3684(defvar gdb-registers-header 3708(defvar gdb-registers-header
3685 (list 3709 (list
3686 (gdb-propertize-header "Locals" gdb-locals-buffer 3710 (gdb-propertize-header "Locals" gdb-locals-buffer
3687 "mouse-1: select" mode-line-highlight mode-line-inactive) 3711 "mouse-1: select" mode-line-highlight
3712 mode-line-inactive)
3688 " " 3713 " "
3689 (gdb-propertize-header "Registers" gdb-registers-buffer 3714 (gdb-propertize-header "Registers" gdb-registers-buffer
3690 nil nil mode-line))) 3715 nil nil mode-line)))
@@ -3699,17 +3724,17 @@ member."
3699 (concat "registers of " (gdb-get-target-string)))) 3724 (concat "registers of " (gdb-get-target-string))))
3700 3725
3701(def-gdb-display-buffer 3726(def-gdb-display-buffer
3702 gdb-display-registers-buffer 3727 gdb-display-registers-buffer
3703 'gdb-registers-buffer 3728 'gdb-registers-buffer
3704 "Display integer register contents.") 3729 "Display integer register contents.")
3705 3730
3706(def-gdb-preempt-display-buffer 3731(def-gdb-preempt-display-buffer
3707 gdb-preemptively-display-registers-buffer 3732 gdb-preemptively-display-registers-buffer
3708 'gdb-registers-buffer nil t) 3733 'gdb-registers-buffer nil t)
3709 3734
3710(def-gdb-frame-for-buffer 3735(def-gdb-frame-for-buffer
3711 gdb-frame-registers-buffer 3736 gdb-frame-registers-buffer
3712 'gdb-registers-buffer 3737 'gdb-registers-buffer
3713 "Display integer register contents in a new frame.") 3738 "Display integer register contents in a new frame.")
3714 3739
3715;; Needs GDB 6.4 onwards (used to fail with no stack). 3740;; Needs GDB 6.4 onwards (used to fail with no stack).
@@ -3726,14 +3751,16 @@ member."
3726(defun gdb-changed-registers-handler () 3751(defun gdb-changed-registers-handler ()
3727 (gdb-delete-pending 'gdb-get-changed-registers) 3752 (gdb-delete-pending 'gdb-get-changed-registers)
3728 (setq gdb-changed-registers nil) 3753 (setq gdb-changed-registers nil)
3729 (dolist (register-number (bindat-get-field (gdb-json-partial-output) 'changed-registers)) 3754 (dolist (register-number
3755 (bindat-get-field (gdb-json-partial-output) 'changed-registers))
3730 (push register-number gdb-changed-registers))) 3756 (push register-number gdb-changed-registers)))
3731 3757
3732(defun gdb-register-names-handler () 3758(defun gdb-register-names-handler ()
3733 ;; Don't use gdb-pending-triggers because this handler is called 3759 ;; Don't use gdb-pending-triggers because this handler is called
3734 ;; only once (in gdb-init-1) 3760 ;; only once (in gdb-init-1)
3735 (setq gdb-register-names nil) 3761 (setq gdb-register-names nil)
3736 (dolist (register-name (bindat-get-field (gdb-json-partial-output) 'register-names)) 3762 (dolist (register-name
3763 (bindat-get-field (gdb-json-partial-output) 'register-names))
3737 (push register-name gdb-register-names)) 3764 (push register-name gdb-register-names))
3738 (setq gdb-register-names (reverse gdb-register-names))) 3765 (setq gdb-register-names (reverse gdb-register-names)))
3739 3766
@@ -3758,7 +3785,8 @@ thread. Called from `gdb-update'."
3758 (if (not (gdb-pending-p 'gdb-get-main-selected-frame)) 3785 (if (not (gdb-pending-p 'gdb-get-main-selected-frame))
3759 (progn 3786 (progn
3760 (gdb-input 3787 (gdb-input
3761 (list (gdb-current-context-command "-stack-info-frame") 'gdb-frame-handler)) 3788 (list (gdb-current-context-command "-stack-info-frame")
3789 'gdb-frame-handler))
3762 (gdb-add-pending 'gdb-get-main-selected-frame)))) 3790 (gdb-add-pending 'gdb-get-main-selected-frame))))
3763 3791
3764(defun gdb-frame-handler () 3792(defun gdb-frame-handler ()
@@ -3809,10 +3837,10 @@ window and show BUF there, if the window is not used for GDB
3809already, in which case that window is splitted first." 3837already, in which case that window is splitted first."
3810 (let ((answer (get-buffer-window buf (or frame 0)))) 3838 (let ((answer (get-buffer-window buf (or frame 0))))
3811 (if answer 3839 (if answer
3812 (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary. 3840 (display-buffer buf nil (or frame 0)) ;Deiconify frame if necessary.
3813 (let ((window (get-lru-window))) 3841 (let ((window (get-lru-window)))
3814 (if (eq (buffer-local-value 'gud-minor-mode (window-buffer window)) 3842 (if (eq (buffer-local-value 'gud-minor-mode (window-buffer window))
3815 'gdbmi) 3843 'gdbmi)
3816 (let ((largest (get-largest-window))) 3844 (let ((largest (get-largest-window)))
3817 (setq answer (split-window largest)) 3845 (setq answer (split-window largest))
3818 (set-window-buffer answer buf) 3846 (set-window-buffer answer buf)
@@ -3875,7 +3903,8 @@ SPLIT-HORIZONTAL and show BUF in the new window."
3875 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) 3903 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
3876 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) 3904 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
3877 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) 3905 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
3878 (define-key menu [disassembly] '("Disassembly" . gdb-frame-disassembly-buffer)) 3906 (define-key menu [disassembly]
3907 '("Disassembly" . gdb-frame-disassembly-buffer))
3879 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) 3908 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
3880 (define-key menu [inferior] 3909 (define-key menu [inferior]
3881 '("IO" . gdb-frame-io-buffer)) 3910 '("IO" . gdb-frame-io-buffer))
@@ -3886,40 +3915,41 @@ SPLIT-HORIZONTAL and show BUF in the new window."
3886 3915
3887(let ((menu (make-sparse-keymap "GDB-MI"))) 3916(let ((menu (make-sparse-keymap "GDB-MI")))
3888 (define-key menu [gdb-customize] 3917 (define-key menu [gdb-customize]
3889 '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb)) 3918 '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb))
3890 :help "Customize Gdb Graphical Mode options.")) 3919 :help "Customize Gdb Graphical Mode options."))
3891 (define-key menu [gdb-many-windows] 3920 (define-key menu [gdb-many-windows]
3892 '(menu-item "Display Other Windows" gdb-many-windows 3921 '(menu-item "Display Other Windows" gdb-many-windows
3893 :help "Toggle display of locals, stack and breakpoint information" 3922 :help "Toggle display of locals, stack and breakpoint information"
3894 :button (:toggle . gdb-many-windows))) 3923 :button (:toggle . gdb-many-windows)))
3895 (define-key menu [gdb-restore-windows] 3924 (define-key menu [gdb-restore-windows]
3896 '(menu-item "Restore Window Layout" gdb-restore-windows 3925 '(menu-item "Restore Window Layout" gdb-restore-windows
3897 :help "Restore standard layout for debug session.")) 3926 :help "Restore standard layout for debug session."))
3898 (define-key menu [sep1] 3927 (define-key menu [sep1]
3899 '(menu-item "--")) 3928 '(menu-item "--"))
3900 (define-key menu [all-threads] 3929 (define-key menu [all-threads]
3901 '(menu-item "GUD controls all threads" 3930 '(menu-item "GUD controls all threads"
3902 (lambda () 3931 (lambda ()
3903 (interactive) 3932 (interactive)
3904 (setq gdb-gud-control-all-threads t)) 3933 (setq gdb-gud-control-all-threads t))
3905 :help "GUD start/stop commands apply to all threads" 3934 :help "GUD start/stop commands apply to all threads"
3906 :button (:radio . gdb-gud-control-all-threads))) 3935 :button (:radio . gdb-gud-control-all-threads)))
3907 (define-key menu [current-thread] 3936 (define-key menu [current-thread]
3908 '(menu-item "GUD controls current thread" 3937 '(menu-item "GUD controls current thread"
3909 (lambda () 3938 (lambda ()
3910 (interactive) 3939 (interactive)
3911 (setq gdb-gud-control-all-threads nil)) 3940 (setq gdb-gud-control-all-threads nil))
3912 :help "GUD start/stop commands apply to current thread only" 3941 :help "GUD start/stop commands apply to current thread only"
3913 :button (:radio . (not gdb-gud-control-all-threads)))) 3942 :button (:radio . (not gdb-gud-control-all-threads))))
3914 (define-key menu [sep2] 3943 (define-key menu [sep2]
3915 '(menu-item "--")) 3944 '(menu-item "--"))
3916 (define-key menu [gdb-customize-reasons] 3945 (define-key menu [gdb-customize-reasons]
3917 '(menu-item "Customize switching..." 3946 '(menu-item "Customize switching..."
3918 (lambda () 3947 (lambda ()
3919 (interactive) 3948 (interactive)
3920 (customize-option 'gdb-switch-reasons)))) 3949 (customize-option 'gdb-switch-reasons))))
3921 (define-key menu [gdb-switch-when-another-stopped] 3950 (define-key menu [gdb-switch-when-another-stopped]
3922 (menu-bar-make-toggle gdb-toggle-switch-when-another-stopped gdb-switch-when-another-stopped 3951 (menu-bar-make-toggle gdb-toggle-switch-when-another-stopped
3952 gdb-switch-when-another-stopped
3923 "Automatically switch to stopped thread" 3953 "Automatically switch to stopped thread"
3924 "GDB thread switching %s" 3954 "GDB thread switching %s"
3925 "Switch to stopped thread")) 3955 "Switch to stopped thread"))
@@ -3933,18 +3963,18 @@ SPLIT-HORIZONTAL and show BUF in the new window."
3933;; show up right before Run button. 3963;; show up right before Run button.
3934(define-key-after gud-tool-bar-map [all-threads] 3964(define-key-after gud-tool-bar-map [all-threads]
3935 '(menu-item "Switch to non-stop/A mode" gdb-control-all-threads 3965 '(menu-item "Switch to non-stop/A mode" gdb-control-all-threads
3936 :image (find-image '((:type xpm :file "gud/thread.xpm"))) 3966 :image (find-image '((:type xpm :file "gud/thread.xpm")))
3937 :visible (and (eq gud-minor-mode 'gdbmi) 3967 :visible (and (eq gud-minor-mode 'gdbmi)
3938 gdb-non-stop 3968 gdb-non-stop
3939 (not gdb-gud-control-all-threads))) 3969 (not gdb-gud-control-all-threads)))
3940 'run) 3970 'run)
3941 3971
3942(define-key-after gud-tool-bar-map [current-thread] 3972(define-key-after gud-tool-bar-map [current-thread]
3943 '(menu-item "Switch to non-stop/T mode" gdb-control-current-thread 3973 '(menu-item "Switch to non-stop/T mode" gdb-control-current-thread
3944 :image (find-image '((:type xpm :file "gud/all.xpm"))) 3974 :image (find-image '((:type xpm :file "gud/all.xpm")))
3945 :visible (and (eq gud-minor-mode 'gdbmi) 3975 :visible (and (eq gud-minor-mode 'gdbmi)
3946 gdb-non-stop 3976 gdb-non-stop
3947 gdb-gud-control-all-threads)) 3977 gdb-gud-control-all-threads))
3948 'all-threads) 3978 'all-threads)
3949 3979
3950(defun gdb-frame-gdb-buffer () 3980(defun gdb-frame-gdb-buffer ()
@@ -3963,15 +3993,16 @@ SPLIT-HORIZONTAL and show BUF in the new window."
3963 (let ((same-window-regexps nil)) 3993 (let ((same-window-regexps nil))
3964 (select-window (display-buffer gud-comint-buffer nil 0)))) 3994 (select-window (display-buffer gud-comint-buffer nil 0))))
3965 3995
3966(defun gdb-set-window-buffer (name &optional ignore-dedicated) 3996(defun gdb-set-window-buffer (name &optional ignore-dedicated window)
3967 "Set buffer of selected window to NAME and dedicate window. 3997 "Set buffer of selected window to NAME and dedicate window.
3968 3998
3969When IGNORE-DEDICATED is non-nil, buffer is set even if selected 3999When IGNORE-DEDICATED is non-nil, buffer is set even if selected
3970window is dedicated." 4000window is dedicated."
4001 (unless window (setq window (selected-window)))
3971 (when ignore-dedicated 4002 (when ignore-dedicated
3972 (set-window-dedicated-p (selected-window) nil)) 4003 (set-window-dedicated-p window nil))
3973 (set-window-buffer (selected-window) (get-buffer name)) 4004 (set-window-buffer window (get-buffer name))
3974 (set-window-dedicated-p (selected-window) t)) 4005 (set-window-dedicated-p window t))
3975 4006
3976(defun gdb-setup-windows () 4007(defun gdb-setup-windows ()
3977 "Layout the window pattern for `gdb-many-windows'." 4008 "Layout the window pattern for `gdb-many-windows'."
@@ -3980,35 +4011,35 @@ window is dedicated."
3980 (delete-other-windows) 4011 (delete-other-windows)
3981 (gdb-display-breakpoints-buffer) 4012 (gdb-display-breakpoints-buffer)
3982 (delete-other-windows) 4013 (delete-other-windows)
3983 ; Don't dedicate. 4014 ;; Don't dedicate.
3984 (pop-to-buffer gud-comint-buffer) 4015 (pop-to-buffer gud-comint-buffer)
3985 (split-window nil ( / ( * (window-height) 3) 4)) 4016 (let ((win0 (selected-window))
3986 (split-window nil ( / (window-height) 3)) 4017 (win1 (split-window nil ( / ( * (window-height) 3) 4)))
3987 (split-window-horizontally) 4018 (win2 (split-window nil ( / (window-height) 3)))
3988 (other-window 1) 4019 (win3 (split-window-horizontally)))
3989 (gdb-set-window-buffer (gdb-locals-buffer-name)) 4020 (gdb-set-window-buffer (gdb-locals-buffer-name) nil win3)
3990 (other-window 1) 4021 (select-window win2)
3991 (switch-to-buffer 4022 (set-window-buffer
3992 (if gud-last-last-frame 4023 win2
3993 (gud-find-file (car gud-last-last-frame)) 4024 (if gud-last-last-frame
3994 (if gdb-main-file 4025 (gud-find-file (car gud-last-last-frame))
3995 (gud-find-file gdb-main-file) 4026 (if gdb-main-file
3996 ;; Put buffer list in window if we 4027 (gud-find-file gdb-main-file)
3997 ;; can't find a source file. 4028 ;; Put buffer list in window if we
3998 (list-buffers-noselect)))) 4029 ;; can't find a source file.
3999 (setq gdb-source-window (selected-window)) 4030 (list-buffers-noselect))))
4000 (split-window-horizontally) 4031 (setq gdb-source-window (selected-window))
4001 (other-window 1) 4032 (let ((win4 (split-window-horizontally)))
4002 (gdb-set-window-buffer 4033 (gdb-set-window-buffer
4003 (gdb-get-buffer-create 'gdb-inferior-io)) 4034 (gdb-get-buffer-create 'gdb-inferior-io) nil win4))
4004 (other-window 1) 4035 (select-window win1)
4005 (gdb-set-window-buffer (gdb-stack-buffer-name)) 4036 (gdb-set-window-buffer (gdb-stack-buffer-name))
4006 (split-window-horizontally) 4037 (let ((win5 (split-window-horizontally)))
4007 (other-window 1) 4038 (gdb-set-window-buffer (if gdb-show-threads-by-default
4008 (gdb-set-window-buffer (if gdb-show-threads-by-default 4039 (gdb-threads-buffer-name)
4009 (gdb-threads-buffer-name) 4040 (gdb-breakpoints-buffer-name))
4010 (gdb-breakpoints-buffer-name))) 4041 nil win5))
4011 (other-window 1)) 4042 (select-window win0)))
4012 4043
4013(defcustom gdb-many-windows nil 4044(defcustom gdb-many-windows nil
4014 "If nil just pop up the GUD buffer unless `gdb-show-main' is t. 4045 "If nil just pop up the GUD buffer unless `gdb-show-main' is t.
@@ -4025,34 +4056,33 @@ of the debugged program. Non-nil means display the layout shown for
4025With arg, display additional buffers iff arg is positive." 4056With arg, display additional buffers iff arg is positive."
4026 (interactive "P") 4057 (interactive "P")
4027 (setq gdb-many-windows 4058 (setq gdb-many-windows
4028 (if (null arg) 4059 (if (null arg)
4029 (not gdb-many-windows) 4060 (not gdb-many-windows)
4030 (> (prefix-numeric-value arg) 0))) 4061 (> (prefix-numeric-value arg) 0)))
4031 (message (format "Display of other windows %sabled" 4062 (message (format "Display of other windows %sabled"
4032 (if gdb-many-windows "en" "dis"))) 4063 (if gdb-many-windows "en" "dis")))
4033 (if (and gud-comint-buffer 4064 (if (and gud-comint-buffer
4034 (buffer-name gud-comint-buffer)) 4065 (buffer-name gud-comint-buffer))
4035 (condition-case nil 4066 (condition-case nil
4036 (gdb-restore-windows) 4067 (gdb-restore-windows)
4037 (error nil)))) 4068 (error nil))))
4038 4069
4039(defun gdb-restore-windows () 4070(defun gdb-restore-windows ()
4040 "Restore the basic arrangement of windows used by gdb. 4071 "Restore the basic arrangement of windows used by gdb.
4041This arrangement depends on the value of `gdb-many-windows'." 4072This arrangement depends on the value of `gdb-many-windows'."
4042 (interactive) 4073 (interactive)
4043 (pop-to-buffer gud-comint-buffer) ;Select the right window and frame. 4074 (pop-to-buffer gud-comint-buffer) ;Select the right window and frame.
4044 (delete-other-windows) 4075 (delete-other-windows)
4045 (if gdb-many-windows 4076 (if gdb-many-windows
4046 (gdb-setup-windows) 4077 (gdb-setup-windows)
4047 (when (or gud-last-last-frame gdb-show-main) 4078 (when (or gud-last-last-frame gdb-show-main)
4048 (split-window) 4079 (let ((win (split-window)))
4049 (other-window 1) 4080 (set-window-buffer
4050 (switch-to-buffer 4081 win
4051 (if gud-last-last-frame 4082 (if gud-last-last-frame
4052 (gud-find-file (car gud-last-last-frame)) 4083 (gud-find-file (car gud-last-last-frame))
4053 (gud-find-file gdb-main-file))) 4084 (gud-find-file gdb-main-file)))
4054 (setq gdb-source-window (selected-window)) 4085 (setq gdb-source-window win)))))
4055 (other-window 1))))
4056 4086
4057(defun gdb-reset () 4087(defun gdb-reset ()
4058 "Exit a debugging session cleanly. 4088 "Exit a debugging session cleanly.
@@ -4060,23 +4090,23 @@ Kills the gdb buffers, and resets variables and the source buffers."
4060 (dolist (buffer (buffer-list)) 4090 (dolist (buffer (buffer-list))
4061 (unless (eq buffer gud-comint-buffer) 4091 (unless (eq buffer gud-comint-buffer)
4062 (with-current-buffer buffer 4092 (with-current-buffer buffer
4063 (if (eq gud-minor-mode 'gdbmi) 4093 (if (eq gud-minor-mode 'gdbmi)
4064 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name)) 4094 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name))
4065 (kill-buffer nil) 4095 (kill-buffer nil)
4066 (gdb-remove-breakpoint-icons (point-min) (point-max) t) 4096 (gdb-remove-breakpoint-icons (point-min) (point-max) t)
4067 (setq gud-minor-mode nil) 4097 (setq gud-minor-mode nil)
4068 (kill-local-variable 'tool-bar-map) 4098 (kill-local-variable 'tool-bar-map)
4069 (kill-local-variable 'gdb-define-alist)))))) 4099 (kill-local-variable 'gdb-define-alist))))))
4070 (setq gdb-disassembly-position nil) 4100 (setq gdb-disassembly-position nil)
4071 (setq overlay-arrow-variable-list 4101 (setq overlay-arrow-variable-list
4072 (delq 'gdb-disassembly-position overlay-arrow-variable-list)) 4102 (delq 'gdb-disassembly-position overlay-arrow-variable-list))
4073 (setq fringe-indicator-alist '((overlay-arrow . right-triangle))) 4103 (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
4074 (setq gdb-stack-position nil) 4104 (setq gdb-stack-position nil)
4075 (setq overlay-arrow-variable-list 4105 (setq overlay-arrow-variable-list
4076 (delq 'gdb-stack-position overlay-arrow-variable-list)) 4106 (delq 'gdb-stack-position overlay-arrow-variable-list))
4077 (setq gdb-thread-position nil) 4107 (setq gdb-thread-position nil)
4078 (setq overlay-arrow-variable-list 4108 (setq overlay-arrow-variable-list
4079 (delq 'gdb-thread-position overlay-arrow-variable-list)) 4109 (delq 'gdb-thread-position overlay-arrow-variable-list))
4080 (if (boundp 'speedbar-frame) (speedbar-timer-fn)) 4110 (if (boundp 'speedbar-frame) (speedbar-timer-fn))
4081 (setq gud-running nil) 4111 (setq gud-running nil)
4082 (setq gdb-active-process nil) 4112 (setq gdb-active-process nil)
@@ -4088,12 +4118,12 @@ buffers, if required."
4088 (goto-char (point-min)) 4118 (goto-char (point-min))
4089 (if (re-search-forward gdb-source-file-regexp nil t) 4119 (if (re-search-forward gdb-source-file-regexp nil t)
4090 (setq gdb-main-file (match-string 1))) 4120 (setq gdb-main-file (match-string 1)))
4091 (if gdb-many-windows 4121 (if gdb-many-windows
4092 (gdb-setup-windows) 4122 (gdb-setup-windows)
4093 (gdb-get-buffer-create 'gdb-breakpoints-buffer) 4123 (gdb-get-buffer-create 'gdb-breakpoints-buffer)
4094 (if gdb-show-main 4124 (if gdb-show-main
4095 (let ((pop-up-windows t)) 4125 (let ((pop-up-windows t))
4096 (display-buffer (gud-find-file gdb-main-file)))))) 4126 (display-buffer (gud-find-file gdb-main-file))))))
4097 4127
4098;;from put-image 4128;;from put-image
4099(defun gdb-put-string (putstring pos &optional dprop &rest sprops) 4129(defun gdb-put-string (putstring pos &optional dprop &rest sprops)
@@ -4102,14 +4132,14 @@ PUTSTRING is displayed by putting an overlay into the current buffer with a
4102`before-string' string that has a `display' property whose value is 4132`before-string' string that has a `display' property whose value is
4103PUTSTRING." 4133PUTSTRING."
4104 (let ((string (make-string 1 ?x)) 4134 (let ((string (make-string 1 ?x))
4105 (buffer (current-buffer))) 4135 (buffer (current-buffer)))
4106 (setq putstring (copy-sequence putstring)) 4136 (setq putstring (copy-sequence putstring))
4107 (let ((overlay (make-overlay pos pos buffer)) 4137 (let ((overlay (make-overlay pos pos buffer))
4108 (prop (or dprop 4138 (prop (or dprop
4109 (list (list 'margin 'left-margin) putstring)))) 4139 (list (list 'margin 'left-margin) putstring))))
4110 (put-text-property 0 1 'display prop string) 4140 (put-text-property 0 1 'display prop string)
4111 (if sprops 4141 (if sprops
4112 (add-text-properties 0 1 sprops string)) 4142 (add-text-properties 0 1 sprops string))
4113 (overlay-put overlay 'put-break t) 4143 (overlay-put overlay 'put-break t)
4114 (overlay-put overlay 'before-string string)))) 4144 (overlay-put overlay 'before-string string))))
4115 4145
@@ -4122,7 +4152,7 @@ BUFFER nil or omitted means use the current buffer."
4122 (setq buffer (current-buffer))) 4152 (setq buffer (current-buffer)))
4123 (dolist (overlay (overlays-in start end)) 4153 (dolist (overlay (overlays-in start end))
4124 (when (overlay-get overlay 'put-break) 4154 (when (overlay-get overlay 'put-break)
4125 (delete-overlay overlay)))) 4155 (delete-overlay overlay))))
4126 4156
4127(defun gdb-put-breakpoint-icon (enabled bptno &optional line) 4157(defun gdb-put-breakpoint-icon (enabled bptno &optional line)
4128 (let* ((posns (gdb-line-posns (or line (line-number-at-pos)))) 4158 (let* ((posns (gdb-line-posns (or line (line-number-at-pos))))
@@ -4134,62 +4164,63 @@ BUFFER nil or omitted means use the current buffer."
4134 0 1 '(help-echo "mouse-1: clear bkpt, mouse-3: enable/disable bkpt") 4164 0 1 '(help-echo "mouse-1: clear bkpt, mouse-3: enable/disable bkpt")
4135 putstring) 4165 putstring)
4136 (if enabled 4166 (if enabled
4137 (add-text-properties 4167 (add-text-properties
4138 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring) 4168 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring)
4139 (add-text-properties 4169 (add-text-properties
4140 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) 4170 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
4141 (gdb-remove-breakpoint-icons start end) 4171 (gdb-remove-breakpoint-icons start end)
4142 (if (display-images-p) 4172 (if (display-images-p)
4143 (if (>= (or left-fringe-width 4173 (if (>= (or left-fringe-width
4144 (if source-window (car (window-fringes source-window))) 4174 (if source-window (car (window-fringes source-window)))
4145 gdb-buffer-fringe-width) 8) 4175 gdb-buffer-fringe-width) 8)
4146 (gdb-put-string 4176 (gdb-put-string
4147 nil (1+ start) 4177 nil (1+ start)
4148 `(left-fringe breakpoint 4178 `(left-fringe breakpoint
4149 ,(if enabled 4179 ,(if enabled
4150 'breakpoint-enabled 4180 'breakpoint-enabled
4151 'breakpoint-disabled)) 4181 'breakpoint-disabled))
4152 'gdb-bptno bptno 4182 'gdb-bptno bptno
4153 'gdb-enabled enabled) 4183 'gdb-enabled enabled)
4154 (when (< left-margin-width 2) 4184 (when (< left-margin-width 2)
4155 (save-current-buffer 4185 (save-current-buffer
4156 (setq left-margin-width 2) 4186 (setq left-margin-width 2)
4157 (if source-window 4187 (if source-window
4158 (set-window-margins 4188 (set-window-margins
4159 source-window 4189 source-window
4160 left-margin-width right-margin-width)))) 4190 left-margin-width right-margin-width))))
4161 (put-image 4191 (put-image
4162 (if enabled 4192 (if enabled
4163 (or breakpoint-enabled-icon 4193 (or breakpoint-enabled-icon
4164 (setq breakpoint-enabled-icon 4194 (setq breakpoint-enabled-icon
4165 (find-image `((:type xpm :data 4195 (find-image `((:type xpm :data
4166 ,breakpoint-xpm-data 4196 ,breakpoint-xpm-data
4167 :ascent 100 :pointer hand) 4197 :ascent 100 :pointer hand)
4168 (:type pbm :data 4198 (:type pbm :data
4169 ,breakpoint-enabled-pbm-data 4199 ,breakpoint-enabled-pbm-data
4170 :ascent 100 :pointer hand))))) 4200 :ascent 100 :pointer hand)))))
4171 (or breakpoint-disabled-icon 4201 (or breakpoint-disabled-icon
4172 (setq breakpoint-disabled-icon 4202 (setq breakpoint-disabled-icon
4173 (find-image `((:type xpm :data 4203 (find-image `((:type xpm :data
4174 ,breakpoint-xpm-data 4204 ,breakpoint-xpm-data
4175 :conversion disabled 4205 :conversion disabled
4176 :ascent 100 :pointer hand) 4206 :ascent 100 :pointer hand)
4177 (:type pbm :data 4207 (:type pbm :data
4178 ,breakpoint-disabled-pbm-data 4208 ,breakpoint-disabled-pbm-data
4179 :ascent 100 :pointer hand)))))) 4209 :ascent 100 :pointer hand))))))
4180 (+ start 1) 4210 (+ start 1)
4181 putstring 4211 putstring
4182 'left-margin)) 4212 'left-margin))
4183 (when (< left-margin-width 2) 4213 (when (< left-margin-width 2)
4184 (save-current-buffer 4214 (save-current-buffer
4185 (setq left-margin-width 2) 4215 (setq left-margin-width 2)
4186 (let ((window (get-buffer-window (current-buffer) 0))) 4216 (let ((window (get-buffer-window (current-buffer) 0)))
4187 (if window 4217 (if window
4188 (set-window-margins 4218 (set-window-margins
4189 window left-margin-width right-margin-width))))) 4219 window left-margin-width right-margin-width)))))
4190 (gdb-put-string 4220 (gdb-put-string
4191 (propertize putstring 4221 (propertize putstring
4192 'face (if enabled 'breakpoint-enabled 'breakpoint-disabled)) 4222 'face (if enabled
4223 'breakpoint-enabled 'breakpoint-disabled))
4193 (1+ start))))) 4224 (1+ start)))))
4194 4225
4195(defun gdb-remove-breakpoint-icons (start end &optional remove-margin) 4226(defun gdb-remove-breakpoint-icons (start end &optional remove-margin)
@@ -4200,8 +4231,8 @@ BUFFER nil or omitted means use the current buffer."
4200 (setq left-margin-width 0) 4231 (setq left-margin-width 0)
4201 (let ((window (get-buffer-window (current-buffer) 0))) 4232 (let ((window (get-buffer-window (current-buffer) 0)))
4202 (if window 4233 (if window
4203 (set-window-margins 4234 (set-window-margins
4204 window left-margin-width right-margin-width))))) 4235 window left-margin-width right-margin-width)))))
4205 4236
4206(provide 'gdb-mi) 4237(provide 'gdb-mi)
4207 4238
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index d00189f15c3..5561575ea20 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -966,8 +966,7 @@ This command shares argument histories with \\[lgrep] and \\[grep-find]."
966 (setq dir default-directory)) 966 (setq dir default-directory))
967 (if (null files) 967 (if (null files)
968 (if (not (string= regexp grep-find-command)) 968 (if (not (string= regexp grep-find-command))
969 (let ((process-connection-type nil)) 969 (compilation-start regexp 'grep-mode))
970 (compilation-start regexp 'grep-mode)))
971 (setq dir (file-name-as-directory (expand-file-name dir))) 970 (setq dir (file-name-as-directory (expand-file-name dir)))
972 (require 'find-dired) ; for `find-name-arg' 971 (require 'find-dired) ; for `find-name-arg'
973 (let ((command (grep-expand-template 972 (let ((command (grep-expand-template
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 259ee81c9ba..a54d1438368 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -1581,7 +1581,8 @@ and source-file directory for your debugger."
1581;; Last group is for return value, e.g. "> test.py(2)foo()->None" 1581;; Last group is for return value, e.g. "> test.py(2)foo()->None"
1582;; Either file or function name may be omitted: "> <string>(0)?()" 1582;; Either file or function name may be omitted: "> <string>(0)?()"
1583(defvar gud-pdb-marker-regexp 1583(defvar gud-pdb-marker-regexp
1584 "^> \\([-a-zA-Z0-9_/.:\\]*\\|<string>\\)(\\([0-9]+\\))\\([a-zA-Z0-9_]*\\|\\?\\|<module>\\)()\\(->[^\n]*\\)?\n") 1584 "^> \\([-a-zA-Z0-9_/.:\\]*\\|<string>\\)(\\([0-9]+\\))\\([a-zA-Z0-9_]*\\|\\?\\|<module>\\)()\\(->[^\n\r]*\\)?[\n\r]")
1585
1585(defvar gud-pdb-marker-regexp-file-group 1) 1586(defvar gud-pdb-marker-regexp-file-group 1)
1586(defvar gud-pdb-marker-regexp-line-group 2) 1587(defvar gud-pdb-marker-regexp-line-group 2)
1587(defvar gud-pdb-marker-regexp-fnname-group 3) 1588(defvar gud-pdb-marker-regexp-fnname-group 3)
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 1da819660d2..80358e1c651 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4,10 +4,9 @@
4 4
5;; Author: Alex Schroeder <alex@gnu.org> 5;; Author: Alex Schroeder <alex@gnu.org>
6;; Maintainer: Michael Mauger <mmaug@yahoo.com> 6;; Maintainer: Michael Mauger <mmaug@yahoo.com>
7;; Version: 2.8 7;; Version: 3.0
8;; Keywords: comm languages processes 8;; Keywords: comm languages processes
9;; URL: http://savannah.gnu.org/projects/emacs/ 9;; URL: http://savannah.gnu.org/projects/emacs/
10;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
11 10
12;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
13 12
@@ -46,7 +45,7 @@
46;; available in early versions of sql.el. This support has been 45;; available in early versions of sql.el. This support has been
47;; extended and formalized in later versions. Part of the impetus for 46;; extended and formalized in later versions. Part of the impetus for
48;; the improved support of SQL flavors was borne out of the current 47;; the improved support of SQL flavors was borne out of the current
49;; maintainer's consulting experience. In the past fifteen years, I 48;; maintainers consulting experience. In the past twenty years, I
50;; have used Oracle, Sybase, Informix, MySQL, Postgres, and SQLServer. 49;; have used Oracle, Sybase, Informix, MySQL, Postgres, and SQLServer.
51;; On some assignments, I have used two or more of these concurrently. 50;; On some assignments, I have used two or more of these concurrently.
52 51
@@ -130,7 +129,7 @@
130;; identifier characters. 129;; identifier characters.
131 130
132;; (sql-set-product-feature 'xyz 131;; (sql-set-product-feature 'xyz
133;; :syntax-alist ((?# . "w"))) 132;; :syntax-alist ((?# . "_")))
134 133
135;; 4) Define the interactive command interpreter for the database 134;; 4) Define the interactive command interpreter for the database
136;; product. 135;; product.
@@ -184,7 +183,7 @@
184;; (sql-set-product-feature 'xyz 183;; (sql-set-product-feature 'xyz
185;; :sqli-comint-func 'my-sql-comint-xyz) 184;; :sqli-comint-func 'my-sql-comint-xyz)
186 185
187;; 6) Define a convienence function to invoke the SQL interpreter. 186;; 6) Define a convenience function to invoke the SQL interpreter.
188 187
189;; (defun my-sql-xyz (&optional buffer) 188;; (defun my-sql-xyz (&optional buffer)
190;; "Run ixyz by XyzDB as an inferior process." 189;; "Run ixyz by XyzDB as an inferior process."
@@ -230,9 +229,18 @@
230(eval-when-compile 229(eval-when-compile
231 (require 'regexp-opt)) 230 (require 'regexp-opt))
232(require 'custom) 231(require 'custom)
232(require 'thingatpt)
233(eval-when-compile ;; needed in Emacs 19, 20 233(eval-when-compile ;; needed in Emacs 19, 20
234 (setq max-specpdl-size (max max-specpdl-size 2000))) 234 (setq max-specpdl-size (max max-specpdl-size 2000)))
235 235
236(defun sql-signum (n)
237 "Return 1, 0, or -1 to identify the sign of N."
238 (cond
239 ((not (numberp n)) nil)
240 ((< n 0) -1)
241 ((> n 0) 1)
242 (t 0)))
243
236(defvar font-lock-keyword-face) 244(defvar font-lock-keyword-face)
237(defvar font-lock-set-defaults) 245(defvar font-lock-set-defaults)
238(defvar font-lock-string-face) 246(defvar font-lock-string-face)
@@ -327,7 +335,8 @@ Customizing your password will store it in your ~/.emacs file."
327(defvar sql-product-alist 335(defvar sql-product-alist
328 '((ansi 336 '((ansi
329 :name "ANSI" 337 :name "ANSI"
330 :font-lock sql-mode-ansi-font-lock-keywords) 338 :font-lock sql-mode-ansi-font-lock-keywords
339 :statement sql-ansi-statement-starters)
331 340
332 (db2 341 (db2
333 :name "DB2" 342 :name "DB2"
@@ -392,7 +401,7 @@ Customizing your password will store it in your ~/.emacs file."
392 :sqli-comint-func sql-comint-ms 401 :sqli-comint-func sql-comint-ms
393 :prompt-regexp "^[0-9]*>" 402 :prompt-regexp "^[0-9]*>"
394 :prompt-length 5 403 :prompt-length 5
395 :syntax-alist ((?@ . "w")) 404 :syntax-alist ((?@ . "_"))
396 :terminator ("^go" . "go")) 405 :terminator ("^go" . "go"))
397 406
398 (mysql 407 (mysql
@@ -408,6 +417,7 @@ Customizing your password will store it in your ~/.emacs file."
408 :prompt-regexp "^mysql> " 417 :prompt-regexp "^mysql> "
409 :prompt-length 6 418 :prompt-length 6
410 :prompt-cont-regexp "^ -> " 419 :prompt-cont-regexp "^ -> "
420 :syntax-alist ((?# . "< b"))
411 :input-filter sql-remove-tabs-filter) 421 :input-filter sql-remove-tabs-filter)
412 422
413 (oracle 423 (oracle
@@ -417,11 +427,15 @@ Customizing your password will store it in your ~/.emacs file."
417 :sqli-options sql-oracle-options 427 :sqli-options sql-oracle-options
418 :sqli-login sql-oracle-login-params 428 :sqli-login sql-oracle-login-params
419 :sqli-comint-func sql-comint-oracle 429 :sqli-comint-func sql-comint-oracle
430 :list-all sql-oracle-list-all
431 :list-table sql-oracle-list-table
432 :completion-object sql-oracle-completion-object
420 :prompt-regexp "^SQL> " 433 :prompt-regexp "^SQL> "
421 :prompt-length 5 434 :prompt-length 5
422 :prompt-cont-regexp "^\\s-*\\d+> " 435 :prompt-cont-regexp "^\\s-*[[:digit:]]+ "
423 :syntax-alist ((?$ . "w") (?# . "w")) 436 :statement sql-oracle-statement-starters
424 :terminator ("\\(^/\\|;\\)" . "/") 437 :syntax-alist ((?$ . "_") (?# . "_"))
438 :terminator ("\\(^/\\|;\\)$" . "/")
425 :input-filter sql-placeholders-filter) 439 :input-filter sql-placeholders-filter)
426 440
427 (postgres 441 (postgres
@@ -434,11 +448,12 @@ Customizing your password will store it in your ~/.emacs file."
434 :sqli-comint-func sql-comint-postgres 448 :sqli-comint-func sql-comint-postgres
435 :list-all ("\\d+" . "\\dS+") 449 :list-all ("\\d+" . "\\dS+")
436 :list-table ("\\d+ %s" . "\\dS+ %s") 450 :list-table ("\\d+ %s" . "\\dS+ %s")
437 :prompt-regexp "^.*=[#>] " 451 :completion-object sql-postgres-completion-object
452 :prompt-regexp "^\\w*=[#>] "
438 :prompt-length 5 453 :prompt-length 5
439 :prompt-cont-regexp "^.*[-(][#>] " 454 :prompt-cont-regexp "^\\w*[-(][#>] "
440 :input-filter sql-remove-tabs-filter 455 :input-filter sql-remove-tabs-filter
441 :terminator ("\\(^\\s-*\\\\g\\|;\\)" . ";")) 456 :terminator ("\\(^\\s-*\\\\g$\\|;\\)" . "\\g"))
442 457
443 (solid 458 (solid
444 :name "Solid" 459 :name "Solid"
@@ -460,9 +475,10 @@ Customizing your password will store it in your ~/.emacs file."
460 :sqli-comint-func sql-comint-sqlite 475 :sqli-comint-func sql-comint-sqlite
461 :list-all ".tables" 476 :list-all ".tables"
462 :list-table ".schema %s" 477 :list-table ".schema %s"
478 :completion-object sql-sqlite-completion-object
463 :prompt-regexp "^sqlite> " 479 :prompt-regexp "^sqlite> "
464 :prompt-length 8 480 :prompt-length 8
465 :prompt-cont-regexp "^ ...> " 481 :prompt-cont-regexp "^ \.\.\.> "
466 :terminator ";") 482 :terminator ";")
467 483
468 (sybase 484 (sybase
@@ -474,7 +490,7 @@ Customizing your password will store it in your ~/.emacs file."
474 :sqli-comint-func sql-comint-sybase 490 :sqli-comint-func sql-comint-sybase
475 :prompt-regexp "^SQL> " 491 :prompt-regexp "^SQL> "
476 :prompt-length 5 492 :prompt-length 5
477 :syntax-alist ((?@ . "w")) 493 :syntax-alist ((?@ . "_"))
478 :terminator ("^go" . "go")) 494 :terminator ("^go" . "go"))
479 ) 495 )
480 "An alist of product specific configuration settings. 496 "An alist of product specific configuration settings.
@@ -513,10 +529,11 @@ may be any one of the following:
513 :sqli-comint-func name of a function which accepts no 529 :sqli-comint-func name of a function which accepts no
514 parameters that will use the values of 530 parameters that will use the values of
515 `sql-user', `sql-password', 531 `sql-user', `sql-password',
516 `sql-database' and `sql-server' to open a 532 `sql-database', `sql-server' and
517 comint buffer and connect to the 533 `sql-port' to open a comint buffer and
518 database. Do product specific 534 connect to the database. Do product
519 configuration of comint in this function. 535 specific configuration of comint in this
536 function.
520 537
521 :list-all Command string or function which produces 538 :list-all Command string or function which produces
522 a listing of all objects in the database. 539 a listing of all objects in the database.
@@ -535,6 +552,20 @@ may be any one of the following:
535 produces the standard list and the cdr 552 produces the standard list and the cdr
536 produces an enhanced list. 553 produces an enhanced list.
537 554
555 :completion-object A function that returns a list of
556 objects. Called with a single
557 parameter--if nil then list objects
558 accessible in the current schema, if
559 not-nil it is the name of a schema whose
560 objects should be listed.
561
562 :completion-column A function that returns a list of
563 columns. Called with a single
564 parameter--if nil then list objects
565 accessible in the current schema, if
566 not-nil it is the name of a schema whose
567 objects should be listed.
568
538 :prompt-regexp regular expression string that matches 569 :prompt-regexp regular expression string that matches
539 the prompt issued by the product 570 the prompt issued by the product
540 interpreter. 571 interpreter.
@@ -555,6 +586,9 @@ may be any one of the following:
555 filtered string. May also be a list of 586 filtered string. May also be a list of
556 such functions. 587 such functions.
557 588
589 :statement name of a variable containing a regexp that
590 matches the beginning of SQL statements.
591
558 :terminator the terminator to be sent after a 592 :terminator the terminator to be sent after a
559 `sql-send-string', `sql-send-region', 593 `sql-send-string', `sql-send-region',
560 `sql-send-paragraph' and 594 `sql-send-paragraph' and
@@ -574,7 +608,7 @@ using `sql-get-product-feature' to lookup the product specific
574settings.") 608settings.")
575 609
576(defvar sql-indirect-features 610(defvar sql-indirect-features
577 '(:font-lock :sqli-program :sqli-options :sqli-login)) 611 '(:font-lock :sqli-program :sqli-options :sqli-login :statement))
578 612
579(defcustom sql-connection-alist nil 613(defcustom sql-connection-alist nil
580 "An alist of connection parameters for interacting with a SQL 614 "An alist of connection parameters for interacting with a SQL
@@ -683,6 +717,13 @@ it automatically."
683 :version "22.2" 717 :version "22.2"
684 :group 'SQL) 718 :group 'SQL)
685 719
720(defvar sql-contains-names nil
721 "When non-nil, the current buffer contains database names.
722
723Globally should be set to nil; it will be non-nil in `sql-mode',
724`sql-interactive-mode' and list all buffers.")
725
726
686(defcustom sql-pop-to-buffer-after-send-region nil 727(defcustom sql-pop-to-buffer-after-send-region nil
687 "When non-nil, pop to the buffer SQL statements are sent to. 728 "When non-nil, pop to the buffer SQL statements are sent to.
688 729
@@ -770,6 +811,19 @@ is changed."
770 :type 'hook 811 :type 'hook
771 :group 'SQL) 812 :group 'SQL)
772 813
814;; Customization for ANSI
815
816(defcustom sql-ansi-statement-starters (regexp-opt '(
817 "create" "alter" "drop"
818 "select" "insert" "update" "delete" "merge"
819 "grant" "revoke"
820))
821 "Regexp of keywords that start SQL commands
822
823All products share this list; products should define a regexp to
824identify additional keywords in a variable defined by
825the :statement feature.")
826
773;; Customization for Oracle 827;; Customization for Oracle
774 828
775(defcustom sql-oracle-program "sqlplus" 829(defcustom sql-oracle-program "sqlplus"
@@ -795,18 +849,22 @@ You will find the file in your Orant\\bin directory."
795 :version "24.1" 849 :version "24.1"
796 :group 'SQL) 850 :group 'SQL)
797 851
852(defcustom sql-oracle-statement-starters (regexp-opt '("declare" "begin" "with"))
853 "Additional statement starting keywords in Oracle.")
854
798(defcustom sql-oracle-scan-on t 855(defcustom sql-oracle-scan-on t
799 "Non-nil if placeholders should be replaced in Oracle SQLi. 856 "Non-nil if placeholders should be replaced in Oracle SQLi.
800 857
801When non-nil, Emacs will scan text sent to sqlplus and prompt 858When non-nil, Emacs will scan text sent to sqlplus and prompt
802for replacement text for & placeholders as sqlplus does. This 859for replacement text for & placeholders as sqlplus does. This
803is needed on Windows where sqlplus output is buffered and the 860is needed on Windows where SQL*Plus output is buffered and the
804prompts are not shown until after the text is entered. 861prompts are not shown until after the text is entered.
805 862
806You will probably want to issue the following command in sqlplus 863You need to issue the following command in SQL*Plus to be safe:
807to be safe: 864
865 SET DEFINE OFF
808 866
809 SET SCAN OFF" 867In older versions of SQL*Plus, this was the SET SCAN OFF command."
810 :type 'boolean 868 :type 'boolean
811 :group 'SQL) 869 :group 'SQL)
812 870
@@ -833,7 +891,7 @@ Starts `sql-interactive-mode' after doing some setup."
833 :version "24.1" 891 :version "24.1"
834 :group 'SQL) 892 :group 'SQL)
835 893
836;; Customization for MySql 894;; Customization for MySQL
837 895
838(defcustom sql-mysql-program "mysql" 896(defcustom sql-mysql-program "mysql"
839 "Command to start mysql by TcX. 897 "Command to start mysql by TcX.
@@ -851,7 +909,7 @@ on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
851 :group 'SQL) 909 :group 'SQL)
852 910
853(defcustom sql-mysql-login-params '(user password database server) 911(defcustom sql-mysql-login-params '(user password database server)
854 "List of login parameters needed to connect to MySql." 912 "List of login parameters needed to connect to MySQL."
855 :type 'sql-login-params 913 :type 'sql-login-params
856 :version "24.1" 914 :version "24.1"
857 :group 'SQL) 915 :group 'SQL)
@@ -1085,13 +1143,13 @@ You can change `sql-prompt-length' on `sql-interactive-mode-hook'.")
1085 1143
1086Used by `sql-rename-buffer'.") 1144Used by `sql-rename-buffer'.")
1087 1145
1088(defun sql-buffer-live-p (buffer &optional product) 1146(defun sql-buffer-live-p (buffer &optional product connection)
1089 "Returns non-nil if the process associated with buffer is live. 1147 "Returns non-nil if the process associated with buffer is live.
1090 1148
1091BUFFER can be a buffer object or a buffer name. The buffer must 1149BUFFER can be a buffer object or a buffer name. The buffer must
1092be a live buffer, have an running process attached to it, be in 1150be a live buffer, have an running process attached to it, be in
1093`sql-interactive-mode', and, if PRODUCT is specified, it's 1151`sql-interactive-mode', and, if PRODUCT or CONNECTION are
1094`sql-product' must match." 1152specified, it's `sql-product' or `sql-connection' must match."
1095 1153
1096 (when buffer 1154 (when buffer
1097 (setq buffer (get-buffer buffer)) 1155 (setq buffer (get-buffer buffer))
@@ -1102,7 +1160,9 @@ be a live buffer, have an running process attached to it, be in
1102 (with-current-buffer buffer 1160 (with-current-buffer buffer
1103 (and (derived-mode-p 'sql-interactive-mode) 1161 (and (derived-mode-p 'sql-interactive-mode)
1104 (or (not product) 1162 (or (not product)
1105 (eq product sql-product))))))) 1163 (eq product sql-product))
1164 (or (not connection)
1165 (eq connection sql-connection)))))))
1106 1166
1107;; Keymap for sql-interactive-mode. 1167;; Keymap for sql-interactive-mode.
1108 1168
@@ -1136,6 +1196,8 @@ Based on `comint-mode-map'.")
1136 (define-key map (kbd "C-c C-i") 'sql-product-interactive) 1196 (define-key map (kbd "C-c C-i") 'sql-product-interactive)
1137 (define-key map (kbd "C-c C-l a") 'sql-list-all) 1197 (define-key map (kbd "C-c C-l a") 'sql-list-all)
1138 (define-key map (kbd "C-c C-l t") 'sql-list-table) 1198 (define-key map (kbd "C-c C-l t") 'sql-list-table)
1199 (define-key map [remap beginning-of-defun] 'sql-beginning-of-statement)
1200 (define-key map [remap end-of-defun] 'sql-end-of-statement)
1139 map) 1201 map)
1140 "Mode map used for `sql-mode'.") 1202 "Mode map used for `sql-mode'.")
1141 1203
@@ -1151,8 +1213,10 @@ Based on `comint-mode-map'.")
1151 ["Send Buffer" sql-send-buffer (sql-buffer-live-p sql-buffer)] 1213 ["Send Buffer" sql-send-buffer (sql-buffer-live-p sql-buffer)]
1152 ["Send String" sql-send-string (sql-buffer-live-p sql-buffer)] 1214 ["Send String" sql-send-string (sql-buffer-live-p sql-buffer)]
1153 "--" 1215 "--"
1154 ["List all objects" sql-list-all (sql-buffer-live-p sql-buffer)] 1216 ["List all objects" sql-list-all (and (sql-buffer-live-p sql-buffer)
1155 ["List table details" sql-list-table (sql-buffer-live-p sql-buffer)] 1217 (sql-get-product-feature sql-product :list-all))]
1218 ["List table details" sql-list-table (and (sql-buffer-live-p sql-buffer)
1219 (sql-get-product-feature sql-product :list-table))]
1156 "--" 1220 "--"
1157 ["Start SQLi session" sql-product-interactive 1221 ["Start SQLi session" sql-product-interactive
1158 :visible (not sql-connection-alist) 1222 :visible (not sql-connection-alist)
@@ -1194,8 +1258,8 @@ Based on `comint-mode-map'.")
1194 ["Rename Buffer" sql-rename-buffer t] 1258 ["Rename Buffer" sql-rename-buffer t]
1195 ["Save Connection" sql-save-connection (not sql-connection)] 1259 ["Save Connection" sql-save-connection (not sql-connection)]
1196 "--" 1260 "--"
1197 ["List all objects" sql-list-all t] 1261 ["List all objects" sql-list-all (sql-get-product-feature sql-product :list-all)]
1198 ["List table details" sql-list-table t])) 1262 ["List table details" sql-list-table (sql-get-product-feature sql-product :list-table)]))
1199 1263
1200;; Abbreviations -- if you want more of them, define them in your 1264;; Abbreviations -- if you want more of them, define them in your
1201;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too. 1265;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too.
@@ -1238,8 +1302,9 @@ Based on `comint-mode-map'.")
1238 (modify-syntax-entry ?' "\"" table) 1302 (modify-syntax-entry ?' "\"" table)
1239 ;; double quotes (") don't delimit strings 1303 ;; double quotes (") don't delimit strings
1240 (modify-syntax-entry ?\" "." table) 1304 (modify-syntax-entry ?\" "." table)
1241 ;; backslash is no escape character 1305 ;; Make these all punctuation
1242 (modify-syntax-entry ?\\ "." table) 1306 (mapc (lambda (c) (modify-syntax-entry c "." table))
1307 (string-to-list "!#$%&+,.:;<=>?@\\|"))
1243 table) 1308 table)
1244 "Syntax table used in `sql-mode' and `sql-interactive-mode'.") 1309 "Syntax table used in `sql-mode' and `sql-interactive-mode'.")
1245 1310
@@ -1298,20 +1363,45 @@ statement. The format of variable should be a valid
1298 1363
1299 ;; Remove keywords that are defined in ANSI 1364 ;; Remove keywords that are defined in ANSI
1300 (setq kwd keywords) 1365 (setq kwd keywords)
1301 (dolist (k keywords) 1366 ;; (dolist (k keywords)
1302 (catch 'next 1367 ;; (catch 'next
1303 (dolist (a sql-mode-ansi-font-lock-keywords) 1368 ;; (dolist (a sql-mode-ansi-font-lock-keywords)
1304 (when (and (eq face (cdr a)) 1369 ;; (when (and (eq face (cdr a))
1305 (eq (string-match (car a) k 0) 0) 1370 ;; (eq (string-match (car a) k 0) 0)
1306 (eq (match-end 0) (length k))) 1371 ;; (eq (match-end 0) (length k)))
1307 (setq kwd (delq k kwd)) 1372 ;; (setq kwd (delq k kwd))
1308 (throw 'next nil))))) 1373 ;; (throw 'next nil)))))
1309 1374
1310 ;; Create a properly formed font-lock-keywords item 1375 ;; Create a properly formed font-lock-keywords item
1311 (cons (concat (car bdy) 1376 (cons (concat (car bdy)
1312 (regexp-opt kwd t) 1377 (regexp-opt kwd t)
1313 (cdr bdy)) 1378 (cdr bdy))
1314 face)))) 1379 face)))
1380
1381 (defun sql-regexp-abbrev (keyword)
1382 (let ((brk (string-match "[~]" keyword))
1383 (len (length keyword))
1384 (sep "\\(?:")
1385 re i)
1386 (if (not brk)
1387 keyword
1388 (setq re (substring keyword 0 brk)
1389 i (+ 2 brk)
1390 brk (1+ brk))
1391 (while (<= i len)
1392 (setq re (concat re sep (substring keyword brk i))
1393 sep "\\|"
1394 i (1+ i)))
1395 (concat re "\\)?"))))
1396
1397 (defun sql-regexp-abbrev-list (&rest keyw-list)
1398 (let ((re nil)
1399 (sep "\\<\\(?:"))
1400 (while keyw-list
1401 (setq re (concat re sep (sql-regexp-abbrev (car keyw-list)))
1402 sep "\\|"
1403 keyw-list (cdr keyw-list)))
1404 (concat re "\\)\\>"))))
1315 1405
1316(eval-when-compile 1406(eval-when-compile
1317 (setq sql-mode-ansi-font-lock-keywords 1407 (setq sql-mode-ansi-font-lock-keywords
@@ -1346,6 +1436,7 @@ statement. The format of variable should be a valid
1346"user_defined_type_catalog" "user_defined_type_name" 1436"user_defined_type_catalog" "user_defined_type_name"
1347"user_defined_type_schema" 1437"user_defined_type_schema"
1348) 1438)
1439
1349 ;; ANSI Reserved keywords 1440 ;; ANSI Reserved keywords
1350 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil 1441 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
1351"absolute" "action" "add" "admin" "after" "aggregate" "alias" "all" 1442"absolute" "action" "add" "admin" "after" "aggregate" "alias" "all"
@@ -1395,6 +1486,7 @@ statement. The format of variable should be a valid
1395"substring" "sum" "system_user" "translate" "treat" "trim" "upper" 1486"substring" "sum" "system_user" "translate" "treat" "trim" "upper"
1396"user" 1487"user"
1397) 1488)
1489
1398 ;; ANSI Data Types 1490 ;; ANSI Data Types
1399 (sql-font-lock-keywords-builder 'font-lock-type-face nil 1491 (sql-font-lock-keywords-builder 'font-lock-type-face nil
1400"array" "binary" "bit" "blob" "boolean" "char" "character" "clob" 1492"array" "binary" "bit" "blob" "boolean" "char" "character" "clob"
@@ -1414,86 +1506,142 @@ function `regexp-opt'. Therefore, take a look at the source before
1414you define your own `sql-mode-ansi-font-lock-keywords'. You may want 1506you define your own `sql-mode-ansi-font-lock-keywords'. You may want
1415to add functions and PL/SQL keywords.") 1507to add functions and PL/SQL keywords.")
1416 1508
1509(defun sql-oracle-show-reserved-words ()
1510 ;; This function is for use by the maintainer of SQL.EL only.
1511 (interactive)
1512 (if (or (and (not (derived-mode-p 'sql-mode))
1513 (not (derived-mode-p 'sql-interactive-mode)))
1514 (not sql-buffer)
1515 (not (eq sql-product 'oracle)))
1516 (error "Not an Oracle buffer")
1517
1518 (let ((b "*RESERVED WORDS*"))
1519 (sql-execute sql-buffer b
1520 (concat "SELECT "
1521 " keyword "
1522 ", reserved AS \"Res\" "
1523 ", res_type AS \"Type\" "
1524 ", res_attr AS \"Attr\" "
1525 ", res_semi AS \"Semi\" "
1526 ", duplicate AS \"Dup\" "
1527 "FROM V$RESERVED_WORDS "
1528 "WHERE length > 1 "
1529 "AND SUBSTR(keyword, 1, 1) BETWEEN 'A' AND 'Z' "
1530 "ORDER BY 2 DESC, 3 DESC, 4 DESC, 5 DESC, 6 DESC, 1;")
1531 nil nil)
1532 (with-current-buffer b
1533 (set (make-local-variable 'sql-product) 'oracle)
1534 (sql-product-font-lock t nil)
1535 (font-lock-mode +1)))))
1536
1417(defvar sql-mode-oracle-font-lock-keywords 1537(defvar sql-mode-oracle-font-lock-keywords
1418 (eval-when-compile 1538 (eval-when-compile
1419 (list 1539 (list
1420 ;; Oracle SQL*Plus Commands 1540 ;; Oracle SQL*Plus Commands
1421 (cons 1541 ;; Only recognized in they start in column 1 and the
1422 (concat 1542 ;; abbreviation is followed by a space or the end of line.
1423 "^\\s-*\\(?:\\(?:" (regexp-opt '(
1424"@" "@@" "accept" "append" "archive" "attribute" "break"
1425"btitle" "change" "clear" "column" "connect" "copy" "define"
1426"del" "describe" "disconnect" "edit" "execute" "exit" "get" "help"
1427"host" "input" "list" "password" "pause" "print" "prompt" "recover"
1428"remark" "repfooter" "repheader" "run" "save" "show" "shutdown"
1429"spool" "start" "startup" "store" "timing" "ttitle" "undefine"
1430"variable" "whenever"
1431) t)
1432 1543
1433 "\\)\\|" 1544 "\\|"
1434 "\\(?:compute\\s-+\\(?:avg\\|cou\\|min\\|max\\|num\\|sum\\|std\\|var\\)\\)\\|" 1545 (list (concat "^" (sql-regexp-abbrev "rem~ark") "\\(?:\\s-.*\\)?$")
1435 "\\(?:set\\s-+\\(" 1546 0 'font-lock-comment-face t)
1436 1547
1437 (regexp-opt 1548 (list
1438 '("appi" "appinfo" "array" "arraysize" "auto" "autocommit" 1549 (concat
1439 "autop" "autoprint" "autorecovery" "autot" "autotrace" "blo" 1550 "^\\(?:"
1440 "blockterminator" "buffer" "closecursor" "cmds" "cmdsep" 1551 (sql-regexp-abbrev-list
1441 "colsep" "com" "compatibility" "con" "concat" "constraint" 1552 "[@]\\{1,2\\}" "acc~ept" "a~ppend" "archive" "attribute"
1442 "constraints" "copyc" "copycommit" "copytypecheck" "database" 1553 "bre~ak" "bti~tle" "c~hange" "cl~ear" "col~umn" "conn~ect"
1443 "def" "define" "document" "echo" "editf" "editfile" "emb" 1554 "copy" "def~ine" "del" "desc~ribe" "disc~onnect" "ed~it"
1444 "embedded" "esc" "escape" "feed" "feedback" "flagger" "flu" 1555 "exec~ute" "exit" "get" "help" "ho~st" "[$]" "i~nput" "l~ist"
1445 "flush" "hea" "heading" "heads" "headsep" "instance" "lin" 1556 "passw~ord" "pau~se" "pri~nt" "pro~mpt" "quit" "recover"
1446 "linesize" "lobof" "loboffset" "logsource" "long" "longc" 1557 "repf~ooter" "reph~eader" "r~un" "sav~e" "sho~w" "shutdown"
1447 "longchunksize" "maxdata" "newp" "newpage" "null" "num" 1558 "spo~ol" "sta~rt" "startup" "store" "tim~ing" "tti~tle"
1448 "numf" "numformat" "numwidth" "pages" "pagesize" "pau" 1559 "undef~ine" "var~iable" "whenever")
1449 "pause" "recsep" "recsepchar" "role" "scan" "serveroutput" 1560 "\\|"
1450 "shift" "shiftinout" "show" "showmode" "space" "sqlbl" 1561 (concat "\\(?:"
1451 "sqlblanklines" "sqlc" "sqlcase" "sqlco" "sqlcontinue" "sqln" 1562 (sql-regexp-abbrev "comp~ute")
1452 "sqlnumber" "sqlp" "sqlpluscompat" "sqlpluscompatibility" 1563 "\\s-+"
1453 "sqlpre" "sqlprefix" "sqlprompt" "sqlt" "sqlterminator" 1564 (sql-regexp-abbrev-list
1454 "statement_id" "suf" "suffix" "tab" "term" "termout" "ti" 1565 "avg" "cou~nt" "min~imum" "max~imum" "num~ber" "sum"
1455 "time" "timi" "timing" "transaction" "trim" "trimout" "trims" 1566 "std" "var~iance")
1456 "trimspool" "truncate" "und" "underline" "ver" "verify" "wra" 1567 "\\)")
1457 "wrap")) "\\)\\)" 1568 "\\|"
1458 1569 (concat "\\(?:set\\s-+"
1459 "\\)\\b.*" 1570 (sql-regexp-abbrev-list
1460 ) 1571 "appi~nfo" "array~size" "auto~commit" "autop~rint"
1461 'font-lock-doc-face) 1572 "autorecovery" "autot~race" "blo~ckterminator"
1462 '("^\\s-*rem\\(?:ark\\)?\\>.*" . font-lock-comment-face) 1573 "cmds~ep" "colsep" "com~patibility" "con~cat"
1574 "copyc~ommit" "copytypecheck" "def~ine" "describe"
1575 "echo" "editf~ile" "emb~edded" "esc~ape" "feed~back"
1576 "flagger" "flu~sh" "hea~ding" "heads~ep" "instance"
1577 "lin~esize" "lobof~fset" "long" "longc~hunksize"
1578 "mark~up" "newp~age" "null" "numf~ormat" "num~width"
1579 "pages~ize" "pau~se" "recsep" "recsepchar"
1580 "scan" "serverout~put" "shift~inout" "show~mode"
1581 "sqlbl~anklines" "sqlc~ase" "sqlco~ntinue"
1582 "sqln~umber" "sqlpluscompat~ibility" "sqlpre~fix"
1583 "sqlp~rompt" "sqlt~erminator" "suf~fix" "tab"
1584 "term~out" "ti~me" "timi~ng" "trim~out" "trims~pool"
1585 "und~erline" "ver~ify" "wra~p")
1586 "\\)")
1587
1588 "\\)\\(?:\\s-.*\\)?\\(?:[-]\n.*\\)*$")
1589 0 'font-lock-doc-face t)
1463 1590
1464 ;; Oracle Functions 1591 ;; Oracle Functions
1465 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil 1592 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
1466"abs" "acos" "add_months" "ascii" "asciistr" "asin" "atan" "atan2" 1593"abs" "acos" "add_months" "appendchildxml" "ascii" "asciistr" "asin"
1467"avg" "bfilename" "bin_to_num" "bitand" "cast" "ceil" "chartorowid" 1594"atan" "atan2" "avg" "bfilename" "bin_to_num" "bitand" "cardinality"
1468"chr" "coalesce" "compose" "concat" "convert" "corr" "cos" "cosh" 1595"cast" "ceil" "chartorowid" "chr" "cluster_id" "cluster_probability"
1469"count" "covar_pop" "covar_samp" "cume_dist" "current_date" 1596"cluster_set" "coalesce" "collect" "compose" "concat" "convert" "corr"
1470"current_timestamp" "current_user" "dbtimezone" "decode" "decompose" 1597"corr_k" "corr_s" "cos" "cosh" "count" "covar_pop" "covar_samp"
1471"dense_rank" "depth" "deref" "dump" "empty_clob" "existsnode" "exp" 1598"cube_table" "cume_dist" "currrent_date" "currrent_timestamp" "cv"
1472"extract" "extractvalue" "first" "first_value" "floor" "following" 1599"dataobj_to_partition" "dbtimezone" "decode" "decompose" "deletexml"
1473"from_tz" "greatest" "group_id" "grouping_id" "hextoraw" "initcap" 1600"dense_rank" "depth" "deref" "dump" "empty_blob" "empty_clob"
1474"instr" "lag" "last" "last_day" "last_value" "lead" "least" "length" 1601"existsnode" "exp" "extract" "extractvalue" "feature_id" "feature_set"
1475"ln" "localtimestamp" "lower" "lpad" "ltrim" "make_ref" "max" "min" 1602"feature_value" "first" "first_value" "floor" "from_tz" "greatest"
1476"mod" "months_between" "new_time" "next_day" "nls_charset_decl_len" 1603"grouping" "grouping_id" "group_id" "hextoraw" "initcap"
1604"insertchildxml" "insertchildxmlafter" "insertchildxmlbefore"
1605"insertxmlafter" "insertxmlbefore" "instr" "instr2" "instr4" "instrb"
1606"instrc" "iteration_number" "lag" "last" "last_day" "last_value"
1607"lead" "least" "length" "length2" "length4" "lengthb" "lengthc"
1608"listagg" "ln" "lnnvl" "localtimestamp" "log" "lower" "lpad" "ltrim"
1609"make_ref" "max" "median" "min" "mod" "months_between" "nanvl" "nchr"
1610"new_time" "next_day" "nlssort" "nls_charset_decl_len"
1477"nls_charset_id" "nls_charset_name" "nls_initcap" "nls_lower" 1611"nls_charset_id" "nls_charset_name" "nls_initcap" "nls_lower"
1478"nls_upper" "nlssort" "ntile" "nullif" "numtodsinterval" 1612"nls_upper" "nth_value" "ntile" "nullif" "numtodsinterval"
1479"numtoyminterval" "nvl" "nvl2" "over" "path" "percent_rank" 1613"numtoyminterval" "nvl" "nvl2" "ora_dst_affected" "ora_dst_convert"
1480"percentile_cont" "percentile_disc" "power" "preceding" "rank" 1614"ora_dst_error" "ora_hash" "path" "percentile_cont" "percentile_disc"
1481"ratio_to_report" "rawtohex" "rawtonhex" "reftohex" "regr_" 1615"percent_rank" "power" "powermultiset" "powermultiset_by_cardinality"
1482"regr_avgx" "regr_avgy" "regr_count" "regr_intercept" "regr_r2" 1616"prediction" "prediction_bounds" "prediction_cost"
1483"regr_slope" "regr_sxx" "regr_sxy" "regr_syy" "replace" "round" 1617"prediction_details" "prediction_probability" "prediction_set"
1484"row_number" "rowidtochar" "rowidtonchar" "rpad" "rtrim" 1618"presentnnv" "presentv" "previous" "rank" "ratio_to_report" "rawtohex"
1485"sessiontimezone" "sign" "sin" "sinh" "soundex" "sqrt" "stddev" 1619"rawtonhex" "ref" "reftohex" "regexp_count" "regexp_instr"
1486"stddev_pop" "stddev_samp" "substr" "sum" "sys_connect_by_path" 1620"regexp_replace" "regexp_substr" "regr_avgx" "regr_avgy" "regr_count"
1487"sys_context" "sys_dburigen" "sys_extract_utc" "sys_guid" "sys_typeid" 1621"regr_intercept" "regr_r2" "regr_slope" "regr_sxx" "regr_sxy"
1488"sys_xmlagg" "sys_xmlgen" "sysdate" "systimestamp" "tan" "tanh" 1622"regr_syy" "remainder" "replace" "round" "rowidtochar" "rowidtonchar"
1623"row_number" "rpad" "rtrim" "scn_to_timestamp" "sessiontimezone" "set"
1624"sign" "sin" "sinh" "soundex" "sqrt" "stats_binomial_test"
1625"stats_crosstab" "stats_f_test" "stats_ks_test" "stats_mode"
1626"stats_mw_test" "stats_one_way_anova" "stats_t_test_indep"
1627"stats_t_test_indepu" "stats_t_test_one" "stats_t_test_paired"
1628"stats_wsr_test" "stddev" "stddev_pop" "stddev_samp" "substr"
1629"substr2" "substr4" "substrb" "substrc" "sum" "sysdate" "systimestamp"
1630"sys_connect_by_path" "sys_context" "sys_dburigen" "sys_extract_utc"
1631"sys_guid" "sys_typeid" "sys_xmlagg" "sys_xmlgen" "tan" "tanh"
1632"timestamp_to_scn" "to_binary_double" "to_binary_float" "to_blob"
1489"to_char" "to_clob" "to_date" "to_dsinterval" "to_lob" "to_multi_byte" 1633"to_char" "to_clob" "to_date" "to_dsinterval" "to_lob" "to_multi_byte"
1490"to_nchar" "to_nclob" "to_number" "to_single_byte" "to_timestamp" 1634"to_nchar" "to_nclob" "to_number" "to_single_byte" "to_timestamp"
1491"to_timestamp_tz" "to_yminterval" "translate" "treat" "trim" "trunc" 1635"to_timestamp_tz" "to_yminterval" "translate" "treat" "trim" "trunc"
1492"tz_offset" "uid" "unbounded" "unistr" "updatexml" "upper" "user" 1636"tz_offset" "uid" "unistr" "updatexml" "upper" "user" "userenv"
1493"userenv" "var_pop" "var_samp" "variance" "vsize" "width_bucket" "xml" 1637"value" "variance" "var_pop" "var_samp" "vsize" "width_bucket"
1494"xmlagg" "xmlattribute" "xmlcolattval" "xmlconcat" "xmlelement" 1638"xmlagg" "xmlcast" "xmlcdata" "xmlcolattval" "xmlcomment" "xmlconcat"
1495"xmlforest" "xmlsequence" "xmltransform" 1639"xmldiff" "xmlelement" "xmlexists" "xmlforest" "xmlisvalid" "xmlparse"
1640"xmlpatch" "xmlpi" "xmlquery" "xmlroot" "xmlsequence" "xmlserialize"
1641"xmltable" "xmltransform"
1496) 1642)
1643
1644 ;; See the table V$RESERVED_WORDS
1497 ;; Oracle Keywords 1645 ;; Oracle Keywords
1498 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil 1646 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
1499"abort" "access" "accessed" "account" "activate" "add" "admin" 1647"abort" "access" "accessed" "account" "activate" "add" "admin"
@@ -1582,52 +1730,120 @@ to add functions and PL/SQL keywords.")
1582"varray" "version" "view" "wait" "when" "whenever" "where" "with" 1730"varray" "version" "view" "wait" "when" "whenever" "where" "with"
1583"without" "wnds" "wnps" "work" "write" "xmldata" "xmlschema" "xmltype" 1731"without" "wnds" "wnps" "work" "write" "xmldata" "xmlschema" "xmltype"
1584) 1732)
1733
1585 ;; Oracle Data Types 1734 ;; Oracle Data Types
1586 (sql-font-lock-keywords-builder 'font-lock-type-face nil 1735 (sql-font-lock-keywords-builder 'font-lock-type-face nil
1587"bfile" "blob" "byte" "char" "character" "clob" "date" "dec" "decimal" 1736"bfile" "binary_double" "binary_float" "blob" "byte" "char" "charbyte"
1588"double" "float" "int" "integer" "interval" "long" "national" "nchar" 1737"clob" "date" "day" "float" "interval" "local" "long" "longraw"
1589"nclob" "number" "numeric" "nvarchar2" "precision" "raw" "real" 1738"minute" "month" "nchar" "nclob" "number" "nvarchar2" "raw" "rowid" "second"
1590"rowid" "second" "smallint" "time" "timestamp" "urowid" "varchar" 1739"time" "timestamp" "urowid" "varchar2" "with" "year" "zone"
1591"varchar2" "varying" "year" "zone"
1592) 1740)
1593 1741
1594 ;; Oracle PL/SQL Attributes 1742 ;; Oracle PL/SQL Attributes
1595 (sql-font-lock-keywords-builder 'font-lock-builtin-face '("" . "\\b") 1743 (sql-font-lock-keywords-builder 'font-lock-builtin-face '("%" . "\\b")
1596"%bulk_rowcount" "%found" "%isopen" "%notfound" "%rowcount" "%rowtype" 1744"bulk_exceptions" "bulk_rowcount" "found" "isopen" "notfound"
1597"%type" 1745"rowcount" "rowtype" "type"
1598) 1746)
1599 1747
1600 ;; Oracle PL/SQL Functions 1748 ;; Oracle PL/SQL Functions
1601 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil 1749 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
1602"extend" "prior" 1750"delete" "trim" "extend" "exists" "first" "last" "count" "limit"
1751"prior" "next"
1752)
1753
1754 ;; Oracle PL/SQL Reserved words
1755 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
1756"all" "alter" "and" "any" "as" "asc" "at" "begin" "between" "by"
1757"case" "check" "clusters" "cluster" "colauth" "columns" "compress"
1758"connect" "crash" "create" "cursor" "declare" "default" "desc"
1759"distinct" "drop" "else" "end" "exception" "exclusive" "fetch" "for"
1760"from" "function" "goto" "grant" "group" "having" "identified" "if"
1761"in" "index" "indexes" "insert" "intersect" "into" "is" "like" "lock"
1762"minus" "mode" "nocompress" "not" "nowait" "null" "of" "on" "option"
1763"or" "order" "overlaps" "procedure" "public" "resource" "revoke"
1764"select" "share" "size" "sql" "start" "subtype" "tabauth" "table"
1765"then" "to" "type" "union" "unique" "update" "values" "view" "views"
1766"when" "where" "with"
1767
1768"true" "false"
1769"raise_application_error"
1603) 1770)
1604 1771
1605 ;; Oracle PL/SQL Keywords 1772 ;; Oracle PL/SQL Keywords
1606 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil 1773 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
1607"autonomous_transaction" "bulk" "char_base" "collect" "constant" 1774"a" "add" "agent" "aggregate" "array" "attribute" "authid" "avg"
1608"cursor" "declare" "do" "elsif" "exception_init" "execute" "exit" 1775"bfile_base" "binary" "blob_base" "block" "body" "both" "bound" "bulk"
1609"extends" "false" "fetch" "forall" "goto" "hour" "if" "interface" 1776"byte" "c" "call" "calling" "cascade" "char" "char_base" "character"
1610"loop" "minute" "number_base" "ocirowid" "opaque" "others" "rowtype" 1777"charset" "charsetform" "charsetid" "clob_base" "close" "collect"
1611"separate" "serially_reusable" "sql" "sqlcode" "sqlerrm" "subtype" 1778"comment" "commit" "committed" "compiled" "constant" "constructor"
1612"the" "timezone_abbr" "timezone_hour" "timezone_minute" 1779"context" "continue" "convert" "count" "current" "customdatum"
1613"timezone_region" "true" "varrying" "while" 1780"dangling" "data" "date" "date_base" "day" "define" "delete"
1781"deterministic" "double" "duration" "element" "elsif" "empty" "escape"
1782"except" "exceptions" "execute" "exists" "exit" "external" "final"
1783"fixed" "float" "forall" "force" "general" "hash" "heap" "hidden"
1784"hour" "immediate" "including" "indicator" "indices" "infinite"
1785"instantiable" "int" "interface" "interval" "invalidate" "isolation"
1786"java" "language" "large" "leading" "length" "level" "library" "like2"
1787"like4" "likec" "limit" "limited" "local" "long" "loop" "map" "max"
1788"maxlen" "member" "merge" "min" "minute" "mod" "modify" "month"
1789"multiset" "name" "nan" "national" "native" "nchar" "new" "nocopy"
1790"number_base" "object" "ocicoll" "ocidate" "ocidatetime" "ociduration"
1791"ociinterval" "ociloblocator" "ocinumber" "ociraw" "ociref"
1792"ocirefcursor" "ocirowid" "ocistring" "ocitype" "old" "only" "opaque"
1793"open" "operator" "oracle" "oradata" "organization" "orlany" "orlvary"
1794"others" "out" "overriding" "package" "parallel_enable" "parameter"
1795"parameters" "parent" "partition" "pascal" "pipe" "pipelined" "pragma"
1796"precision" "prior" "private" "raise" "range" "raw" "read" "record"
1797"ref" "reference" "relies_on" "rem" "remainder" "rename" "result"
1798"result_cache" "return" "returning" "reverse" "rollback" "row"
1799"sample" "save" "savepoint" "sb1" "sb2" "sb4" "second" "segment"
1800"self" "separate" "sequence" "serializable" "set" "short" "size_t"
1801"some" "sparse" "sqlcode" "sqldata" "sqlname" "sqlstate" "standard"
1802"static" "stddev" "stored" "string" "struct" "style" "submultiset"
1803"subpartition" "substitutable" "sum" "synonym" "tdo" "the" "time"
1804"timestamp" "timezone_abbr" "timezone_hour" "timezone_minute"
1805"timezone_region" "trailing" "transaction" "transactional" "trusted"
1806"ub1" "ub2" "ub4" "under" "unsigned" "untrusted" "use" "using"
1807"valist" "value" "variable" "variance" "varray" "varying" "void"
1808"while" "work" "wrapped" "write" "year" "zone"
1809;; Pragma
1810"autonomous_transaction" "exception_init" "inline"
1811"restrict_references" "serially_reusable"
1614) 1812)
1615 1813
1616 ;; Oracle PL/SQL Data Types 1814 ;; Oracle PL/SQL Data Types
1617 (sql-font-lock-keywords-builder 'font-lock-type-face nil 1815 (sql-font-lock-keywords-builder 'font-lock-type-face nil
1618"binary_integer" "boolean" "naturaln" "pls_integer" "positive" 1816"\"BINARY LARGE OBJECT\"" "\"CHAR LARGE OBJECT\"" "\"CHAR VARYING\""
1619"positiven" "record" "signtype" "string" 1817"\"CHARACTER LARGE OBJECT\"" "\"CHARACTER VARYING\""
1818"\"DOUBLE PRECISION\"" "\"INTERVAL DAY TO SECOND\""
1819"\"INTERVAL YEAR TO MONTH\"" "\"LONG RAW\"" "\"NATIONAL CHAR\""
1820"\"NATIONAL CHARACTER LARGE OBJECT\"" "\"NATIONAL CHARACTER\""
1821"\"NCHAR LARGE OBJECT\"" "\"NCHAR\"" "\"NCLOB\"" "\"NVARCHAR2\""
1822"\"TIME WITH TIME ZONE\"" "\"TIMESTAMP WITH LOCAL TIME ZONE\""
1823"\"TIMESTAMP WITH TIME ZONE\""
1824"bfile" "bfile_base" "binary_double" "binary_float" "binary_integer"
1825"blob" "blob_base" "boolean" "char" "character" "char_base" "clob"
1826"clob_base" "cursor" "date" "day" "dec" "decimal"
1827"dsinterval_unconstrained" "float" "int" "integer" "interval" "local"
1828"long" "mlslabel" "month" "natural" "naturaln" "nchar_cs" "number"
1829"number_base" "numeric" "pls_integer" "positive" "positiven" "raw"
1830"real" "ref" "rowid" "second" "signtype" "simple_double"
1831"simple_float" "simple_integer" "smallint" "string" "time" "timestamp"
1832"timestamp_ltz_unconstrained" "timestamp_tz_unconstrained"
1833"timestamp_unconstrained" "time_tz_unconstrained" "time_unconstrained"
1834"to" "urowid" "varchar" "varchar2" "with" "year"
1835"yminterval_unconstrained" "zone"
1620) 1836)
1621 1837
1622 ;; Oracle PL/SQL Exceptions 1838 ;; Oracle PL/SQL Exceptions
1623 (sql-font-lock-keywords-builder 'font-lock-warning-face nil 1839 (sql-font-lock-keywords-builder 'font-lock-warning-face nil
1624"access_into_null" "case_not_found" "collection_is_null" 1840"access_into_null" "case_not_found" "collection_is_null"
1625"cursor_already_open" "dup_val_on_index" "invalid_cursor" 1841"cursor_already_open" "dup_val_on_index" "invalid_cursor"
1626"invalid_number" "login_denied" "no_data_found" "not_logged_on" 1842"invalid_number" "login_denied" "no_data_found" "no_data_needed"
1627"program_error" "rowtype_mismatch" "self_is_null" "storage_error" 1843"not_logged_on" "program_error" "rowtype_mismatch" "self_is_null"
1628"subscript_beyond_count" "subscript_outside_limit" "sys_invalid_rowid" 1844"storage_error" "subscript_beyond_count" "subscript_outside_limit"
1629"timeout_on_resource" "too_many_rows" "value_error" "zero_divide" 1845"sys_invalid_rowid" "timeout_on_resource" "too_many_rows"
1630"exception" "notfound" 1846"value_error" "zero_divide"
1631))) 1847)))
1632 1848
1633 "Oracle SQL keywords used by font-lock. 1849 "Oracle SQL keywords used by font-lock.
@@ -2296,10 +2512,7 @@ also be configured."
2296 2512
2297 (let 2513 (let
2298 ;; Get the product-specific syntax-alist. 2514 ;; Get the product-specific syntax-alist.
2299 ((syntax-alist 2515 ((syntax-alist (sql-product-font-lock-syntax-alist)))
2300 (append
2301 (sql-get-product-feature sql-product :syntax-alist)
2302 '((?_ . "w") (?. . "w")))))
2303 2516
2304 ;; Get the product-specific keywords. 2517 ;; Get the product-specific keywords.
2305 (set (make-local-variable 'sql-mode-font-lock-keywords) 2518 (set (make-local-variable 'sql-mode-font-lock-keywords)
@@ -2388,9 +2601,30 @@ adds a fontification pattern to fontify identifiers ending in
2388 2601
2389;;; Functions to switch highlighting 2602;;; Functions to switch highlighting
2390 2603
2604(defun sql-product-syntax-table ()
2605 (let ((table (copy-syntax-table sql-mode-syntax-table)))
2606 (mapc (lambda (entry)
2607 (modify-syntax-entry (car entry) (cdr entry) table))
2608 (sql-get-product-feature sql-product :syntax-alist))
2609 table))
2610
2611(defun sql-product-font-lock-syntax-alist ()
2612 (append
2613 ;; Change all symbol character to word characters
2614 (mapcar
2615 (lambda (entry) (if (string= (substring (cdr entry) 0 1) "_")
2616 (cons (car entry)
2617 (concat "w" (substring (cdr entry) 1)))
2618 entry))
2619 (sql-get-product-feature sql-product :syntax-alist))
2620 '((?_ . "w"))))
2621
2391(defun sql-highlight-product () 2622(defun sql-highlight-product ()
2392 "Turn on the font highlighting for the SQL product selected." 2623 "Turn on the font highlighting for the SQL product selected."
2393 (when (derived-mode-p 'sql-mode) 2624 (when (derived-mode-p 'sql-mode)
2625 ;; Enhance the syntax table for the product
2626 (set-syntax-table (sql-product-syntax-table))
2627
2394 ;; Setup font-lock 2628 ;; Setup font-lock
2395 (sql-product-font-lock nil t) 2629 (sql-product-font-lock nil t)
2396 2630
@@ -2418,11 +2652,77 @@ adds a fontification pattern to fontify identifiers ending in
2418 ;; comint-line-beginning-position is defined in Emacs 21 2652 ;; comint-line-beginning-position is defined in Emacs 21
2419 (defun comint-line-beginning-position () 2653 (defun comint-line-beginning-position ()
2420 "Return the buffer position of the beginning of the line, after any prompt. 2654 "Return the buffer position of the beginning of the line, after any prompt.
2421The prompt is assumed to be any text at the beginning of the line matching 2655The prompt is assumed to be any text at the beginning of the line
2422the regular expression `comint-prompt-regexp', a buffer local variable." 2656matching the regular expression `comint-prompt-regexp', a buffer
2657local variable."
2423 (save-excursion (comint-bol nil) (point)))) 2658 (save-excursion (comint-bol nil) (point))))
2424 2659
2425 2660;;; Motion Functions
2661
2662(defun sql-statement-regexp (prod)
2663 (let* ((ansi-stmt (sql-get-product-feature 'ansi :statement))
2664 (prod-stmt (sql-get-product-feature prod :statement)))
2665 (concat "^\\<"
2666 (if prod-stmt
2667 ansi-stmt
2668 (concat "\\(" ansi-stmt "\\|" prod-stmt "\\)"))
2669 "\\>")))
2670
2671(defun sql-beginning-of-statement (arg)
2672 "Moves the cursor to the beginning of the current SQL statement."
2673 (interactive "p")
2674
2675 (let ((here (point))
2676 (regexp (sql-statement-regexp sql-product))
2677 last next)
2678
2679 ;; Go to the end of the statement before the start we desire
2680 (setq last (or (sql-end-of-statement (- arg))
2681 (point-min)))
2682 ;; And find the end after that
2683 (setq next (or (sql-end-of-statement 1)
2684 (point-max)))
2685
2686 ;; Our start must be between them
2687 (goto-char last)
2688 ;; Find an beginning-of-stmt that's not in a comment
2689 (while (and (re-search-forward regexp next t 1)
2690 (nth 7 (syntax-ppss)))
2691 (goto-char (match-end 0)))
2692 (goto-char
2693 (if (match-data)
2694 (match-beginning 0)
2695 last))
2696 (beginning-of-line)
2697 ;; If we didn't move, try again
2698 (when (= here (point))
2699 (sql-beginning-of-statement (* 2 (sql-signum arg))))))
2700
2701(defun sql-end-of-statement (arg)
2702 "Moves the cursor to the end of the current SQL statement."
2703 (interactive "p")
2704 (let ((term (sql-get-product-feature sql-product :terminator))
2705 (re-search (if (> 0 arg) 're-search-backward 're-search-forward))
2706 (here (point))
2707 (n 0))
2708 (when (consp term)
2709 (setq term (car term)))
2710 ;; Iterate until we've moved the desired number of stmt ends
2711 (while (not (= (sql-signum arg) 0))
2712 ;; if we're looking at the terminator, jump by 2
2713 (if (or (and (> 0 arg) (looking-back term))
2714 (and (< 0 arg) (looking-at term)))
2715 (setq n 2)
2716 (setq n 1))
2717 ;; If we found another end-of-stmt
2718 (if (not (apply re-search term nil t n nil))
2719 (setq arg 0)
2720 ;; count it if we're not in a comment
2721 (unless (nth 7 (syntax-ppss))
2722 (setq arg (- arg (sql-signum arg))))))
2723 (goto-char (if (match-data)
2724 (match-end 0)
2725 here))))
2426 2726
2427;;; Small functions 2727;;; Small functions
2428 2728
@@ -2456,7 +2756,7 @@ the regular expression `comint-prompt-regexp', a buffer local variable."
2456(defun sql-help-list-products (indent freep) 2756(defun sql-help-list-products (indent freep)
2457 "Generate listing of products available for use under SQLi. 2757 "Generate listing of products available for use under SQLi.
2458 2758
2459List products with :free-softare attribute set to FREEP. Indent 2759List products with :free-software attribute set to FREEP. Indent
2460each line with INDENT." 2760each line with INDENT."
2461 2761
2462 (let (sqli-func doc) 2762 (let (sqli-func doc)
@@ -2649,7 +2949,7 @@ function like this: (sql-get-login 'user 'password 'database)."
2649 nil (append '(:number t) plist))))))) 2949 nil (append '(:number t) plist)))))))
2650 what)) 2950 what))
2651 2951
2652(defun sql-find-sqli-buffer (&optional product) 2952(defun sql-find-sqli-buffer (&optional product connection)
2653 "Returns the name of the current default SQLi buffer or nil. 2953 "Returns the name of the current default SQLi buffer or nil.
2654In order to qualify, the SQLi buffer must be alive, be in 2954In order to qualify, the SQLi buffer must be alive, be in
2655`sql-interactive-mode' and have a process." 2955`sql-interactive-mode' and have a process."
@@ -2657,16 +2957,16 @@ In order to qualify, the SQLi buffer must be alive, be in
2657 (prod (or product sql-product))) 2957 (prod (or product sql-product)))
2658 (or 2958 (or
2659 ;; Current sql-buffer, if there is one. 2959 ;; Current sql-buffer, if there is one.
2660 (and (sql-buffer-live-p buf prod) 2960 (and (sql-buffer-live-p buf prod connection)
2661 buf) 2961 buf)
2662 ;; Global sql-buffer 2962 ;; Global sql-buffer
2663 (and (setq buf (default-value 'sql-buffer)) 2963 (and (setq buf (default-value 'sql-buffer))
2664 (sql-buffer-live-p buf prod) 2964 (sql-buffer-live-p buf prod connection)
2665 buf) 2965 buf)
2666 ;; Look thru each buffer 2966 ;; Look thru each buffer
2667 (car (apply 'append 2967 (car (apply 'append
2668 (mapcar (lambda (b) 2968 (mapcar (lambda (b)
2669 (and (sql-buffer-live-p b prod) 2969 (and (sql-buffer-live-p b prod connection)
2670 (list (buffer-name b)))) 2970 (list (buffer-name b))))
2671 (buffer-list))))))) 2971 (buffer-list)))))))
2672 2972
@@ -2722,7 +3022,8 @@ If you call it from anywhere else, it sets the global copy of
2722This is the buffer SQL strings are sent to. It is stored in the 3022This is the buffer SQL strings are sent to. It is stored in the
2723variable `sql-buffer'. See `sql-help' on how to create such a buffer." 3023variable `sql-buffer'. See `sql-help' on how to create such a buffer."
2724 (interactive) 3024 (interactive)
2725 (if (null (buffer-live-p (get-buffer sql-buffer))) 3025 (if (or (null sql-buffer)
3026 (null (buffer-live-p (get-buffer sql-buffer))))
2726 (message "%s has no SQLi buffer set." (buffer-name (current-buffer))) 3027 (message "%s has no SQLi buffer set." (buffer-name (current-buffer)))
2727 (if (null (get-buffer-process sql-buffer)) 3028 (if (null (get-buffer-process sql-buffer))
2728 (message "Buffer %s has no process." sql-buffer) 3029 (message "Buffer %s has no process." sql-buffer)
@@ -2932,37 +3233,58 @@ Allows the suppression of continuation prompts.")
2932 3233
2933;;; Strip out continuation prompts 3234;;; Strip out continuation prompts
2934 3235
3236(defvar sql-preoutput-hold nil)
3237
2935(defun sql-interactive-remove-continuation-prompt (oline) 3238(defun sql-interactive-remove-continuation-prompt (oline)
2936 "Strip out continuation prompts out of the OLINE. 3239 "Strip out continuation prompts out of the OLINE.
2937 3240
2938Added to the `comint-preoutput-filter-functions' hook in a SQL 3241Added to the `comint-preoutput-filter-functions' hook in a SQL
2939interactive buffer. If `sql-outut-newline-count' is greater than 3242interactive buffer. If `sql-output-newline-count' is greater than
2940zero, then an output line matching the continuation prompt is filtered 3243zero, then an output line matching the continuation prompt is filtered
2941out. If the count is one, then the prompt is replaced with a newline 3244out. If the count is zero, then a newline is inserted into the output
2942to force the output from the query to appear on a new line." 3245to force the output from the query to appear on a new line.
2943 (if (and sql-prompt-cont-regexp 3246
2944 sql-output-newline-count 3247The complication to this filter is that the continuation prompts
2945 (numberp sql-output-newline-count) 3248may arrive in multiple chunks. If they do, then the function
2946 (>= sql-output-newline-count 1)) 3249saves any unfiltered output in a buffer and prepends that buffer
2947 (progn 3250to the next chunk to properly match the broken-up prompt.
2948 (while (and oline 3251
2949 sql-output-newline-count 3252If the filter gets confused, it should reset and stop filtering
2950 (> sql-output-newline-count 0) 3253to avoid deleting non-prompt output."
2951 (string-match sql-prompt-cont-regexp oline)) 3254
2952 3255 (let (did-filter)
2953 (setq oline 3256 (setq oline (concat (or sql-preoutput-hold "") oline)
2954 (replace-match (if (and 3257 sql-preoutput-hold nil)
2955 (= 1 sql-output-newline-count) 3258
2956 sql-output-by-send) 3259 (if (and comint-prompt-regexp
2957 "\n" "") 3260 (integerp sql-output-newline-count)
2958 nil nil oline) 3261 (>= sql-output-newline-count 1))
2959 sql-output-newline-count 3262 (progn
2960 (1- sql-output-newline-count))) 3263 (while (and (not (string= oline ""))
2961 (if (= sql-output-newline-count 0) 3264 (> sql-output-newline-count 0)
2962 (setq sql-output-newline-count nil)) 3265 (string-match comint-prompt-regexp oline)
2963 (setq sql-output-by-send nil)) 3266 (= (match-beginning 0) 0))
2964 (setq sql-output-newline-count nil)) 3267
2965 oline) 3268 (setq oline (replace-match "" nil nil oline)
3269 sql-output-newline-count (1- sql-output-newline-count)
3270 did-filter t))
3271
3272 (if (= sql-output-newline-count 0)
3273 (setq sql-output-newline-count nil
3274 oline (concat "\n" oline)
3275 sql-output-by-send nil)
3276
3277 (setq sql-preoutput-hold oline
3278 oline ""))
3279
3280 (unless did-filter
3281 (setq oline (or sql-preoutput-hold "")
3282 sql-preoutput-hold nil
3283 sql-output-newline-count nil)))
3284
3285 (setq sql-output-newline-count nil))
3286
3287 oline))
2966 3288
2967;;; Sending the region to the SQLi buffer. 3289;;; Sending the region to the SQLi buffer.
2968 3290
@@ -3066,16 +3388,35 @@ If given the optional parameter VALUE, sets
3066 3388
3067;;; Redirect output functions 3389;;; Redirect output functions
3068 3390
3069(defun sql-redirect (command combuf &optional outbuf save-prior) 3391(defvar sql-debug-redirect nil
3392 "If non-nil, display messages related to the use of redirection.")
3393
3394(defun sql-str-literal (s)
3395 (concat "'" (replace-regexp-in-string "[']" "''" s) "'"))
3396
3397(defun sql-redirect (sqlbuf command &optional outbuf save-prior)
3070 "Execute the SQL command and send output to OUTBUF. 3398 "Execute the SQL command and send output to OUTBUF.
3071 3399
3072COMBUF must be an active SQL interactive buffer. OUTBUF may be 3400SQLBUF must be an active SQL interactive buffer. OUTBUF may be
3073an existing buffer, or the name of a non-existing buffer. If 3401an existing buffer, or the name of a non-existing buffer. If
3074omitted the output is sent to a temporary buffer which will be 3402omitted the output is sent to a temporary buffer which will be
3075killed after the command completes. COMMAND should be a string 3403killed after the command completes. COMMAND should be a string
3076of commands accepted by the SQLi program." 3404of commands accepted by the SQLi program. COMMAND may also be a
3077 3405list of SQLi command strings."
3078 (with-current-buffer combuf 3406
3407 (let* ((visible (and outbuf
3408 (not (string= " " (substring outbuf 0 1))))))
3409 (when visible
3410 (message "Executing SQL command..."))
3411 (if (consp command)
3412 (mapc (lambda (c) (sql-redirect-one sqlbuf c outbuf save-prior))
3413 command)
3414 (sql-redirect-one sqlbuf command outbuf save-prior))
3415 (when visible
3416 (message "Executing SQL command...done"))))
3417
3418(defun sql-redirect-one (sqlbuf command outbuf save-prior)
3419 (with-current-buffer sqlbuf
3079 (let ((buf (get-buffer-create (or outbuf " *SQL-Redirect*"))) 3420 (let ((buf (get-buffer-create (or outbuf " *SQL-Redirect*")))
3080 (proc (get-buffer-process (current-buffer))) 3421 (proc (get-buffer-process (current-buffer)))
3081 (comint-prompt-regexp (sql-get-product-feature sql-product 3422 (comint-prompt-regexp (sql-get-product-feature sql-product
@@ -3090,12 +3431,13 @@ of commands accepted by the SQLi program."
3090 (insert "\n")) 3431 (insert "\n"))
3091 (setq start (point))) 3432 (setq start (point)))
3092 3433
3434 (when sql-debug-redirect
3435 (message ">>SQL> %S" command))
3436
3093 ;; Run the command 3437 ;; Run the command
3094 (message "Executing SQL command...")
3095 (comint-redirect-send-command-to-process command buf proc nil t) 3438 (comint-redirect-send-command-to-process command buf proc nil t)
3096 (while (null comint-redirect-completed) 3439 (while (null comint-redirect-completed)
3097 (accept-process-output nil 1)) 3440 (accept-process-output nil 1))
3098 (message "Executing SQL command...done")
3099 3441
3100 ;; Clean up the output results 3442 ;; Clean up the output results
3101 (with-current-buffer buf 3443 (with-current-buffer buf
@@ -3107,12 +3449,16 @@ of commands accepted by the SQLi program."
3107 (goto-char start) 3449 (goto-char start)
3108 (when (looking-at (concat "^" (regexp-quote command) "[\\n]")) 3450 (when (looking-at (concat "^" (regexp-quote command) "[\\n]"))
3109 (delete-region (match-beginning 0) (match-end 0))) 3451 (delete-region (match-beginning 0) (match-end 0)))
3452 ;; Remove Ctrl-Ms
3453 (goto-char start)
3454 (while (re-search-forward "\r+$" nil t)
3455 (replace-match "" t t))
3110 (goto-char start))))) 3456 (goto-char start)))))
3111 3457
3112(defun sql-redirect-value (command combuf regexp &optional regexp-groups) 3458(defun sql-redirect-value (sqlbuf command regexp &optional regexp-groups)
3113 "Execute the SQL command and return part of result. 3459 "Execute the SQL command and return part of result.
3114 3460
3115COMBUF must be an active SQL interactive buffer. COMMAND should 3461SQLBUF must be an active SQL interactive buffer. COMMAND should
3116be a string of commands accepted by the SQLi program. From the 3462be a string of commands accepted by the SQLi program. From the
3117output, the REGEXP is repeatedly matched and the list of 3463output, the REGEXP is repeatedly matched and the list of
3118REGEXP-GROUPS submatches is returned. This behaves much like 3464REGEXP-GROUPS submatches is returned. This behaves much like
@@ -3122,18 +3468,19 @@ for each match."
3122 3468
3123 (let ((outbuf " *SQL-Redirect-values*") 3469 (let ((outbuf " *SQL-Redirect-values*")
3124 (results nil)) 3470 (results nil))
3125 (sql-redirect command combuf outbuf nil) 3471 (sql-redirect sqlbuf command outbuf nil)
3126 (with-current-buffer outbuf 3472 (with-current-buffer outbuf
3127 (while (re-search-forward regexp nil t) 3473 (while (re-search-forward regexp nil t)
3128 (push 3474 (push
3129 (cond 3475 (cond
3130 ;; no groups-return all of them 3476 ;; no groups-return all of them
3131 ((null regexp-groups) 3477 ((null regexp-groups)
3132 (let ((i 1) 3478 (let ((i (/ (length (match-data)) 2))
3133 (r nil)) 3479 (r nil))
3134 (while (match-beginning i) 3480 (while (> i 0)
3481 (setq i (1- i))
3135 (push (match-string i) r)) 3482 (push (match-string i) r))
3136 (nreverse r))) 3483 r))
3137 ;; one group specified 3484 ;; one group specified
3138 ((numberp regexp-groups) 3485 ((numberp regexp-groups)
3139 (match-string regexp-groups)) 3486 (match-string regexp-groups))
@@ -3152,10 +3499,14 @@ for each match."
3152 (error "sql-redirect-value: unknown REGEXP-GROUPS value - %s" 3499 (error "sql-redirect-value: unknown REGEXP-GROUPS value - %s"
3153 regexp-groups))) 3500 regexp-groups)))
3154 results))) 3501 results)))
3155 (nreverse results)))
3156 3502
3157(defun sql-execute (sqlbuf outbuf command arg) 3503 (when sql-debug-redirect
3158 "Executes a command in a SQL interacive buffer and captures the output. 3504 (message ">>SQL> = %S" (reverse results)))
3505
3506 (nreverse results)))
3507
3508(defun sql-execute (sqlbuf outbuf command enhanced arg)
3509 "Executes a command in a SQL interactive buffer and captures the output.
3159 3510
3160The commands are run in SQLBUF and the output saved in OUTBUF. 3511The commands are run in SQLBUF and the output saved in OUTBUF.
3161COMMAND must be a string, a function or a list of such elements. 3512COMMAND must be a string, a function or a list of such elements.
@@ -3168,9 +3519,9 @@ buffer is popped into a view window. "
3168 (lambda (c) 3519 (lambda (c)
3169 (cond 3520 (cond
3170 ((stringp c) 3521 ((stringp c)
3171 (sql-redirect (if arg (format c arg) c) sqlbuf outbuf) t) 3522 (sql-redirect sqlbuf (if arg (format c arg) c) outbuf) t)
3172 ((functionp c) 3523 ((functionp c)
3173 (apply c sqlbuf outbuf arg)) 3524 (apply c sqlbuf outbuf enhanced arg nil))
3174 (t (error "Unknown sql-execute item %s" c)))) 3525 (t (error "Unknown sql-execute item %s" c))))
3175 (if (consp command) command (cons command nil))) 3526 (if (consp command) command (cons command nil)))
3176 3527
@@ -3197,14 +3548,92 @@ buffer is popped into a view window. "
3197 (setq command (if enhanced 3548 (setq command (if enhanced
3198 (cdr command) 3549 (cdr command)
3199 (car command)))) 3550 (car command))))
3200 (sql-execute sqlbuf outbuf command arg))) 3551 (sql-execute sqlbuf outbuf command enhanced arg)))
3552
3553(defvar sql-completion-object nil
3554 "A list of database objects used for completion.
3555
3556The list is maintained in SQL interactive buffers.")
3557
3558(defvar sql-completion-column nil
3559 "A list of column names used for completion.
3560
3561The list is maintained in SQL interactive buffers.")
3562
3563(defun sql-build-completions-1 (schema completion-list feature)
3564 "Generate a list of objects in the database for use as completions."
3565 (let ((f (sql-get-product-feature sql-product feature)))
3566 (when f
3567 (set completion-list
3568 (let (cl)
3569 (dolist (e (append (symbol-value completion-list)
3570 (apply f (current-buffer) (cons schema nil)))
3571 cl)
3572 (unless (member e cl) (setq cl (cons e cl))))
3573 (sort cl (function string<)))))))
3574
3575(defun sql-build-completions (schema)
3576 "Generate a list of names in the database for use as completions."
3577 (sql-build-completions-1 schema 'sql-completion-object :completion-object)
3578 (sql-build-completions-1 schema 'sql-completion-column :completion-column))
3579
3580(defvar sql-completion-sqlbuf nil)
3581
3582(defun sql-try-completion (string collection &optional predicate)
3583 (when sql-completion-sqlbuf
3584 (with-current-buffer sql-completion-sqlbuf
3585 (let ((schema (and (string-match "\\`\\(\\sw\\(:?\\sw\\|\\s_\\)*\\)[.]" string)
3586 (downcase (match-string 1 string)))))
3587
3588 ;; If we haven't loaded any object name yet, load local schema
3589 (unless sql-completion-object
3590 (sql-build-completions nil))
3591
3592 ;; If they want another schema, load it if we haven't yet
3593 (when schema
3594 (let ((schema-dot (concat schema "."))
3595 (schema-len (1+ (length schema)))
3596 (names sql-completion-object)
3597 has-schema)
3598
3599 (while (and (not has-schema) names)
3600 (setq has-schema (and
3601 (>= (length (car names)) schema-len)
3602 (string= schema-dot
3603 (downcase (substring (car names)
3604 0 schema-len))))
3605 names (cdr names)))
3606 (unless has-schema
3607 (sql-build-completions schema)))))
3608
3609 ;; Try to find the completion
3610 (cond
3611 ((not predicate)
3612 (try-completion string sql-completion-object))
3613 ((eq predicate t)
3614 (all-completions string sql-completion-object))
3615 ((eq predicate 'lambda)
3616 (test-completion string sql-completion-object))
3617 ((eq (car predicate) 'boundaries)
3618 (completion-boundaries string sql-completion-object nil (cdr predicate)))))))
3201 3619
3202(defun sql-read-table-name (prompt) 3620(defun sql-read-table-name (prompt)
3203 "Read the name of a database table." 3621 "Read the name of a database table."
3204 ;; TODO: Fetch table/view names from database and provide completion. 3622 (let* ((tname
3205 ;; Also implement thing-at-point if the buffer has valid names in it 3623 (and (buffer-local-value 'sql-contains-names (current-buffer))
3206 ;; (i.e. sql-mode, sql-interactive-mode, or sql-list-all buffers) 3624 (thing-at-point-looking-at
3207 (read-from-minibuffer prompt)) 3625 (concat "\\_<\\sw\\(:?\\sw\\|\\s_\\)*"
3626 "\\(?:[.]+\\sw\\(?:\\sw\\|\\s_\\)*\\)*\\_>"))
3627 (buffer-substring-no-properties (match-beginning 0)
3628 (match-end 0))))
3629 (sql-completion-sqlbuf (sql-find-sqli-buffer))
3630 (product (with-current-buffer sql-completion-sqlbuf sql-product))
3631 (completion-ignore-case t))
3632
3633 (if (sql-get-product-feature product :completion-object)
3634 (completing-read prompt (function sql-try-completion)
3635 nil nil tname)
3636 (read-from-minibuffer prompt tname))))
3208 3637
3209(defun sql-list-all (&optional enhanced) 3638(defun sql-list-all (&optional enhanced)
3210 "List all database objects." 3639 "List all database objects."
@@ -3212,7 +3641,11 @@ buffer is popped into a view window. "
3212 (let ((sqlbuf (sql-find-sqli-buffer))) 3641 (let ((sqlbuf (sql-find-sqli-buffer)))
3213 (unless sqlbuf 3642 (unless sqlbuf
3214 (error "No SQL interactive buffer found")) 3643 (error "No SQL interactive buffer found"))
3215 (sql-execute-feature sqlbuf "*List All*" :list-all enhanced nil))) 3644 (sql-execute-feature sqlbuf "*List All*" :list-all enhanced nil)
3645 (with-current-buffer sqlbuf
3646 ;; Contains the name of database objects
3647 (set (make-local-variable 'sql-contains-names) t)
3648 (set (make-local-variable 'sql-buffer) sqlbuf))))
3216 3649
3217(defun sql-list-table (name &optional enhanced) 3650(defun sql-list-table (name &optional enhanced)
3218 "List the details of a database table. " 3651 "List the details of a database table. "
@@ -3226,7 +3659,6 @@ buffer is popped into a view window. "
3226 (error "No table name specified")) 3659 (error "No table name specified"))
3227 (sql-execute-feature sqlbuf (format "*List %s*" name) 3660 (sql-execute-feature sqlbuf (format "*List %s*" name)
3228 :list-table enhanced name))) 3661 :list-table enhanced name)))
3229
3230 3662
3231 3663
3232;;; SQL mode -- uses SQL interactive mode 3664;;; SQL mode -- uses SQL interactive mode
@@ -3277,6 +3709,8 @@ you must tell Emacs. Here's how to do that in your `~/.emacs' file:
3277 (set (make-local-variable 'paragraph-start) "[\n\f]") 3709 (set (make-local-variable 'paragraph-start) "[\n\f]")
3278 ;; Abbrevs 3710 ;; Abbrevs
3279 (setq abbrev-all-caps 1) 3711 (setq abbrev-all-caps 1)
3712 ;; Contains the name of database objects
3713 (set (make-local-variable 'sql-contains-names) t)
3280 ;; Catch changes to sql-product and highlight accordingly 3714 ;; Catch changes to sql-product and highlight accordingly
3281 (add-hook 'hack-local-variables-hook 'sql-highlight-product t t)) 3715 (add-hook 'hack-local-variables-hook 'sql-highlight-product t t))
3282 3716
@@ -3362,7 +3796,7 @@ you entered, right above the output it created.
3362 sql-product)) 3796 sql-product))
3363 3797
3364 ;; Setup the mode. 3798 ;; Setup the mode.
3365 (setq major-mode 'sql-interactive-mode) ;FIXME: Use define-derived-mode. 3799 (setq major-mode 'sql-interactive-mode)
3366 (setq mode-name 3800 (setq mode-name
3367 (concat "SQLi[" (or (sql-get-product-feature sql-product :name) 3801 (concat "SQLi[" (or (sql-get-product-feature sql-product :name)
3368 (symbol-name sql-product)) "]")) 3802 (symbol-name sql-product)) "]"))
@@ -3385,9 +3819,18 @@ you entered, right above the output it created.
3385 (setq abbrev-all-caps 1) 3819 (setq abbrev-all-caps 1)
3386 ;; Exiting the process will call sql-stop. 3820 ;; Exiting the process will call sql-stop.
3387 (set-process-sentinel (get-buffer-process (current-buffer)) 'sql-stop) 3821 (set-process-sentinel (get-buffer-process (current-buffer)) 'sql-stop)
3388 ;; Save the connection name 3822 ;; Save the connection and login params
3389 (make-local-variable 'sql-connection) 3823 (set (make-local-variable 'sql-user) sql-user)
3390 ;; Create a usefull name for renaming this buffer later. 3824 (set (make-local-variable 'sql-database) sql-database)
3825 (set (make-local-variable 'sql-server) sql-server)
3826 (set (make-local-variable 'sql-port) sql-port)
3827 (set (make-local-variable 'sql-connection) sql-connection)
3828 ;; Contains the name of database objects
3829 (set (make-local-variable 'sql-contains-names) t)
3830 ;; Keep track of existing object names
3831 (set (make-local-variable 'sql-completion-object) nil)
3832 (set (make-local-variable 'sql-completion-column) nil)
3833 ;; Create a useful name for renaming this buffer later.
3391 (set (make-local-variable 'sql-alternate-buffer-name) 3834 (set (make-local-variable 'sql-alternate-buffer-name)
3392 (sql-make-alternate-buffer-name)) 3835 (sql-make-alternate-buffer-name))
3393 ;; User stuff. Initialize before the hook. 3836 ;; User stuff. Initialize before the hook.
@@ -3398,6 +3841,7 @@ you entered, right above the output it created.
3398 (set (make-local-variable 'sql-prompt-cont-regexp) 3841 (set (make-local-variable 'sql-prompt-cont-regexp)
3399 (sql-get-product-feature sql-product :prompt-cont-regexp)) 3842 (sql-get-product-feature sql-product :prompt-cont-regexp))
3400 (make-local-variable 'sql-output-newline-count) 3843 (make-local-variable 'sql-output-newline-count)
3844 (make-local-variable 'sql-preoutput-hold)
3401 (make-local-variable 'sql-output-by-send) 3845 (make-local-variable 'sql-output-by-send)
3402 (add-hook 'comint-preoutput-filter-functions 3846 (add-hook 'comint-preoutput-filter-functions
3403 'sql-interactive-remove-continuation-prompt nil t) 3847 'sql-interactive-remove-continuation-prompt nil t)
@@ -3450,7 +3894,7 @@ Sentinels will always get the two parameters PROCESS and EVENT."
3450 nil t initial 'sql-connection-history default))) 3894 nil t initial 'sql-connection-history default)))
3451 3895
3452;;;###autoload 3896;;;###autoload
3453(defun sql-connect (connection) 3897(defun sql-connect (connection &optional new-name)
3454 "Connect to an interactive session using CONNECTION settings. 3898 "Connect to an interactive session using CONNECTION settings.
3455 3899
3456See `sql-connection-alist' to see how to define connections and 3900See `sql-connection-alist' to see how to define connections and
@@ -3462,7 +3906,8 @@ is specified in the connection settings."
3462 ;; Prompt for the connection from those defined in the alist 3906 ;; Prompt for the connection from those defined in the alist
3463 (interactive 3907 (interactive
3464 (if sql-connection-alist 3908 (if sql-connection-alist
3465 (list (sql-read-connection "Connection: " nil '(nil))) 3909 (list (sql-read-connection "Connection: " nil '(nil))
3910 current-prefix-arg)
3466 nil)) 3911 nil))
3467 3912
3468 ;; Are there connections defined 3913 ;; Are there connections defined
@@ -3500,14 +3945,15 @@ is specified in the connection settings."
3500 (unless (member token set-params) 3945 (unless (member token set-params)
3501 (if plist 3946 (if plist
3502 (cons token plist) 3947 (cons token plist)
3503 token))))) 3948 token))))))
3504 ;; Remember the connection
3505 (sql-connection connection))
3506 3949
3507 ;; Set the remaining parameters and start the 3950 ;; Set the remaining parameters and start the
3508 ;; interactive session 3951 ;; interactive session
3509 (eval `(let ((,param-var ',rem-params)) 3952 (eval `(let ((sql-connection ,connection)
3510 (sql-product-interactive sql-product))))) 3953 (,param-var ',rem-params))
3954 (sql-product-interactive sql-product
3955 new-name)))))
3956
3511 (message "SQL Connection <%s> does not exist" connection) 3957 (message "SQL Connection <%s> does not exist" connection)
3512 nil))) 3958 nil)))
3513 (message "No SQL Connections defined") 3959 (message "No SQL Connections defined")
@@ -3521,39 +3967,51 @@ optionally is saved to the user's init file."
3521 3967
3522 (interactive "sNew connection name: ") 3968 (interactive "sNew connection name: ")
3523 3969
3524 (if sql-connection 3970 (unless (derived-mode-p 'sql-interactive-mode)
3525 (message "This session was started by a connection; it's already been saved.") 3971 (error "Not in a SQL interactive mode!"))
3526 3972
3527 (let ((login (sql-get-product-feature sql-product :sqli-login)) 3973 ;; Capture the buffer local settings
3528 (alist sql-connection-alist) 3974 (let* ((buf (current-buffer))
3529 connect) 3975 (connection (buffer-local-value 'sql-connection buf))
3530 3976 (product (buffer-local-value 'sql-product buf))
3531 ;; Remove the existing connection if the user says so 3977 (user (buffer-local-value 'sql-user buf))
3532 (when (and (assoc name alist) 3978 (database (buffer-local-value 'sql-database buf))
3533 (yes-or-no-p (format "Replace connection definition <%s>? " name))) 3979 (server (buffer-local-value 'sql-server buf))
3534 (setq alist (assq-delete-all name alist))) 3980 (port (buffer-local-value 'sql-port buf)))
3535 3981
3536 ;; Add the new connection if it doesn't exist 3982 (if connection
3537 (if (assoc name alist) 3983 (message "This session was started by a connection; it's already been saved.")
3538 (message "Connection <%s> already exists" name) 3984
3539 (setq connect 3985 (let ((login (sql-get-product-feature product :sqli-login))
3540 (append (list name) 3986 (alist sql-connection-alist)
3541 (sql-for-each-login 3987 connect)
3542 `(product ,@login) 3988
3543 (lambda (token _plist) 3989 ;; Remove the existing connection if the user says so
3544 (cond 3990 (when (and (assoc name alist)
3545 ((eq token 'product) `(sql-product ',sql-product)) 3991 (yes-or-no-p (format "Replace connection definition <%s>? " name)))
3546 ((eq token 'user) `(sql-user ,sql-user)) 3992 (setq alist (assq-delete-all name alist)))
3547 ((eq token 'database) `(sql-database ,sql-database)) 3993
3548 ((eq token 'server) `(sql-server ,sql-server)) 3994 ;; Add the new connection if it doesn't exist
3549 ((eq token 'port) `(sql-port ,sql-port))))))) 3995 (if (assoc name alist)
3550 3996 (message "Connection <%s> already exists" name)
3551 (setq alist (append alist (list connect))) 3997 (setq connect
3552 3998 (append (list name)
3553 ;; confirm whether we want to save the connections 3999 (sql-for-each-login
3554 (if (yes-or-no-p "Save the connections for future sessions? ") 4000 `(product ,@login)
3555 (customize-save-variable 'sql-connection-alist alist) 4001 (lambda (token _plist)
3556 (customize-set-variable 'sql-connection-alist alist)))))) 4002 (cond
4003 ((eq token 'product) `(sql-product ',product))
4004 ((eq token 'user) `(sql-user ,user))
4005 ((eq token 'database) `(sql-database ,database))
4006 ((eq token 'server) `(sql-server ,server))
4007 ((eq token 'port) `(sql-port ,port)))))))
4008
4009 (setq alist (append alist (list connect)))
4010
4011 ;; confirm whether we want to save the connections
4012 (if (yes-or-no-p "Save the connections for future sessions? ")
4013 (customize-save-variable 'sql-connection-alist alist)
4014 (customize-set-variable 'sql-connection-alist alist)))))))
3557 4015
3558(defun sql-connection-menu-filter (tail) 4016(defun sql-connection-menu-filter (tail)
3559 "Generates menu entries for using each connection." 4017 "Generates menu entries for using each connection."
@@ -3561,7 +4019,10 @@ optionally is saved to the user's init file."
3561 (mapcar 4019 (mapcar
3562 (lambda (conn) 4020 (lambda (conn)
3563 (vector 4021 (vector
3564 (format "Connection <%s>" (car conn)) 4022 (format "Connection <%s>\t%s" (car conn)
4023 (let ((sql-user "") (sql-database "")
4024 (sql-server "") (sql-port 0))
4025 (eval `(let ,(cdr conn) (sql-make-alternate-buffer-name)))))
3565 (list 'sql-connect (car conn)) 4026 (list 'sql-connect (car conn))
3566 t)) 4027 t))
3567 sql-connection-alist) 4028 sql-connection-alist)
@@ -3599,10 +4060,10 @@ the call to \\[sql-product-interactive] with
3599 ;; Get the value of product that we need 4060 ;; Get the value of product that we need
3600 (setq product 4061 (setq product
3601 (cond 4062 (cond
3602 ((and product ; Product specified
3603 (symbolp product)) product)
3604 ((= (prefix-numeric-value product) 4) ; C-u, prompt for product 4063 ((= (prefix-numeric-value product) 4) ; C-u, prompt for product
3605 (sql-read-product "SQL product: " sql-product)) 4064 (sql-read-product "SQL product: " sql-product))
4065 ((and product ; Product specified
4066 (symbolp product)) product)
3606 (t sql-product))) ; Default to sql-product 4067 (t sql-product))) ; Default to sql-product
3607 4068
3608 ;; If we have a product and it has a interactive mode 4069 ;; If we have a product and it has a interactive mode
@@ -3610,7 +4071,7 @@ the call to \\[sql-product-interactive] with
3610 (when (sql-get-product-feature product :sqli-comint-func) 4071 (when (sql-get-product-feature product :sqli-comint-func)
3611 ;; If no new name specified, try to pop to an active SQL 4072 ;; If no new name specified, try to pop to an active SQL
3612 ;; interactive for the same product 4073 ;; interactive for the same product
3613 (let ((buf (sql-find-sqli-buffer product))) 4074 (let ((buf (sql-find-sqli-buffer product sql-connection)))
3614 (if (and (not new-name) buf) 4075 (if (and (not new-name) buf)
3615 (pop-to-buffer buf) 4076 (pop-to-buffer buf)
3616 4077
@@ -3629,23 +4090,24 @@ the call to \\[sql-product-interactive] with
3629 (sql-get-product-feature product :sqli-options)) 4090 (sql-get-product-feature product :sqli-options))
3630 4091
3631 ;; Set SQLi mode. 4092 ;; Set SQLi mode.
3632 (setq new-sqli-buffer (current-buffer))
3633 (let ((sql-interactive-product product)) 4093 (let ((sql-interactive-product product))
3634 (sql-interactive-mode)) 4094 (sql-interactive-mode))
3635 4095
3636 ;; Set the new buffer name 4096 ;; Set the new buffer name
4097 (setq new-sqli-buffer (current-buffer))
3637 (when new-name 4098 (when new-name
3638 (sql-rename-buffer new-name)) 4099 (sql-rename-buffer new-name))
3639
3640 ;; Set `sql-buffer' in the new buffer and the start buffer
3641 (setq sql-buffer (buffer-name new-sqli-buffer)) 4100 (setq sql-buffer (buffer-name new-sqli-buffer))
4101
4102 ;; Set `sql-buffer' in the start buffer
3642 (with-current-buffer start-buffer 4103 (with-current-buffer start-buffer
3643 (setq sql-buffer (buffer-name new-sqli-buffer)) 4104 (when (derived-mode-p 'sql-mode)
3644 (run-hooks 'sql-set-sqli-hook)) 4105 (setq sql-buffer (buffer-name new-sqli-buffer))
4106 (run-hooks 'sql-set-sqli-hook)))
3645 4107
3646 ;; All done. 4108 ;; All done.
3647 (message "Login...done") 4109 (message "Login...done")
3648 (pop-to-buffer sql-buffer))))) 4110 (pop-to-buffer new-sqli-buffer)))))
3649 (message "No default SQL product defined. Set `sql-product'."))) 4111 (message "No default SQL product defined. Set `sql-product'.")))
3650 4112
3651(defun sql-comint (product params) 4113(defun sql-comint (product params)
@@ -3720,6 +4182,157 @@ The default comes from `process-coding-system-alist' and
3720 (setq parameter options)) 4182 (setq parameter options))
3721 (sql-comint product parameter))) 4183 (sql-comint product parameter)))
3722 4184
4185(defun sql-oracle-save-settings (sqlbuf)
4186 "Saves most SQL*Plus settings so they may be reset by \\[sql-redirect]."
4187 ;; Note: does not capture the following settings:
4188 ;;
4189 ;; APPINFO
4190 ;; BTITLE
4191 ;; COMPATIBILITY
4192 ;; COPYTYPECHECK
4193 ;; MARKUP
4194 ;; RELEASE
4195 ;; REPFOOTER
4196 ;; REPHEADER
4197 ;; SQLPLUSCOMPATIBILITY
4198 ;; TTITLE
4199 ;; USER
4200 ;;
4201
4202 (append
4203 ;; (apply 'concat (append
4204 ;; '("SET")
4205
4206 ;; option value...
4207 (sql-redirect-value
4208 sqlbuf
4209 (concat "SHOW ARRAYSIZE AUTOCOMMIT AUTOPRINT AUTORECOVERY AUTOTRACE"
4210 " CMDSEP COLSEP COPYCOMMIT DESCRIBE ECHO EDITFILE EMBEDDED"
4211 " ESCAPE FLAGGER FLUSH HEADING INSTANCE LINESIZE LNO LOBOFFSET"
4212 " LOGSOURCE LONG LONGCHUNKSIZE NEWPAGE NULL NUMFORMAT NUMWIDTH"
4213 " PAGESIZE PAUSE PNO RECSEP SERVEROUTPUT SHIFTINOUT SHOWMODE"
4214 " SPOOL SQLBLANKLINES SQLCASE SQLCODE SQLCONTINUE SQLNUMBER"
4215 " SQLPROMPT SUFFIX TAB TERMOUT TIMING TRIMOUT TRIMSPOOL VERIFY")
4216 "^.+$"
4217 "SET \\&")
4218
4219 ;; option "c" (hex xx)
4220 (sql-redirect-value
4221 sqlbuf
4222 (concat "SHOW BLOCKTERMINATOR CONCAT DEFINE SQLPREFIX SQLTERMINATOR"
4223 " UNDERLINE HEADSEP RECSEPCHAR")
4224 "^\\(.+\\) (hex ..)$"
4225 "SET \\1")
4226
4227 ;; FEDDBACK ON for 99 or more rows
4228 ;; feedback OFF
4229 (sql-redirect-value
4230 sqlbuf
4231 "SHOW FEEDBACK"
4232 "^\\(?:FEEDBACK ON for \\([[:digit:]]+\\) or more rows\\|feedback \\(OFF\\)\\)"
4233 "SET FEEDBACK \\1\\2")
4234
4235 ;; wrap : lines will be wrapped
4236 ;; wrap : lines will be truncated
4237 (list (concat "SET WRAP "
4238 (if (string=
4239 (car (sql-redirect-value
4240 sqlbuf
4241 "SHOW WRAP"
4242 "^wrap : lines will be \\(wrapped\\|truncated\\)" 1))
4243 "wrapped")
4244 "ON" "OFF")))))
4245
4246(defun sql-oracle-restore-settings (sqlbuf saved-settings)
4247 "Restore the SQL*Plus settings in SAVED-SETTINGS."
4248
4249 ;; Remove any settings that haven't changed
4250 (mapc
4251 (lambda (one-cur-setting)
4252 (setq saved-settings (delete one-cur-setting saved-settings)))
4253 (sql-oracle-save-settings sqlbuf))
4254
4255 ;; Restore the changed settings
4256 (sql-redirect sqlbuf saved-settings))
4257
4258(defun sql-oracle-list-all (sqlbuf outbuf enhanced table-name)
4259 ;; Query from USER_OBJECTS or ALL_OBJECTS
4260 (let ((settings (sql-oracle-save-settings sqlbuf))
4261 (simple-sql
4262 (concat
4263 "SELECT INITCAP(x.object_type) AS SQL_EL_TYPE "
4264 ", x.object_name AS SQL_EL_NAME "
4265 "FROM user_objects x "
4266 "WHERE x.object_type NOT LIKE '%% BODY' "
4267 "ORDER BY 2, 1;"))
4268 (enhanced-sql
4269 (concat
4270 "SELECT INITCAP(x.object_type) AS SQL_EL_TYPE "
4271 ", x.owner ||'.'|| x.object_name AS SQL_EL_NAME "
4272 "FROM all_objects x "
4273 "WHERE x.object_type NOT LIKE '%% BODY' "
4274 "AND x.owner <> 'SYS' "
4275 "ORDER BY 2, 1;")))
4276
4277 (sql-redirect sqlbuf
4278 (concat "SET LINESIZE 80 PAGESIZE 50000 TRIMOUT ON"
4279 " TAB OFF TIMING OFF FEEDBACK OFF"))
4280
4281 (sql-redirect sqlbuf
4282 (list "COLUMN SQL_EL_TYPE HEADING \"Type\" FORMAT A19"
4283 "COLUMN SQL_EL_NAME HEADING \"Name\""
4284 (format "COLUMN SQL_EL_NAME FORMAT A%d"
4285 (if enhanced 60 35))))
4286
4287 (sql-redirect sqlbuf
4288 (if enhanced enhanced-sql simple-sql)
4289 outbuf)
4290
4291 (sql-redirect sqlbuf
4292 '("COLUMN SQL_EL_NAME CLEAR"
4293 "COLUMN SQL_EL_TYPE CLEAR"))
4294
4295 (sql-oracle-restore-settings sqlbuf settings)))
4296
4297(defun sql-oracle-list-table (sqlbuf outbuf enhanced table-name)
4298 "Implements :list-table under Oracle."
4299 (let ((settings (sql-oracle-save-settings sqlbuf)))
4300
4301 (sql-redirect sqlbuf
4302 (format
4303 (concat "SET LINESIZE %d PAGESIZE 50000"
4304 " DESCRIBE DEPTH 1 LINENUM OFF INDENT ON")
4305 (max 65 (min 120 (window-width)))))
4306
4307 (sql-redirect sqlbuf (format "DESCRIBE %s" table-name)
4308 outbuf)
4309
4310 (sql-oracle-restore-settings sqlbuf settings)))
4311
4312(defcustom sql-oracle-completion-types '("FUNCTION" "PACKAGE" "PROCEDURE"
4313 "SEQUENCE" "SYNONYM" "TABLE" "TRIGGER"
4314 "TYPE" "VIEW")
4315 "List of object types to include for completion under Oracle.
4316
4317See the distinct values in ALL_OBJECTS.OBJECT_TYPE for possible values."
4318 :version "24.1"
4319 :type '(repeat string)
4320 :group 'SQL)
4321
4322(defun sql-oracle-completion-object (sqlbuf schema)
4323 (sql-redirect-value
4324 sqlbuf
4325 (concat
4326 "SELECT CHR(1)||"
4327 (if schema
4328 (format "owner||'.'||object_name AS o FROM all_objects WHERE owner = %s AND "
4329 (sql-str-literal (upcase schema)))
4330 "object_name AS o FROM user_objects WHERE ")
4331 "temporary = 'N' AND generated = 'N' AND secondary = 'N' AND "
4332 "object_type IN ("
4333 (mapconcat (function sql-str-literal) sql-oracle-completion-types ",")
4334 ");")
4335 "^[\001]\\(.+\\)$" 1))
3723 4336
3724 4337
3725;;;###autoload 4338;;;###autoload
@@ -3858,6 +4471,9 @@ The default comes from `process-coding-system-alist' and
3858 (setq params (append options params)) 4471 (setq params (append options params))
3859 (sql-comint product params))) 4472 (sql-comint product params)))
3860 4473
4474(defun sql-sqlite-completion-object (sqlbuf schema)
4475 (sql-redirect-value sqlbuf ".tables" "\\sw\\(?:\\sw\\|\\s_\\)*" 0))
4476
3861 4477
3862 4478
3863;;;###autoload 4479;;;###autoload
@@ -4112,6 +4728,33 @@ Try to set `comint-output-filter-functions' like this:
4112 (setq params (append (list "-p" sql-port) params))) 4728 (setq params (append (list "-p" sql-port) params)))
4113 (sql-comint product params))) 4729 (sql-comint product params)))
4114 4730
4731(defun sql-postgres-completion-object (sqlbuf schema)
4732 (let (cl re fs a r)
4733 (sql-redirect sqlbuf "\\t on")
4734 (setq a (car (sql-redirect-value sqlbuf "\\a" "Output format is \\(.*\\)[.]$" 1)))
4735 (when (string= a "aligned")
4736 (sql-redirect sqlbuf "\\a"))
4737 (setq fs (or (car (sql-redirect-value sqlbuf "\\f" "Field separator is \"\\(.\\)[.]$" 1)) "|"))
4738
4739 (setq re (concat "^\\([^" fs "]*\\)" fs "\\([^" fs "]*\\)" fs "[^" fs "]*" fs "[^" fs "]*$"))
4740 (setq cl (if (not schema)
4741 (sql-redirect-value sqlbuf "\\d" re '(1 2))
4742 (append (sql-redirect-value sqlbuf (format "\\dt %s.*" schema) re '(1 2))
4743 (sql-redirect-value sqlbuf (format "\\dv %s.*" schema) re '(1 2))
4744 (sql-redirect-value sqlbuf (format "\\ds %s.*" schema) re '(1 2)))))
4745
4746 ;; Restore tuples and alignment to what they were
4747 (sql-redirect sqlbuf "\\t off")
4748 (when (not (string= a "aligned"))
4749 (sql-redirect sqlbuf "\\a"))
4750
4751 ;; Return the list of table names (public schema name can be omitted)
4752 (mapcar (lambda (tbl)
4753 (if (string= (car tbl) "public")
4754 (cadr tbl)
4755 (format "%s.%s" (car tbl) (cadr tbl))))
4756 cl)))
4757
4115 4758
4116 4759
4117;;;###autoload 4760;;;###autoload
@@ -4199,8 +4842,7 @@ The default comes from `process-coding-system-alist' and
4199 "Create comint buffer and connect to DB2." 4842 "Create comint buffer and connect to DB2."
4200 ;; Put all parameters to the program (if defined) in a list and call 4843 ;; Put all parameters to the program (if defined) in a list and call
4201 ;; make-comint. 4844 ;; make-comint.
4202 (sql-comint product options) 4845 (sql-comint product options))
4203)
4204 4846
4205;;;###autoload 4847;;;###autoload
4206(defun sql-linter (&optional buffer) 4848(defun sql-linter (&optional buffer)
@@ -4257,3 +4899,6 @@ buffer.
4257(provide 'sql) 4899(provide 'sql)
4258 4900
4259;;; sql.el ends here 4901;;; sql.el ends here
4902
4903; LocalWords: sql SQL SQLite sqlite Sybase Informix MySQL
4904; LocalWords: Postgres SQLServer SQLi
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 4e4d7b15053..97e188139e9 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -206,7 +206,8 @@ It creates the Imenu index for the buffer, if necessary."
206 (setq imenu--index-alist 206 (setq imenu--index-alist
207 (save-excursion (funcall imenu-create-index-function)))) 207 (save-excursion (funcall imenu-create-index-function))))
208 (error 208 (error
209 (message "which-func-ff-hook error: %S" err) 209 (unless (equal err '(error "This buffer cannot use `imenu-default-create-index-function'"))
210 (message "which-func-ff-hook error: %S" err))
210 (setq which-func-mode nil)))) 211 (setq which-func-mode nil))))
211 212
212(defun which-func-update () 213(defun which-func-update ()
diff --git a/lisp/register.el b/lisp/register.el
index 82a0cf33c3e..221242546ec 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -70,7 +70,7 @@
70DATA can be any value. 70DATA can be any value.
71PRINT-FUNC if provided controls how `list-registers' and 71PRINT-FUNC if provided controls how `list-registers' and
72`view-register' print the register. It should be a function 72`view-register' print the register. It should be a function
73recieving one argument DATA and print text that completes 73receiving one argument DATA and print text that completes
74this sentence: 74this sentence:
75 Register X contains [TEXT PRINTED BY PRINT-FUNC] 75 Register X contains [TEXT PRINTED BY PRINT-FUNC]
76JUMP-FUNC if provided, controls how `jump-to-register' jumps to the register. 76JUMP-FUNC if provided, controls how `jump-to-register' jumps to the register.
diff --git a/lisp/simple.el b/lisp/simple.el
index 6c078830a18..2c792a2c78e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2533,7 +2533,8 @@ specifies the value of ERROR-BUFFER."
2533 (< 0 (nth 7 (file-attributes error-file)))) 2533 (< 0 (nth 7 (file-attributes error-file))))
2534 (format "some error output%s" 2534 (format "some error output%s"
2535 (if shell-command-default-error-buffer 2535 (if shell-command-default-error-buffer
2536 (format " to the \"%s\" buffer" shell-command-default-error-buffer) 2536 (format " to the \"%s\" buffer"
2537 shell-command-default-error-buffer)
2537 "")) 2538 ""))
2538 "no output"))) 2539 "no output")))
2539 (cond ((null exit-status) 2540 (cond ((null exit-status)
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 107a0728bae..930d3200234 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -90,8 +90,8 @@ If this is a function, call it to generate the initial field text."
90(defcustom bibtex-user-optional-fields 90(defcustom bibtex-user-optional-fields
91 '(("annote" "Personal annotation (ignored)")) 91 '(("annote" "Personal annotation (ignored)"))
92 "List of optional fields the user wants to have always present. 92 "List of optional fields the user wants to have always present.
93Entries should be of the same form as the OPTIONAL and 93Entries should be of the same form as the OPTIONAL list
94CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (which see)." 94in `bibtex-BibTeX-entry-alist' (which see)."
95 :group 'bibtex 95 :group 'bibtex
96 :type '(repeat (group (string :tag "Field") 96 :type '(repeat (group (string :tag "Field")
97 (string :tag "Comment") 97 (string :tag "Comment")
@@ -127,7 +127,7 @@ braces Enclose parts of field entries by braces according to
127strings Replace parts of field entries by string constants 127strings Replace parts of field entries by string constants
128 according to `bibtex-field-strings-alist'. 128 according to `bibtex-field-strings-alist'.
129sort-fields Sort fields to match the field order in 129sort-fields Sort fields to match the field order in
130 `bibtex-entry-field-alist'. 130 `bibtex-BibTeX-entry-alist'.
131 131
132The value t means do all of the above formatting actions. 132The value t means do all of the above formatting actions.
133The value nil means do no formatting at all." 133The value nil means do no formatting at all."
@@ -264,265 +264,584 @@ If parsing fails, try to set this variable to nil."
264 :group 'bibtex 264 :group 'bibtex
265 :type 'boolean) 265 :type 'boolean)
266 266
267(defcustom bibtex-entry-field-alist 267(define-widget 'bibtex-entry-alist 'lazy
268 '(("Article" 268 "Format of `bibtex-BibTeX-entry-alist' and friends."
269 ((("author" "Author1 [and Author2 ...] [and others]") 269 :type '(repeat (group (string :tag "Entry type")
270 ("title" "Title of the article (BibTeX converts it to lowercase)") 270 (string :tag "Documentation")
271 ("journal" "Name of the journal (use string, remove braces)") 271 (repeat :tag "Required fields"
272 ("year" "Year of publication")) 272 (group (string :tag "Field")
273 (("volume" "Volume of the journal") 273 (option (choice :tag "Comment" :value nil
274 ("number" "Number of the journal (only allowed if entry contains volume)") 274 (const nil) string))
275 ("pages" "Pages in the journal") 275 (option (choice :tag "Init" :value nil
276 ("month" "Month of the publication as a string (remove braces)") 276 (const nil) string function))
277 ("note" "Remarks to be put at the end of the \\bibitem"))) 277 (option (choice :tag "Alternative" :value nil
278 ((("author" "Author1 [and Author2 ...] [and others]") 278 (const nil) integer))))
279 ("title" "Title of the article (BibTeX converts it to lowercase)")) 279 (repeat :tag "Crossref fields"
280 (("pages" "Pages in the journal") 280 (group (string :tag "Field")
281 ("journal" "Name of the journal (use string, remove braces)") 281 (option (choice :tag "Comment" :value nil
282 ("year" "Year of publication") 282 (const nil) string))
283 ("volume" "Volume of the journal") 283 (option (choice :tag "Init" :value nil
284 ("number" "Number of the journal") 284 (const nil) string function))
285 ("month" "Month of the publication as a string (remove braces)") 285 (option (choice :tag "Alternative" :value nil
286 ("note" "Remarks to be put at the end of the \\bibitem")))) 286 (const nil) integer))))
287 ("Book" 287 (repeat :tag "Optional fields"
288 ((("author" "Author1 [and Author2 ...] [and others]" nil t) 288 (group (string :tag "Field")
289 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) 289 (option (choice :tag "Comment" :value nil
290 ("title" "Title of the book") 290 (const nil) string))
291 ("publisher" "Publishing company") 291 (option (choice :tag "Init" :value nil
292 ("year" "Year of publication")) 292 (const nil) string function)))))))
293 (("volume" "Volume of the book in the series") 293
294 ("number" "Number of the book in a small series (overwritten by volume)") 294(define-obsolete-variable-alias 'bibtex-entry-field-alist
295 ("series" "Series in which the book appeared") 295 'bibtex-BibTeX-entry-alist "24.1")
296 ("address" "Address of the publisher") 296(defcustom bibtex-BibTeX-entry-alist
297 ("edition" "Edition of the book as a capitalized English word") 297 '(("Article" "Article in Journal"
298 ("month" "Month of the publication as a string (remove braces)") 298 (("author")
299 ("note" "Remarks to be put at the end of the \\bibitem"))) 299 ("title" "Title of the article (BibTeX converts it to lowercase)"))
300 ((("author" "Author1 [and Author2 ...] [and others]" nil t) 300 (("journal") ("year"))
301 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) 301 (("volume" "Volume of the journal")
302 ("title" "Title of the book")) 302 ("number" "Number of the journal (only allowed if entry contains volume)")
303 (("publisher" "Publishing company") 303 ("pages" "Pages in the journal")
304 ("year" "Year of publication") 304 ("month") ("note")))
305 ("volume" "Volume of the book in the series") 305 ("InProceedings" "Article in Conference Proceedings"
306 ("number" "Number of the book in a small series (overwritten by volume)") 306 (("author")
307 ("series" "Series in which the book appeared") 307 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)"))
308 ("address" "Address of the publisher") 308 (("booktitle" "Name of the conference proceedings")
309 ("edition" "Edition of the book as a capitalized English word") 309 ("year"))
310 ("month" "Month of the publication as a string (remove braces)") 310 (("editor")
311 ("note" "Remarks to be put at the end of the \\bibitem")))) 311 ("volume" "Volume of the conference proceedings in the series")
312 ("Booklet" 312 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
313 ((("title" "Title of the booklet (BibTeX converts it to lowercase)")) 313 ("series" "Series in which the conference proceedings appeared")
314 (("author" "Author1 [and Author2 ...] [and others]") 314 ("pages" "Pages in the conference proceedings")
315 ("howpublished" "The way in which the booklet was published") 315 ("month") ("address")
316 ("address" "Address of the publisher") 316 ("organization" "Sponsoring organization of the conference")
317 ("month" "Month of the publication as a string (remove braces)") 317 ("publisher" "Publishing company, its location")
318 ("year" "Year of publication") 318 ("note")))
319 ("note" "Remarks to be put at the end of the \\bibitem")))) 319 ("InCollection" "Article in a Collection"
320 ("InBook" 320 (("author")
321 ((("author" "Author1 [and Author2 ...] [and others]" nil t) 321 ("title" "Title of the article in book (BibTeX converts it to lowercase)")
322 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) 322 ("booktitle" "Name of the book"))
323 ("title" "Title of the book") 323 (("publisher") ("year"))
324 ("chapter" "Chapter in the book") 324 (("editor")
325 ("publisher" "Publishing company") 325 ("volume" "Volume of the book in the series")
326 ("year" "Year of publication")) 326 ("number" "Number of the book in a small series (overwritten by volume)")
327 (("volume" "Volume of the book in the series") 327 ("series" "Series in which the book appeared")
328 ("number" "Number of the book in a small series (overwritten by volume)") 328 ("type" "Word to use instead of \"chapter\"")
329 ("series" "Series in which the book appeared") 329 ("chapter" "Chapter in the book")
330 ("type" "Word to use instead of \"chapter\"") 330 ("pages" "Pages in the book")
331 ("address" "Address of the publisher") 331 ("edition" "Edition of the book as a capitalized English word")
332 ("edition" "Edition of the book as a capitalized English word") 332 ("month") ("address") ("note")))
333 ("month" "Month of the publication as a string (remove braces)") 333 ("InBook" "Chapter or Pages in a Book"
334 ("pages" "Pages in the book") 334 (("author" nil nil 0)
335 ("note" "Remarks to be put at the end of the \\bibitem"))) 335 ("editor" nil nil 0)
336 ((("author" "Author1 [and Author2 ...] [and others]" nil t) 336 ("title" "Title of the book")
337 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) 337 ("chapter" "Chapter in the book"))
338 ("title" "Title of the book") 338 (("publisher") ("year"))
339 ("chapter" "Chapter in the book")) 339 (("volume" "Volume of the book in the series")
340 (("pages" "Pages in the book") 340 ("number" "Number of the book in a small series (overwritten by volume)")
341 ("publisher" "Publishing company") 341 ("series" "Series in which the book appeared")
342 ("year" "Year of publication") 342 ("type" "Word to use instead of \"chapter\"")
343 ("volume" "Volume of the book in the series") 343 ("address")
344 ("number" "Number of the book in a small series (overwritten by volume)") 344 ("edition" "Edition of the book as a capitalized English word")
345 ("series" "Series in which the book appeared") 345 ("month")
346 ("type" "Word to use instead of \"chapter\"") 346 ("pages" "Pages in the book")
347 ("address" "Address of the publisher") 347 ("note")))
348 ("edition" "Edition of the book as a capitalized English word") 348 ("Proceedings" "Conference Proceedings"
349 ("month" "Month of the publication as a string (remove braces)") 349 (("title" "Title of the conference proceedings")
350 ("note" "Remarks to be put at the end of the \\bibitem")))) 350 ("year"))
351 ("InCollection" 351 nil
352 ((("author" "Author1 [and Author2 ...] [and others]") 352 (("booktitle" "Title of the proceedings for cross references")
353 ("title" "Title of the article in book (BibTeX converts it to lowercase)") 353 ("editor")
354 ("booktitle" "Name of the book") 354 ("volume" "Volume of the conference proceedings in the series")
355 ("publisher" "Publishing company") 355 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
356 ("year" "Year of publication")) 356 ("series" "Series in which the conference proceedings appeared")
357 (("editor" "Editor1 [and Editor2 ...] [and others]") 357 ("address")
358 ("volume" "Volume of the book in the series") 358 ("month")
359 ("number" "Number of the book in a small series (overwritten by volume)") 359 ("organization" "Sponsoring organization of the conference")
360 ("series" "Series in which the book appeared") 360 ("publisher" "Publishing company, its location")
361 ("type" "Word to use instead of \"chapter\"") 361 ("note")))
362 ("chapter" "Chapter in the book") 362 ("Book" "Book"
363 ("pages" "Pages in the book") 363 (("author" nil nil 0)
364 ("address" "Address of the publisher") 364 ("editor" nil nil 0)
365 ("edition" "Edition of the book as a capitalized English word") 365 ("title" "Title of the book"))
366 ("month" "Month of the publication as a string (remove braces)") 366 (("publisher") ("year"))
367 ("note" "Remarks to be put at the end of the \\bibitem"))) 367 (("volume" "Volume of the book in the series")
368 ((("author" "Author1 [and Author2 ...] [and others]") 368 ("number" "Number of the book in a small series (overwritten by volume)")
369 ("title" "Title of the article in book (BibTeX converts it to lowercase)") 369 ("series" "Series in which the book appeared")
370 ("booktitle" "Name of the book")) 370 ("address")
371 (("pages" "Pages in the book") 371 ("edition" "Edition of the book as a capitalized English word")
372 ("publisher" "Publishing company") 372 ("month") ("note")))
373 ("year" "Year of publication") 373 ("Booklet" "Booklet (Bound, but no Publisher)"
374 ("editor" "Editor1 [and Editor2 ...] [and others]") 374 (("title" "Title of the booklet (BibTeX converts it to lowercase)"))
375 ("volume" "Volume of the book in the series") 375 nil
376 ("number" "Number of the book in a small series (overwritten by volume)") 376 (("author")
377 ("series" "Series in which the book appeared") 377 ("howpublished" "The way in which the booklet was published")
378 ("type" "Word to use instead of \"chapter\"") 378 ("address") ("month") ("year") ("note")))
379 ("chapter" "Chapter in the book") 379 ("PhdThesis" "PhD. Thesis"
380 ("address" "Address of the publisher") 380 (("author")
381 ("edition" "Edition of the book as a capitalized English word") 381 ("title" "Title of the PhD. thesis")
382 ("month" "Month of the publication as a string (remove braces)") 382 ("school" "School where the PhD. thesis was written")
383 ("note" "Remarks to be put at the end of the \\bibitem")))) 383 ("year"))
384 ("InProceedings" 384 nil
385 ((("author" "Author1 [and Author2 ...] [and others]") 385 (("type" "Type of the PhD. thesis")
386 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)") 386 ("address" "Address of the school (if not part of field \"school\") or country")
387 ("booktitle" "Name of the conference proceedings") 387 ("month") ("note")))
388 ("year" "Year of publication")) 388 ("MastersThesis" "Master's Thesis"
389 (("editor" "Editor1 [and Editor2 ...] [and others]") 389 (("author")
390 ("volume" "Volume of the conference proceedings in the series") 390 ("title" "Title of the master's thesis (BibTeX converts it to lowercase)")
391 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") 391 ("school" "School where the master's thesis was written")
392 ("series" "Series in which the conference proceedings appeared") 392 ("year"))
393 ("pages" "Pages in the conference proceedings") 393 nil
394 ("address" "Location of the Proceedings") 394 (("type" "Type of the master's thesis (if other than \"Master's thesis\")")
395 ("month" "Month of the publication as a string (remove braces)") 395 ("address" "Address of the school (if not part of field \"school\") or country")
396 ("organization" "Sponsoring organization of the conference") 396 ("month") ("note")))
397 ("publisher" "Publishing company, its location") 397 ("TechReport" "Technical Report"
398 ("note" "Remarks to be put at the end of the \\bibitem"))) 398 (("author")
399 ((("author" "Author1 [and Author2 ...] [and others]") 399 ("title" "Title of the technical report (BibTeX converts it to lowercase)")
400 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")) 400 ("institution" "Sponsoring institution of the report")
401 (("booktitle" "Name of the conference proceedings") 401 ("year"))
402 ("pages" "Pages in the conference proceedings") 402 nil
403 ("year" "Year of publication") 403 (("type" "Type of the report (if other than \"technical report\")")
404 ("editor" "Editor1 [and Editor2 ...] [and others]") 404 ("number" "Number of the technical report")
405 ("volume" "Volume of the conference proceedings in the series") 405 ("address") ("month") ("note")))
406 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") 406 ("Manual" "Technical Manual"
407 ("series" "Series in which the conference proceedings appeared") 407 (("title" "Title of the manual"))
408 ("address" "Location of the Proceedings") 408 nil
409 ("month" "Month of the publication as a string (remove braces)") 409 (("author")
410 ("organization" "Sponsoring organization of the conference") 410 ("organization" "Publishing organization of the manual")
411 ("publisher" "Publishing company, its location") 411 ("address")
412 ("note" "Remarks to be put at the end of the \\bibitem")))) 412 ("edition" "Edition of the manual as a capitalized English word")
413 ("Manual" 413 ("month") ("year") ("note")))
414 ((("title" "Title of the manual")) 414 ("Unpublished" "Unpublished"
415 (("author" "Author1 [and Author2 ...] [and others]") 415 (("author")
416 ("organization" "Publishing organization of the manual") 416 ("title" "Title of the unpublished work (BibTeX converts it to lowercase)")
417 ("address" "Address of the organization") 417 ("note"))
418 ("edition" "Edition of the manual as a capitalized English word") 418 nil
419 ("month" "Month of the publication as a string (remove braces)") 419 (("month") ("year")))
420 ("year" "Year of publication") 420 ("Misc" "Miscellaneous" nil nil
421 ("note" "Remarks to be put at the end of the \\bibitem")))) 421 (("author")
422 ("MastersThesis" 422 ("title" "Title of the work (BibTeX converts it to lowercase)")
423 ((("author" "Author1 [and Author2 ...] [and others]") 423 ("howpublished" "The way in which the work was published")
424 ("title" "Title of the master\'s thesis (BibTeX converts it to lowercase)") 424 ("month") ("year") ("note"))))
425 ("school" "School where the master\'s thesis was written") 425 "Alist of BibTeX entry types and their associated fields.
426 ("year" "Year of publication")) 426Elements are lists (ENTRY-TYPE DOC REQUIRED CROSSREF OPTIONAL).
427 (("type" "Type of the master\'s thesis (if other than \"Master\'s thesis\")") 427ENTRY-TYPE is the type of a BibTeX entry.
428 ("address" "Address of the school (if not part of field \"school\") or country") 428DOC is a brief doc string used for menus. If nil ENTRY-TYPE is used.
429 ("month" "Month of the publication as a string (remove braces)") 429REQUIRED is a list of required fields.
430 ("note" "Remarks to be put at the end of the \\bibitem")))) 430CROSSREF is a list of fields that are optional if a crossref field
431 ("Misc" 431is present; but these fields are required otherwise.
432 (() 432OPTIONAL is a list of optional fields.
433 (("author" "Author1 [and Author2 ...] [and others]") 433
434 ("title" "Title of the work (BibTeX converts it to lowercase)")
435 ("howpublished" "The way in which the work was published")
436 ("month" "Month of the publication as a string (remove braces)")
437 ("year" "Year of publication")
438 ("note" "Remarks to be put at the end of the \\bibitem"))))
439 ("PhdThesis"
440 ((("author" "Author1 [and Author2 ...] [and others]")
441 ("title" "Title of the PhD. thesis")
442 ("school" "School where the PhD. thesis was written")
443 ("year" "Year of publication"))
444 (("type" "Type of the PhD. thesis")
445 ("address" "Address of the school (if not part of field \"school\") or country")
446 ("month" "Month of the publication as a string (remove braces)")
447 ("note" "Remarks to be put at the end of the \\bibitem"))))
448 ("Proceedings"
449 ((("title" "Title of the conference proceedings")
450 ("year" "Year of publication"))
451 (("booktitle" "Title of the proceedings for cross references")
452 ("editor" "Editor1 [and Editor2 ...] [and others]")
453 ("volume" "Volume of the conference proceedings in the series")
454 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
455 ("series" "Series in which the conference proceedings appeared")
456 ("address" "Location of the Proceedings")
457 ("month" "Month of the publication as a string (remove braces)")
458 ("organization" "Sponsoring organization of the conference")
459 ("publisher" "Publishing company, its location")
460 ("note" "Remarks to be put at the end of the \\bibitem"))))
461 ("TechReport"
462 ((("author" "Author1 [and Author2 ...] [and others]")
463 ("title" "Title of the technical report (BibTeX converts it to lowercase)")
464 ("institution" "Sponsoring institution of the report")
465 ("year" "Year of publication"))
466 (("type" "Type of the report (if other than \"technical report\")")
467 ("number" "Number of the technical report")
468 ("address" "Address of the institution (if not part of field \"institution\") or country")
469 ("month" "Month of the publication as a string (remove braces)")
470 ("note" "Remarks to be put at the end of the \\bibitem"))))
471 ("Unpublished"
472 ((("author" "Author1 [and Author2 ...] [and others]")
473 ("title" "Title of the unpublished work (BibTeX converts it to lowercase)")
474 ("note" "Remarks to be put at the end of the \\bibitem"))
475 (("month" "Month of the publication as a string (remove braces)")
476 ("year" "Year of publication")))))
477
478 "List of BibTeX entry types and their associated fields.
479List elements are triples
480\(ENTRY-TYPE (REQUIRED OPTIONAL) (CROSSREF-REQUIRED CROSSREF-OPTIONAL)).
481ENTRY-TYPE is the type of a BibTeX entry. The remaining pairs contain
482the required and optional fields of the BibTeX entry.
483The second pair is used if a crossref field is present
484and the first pair is used if a crossref field is absent.
485If the second pair is nil, the first pair is always used.
486REQUIRED, OPTIONAL, CROSSREF-REQUIRED and CROSSREF-OPTIONAL are lists.
487Each element of these lists is a list of the form 434Each element of these lists is a list of the form
488\(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG). 435 \(FIELD COMMENT INIT ALTERNATIVE).
489COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional. 436COMMENT, INIT, and ALTERNATIVE are optional.
490FIELD-NAME is the name of the field, COMMENT-STRING is the comment that 437
491appears in the echo area, INIT is either the initial content of the 438FIELD is the name of the field.
492field or a function, which is called to determine the initial content 439COMMENT is the comment string that appears in the echo area.
493of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the 440If COMMENT is nil use `bibtex-BibTeX-field-alist' if possible.
494field is an alternative. ALTERNATIVE-FLAG may be t only in the 441INIT is either the initial content of the field or a function,
495REQUIRED or CROSSREF-REQUIRED lists." 442which is called to determine the initial content of the field.
443ALTERNATIVE if non-nil is an integer that numbers sets of
444alternatives, starting from zero."
445 :group 'BibTeX
446 :type 'bibtex-entry-alist)
447(put 'bibtex-BibTeX-entry-alist 'risky-local-variable t)
448
449(defcustom bibtex-biblatex-entry-alist
450 ;; Compare in biblatex documentation:
451 ;; Sec. 2.1.1 Regular types (required and optional fields)
452 ;; Appendix A Default Crossref setup
453 '(("Article" "Article in Journal"
454 (("author") ("title") ("journaltitle")
455 ("year" nil nil 0) ("date" nil nil 0))
456 nil
457 (("translator") ("annotator") ("commentator") ("subtitle") ("titleaddon")
458 ("editor") ("editora") ("editorb") ("editorc")
459 ("journalsubtitle") ("issuetitle") ("issuesubtitle")
460 ("language") ("origlanguage") ("series") ("volume") ("number") ("eid")
461 ("issue") ("month") ("pages") ("version") ("note") ("issn")
462 ("addendum") ("pubstate") ("doi") ("eprint") ("eprintclass")
463 ("eprinttype") ("url") ("urldate")))
464 ("Book" "Single-Volume Book"
465 (("author") ("title") ("year" nil nil 0) ("date" nil nil 0))
466 nil
467 (("editor") ("editora") ("editorb") ("editorc")
468 ("translator") ("annotator") ("commentator")
469 ("introduction") ("foreword") ("afterword") ("titleaddon")
470 ("maintitle") ("mainsubtitle") ("maintitleaddon")
471 ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes")
472 ("series") ("number") ("note") ("publisher") ("location") ("isbn")
473 ("chapter") ("pages") ("pagetotal") ("addendum") ("pubstate") ("doi")
474 ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
475 ("MVBook" "Multi-Volume Book"
476 (("author") ("title") ("year" nil nil 0) ("date" nil nil 0))
477 nil
478 (("editor") ("editora") ("editorb") ("editorc")
479 ("translator") ("annotator") ("commentator")
480 ("introduction") ("foreword") ("afterword") ("subtitle")
481 ("titleaddon") ("language") ("origlanguage") ("edition") ("volumes")
482 ("series") ("number") ("note") ("publisher")
483 ("location") ("isbn") ("pagetotal") ("addendum") ("pubstate") ("doi")
484 ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
485 ("InBook" "Chapter or Pages in a Book"
486 (("title") ("year" nil nil 0) ("date" nil nil 0))
487 (("author") ("booktitle"))
488 (("bookauthor") ("editor") ("editora") ("editorb") ("editorc")
489 ("translator") ("annotator") ("commentator") ("introduction") ("foreword")
490 ("afterword") ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
491 ("maintitleaddon") ("booksubtitle") ("booktitleaddon")
492 ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes")
493 ("series") ("number") ("note") ("publisher") ("location") ("isbn")
494 ("chapter") ("pages") ("addendum") ("pubstate")
495 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
496 ("BookInBook" "Book in Collection" ; same as @inbook
497 (("title") ("year" nil nil 0) ("date" nil nil 0))
498 (("author") ("booktitle"))
499 (("bookauthor") ("editor") ("editora") ("editorb") ("editorc")
500 ("translator") ("annotator") ("commentator") ("introduction") ("foreword")
501 ("afterword") ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
502 ("maintitleaddon") ("booksubtitle") ("booktitleaddon")
503 ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes")
504 ("series") ("number") ("note") ("publisher") ("location") ("isbn")
505 ("chapter") ("pages") ("addendum") ("pubstate")
506 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
507 ("SuppBook" "Supplemental Material in a Book" ; same as @inbook
508 (("title") ("year" nil nil 0) ("date" nil nil 0))
509 (("author") ("booktitle"))
510 (("bookauthor") ("editor") ("editora") ("editorb") ("editorc")
511 ("translator") ("annotator") ("commentator") ("introduction") ("foreword")
512 ("afterword") ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
513 ("maintitleaddon") ("booksubtitle") ("booktitleaddon")
514 ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes")
515 ("series") ("number") ("note") ("publisher") ("location") ("isbn")
516 ("chapter") ("pages") ("addendum") ("pubstate")
517 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
518 ("Booklet" "Booklet (Bound, but no Publisher)"
519 (("author" nil nil 0) ("editor" nil nil 0) ("title")
520 ("year" nil nil 1) ("date" nil nil 1))
521 nil
522 (("subtitle") ("titleaddon") ("language") ("howpublished") ("type")
523 ("note") ("location") ("chapter") ("pages") ("pagetotal") ("addendum")
524 ("pubstate") ("doi") ("eprint") ("eprintclass") ("eprinttype")
525 ("url") ("urldate")))
526 ("Collection" "Single-Volume Collection"
527 (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
528 nil
529 (("editora") ("editorb") ("editorc") ("translator") ("annotator")
530 ("commentator") ("introduction") ("foreword") ("afterword")
531 ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
532 ("maintitleaddon") ("language") ("origlanguage") ("volume")
533 ("part") ("edition") ("volumes") ("series") ("number") ("note")
534 ("publisher") ("location") ("isbn") ("chapter") ("pages") ("pagetotal")
535 ("addendum") ("pubstate") ("doi") ("eprint") ("eprintclass")
536 ("eprinttype") ("url") ("urldate")))
537 ("MVCollection" "Multi-Volume Collection"
538 (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
539 nil
540 (("editora") ("editorb") ("editorc") ("translator") ("annotator")
541 ("commentator") ("introduction") ("foreword") ("afterword")
542 ("subtitle") ("titleaddon") ("language") ("origlanguage") ("edition")
543 ("volumes") ("series") ("number") ("note") ("publisher")
544 ("location") ("isbn") ("pagetotal") ("addendum") ("pubstate") ("doi")
545 ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
546 ("InCollection" "Article in a Collection"
547 (("author") ("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
548 (("booktitle"))
549 (("editora") ("editorb") ("editorc") ("translator") ("annotator")
550 ("commentator") ("introduction") ("foreword") ("afterword")
551 ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
552 ("maintitleaddon") ("booksubtitle") ("booktitleaddon")
553 ("language") ("origlanguage") ("volume") ("part") ("edition")
554 ("volumes") ("series") ("number") ("note") ("publisher") ("location")
555 ("isbn") ("chapter") ("pages") ("addendum") ("pubstate") ("doi")
556 ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
557 ("SuppCollection" "Supplemental Material in a Collection" ; same as @incollection
558 (("author") ("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
559 (("booktitle"))
560 (("editora") ("editorb") ("editorc") ("translator") ("annotator")
561 ("commentator") ("introduction") ("foreword") ("afterword")
562 ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
563 ("maintitleaddon") ("booksubtitle") ("booktitleaddon")
564 ("language") ("origlanguage") ("volume") ("part") ("edition")
565 ("volumes") ("series") ("number") ("note") ("publisher") ("location")
566 ("isbn") ("chapter") ("pages") ("addendum") ("pubstate") ("doi")
567 ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
568 ("Manual" "Technical Manual"
569 (("author" nil nil 0) ("editor" nil nil 0) ("title")
570 ("year" nil nil 1) ("date" nil nil 1))
571 nil
572 (("subtitle") ("titleaddon") ("language") ("edition")
573 ("type") ("series") ("number") ("version") ("note")
574 ("organization") ("publisher") ("location") ("isbn") ("chapter")
575 ("pages") ("pagetotal") ("addendum") ("pubstate")
576 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
577 ("Misc" "Miscellaneous"
578 (("author" nil nil 0) ("editor" nil nil 0) ("title")
579 ("year" nil nil 1) ("date" nil nil 1))
580 nil
581 (("subtitle") ("titleaddon") ("language") ("howpublished") ("type")
582 ("version") ("note") ("organization") ("location")
583 ("date") ("month") ("year") ("addendum") ("pubstate")
584 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
585 ("Online" "Online Resource"
586 (("author" nil nil 0) ("editor" nil nil 0) ("title")
587 ("year" nil nil 1) ("date" nil nil 1) ("url"))
588 nil
589 (("subtitle") ("titleaddon") ("language") ("version") ("note")
590 ("organization") ("date") ("month") ("year") ("addendum")
591 ("pubstate") ("urldate")))
592 ("Patent" "Patent"
593 (("author") ("title") ("number") ("year" nil nil 0) ("date" nil nil 0))
594 nil
595 (("holder") ("subtitle") ("titleaddon") ("type") ("version") ("location")
596 ("note") ("date") ("month") ("year") ("addendum") ("pubstate")
597 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
598 ("Periodical" "Complete Issue of a Periodical"
599 (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
600 nil
601 (("editora") ("editorb") ("editorc") ("subtitle") ("issuetitle")
602 ("issuesubtitle") ("language") ("series") ("volume") ("number") ("issue")
603 ("date") ("month") ("year") ("note") ("issn") ("addendum") ("pubstate")
604 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
605 ("SuppPeriodical" "Supplemental Material in a Periodical" ; same as @article
606 (("author") ("title") ("journaltitle")
607 ("year" nil nil 0) ("date" nil nil 0))
608 nil
609 (("translator") ("annotator") ("commentator") ("subtitle") ("titleaddon")
610 ("editor") ("editora") ("editorb") ("editorc")
611 ("journalsubtitle") ("issuetitle") ("issuesubtitle")
612 ("language") ("origlanguage") ("series") ("volume") ("number") ("eid")
613 ("issue") ("month") ("pages") ("version") ("note") ("issn")
614 ("addendum") ("pubstate") ("doi") ("eprint") ("eprintclass")
615 ("eprinttype") ("url") ("urldate")))
616 ("Proceedings" "Single-Volume Conference Proceedings"
617 (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
618 nil
619 (("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
620 ("maintitleaddon") ("eventtitle") ("eventdate") ("venue") ("language")
621 ("volume") ("part") ("volumes") ("series") ("number") ("note")
622 ("organization") ("publisher") ("location") ("month")
623 ("isbn") ("chapter") ("pages") ("pagetotal") ("addendum") ("pubstate")
624 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
625 ("MVProceedings" "Multi-Volume Conference Proceedings"
626 (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
627 nil
628 (("subtitle") ("titleaddon") ("eventtitle") ("eventdate") ("venue")
629 ("language") ("volumes") ("series") ("number") ("note")
630 ("organization") ("publisher") ("location") ("month")
631 ("isbn") ("pagetotal") ("addendum") ("pubstate")
632 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
633 ("InProceedings" "Article in Conference Proceedings"
634 (("author") ("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
635 (("booktitle"))
636 (("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
637 ("maintitleaddon") ("booksubtitle") ("booktitleaddon")
638 ("eventtitle") ("eventdate") ("venue") ("language")
639 ("volume") ("part") ("volumes") ("series") ("number") ("note")
640 ("organization") ("publisher") ("location") ("month") ("isbn")
641 ("chapter") ("pages") ("addendum") ("pubstate")
642 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
643 ("Reference" "Single-Volume Work of Reference" ; same as @collection
644 (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
645 nil
646 (("editora") ("editorb") ("editorc") ("translator") ("annotator")
647 ("commentator") ("introduction") ("foreword") ("afterword")
648 ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
649 ("maintitleaddon") ("language") ("origlanguage") ("volume")
650 ("part") ("edition") ("volumes") ("series") ("number") ("note")
651 ("publisher") ("location") ("isbn") ("chapter") ("pages") ("pagetotal")
652 ("addendum") ("pubstate") ("doi") ("eprint") ("eprintclass")
653 ("eprinttype") ("url") ("urldate")))
654 ("MVReference" "Multi-Volume Work of Reference" ; same as @mvcollection
655 (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
656 nil
657 (("editora") ("editorb") ("editorc") ("translator") ("annotator")
658 ("commentator") ("introduction") ("foreword") ("afterword")
659 ("subtitle") ("titleaddon") ("language") ("origlanguage") ("edition")
660 ("volumes") ("series") ("number") ("note") ("publisher")
661 ("location") ("isbn") ("pagetotal") ("addendum") ("pubstate") ("doi")
662 ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
663 ("InReference" "Article in a Work of Reference" ; same as @incollection
664 (("author") ("editor") ("title") ("year" nil nil 0) ("date" nil nil 0))
665 (("booktitle"))
666 (("editora") ("editorb") ("editorc") ("translator") ("annotator")
667 ("commentator") ("introduction") ("foreword") ("afterword")
668 ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle")
669 ("maintitleaddon") ("booksubtitle") ("booktitleaddon")
670 ("language") ("origlanguage") ("volume") ("part") ("edition")
671 ("volumes") ("series") ("number") ("note") ("publisher") ("location")
672 ("isbn") ("chapter") ("pages") ("addendum") ("pubstate") ("doi")
673 ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
674 ("Report" "Technical or Research Report"
675 (("author") ("title") ("type") ("institution")
676 ("year" nil nil 0) ("date" nil nil 0))
677 nil
678 (("subtitle") ("titleaddon") ("language") ("number") ("version") ("note")
679 ("location") ("month") ("isrn") ("chapter") ("pages") ("pagetotal")
680 ("addendum") ("pubstate")
681 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
682 ("Thesis" "PhD. or Master's Thesis"
683 (("author") ("title") ("type") ("institution")
684 ("year" nil nil 0) ("date" nil nil 0))
685 nil
686 (("subtitle") ("titleaddon") ("language") ("note") ("location")
687 ("month") ("isbn") ("chapter") ("pages") ("pagetotal")
688 ("addendum") ("pubstate")
689 ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate")))
690 ("Unpublished" "Unpublished"
691 (("author") ("title") ("year" nil nil 0) ("date" nil nil 0))
692 nil
693 (("subtitle") ("titleaddon") ("language") ("howpublished")
694 ("note") ("location") ("isbn") ("date") ("month") ("year")
695 ("addendum") ("pubstate") ("url") ("urldate"))))
696 "Alist of biblatex entry types and their associated fields.
697It has the same format as `bibtex-BibTeX-entry-alist'."
496 :group 'bibtex 698 :group 'bibtex
497 :type '(repeat (group (string :tag "Entry type") 699 :type 'bibtex-entry-alist)
498 (group (repeat :tag "Required fields" 700(put 'bibtex-biblatex-entry-alist 'risky-local-variable t)
499 (group (string :tag "Field") 701
500 (string :tag "Comment") 702(define-widget 'bibtex-field-alist 'lazy
501 (option (choice :tag "Init" :value nil 703 "Format of `bibtex-BibTeX-entry-alist' and friends."
502 (const nil) string function)) 704 :type '(repeat (group (string :tag "Field type")
503 (option (choice :tag "Alternative" 705 (string :tag "Comment"))))
504 (const :tag "No" nil) 706
505 (const :tag "Yes" t))))) 707(defcustom bibtex-BibTeX-field-alist
506 (repeat :tag "Optional fields" 708 '(("author" "Author1 [and Author2 ...] [and others]")
507 (group (string :tag "Field") 709 ("editor" "Editor1 [and Editor2 ...] [and others]")
508 (string :tag "Comment") 710 ("journal" "Name of the journal (use string, remove braces)")
509 (option (choice :tag "Init" :value nil 711 ("year" "Year of publication")
510 (const nil) string function))))) 712 ("month" "Month of the publication as a string (remove braces)")
511 (option :extra-offset -4 713 ("note" "Remarks to be put at the end of the \\bibitem")
512 (group (repeat :tag "Crossref: required fields" 714 ("publisher" "Publishing company")
513 (group (string :tag "Field") 715 ("address" "Address of the publisher"))
514 (string :tag "Comment") 716 "Alist of BibTeX fields.
515 (option (choice :tag "Init" :value nil 717Each element is a list (FIELD COMMENT). COMMENT is used as a default
516 (const nil) string function)) 718if `bibtex-BibTeX-entry-alist' does not define a comment for FIELD."
517 (option (choice :tag "Alternative" 719 :group 'bibtex
518 (const :tag "No" nil) 720 :type 'bibtex-field-alist)
519 (const :tag "Yes" t))))) 721
520 (repeat :tag "Crossref: optional fields" 722(defcustom bibtex-biblatex-field-alist
521 (group (string :tag "Field") 723 ;; See 2.2.2 Data Fields
522 (string :tag "Comment") 724 '(("abstract" "Abstract of the work")
523 (option (choice :tag "Init" :value nil 725 ("addendum" "Miscellaneous bibliographic data")
524 (const nil) string function))))))))) 726 ("afterword" "Author(s) of an afterword to the work")
525(put 'bibtex-entry-field-alist 'risky-local-variable t) 727 ("annotation" "Annotation")
728 ("annotator" "Author(s) of annotations to the work")
729 ("author" "Author(s) of the title")
730 ("bookauthor" "Author(s) of the booktitle.")
731 ("bookpagination" "Pagination scheme of the enclosing work")
732 ("booksubtitle" "Subtitle related to the booktitle")
733 ("booktitle" "Title of the book")
734 ("booktitleaddon" "Annex to the booktitle")
735 ("chapter" "Chapter, section, or any other unit of a work")
736 ("commentator" "Author(s) of a commentary to the work")
737 ("date" "Publication date")
738 ("doi" "Digital Object Identifier")
739 ("edition" "Edition of a printed publication")
740 ("editor" "Editor(s) of the title, booktitle, or maintitle")
741 ("editora" "Secondary editor")
742 ("editorb" "Secondary editor")
743 ("editorc" "Secondary editor")
744 ("editortype" "Type of editorial role performed by the editor")
745 ("editoratype" "Type of editorial role performed by editora")
746 ("editorbtype" "Type of editorial role performed by editorb")
747 ("editorctype" "Type of editorial role performed by editorc")
748 ("eid" "Electronic identifier of an article")
749 ("eprint" "Electronic identifier of an online publication")
750 ("eprintclass" "Additional information related to the eprinttype")
751 ("eprinttype" "Type of eprint identifier")
752 ("eventdate" "Date of a conference or some other event")
753 ("eventtitle" "Title of a conference or some other event")
754 ("file" "Local link to an electronic version of the work")
755 ("foreword" "Author(s) of a foreword to the work")
756 ("holder" "Holder(s) of a patent")
757 ("howpublished" "Publication notice for unusual publications")
758 ("indextitle" "Title to use for indexing instead of the regular title")
759 ("institution" "Name of a university or some other institution")
760 ("introduction" "Author(s) of an introduction to the work")
761 ("isan" "International Standard Audiovisual Number of an audiovisual work")
762 ("isbn" "International Standard Book Number of a book.")
763 ("ismn" "International Standard Music Number for printed music")
764 ("isrn" "International Standard Technical Report Number")
765 ("issn" "International Standard Serial Number of a periodical.")
766 ("issue" "Issue of a journal")
767 ("issuesubtitle" "Subtitle of a specific issue of a journal or other periodical.")
768 ("issuetitle" "Title of a specific issue of a journal or other periodical.")
769 ("iswc" "International Standard Work Code of a musical work")
770 ("journalsubtitle" "Subtitle of a journal, a newspaper, or some other periodical.")
771 ("journaltitle" "Name of a journal, a newspaper, or some other periodical.")
772 ("label" "Substitute for the regular label to be used by the citation style")
773 ("language" "Language(s) of the work")
774 ("library" "Library name and a call number")
775 ("location" "Place(s) of publication")
776 ("mainsubtitle" "Subtitle related to the maintitle")
777 ("maintitle" "Main title of a multi-volume book, such as Collected Works")
778 ("maintitleaddon" "Annex to the maintitle")
779 ("month" "Publication month")
780 ("nameaddon" "Addon to be printed immediately after the author name")
781 ("note" "Miscellaneous bibliographic data")
782 ("number" "Number of a journal or the volume/number of a book in a series")
783 ("organization" "Organization(s) that published a work")
784 ("origdate" "Publication date of the original edition")
785 ("origlanguage" "Original publication language of a translated edition")
786 ("origlocation" "Location of the original edition")
787 ("origpublisher" "Publisher of the original edition")
788 ("origtitle" "Title of the original work")
789 ("pages" "Page number(s) or page range(s)")
790 ("pagetotal" "Total number of pages of the work.")
791 ("pagination" "Pagination of the work")
792 ("part" "Number of a partial volume")
793 ("publisher" "Name(s) of the publisher(s)")
794 ("pubstate" "Publication state of the work, e. g.,'in press'")
795 ("reprinttitle" "Title of a reprint of the work")
796 ("series" "Name of a publication series")
797 ("shortauthor" "Author(s) of the work, given in an abbreviated form")
798 ("shorteditor" "Editor(s) of the work, given in an abbreviated form")
799 ("shortjournal" "Short version or an acronym of the journal title")
800 ("shortseries" "Short version or an acronym of the series field")
801 ("shorttitle" "Title in an abridged form")
802 ("subtitle" "Subtitle of the work")
803 ("title" "Title of the work")
804 ("titleaddon" "Annex to the title")
805 ("translator" "Translator(s) of the work")
806 ("type" "Type of a manual, patent, report, or thesis")
807 ("url" " URL of an online publication.")
808 ("urldate" "Access date of the address specified in the url field")
809 ("venue" "Location of a conference, a symposium, or some other event")
810 ("version" "Revision number of a piece of software, a manual, etc.")
811 ("volume" "Volume of a multi-volume book or a periodical")
812 ("volumes" "Total number of volumes of a multi-volume work")
813 ("year" "Year of publication"))
814 "Alist of biblatex fields.
815It has the same format as `bibtex-BibTeX-entry-alist'."
816 :group 'bibtex
817 :type 'bibtex-field-alist)
818
819(defcustom bibtex-dialect-list '(BibTeX biblatex)
820 "List of BibTeX dialects known to BibTeX mode.
821For each DIALECT (a symbol) a variable bibtex-DIALECT-entry-alist defines
822the allowed entries and bibtex-DIALECT-field-alist defines known field types.
823Predefined dialects include BibTeX and biblatex."
824 :group 'bibtex
825 :type '(repeat (symbol :tag "Dialect")))
826
827(defcustom bibtex-dialect 'BibTeX
828 "Current BibTeX dialect. For allowed values see `bibtex-dialect-list'.
829During a session change it via `bibtex-set-dialect'."
830 :group 'bibtex
831 :set '(lambda (symbol value)
832 (set-default symbol value)
833 ;; `bibtex-set-dialect' is undefined during loading (no problem)
834 (if (fboundp 'bibtex-set-dialect)
835 (bibtex-set-dialect value)))
836 :type '(choice (const BibTeX)
837 (const biblatex)
838 (symbol :tag "Custom")))
839
840(defcustom bibtex-no-opt-remove-re "\\`option"
841 "If a field name matches this regexp, the prefix OPT is not removed.
842If nil prefix OPT is always removed"
843 :group 'bibtex
844 :type '(choice (regexp) (const nil)))
526 845
527(defcustom bibtex-comment-start "@Comment" 846(defcustom bibtex-comment-start "@Comment"
528 "String starting a BibTeX comment." 847 "String starting a BibTeX comment."
@@ -1120,29 +1439,15 @@ Set this variable before loading BibTeX mode."
1120 ["(Re)Initialize BibTeX Buffers" bibtex-initialize t] 1439 ["(Re)Initialize BibTeX Buffers" bibtex-initialize t]
1121 ["Validate Entries" bibtex-validate-globally t]))) 1440 ["Validate Entries" bibtex-validate-globally t])))
1122 1441
1123(easy-menu-define
1124 bibtex-entry-menu bibtex-mode-map "Entry-Types Menu in BibTeX mode"
1125 (list "Entry-Types"
1126 ["Article in Journal" bibtex-Article t]
1127 ["Article in Conference Proceedings" bibtex-InProceedings t]
1128 ["Article in a Collection" bibtex-InCollection t]
1129 ["Chapter or Pages in a Book" bibtex-InBook t]
1130 ["Conference Proceedings" bibtex-Proceedings t]
1131 ["Book" bibtex-Book t]
1132 ["Booklet (Bound, but no Publisher/Institution)" bibtex-Booklet t]
1133 ["PhD. Thesis" bibtex-PhdThesis t]
1134 ["Master's Thesis" bibtex-MastersThesis t]
1135 ["Technical Report" bibtex-TechReport t]
1136 ["Technical Manual" bibtex-Manual t]
1137 ["Unpublished" bibtex-Unpublished t]
1138 ["Miscellaneous" bibtex-Misc t]
1139 "--"
1140 ["String" bibtex-String t]
1141 ["Preamble" bibtex-Preamble t]))
1142
1143 1442
1144;; Internal Variables 1443;; Internal Variables
1145 1444
1445(defvar bibtex-entry-alist bibtex-BibTeX-entry-alist
1446 "Alist of currently active entry types.")
1447
1448(defvar bibtex-field-alist bibtex-BibTeX-field-alist
1449 "Alist of currently active field types.")
1450
1146(defvar bibtex-field-braces-opt nil 1451(defvar bibtex-field-braces-opt nil
1147 "Optimized value of `bibtex-field-braces-alist'. 1452 "Optimized value of `bibtex-field-braces-alist'.
1148Created by `bibtex-field-re-init'. 1453Created by `bibtex-field-re-init'.
@@ -1237,33 +1542,26 @@ The CDRs of the elements are t for header keys and nil for crossref keys.")
1237(defconst bibtex-field-const "[][[:alnum:].:;?!`'/*@+=|<>&_^$-]+" 1542(defconst bibtex-field-const "[][[:alnum:].:;?!`'/*@+=|<>&_^$-]+"
1238 "Regexp matching a BibTeX field constant.") 1543 "Regexp matching a BibTeX field constant.")
1239 1544
1240(defvar bibtex-entry-type 1545(defvar bibtex-entry-type nil
1241 (concat "@[ \t]*\\(?:" 1546 "Regexp matching the type of a BibTeX entry.
1242 (regexp-opt (mapcar 'car bibtex-entry-field-alist)) "\\)") 1547Initialized by `bibtex-set-dialect'.")
1243 "Regexp matching the type of a BibTeX entry.")
1244 1548
1245(defvar bibtex-entry-head 1549(defvar bibtex-entry-head nil
1246 (concat "^[ \t]*\\(" 1550 "Regexp matching the header line of a BibTeX entry (including key).
1247 bibtex-entry-type 1551Initialized by `bibtex-set-dialect'.")
1248 "\\)[ \t]*[({][ \t\n]*\\("
1249 bibtex-reference-key
1250 "\\)")
1251 "Regexp matching the header line of a BibTeX entry (including key).")
1252 1552
1253(defvar bibtex-entry-maybe-empty-head 1553(defvar bibtex-entry-maybe-empty-head nil
1254 (concat bibtex-entry-head "?") 1554 "Regexp matching the header line of a BibTeX entry (possibly without key).
1255 "Regexp matching the header line of a BibTeX entry (possibly without key).") 1555Initialized by `bibtex-set-dialect'.")
1256 1556
1257(defconst bibtex-any-entry-maybe-empty-head 1557(defconst bibtex-any-entry-maybe-empty-head
1258 (concat "^[ \t]*\\(@[ \t]*" bibtex-field-name "\\)[ \t]*[({][ \t\n]*\\(" 1558 (concat "^[ \t]*\\(@[ \t]*" bibtex-field-name "\\)[ \t]*[({][ \t\n]*\\("
1259 bibtex-reference-key "\\)?") 1559 bibtex-reference-key "\\)?")
1260 "Regexp matching the header line of any BibTeX entry (possibly without key).") 1560 "Regexp matching the header line of any BibTeX entry (possibly without key).")
1261 1561
1262(defvar bibtex-any-valid-entry-type 1562(defvar bibtex-any-valid-entry-type nil
1263 (concat "^[ \t]*@[ \t]*\\(?:" 1563 "Regexp matching any valid BibTeX entry (including String and Preamble).
1264 (regexp-opt (append '("String" "Preamble") 1564Initialized by `bibtex-set-dialect'.")
1265 (mapcar 'car bibtex-entry-field-alist))) "\\)")
1266 "Regexp matching any valid BibTeX entry (including String and Preamble).")
1267 1565
1268(defconst bibtex-type-in-head 1 1566(defconst bibtex-type-in-head 1
1269 "Regexp subexpression number of the type part in `bibtex-entry-head'.") 1567 "Regexp subexpression number of the type part in `bibtex-entry-head'.")
@@ -1520,7 +1818,9 @@ If optional arg REMOVE-OPT-ALT is non-nil remove \"OPT\" and \"ALT\"."
1520 (bibtex-start-of-name-in-field bounds) 1818 (bibtex-start-of-name-in-field bounds)
1521 (bibtex-end-of-name-in-field bounds)))) 1819 (bibtex-end-of-name-in-field bounds))))
1522 (if (and remove-opt-alt 1820 (if (and remove-opt-alt
1523 (string-match "\\`\\(OPT\\|ALT\\)" name)) 1821 (string-match "\\`\\(OPT\\|ALT\\)" name)
1822 (not (and bibtex-no-opt-remove-re
1823 (string-match bibtex-no-opt-remove-re name))))
1524 (substring name 3) 1824 (substring name 3)
1525 name))) 1825 name)))
1526 1826
@@ -1686,7 +1986,7 @@ Point must be at beginning of preamble. Do not move point."
1686(defun bibtex-valid-entry (&optional empty-key) 1986(defun bibtex-valid-entry (&optional empty-key)
1687 "Parse a valid BibTeX entry (maybe without key if EMPTY-KEY is t). 1987 "Parse a valid BibTeX entry (maybe without key if EMPTY-KEY is t).
1688A valid entry is a syntactical correct one with type contained in 1988A valid entry is a syntactical correct one with type contained in
1689`bibtex-entry-field-alist'. Ignore @String and @Preamble entries. 1989`bibtex-BibTeX-entry-alist'. Ignore @String and @Preamble entries.
1690Return a cons pair with buffer positions of beginning and end of entry 1990Return a cons pair with buffer positions of beginning and end of entry
1691if a valid entry is found, nil otherwise. Do not move point. 1991if a valid entry is found, nil otherwise. Do not move point.
1692After a call to this function `match-data' corresponds to the header 1992After a call to this function `match-data' corresponds to the header
@@ -1717,7 +2017,7 @@ of the entry, see regexp `bibtex-entry-head'."
1717Do not move if we are already at beginning of a valid BibTeX entry. 2017Do not move if we are already at beginning of a valid BibTeX entry.
1718With optional argument BACKWARD non-nil, move backward to 2018With optional argument BACKWARD non-nil, move backward to
1719beginning of previous valid one. A valid entry is a syntactical correct one 2019beginning of previous valid one. A valid entry is a syntactical correct one
1720with type contained in `bibtex-entry-field-alist' or, if 2020with type contained in `bibtex-BibTeX-entry-alist' or, if
1721`bibtex-sort-ignore-string-entries' is nil, a syntactical correct string 2021`bibtex-sort-ignore-string-entries' is nil, a syntactical correct string
1722entry. Return buffer position of beginning and end of entry if a valid 2022entry. Return buffer position of beginning and end of entry if a valid
1723entry is found, nil otherwise." 2023entry is found, nil otherwise."
@@ -1911,6 +2211,14 @@ Optional arg COMMA is as in `bibtex-enclosing-field'."
1911 (let ((key (bibtex-key-in-head))) 2211 (let ((key (bibtex-key-in-head)))
1912 (if key (push (cons key t) bibtex-reference-keys)))))))) 2212 (if key (push (cons key t) bibtex-reference-keys))))))))
1913 2213
2214(defsubst bibtex-vec-push (vec idx newelt)
2215 "Add NEWELT to the list stored in VEC at index IDX."
2216 (aset vec idx (cons newelt (aref vec idx))))
2217
2218(defsubst bibtex-vec-incr (vec idx)
2219 "Add NEWELT to the list stored in VEC at index IDX."
2220 (aset vec idx (1+ (aref vec idx))))
2221
1914(defun bibtex-format-entry () 2222(defun bibtex-format-entry ()
1915 "Helper function for `bibtex-clean-entry'. 2223 "Helper function for `bibtex-clean-entry'.
1916Formats current entry according to variable `bibtex-entry-format'." 2224Formats current entry according to variable `bibtex-entry-format'."
@@ -1932,7 +2240,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1932 bibtex-entry-format)) 2240 bibtex-entry-format))
1933 (left-delim-re (regexp-quote (bibtex-field-left-delimiter))) 2241 (left-delim-re (regexp-quote (bibtex-field-left-delimiter)))
1934 bounds crossref-key req-field-list default-field-list field-list 2242 bounds crossref-key req-field-list default-field-list field-list
1935 alt-fields error-field-name) 2243 num-alt alt-fields idx error-field-name)
1936 (unwind-protect 2244 (unwind-protect
1937 ;; formatting (undone if error occurs) 2245 ;; formatting (undone if error occurs)
1938 (atomic-change-group 2246 (atomic-change-group
@@ -1954,7 +2262,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1954 (end-type (match-end 0)) 2262 (end-type (match-end 0))
1955 (entry-list (assoc-string (buffer-substring-no-properties 2263 (entry-list (assoc-string (buffer-substring-no-properties
1956 beg-type end-type) 2264 beg-type end-type)
1957 bibtex-entry-field-alist t))) 2265 bibtex-entry-alist t)))
1958 2266
1959 ;; unify case of entry type 2267 ;; unify case of entry type
1960 (when (memq 'unify-case format) 2268 (when (memq 'unify-case format)
@@ -1978,13 +2286,18 @@ Formats current entry according to variable `bibtex-entry-format'."
1978 2286
1979 ;; list of required fields appropriate for an entry with 2287 ;; list of required fields appropriate for an entry with
1980 ;; or without crossref key. 2288 ;; or without crossref key.
1981 (setq req-field-list (if (and crossref-key (nth 2 entry-list)) 2289 (setq req-field-list (if crossref-key (nth 2 entry-list)
1982 (car (nth 2 entry-list)) 2290 (append (nth 2 entry-list) (nth 3 entry-list)))
1983 (car (nth 1 entry-list)))
1984 ;; default list of fields that may appear in this entry 2291 ;; default list of fields that may appear in this entry
1985 default-field-list (append (nth 0 (nth 1 entry-list)) 2292 default-field-list (append (nth 2 entry-list) (nth 3 entry-list)
1986 (nth 1 (nth 1 entry-list)) 2293 (nth 4 entry-list)
1987 bibtex-user-optional-fields)) 2294 bibtex-user-optional-fields)
2295 ;; number of ALT fields we expect to find
2296 num-alt (length (delq nil (delete-dups
2297 (mapcar (lambda (x) (nth 3 x))
2298 req-field-list))))
2299 ;; ALT fields of respective groups
2300 alt-fields (make-vector num-alt nil))
1988 2301
1989 (when (memq 'sort-fields format) 2302 (when (memq 'sort-fields format)
1990 (goto-char (point-min)) 2303 (goto-char (point-min))
@@ -1995,10 +2308,10 @@ Formats current entry according to variable `bibtex-entry-format'."
1995 (dolist (field default-field-list) 2308 (dolist (field default-field-list)
1996 (when (setq elt (assoc-string (car field) fields-alist t)) 2309 (when (setq elt (assoc-string (car field) fields-alist t))
1997 (setq fields-alist (delete elt fields-alist)) 2310 (setq fields-alist (delete elt fields-alist))
1998 (bibtex-make-field (list (car elt) "" (cdr elt)) nil nil t))) 2311 (bibtex-make-field (list (car elt) nil (cdr elt)) nil nil t)))
1999 (dolist (field fields-alist) 2312 (dolist (field fields-alist)
2000 (unless (member (car field) '("=key=" "=type=")) 2313 (unless (member (car field) '("=key=" "=type="))
2001 (bibtex-make-field (list (car field) "" (cdr field)) nil nil t)))))) 2314 (bibtex-make-field (list (car field) nil (cdr field)) nil nil t))))))
2002 2315
2003 ;; process all fields 2316 ;; process all fields
2004 (bibtex-beginning-first-field (point-min)) 2317 (bibtex-beginning-first-field (point-min))
@@ -2009,17 +2322,18 @@ Formats current entry according to variable `bibtex-entry-format'."
2009 (end-name (copy-marker (bibtex-end-of-name-in-field bounds))) 2322 (end-name (copy-marker (bibtex-end-of-name-in-field bounds)))
2010 (beg-text (copy-marker (bibtex-start-of-text-in-field bounds))) 2323 (beg-text (copy-marker (bibtex-start-of-text-in-field bounds)))
2011 (end-text (copy-marker (bibtex-end-of-text-in-field bounds) t)) 2324 (end-text (copy-marker (bibtex-end-of-text-in-field bounds) t))
2012 (opt-alt (string-match "OPT\\|ALT"
2013 (buffer-substring-no-properties
2014 beg-name (+ beg-name 3))))
2015 (field-name (buffer-substring-no-properties
2016 (if opt-alt (+ beg-name 3) beg-name) end-name))
2017 (empty-field (equal "" (bibtex-text-in-field-bounds bounds t))) 2325 (empty-field (equal "" (bibtex-text-in-field-bounds bounds t)))
2326 (field-name (buffer-substring-no-properties beg-name end-name))
2327 (opt-alt (and (string-match "\\`\\(OPT\\|ALT\\)" field-name)
2328 (not (and bibtex-no-opt-remove-re
2329 (string-match bibtex-no-opt-remove-re
2330 field-name)))))
2018 deleted) 2331 deleted)
2332 (if opt-alt (setq field-name (substring field-name 3)))
2019 2333
2020 ;; keep track of alternatives 2334 ;; keep track of alternatives
2021 (if (nth 3 (assoc-string field-name req-field-list t)) 2335 (if (setq idx (nth 3 (assoc-string field-name req-field-list t)))
2022 (push field-name alt-fields)) 2336 (bibtex-vec-push alt-fields idx field-name))
2023 2337
2024 (if (memq 'opts-or-alts format) 2338 (if (memq 'opts-or-alts format)
2025 ;; delete empty optional and alternative fields 2339 ;; delete empty optional and alternative fields
@@ -2170,12 +2484,14 @@ Formats current entry according to variable `bibtex-entry-format'."
2170 2484
2171 ;; check whether all required fields are present 2485 ;; check whether all required fields are present
2172 (if (memq 'required-fields format) 2486 (if (memq 'required-fields format)
2173 (let ((found 0) alt-list) 2487 (let ((alt-expect (make-vector num-alt nil))
2488 (alt-found (make-vector num-alt 0)))
2174 (dolist (fname req-field-list) 2489 (dolist (fname req-field-list)
2175 (cond ((nth 3 fname) ; t if field has alternative flag 2490 (cond ((setq idx (nth 3 fname))
2176 (push (car fname) alt-list) 2491 ;; t if field has alternative flag
2492 (bibtex-vec-push alt-expect idx (car fname))
2177 (if (member-ignore-case (car fname) field-list) 2493 (if (member-ignore-case (car fname) field-list)
2178 (setq found (1+ found)))) 2494 (bibtex-vec-incr alt-found idx)))
2179 ((not (member-ignore-case (car fname) field-list)) 2495 ((not (member-ignore-case (car fname) field-list))
2180 ;; If we use the crossref field, a required field 2496 ;; If we use the crossref field, a required field
2181 ;; can have the OPT prefix. So if it was empty, 2497 ;; can have the OPT prefix. So if it was empty,
@@ -2183,17 +2499,16 @@ Formats current entry according to variable `bibtex-entry-format'."
2183 ;; move point on this empty field. 2499 ;; move point on this empty field.
2184 (setq error-field-name (car fname)) 2500 (setq error-field-name (car fname))
2185 (error "Mandatory field `%s' is missing" (car fname))))) 2501 (error "Mandatory field `%s' is missing" (car fname)))))
2186 (if alt-list 2502 (dotimes (idx num-alt)
2187 (cond ((= found 0) 2503 (cond ((= 0 (aref alt-found idx))
2188 (if alt-fields 2504 (setq error-field-name (car (last (aref alt-fields idx))))
2189 (setq error-field-name (car (last alt-fields)))) 2505 (error "Alternative mandatory field `%s' is missing"
2190 (error "Alternative mandatory field `%s' is missing" 2506 (aref alt-expect idx)))
2191 alt-list)) 2507 ((< 1 (aref alt-found idx))
2192 ((> found 1) 2508 (setq error-field-name (car (last (aref alt-fields idx))))
2193 (if alt-fields 2509 (error "Alternative fields `%s' are defined %s times"
2194 (setq error-field-name (car (last alt-fields)))) 2510 (aref alt-expect idx)
2195 (error "Alternative fields `%s' are defined %s times" 2511 (length (aref alt-fields idx))))))))
2196 alt-list found))))))
2197 2512
2198 ;; update comma after last field 2513 ;; update comma after last field
2199 (if (memq 'last-comma format) 2514 (if (memq 'last-comma format)
@@ -2547,7 +2862,7 @@ for parsing BibTeX keys. If parsing fails, try to set this variable to nil."
2547 (push (list key) crossref-keys)))) 2862 (push (list key) crossref-keys))))
2548 ;; only keys of known entries 2863 ;; only keys of known entries
2549 ((assoc-string (bibtex-type-in-head) 2864 ((assoc-string (bibtex-type-in-head)
2550 bibtex-entry-field-alist t) 2865 bibtex-entry-alist t)
2551 ;; This is an entry. 2866 ;; This is an entry.
2552 (let ((key (bibtex-key-in-head))) 2867 (let ((key (bibtex-key-in-head)))
2553 (unless (assoc key ref-keys) 2868 (unless (assoc key ref-keys)
@@ -3056,25 +3371,122 @@ if that value is non-nil.
3056 bibtex-font-lock-syntactic-keywords)) 3371 bibtex-font-lock-syntactic-keywords))
3057 (setq imenu-generic-expression 3372 (setq imenu-generic-expression
3058 (list (list nil bibtex-entry-head bibtex-key-in-head)) 3373 (list (list nil bibtex-entry-head bibtex-key-in-head))
3059 imenu-case-fold-search t)) 3374 imenu-case-fold-search t)
3375 (bibtex-set-dialect bibtex-dialect))
3376
3377(defun bibtex-set-dialect (dialect)
3378 "Select BibTeX mode DIALECT.
3379This sets the variable `bibtex-dialect' which holds the currently active
3380dialect. Dialects are listed in `bibtex-dialect-list'."
3381 (interactive (list (intern (completing-read "Dialect: "
3382 (mapcar 'list bibtex-dialect-list)
3383 nil t))))
3384 (unless (eq dialect (get 'bibtex-dialect 'dialect))
3385 (put 'bibtex-dialect 'dialect dialect)
3386 (setq bibtex-dialect dialect)
3387
3388 ;; Bind variables
3389 (setq bibtex-entry-alist
3390 (let ((var (intern (format "bibtex-%s-entry-alist" dialect)))
3391 entry-alist)
3392 (if (boundp var)
3393 (setq entry-alist (symbol-value var))
3394 (error "BibTeX dialect `%s' undefined" dialect))
3395 (if (not (consp (nth 1 (car entry-alist))))
3396 ;; new format
3397 entry-alist
3398 ;; Convert old format
3399 (unless (get var 'entry-list-format)
3400 (put var 'entry-list-format "pre-24")
3401 (message "Old format of `%s' (pre GNU Emacs 24).
3402Please convert to the new format."
3403 (if (eq (indirect-variable 'bibtex-entry-field-alist) var)
3404 'bibtex-entry-field-alist var))
3405 (sit-for 3))
3406 (let (lst)
3407 (dolist (entry entry-alist)
3408 (let ((fl (nth 1 entry)) req xref opt)
3409 (dolist (field (copy-tree (car fl)))
3410 (if (nth 3 field) (setcar (nthcdr 3 field) 0))
3411 (if (or (not (nth 2 entry))
3412 (assoc-string (car field) (car (nth 2 entry)) t))
3413 (push field req)
3414 (push field xref)))
3415 (dolist (field (nth 1 fl))
3416 (push field opt))
3417 (push (list (car entry) nil (nreverse req)
3418 (nreverse xref) (nreverse opt))
3419 lst)))
3420 (nreverse lst))))
3421 bibtex-field-alist
3422 (let ((var (intern (format "bibtex-%s-field-alist" dialect))))
3423 (if (boundp var)
3424 (symbol-value var)
3425 (error "Field types for BibTeX dialect `%s' undefined" dialect)))
3426 bibtex-entry-type
3427 (concat "@[ \t]*\\(?:"
3428 (regexp-opt (mapcar 'car bibtex-entry-alist)) "\\)")
3429 bibtex-entry-head (concat "^[ \t]*\\("
3430 bibtex-entry-type
3431 "\\)[ \t]*[({][ \t\n]*\\("
3432 bibtex-reference-key
3433 "\\)")
3434 bibtex-entry-maybe-empty-head (concat bibtex-entry-head "?")
3435 bibtex-any-valid-entry-type
3436 (concat "^[ \t]*@[ \t]*\\(?:"
3437 (regexp-opt (append '("String" "Preamble")
3438 (mapcar 'car bibtex-entry-alist))) "\\)"))
3439 ;; Define entry commands
3440 (dolist (elt bibtex-entry-alist)
3441 (let* ((entry (car elt))
3442 (fname (intern (concat "bibtex-" entry))))
3443 (unless (fboundp fname)
3444 (eval (list 'defun fname nil
3445 (format "Insert a new BibTeX @%s entry; see also `bibtex-entry'."
3446 entry)
3447 '(interactive "*")
3448 `(bibtex-entry ,entry))))))
3449 ;; Define menu
3450 ;; We use the same keymap for all BibTeX buffers. So all these buffers
3451 ;; have the same BibTeX dialect. To define entry types buffer-locally,
3452 ;; it would be necessary to give each BibTeX buffer a new keymap that
3453 ;; becomes a child of `bibtex-mode-map'. Useful??
3454 (easy-menu-define
3455 nil bibtex-mode-map "Entry-Types Menu in BibTeX mode"
3456 (apply 'list "Entry-Types"
3457 (append
3458 (mapcar (lambda (entry)
3459 (vector (or (nth 1 entry) (car entry))
3460 (intern (format "bibtex-%s" (car entry))) t))
3461 bibtex-entry-alist)
3462 `("---"
3463 ["String" bibtex-String t]
3464 ["Preamble" bibtex-Preamble t]
3465 "---"
3466 ,(append '("BibTeX dialect")
3467 (mapcar (lambda (dialect)
3468 (vector (symbol-name dialect)
3469 `(lambda () (interactive)
3470 (bibtex-set-dialect ',dialect))
3471 t))
3472 bibtex-dialect-list))))))))
3060 3473
3061(defun bibtex-field-list (entry-type) 3474(defun bibtex-field-list (entry-type)
3062 "Return list of allowed fields for entry ENTRY-TYPE. 3475 "Return list of allowed fields for entry ENTRY-TYPE.
3063More specifically, the return value is a cons pair (REQUIRED . OPTIONAL), 3476More specifically, the return value is a cons pair (REQUIRED . OPTIONAL),
3064where REQUIRED and OPTIONAL are lists of the required and optional field 3477where REQUIRED and OPTIONAL are lists of the required and optional field
3065names for ENTRY-TYPE according to `bibtex-entry-field-alist', 3478names for ENTRY-TYPE according to `bibtex-BibTeX-entry-alist' and friends,
3066`bibtex-include-OPTkey', `bibtex-include-OPTcrossref', 3479`bibtex-include-OPTkey', `bibtex-include-OPTcrossref',
3067and `bibtex-user-optional-fields'." 3480and `bibtex-user-optional-fields'."
3068 (let ((e (assoc-string entry-type bibtex-entry-field-alist t)) 3481 (let ((e-list (assoc-string entry-type bibtex-entry-alist t))
3069 required optional) 3482 required optional)
3070 (unless e 3483 (unless e-list
3071 (error "Fields for BibTeX entry type %s not defined" entry-type)) 3484 (error "Fields for BibTeX entry type %s not defined" entry-type))
3072 (if (and (member-ignore-case entry-type bibtex-include-OPTcrossref) 3485 (if (member-ignore-case entry-type bibtex-include-OPTcrossref)
3073 (nth 2 e)) 3486 (setq required (nth 2 e-list)
3074 (setq required (nth 0 (nth 2 e)) 3487 optional (append (nth 3 e-list) (nth 4 e-list)))
3075 optional (nth 1 (nth 2 e))) 3488 (setq required (append (nth 2 e-list) (nth 3 e-list))
3076 (setq required (nth 0 (nth 1 e)) 3489 optional (nth 4 e-list)))
3077 optional (nth 1 (nth 1 e))))
3078 (if bibtex-include-OPTkey 3490 (if bibtex-include-OPTkey
3079 (push (list "key" 3491 (push (list "key"
3080 "Used for reference key creation if author and editor fields are missing" 3492 "Used for reference key creation if author and editor fields are missing"
@@ -3094,7 +3506,7 @@ After insertion call the value of `bibtex-add-entry-hook' if that value
3094is non-nil." 3506is non-nil."
3095 (interactive 3507 (interactive
3096 (let ((completion-ignore-case t)) 3508 (let ((completion-ignore-case t))
3097 (list (completing-read "Entry Type: " bibtex-entry-field-alist 3509 (list (completing-read "Entry Type: " bibtex-entry-alist
3098 nil t nil 'bibtex-entry-type-history)))) 3510 nil t nil 'bibtex-entry-type-history))))
3099 (let ((key (if bibtex-maintain-sorted-entries 3511 (let ((key (if bibtex-maintain-sorted-entries
3100 (bibtex-read-key (format "%s key: " entry-type)))) 3512 (bibtex-read-key (format "%s key: " entry-type))))
@@ -3127,7 +3539,7 @@ When called interactively with a prefix arg, query for a value of ENTRY-TYPE."
3127 (interactive 3539 (interactive
3128 (list (if current-prefix-arg 3540 (list (if current-prefix-arg
3129 (let ((completion-ignore-case t)) 3541 (let ((completion-ignore-case t))
3130 (completing-read "New entry type: " bibtex-entry-field-alist 3542 (completing-read "New entry type: " bibtex-entry-alist
3131 nil t nil 'bibtex-entry-type-history))))) 3543 nil t nil 'bibtex-entry-type-history)))))
3132 (save-excursion 3544 (save-excursion
3133 (bibtex-beginning-of-entry) 3545 (bibtex-beginning-of-entry)
@@ -3264,14 +3676,16 @@ interactive calls."
3264 (field-list (bibtex-field-list type)) 3676 (field-list (bibtex-field-list type))
3265 (comment (assoc-string field (append (car field-list) 3677 (comment (assoc-string field (append (car field-list)
3266 (cdr field-list)) t))) 3678 (cdr field-list)) t)))
3267 (if comment (message "%s" (nth 1 comment)) 3679 (message "%s" (cond ((nth 1 comment) (nth 1 comment))
3268 (message "No comment available"))))) 3680 ((setq comment (assoc-string field bibtex-field-alist t))
3681 (nth 1 comment))
3682 (t "No comment available"))))))
3269 3683
3270(defun bibtex-make-field (field &optional move interactive nodelim) 3684(defun bibtex-make-field (field &optional move interactive nodelim)
3271 "Make a field named FIELD in current BibTeX entry. 3685 "Make a field named FIELD in current BibTeX entry.
3272FIELD is either a string or a list of the form 3686FIELD is either a string or a list of the form
3273\(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in 3687\(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in
3274`bibtex-entry-field-alist'. 3688`bibtex-BibTeX-entry-alist' and friends.
3275If MOVE is non-nil, move point past the present field before making 3689If MOVE is non-nil, move point past the present field before making
3276the new field. If INTERACTIVE is non-nil, move point to the end of 3690the new field. If INTERACTIVE is non-nil, move point to the end of
3277the new field. Otherwise move point past the new field. 3691the new field. Otherwise move point past the new field.
@@ -3296,6 +3710,8 @@ INIT is surrounded by field delimiters, unless NODELIM is non-nil."
3296 (forward-char))) 3710 (forward-char)))
3297 (insert ",\n") 3711 (insert ",\n")
3298 (indent-to-column (+ bibtex-entry-offset bibtex-field-indentation)) 3712 (indent-to-column (+ bibtex-entry-offset bibtex-field-indentation))
3713 ;; If there are multiple sets of alternatives, we could use
3714 ;; the numeric value of (nth 3 field) to number these sets. Useful??
3299 (if (nth 3 field) (insert "ALT")) 3715 (if (nth 3 field) (insert "ALT"))
3300 (insert (car field) " ") 3716 (insert (car field) " ")
3301 (if bibtex-align-at-equal-sign 3717 (if bibtex-align-at-equal-sign
@@ -3794,14 +4210,22 @@ Return t if test was successful, nil otherwise."
3794 "Checking required fields and month fields") 4210 "Checking required fields and month fields")
3795 (let ((bibtex-sort-ignore-string-entries t)) 4211 (let ((bibtex-sort-ignore-string-entries t))
3796 (bibtex-map-entries 4212 (bibtex-map-entries
3797 (lambda (_key beg _end) 4213 (lambda (_key beg end)
3798 (bibtex-progress-message) 4214 (bibtex-progress-message)
3799 (let* ((entry-list (assoc-string (bibtex-type-in-head) 4215 (bibtex-beginning-first-field beg)
3800 bibtex-entry-field-alist t)) 4216 (let* ((beg-line (save-excursion (goto-char beg)
3801 (req (copy-sequence (elt (elt entry-list 1) 0))) 4217 (bibtex-current-line)))
3802 (creq (copy-sequence (elt (elt entry-list 2) 0))) 4218 (entry-list (assoc-string (bibtex-type-in-head)
3803 crossref-there bounds alt-there field) 4219 bibtex-entry-alist t))
3804 (bibtex-beginning-first-field beg) 4220 (crossref (bibtex-search-forward-field "crossref" end))
4221 (req (if crossref (copy-sequence (nth 2 entry-list))
4222 (append (nth 2 entry-list)
4223 (copy-sequence (nth 3 entry-list)))))
4224 (num-alt (length (delq nil (delete-dups
4225 (mapcar (lambda (x) (nth 3 x))
4226 req)))))
4227 (alt-fields (make-vector num-alt nil))
4228 bounds field idx)
3805 (while (setq bounds (bibtex-parse-field)) 4229 (while (setq bounds (bibtex-parse-field))
3806 (let ((field-name (bibtex-name-in-field bounds))) 4230 (let ((field-name (bibtex-name-in-field bounds)))
3807 (if (and (bibtex-string= field-name "month") 4231 (if (and (bibtex-string= field-name "month")
@@ -3815,36 +4239,28 @@ Return t if test was successful, nil otherwise."
3815 "Questionable month field") 4239 "Questionable month field")
3816 error-list)) 4240 error-list))
3817 (setq field (assoc-string field-name req t) 4241 (setq field (assoc-string field-name req t)
3818 req (delete field req) 4242 req (delete field req))
3819 creq (delete (assoc-string field-name creq t) creq)) 4243 (if (setq idx (nth 3 field))
3820 (if (nth 3 field) 4244 (if (aref alt-fields idx)
3821 (if alt-there
3822 (push (cons (bibtex-current-line) 4245 (push (cons (bibtex-current-line)
3823 "More than one non-empty alternative") 4246 "More than one non-empty alternative")
3824 error-list) 4247 error-list)
3825 (setq alt-there t))) 4248 (aset alt-fields idx t))))
3826 (if (bibtex-string= field-name "crossref")
3827 (setq crossref-there t)))
3828 (goto-char (bibtex-end-of-field bounds))) 4249 (goto-char (bibtex-end-of-field bounds)))
3829 (if crossref-there (setq req creq)) 4250 (let ((alt-expect (make-vector num-alt nil)))
3830 (let (alt) 4251 (dolist (field req) ; absent required fields
3831 (dolist (field req) 4252 (if (setq idx (nth 3 field))
3832 (if (nth 3 field) 4253 (bibtex-vec-push alt-expect idx (car field))
3833 (push (car field) alt) 4254 (push (cons beg-line
3834 (push (cons (save-excursion (goto-char beg)
3835 (bibtex-current-line))
3836 (format "Required field `%s' missing" 4255 (format "Required field `%s' missing"
3837 (car field))) 4256 (car field)))
3838 error-list))) 4257 error-list)))
3839 ;; The following fails if there are more than two 4258 (dotimes (idx num-alt)
3840 ;; alternatives in a BibTeX entry, which isn't 4259 (unless (aref alt-fields idx)
3841 ;; the case momentarily. 4260 (push (cons beg-line
3842 (if (cdr alt) 4261 (format "Alternative fields `%s' missing"
3843 (push (cons (save-excursion (goto-char beg) 4262 (aref alt-expect idx)))
3844 (bibtex-current-line)) 4263 error-list))))))))
3845 (format "Alternative fields `%s'/`%s' missing"
3846 (car alt) (cadr alt)))
3847 error-list)))))))
3848 (bibtex-progress-message 'done))))) 4264 (bibtex-progress-message 'done)))))
3849 4265
3850 (if error-list 4266 (if error-list
@@ -3890,7 +4306,7 @@ Return t if test was successful, nil otherwise."
3890 (setq entry-type (bibtex-type-in-head) 4306 (setq entry-type (bibtex-type-in-head)
3891 key (bibtex-key-in-head)) 4307 key (bibtex-key-in-head))
3892 (if (or (and strings (bibtex-string= entry-type "string")) 4308 (if (or (and strings (bibtex-string= entry-type "string"))
3893 (assoc-string entry-type bibtex-entry-field-alist t)) 4309 (assoc-string entry-type bibtex-entry-alist t))
3894 (if (member key key-list) 4310 (if (member key key-list)
3895 (push (format "%s:%d: Duplicate key `%s'\n" 4311 (push (format "%s:%d: Duplicate key `%s'\n"
3896 (buffer-file-name) 4312 (buffer-file-name)
@@ -4057,7 +4473,13 @@ is as in `bibtex-enclosing-field'. It is t for interactive calls."
4057 (bounds (bibtex-enclosing-field comma))) 4473 (bounds (bibtex-enclosing-field comma)))
4058 (save-excursion 4474 (save-excursion
4059 (goto-char (bibtex-start-of-name-in-field bounds)) 4475 (goto-char (bibtex-start-of-name-in-field bounds))
4060 (when (looking-at "OPT\\|ALT") 4476 (when (and (looking-at "OPT\\|ALT")
4477 (not (and bibtex-no-opt-remove-re
4478 (string-match
4479 bibtex-no-opt-remove-re
4480 (buffer-substring-no-properties
4481 (bibtex-start-of-name-in-field bounds)
4482 (bibtex-end-of-name-in-field bounds))))))
4061 (delete-region (match-beginning 0) (match-end 0)) 4483 (delete-region (match-beginning 0) (match-end 0))
4062 ;; make field non-OPT 4484 ;; make field non-OPT
4063 (search-forward "=") 4485 (search-forward "=")
@@ -4600,71 +5022,6 @@ entries from minibuffer."
4600 (when (eq status 'finished) 5022 (when (eq status 'finished)
4601 (save-excursion (bibtex-remove-delimiters))))))))) 5023 (save-excursion (bibtex-remove-delimiters)))))))))
4602 5024
4603(defun bibtex-Article ()
4604 "Insert a new BibTeX @Article entry; see also `bibtex-entry'."
4605 (interactive "*")
4606 (bibtex-entry "Article"))
4607
4608(defun bibtex-Book ()
4609 "Insert a new BibTeX @Book entry; see also `bibtex-entry'."
4610 (interactive "*")
4611 (bibtex-entry "Book"))
4612
4613(defun bibtex-Booklet ()
4614 "Insert a new BibTeX @Booklet entry; see also `bibtex-entry'."
4615 (interactive "*")
4616 (bibtex-entry "Booklet"))
4617
4618(defun bibtex-InBook ()
4619 "Insert a new BibTeX @InBook entry; see also `bibtex-entry'."
4620 (interactive "*")
4621 (bibtex-entry "InBook"))
4622
4623(defun bibtex-InCollection ()
4624 "Insert a new BibTeX @InCollection entry; see also `bibtex-entry'."
4625 (interactive "*")
4626 (bibtex-entry "InCollection"))
4627
4628(defun bibtex-InProceedings ()
4629 "Insert a new BibTeX @InProceedings entry; see also `bibtex-entry'."
4630 (interactive "*")
4631 (bibtex-entry "InProceedings"))
4632
4633(defun bibtex-Manual ()
4634 "Insert a new BibTeX @Manual entry; see also `bibtex-entry'."
4635 (interactive "*")
4636 (bibtex-entry "Manual"))
4637
4638(defun bibtex-MastersThesis ()
4639 "Insert a new BibTeX @MastersThesis entry; see also `bibtex-entry'."
4640 (interactive "*")
4641 (bibtex-entry "MastersThesis"))
4642
4643(defun bibtex-Misc ()
4644 "Insert a new BibTeX @Misc entry; see also `bibtex-entry'."
4645 (interactive "*")
4646 (bibtex-entry "Misc"))
4647
4648(defun bibtex-PhdThesis ()
4649 "Insert a new BibTeX @PhdThesis entry; see also `bibtex-entry'."
4650 (interactive "*")
4651 (bibtex-entry "PhdThesis"))
4652
4653(defun bibtex-Proceedings ()
4654 "Insert a new BibTeX @Proceedings entry; see also `bibtex-entry'."
4655 (interactive "*")
4656 (bibtex-entry "Proceedings"))
4657
4658(defun bibtex-TechReport ()
4659 "Insert a new BibTeX @TechReport entry; see also `bibtex-entry'."
4660 (interactive "*")
4661 (bibtex-entry "TechReport"))
4662
4663(defun bibtex-Unpublished ()
4664 "Insert a new BibTeX @Unpublished entry; see also `bibtex-entry'."
4665 (interactive "*")
4666 (bibtex-entry "Unpublished"))
4667
4668(defun bibtex-String (&optional key) 5025(defun bibtex-String (&optional key)
4669 "Insert a new BibTeX @String entry with key KEY." 5026 "Insert a new BibTeX @String entry with key KEY."
4670 (interactive (list (bibtex-read-string-key))) 5027 (interactive (list (bibtex-read-string-key)))
@@ -4822,10 +5179,8 @@ where FILE is the BibTeX file of ENTRY."
4822 (delete-dups 5179 (delete-dups
4823 (apply 'append 5180 (apply 'append
4824 bibtex-user-optional-fields 5181 bibtex-user-optional-fields
4825 (mapcar (lambda (x) 5182 (mapcar (lambda (x) (mapcar 'car (apply 'append (cdr x))))
4826 (append (mapcar 'car (nth 0 (nth 1 x))) 5183 bibtex-entry-alist))) nil t)
4827 (mapcar 'car (nth 1 (nth 1 x)))))
4828 bibtex-entry-field-alist))) nil t)
4829 (read-string "Regexp: ") 5184 (read-string "Regexp: ")
4830 (if bibtex-search-entry-globally 5185 (if bibtex-search-entry-globally
4831 (not current-prefix-arg) 5186 (not current-prefix-arg)
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 9ed5309bb53..c1ce950522c 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -2800,7 +2800,7 @@ details check the Rst Faces Defaults group."
2800 rst-level-face-base-color 2800 rst-level-face-base-color
2801 (+ (* (1- i) rst-level-face-step-light) 2801 (+ (* (1- i) rst-level-face-step-light)
2802 rst-level-face-base-light)))) 2802 rst-level-face-base-light))))
2803 (unless (boundp sym) 2803 (unless (facep sym)
2804 (make-empty-face sym) 2804 (make-empty-face sym)
2805 (set-face-doc-string sym doc) 2805 (set-face-doc-string sym doc)
2806 (set-face-background sym col) 2806 (set-face-background sym col)
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index f0d9530966e..80b970ac02f 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
12011-07-06 Nick Dokos <nicholas.dokos@hp.com> (tiny change)
2
3 * url-cache.el (url-cache-extract): Set buffer multibyte flag to
4 nil (bug#8827).
5
12011-07-03 Nicolas Avrutin <nicolasavru@gmail.com> (tiny change) 62011-07-03 Nicolas Avrutin <nicolasavru@gmail.com> (tiny change)
2 7
3 * url-http.el (url-http-create-request): Remove double carriage 8 * url-http.el (url-http-create-request): Remove double carriage
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index 1615920e64c..80d77020456 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -192,6 +192,7 @@ Very fast if you have an `md5' primitive function, suitably fast otherwise."
192(defun url-cache-extract (fnam) 192(defun url-cache-extract (fnam)
193 "Extract FNAM from the local disk cache." 193 "Extract FNAM from the local disk cache."
194 (erase-buffer) 194 (erase-buffer)
195 (set-buffer-multibyte nil)
195 (insert-file-contents-literally fnam)) 196 (insert-file-contents-literally fnam))
196 197
197(defun url-cache-expired (url &optional expire-time) 198(defun url-cache-expired (url &optional expire-time)
diff --git a/lisp/window.el b/lisp/window.el
index 64f4119027a..2b98630a51e 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -163,8 +163,8 @@ Anything less might crash Emacs.")
163 163
164(defcustom window-min-height 4 164(defcustom window-min-height 4
165 "The minimum number of lines of any window. 165 "The minimum number of lines of any window.
166The value has to accomodate a mode- or header-line if present. A 166The value has to accommodate a mode- or header-line if present.
167value less than `window-safe-min-height' is ignored. The value 167A value less than `window-safe-min-height' is ignored. The value
168of this variable is honored when windows are resized or split. 168of this variable is honored when windows are resized or split.
169 169
170Applications should never rebind this variable. To resize a 170Applications should never rebind this variable. To resize a
@@ -3380,7 +3380,7 @@ WINDOW must be an iso-combination."
3380 (balance-windows-2 window horizontal) 3380 (balance-windows-2 window horizontal)
3381 (let ((size (window-new-total window))) 3381 (let ((size (window-new-total window)))
3382 (while sub 3382 (while sub
3383 (set-window-new-total sub size) 3383 (set-window-new-total sub size)
3384 (balance-windows-1 sub horizontal) 3384 (balance-windows-1 sub horizontal)
3385 (setq sub (window-right sub)))))))) 3385 (setq sub (window-right sub))))))))
3386 3386
@@ -5039,7 +5039,7 @@ description."
5039 (setq window 5039 (setq window
5040 (cond 5040 (cond
5041 ((eq cand 'largest) 5041 ((eq cand 'largest)
5042 ;; The largest window. 5042 ;; The largest window.
5043 (get-largest-window frame t)) 5043 (get-largest-window frame t))
5044 ((eq cand 'lru) 5044 ((eq cand 'lru)
5045 ;; The least recently used window. 5045 ;; The least recently used window.
@@ -5750,7 +5750,7 @@ this list as arguments."
5750 (display-buffer-reuse-window 5750 (display-buffer-reuse-window
5751 buffer '(nil nil t) '((reuse-window-dedicated . t))))))) 5751 buffer '(nil nil t) '((reuse-window-dedicated . t)))))))
5752 5752
5753(defsubst display-buffer-same-window (&optional buffer-or-name label) 5753(defsubst display-buffer-same-window (&optional buffer-or-name label)
5754 "Display buffer specified by BUFFER-OR-NAME in the selected window. 5754 "Display buffer specified by BUFFER-OR-NAME in the selected window.
5755Another window will be used only if the buffer can't be shown in 5755Another window will be used only if the buffer can't be shown in
5756the selected window, usually because it is dedicated to another 5756the selected window, usually because it is dedicated to another
@@ -5759,7 +5759,7 @@ buffer. Optional argument BUFFER-OR-NAME and LABEL are as for
5759 (interactive "BDisplay buffer in same window:\nP") 5759 (interactive "BDisplay buffer in same window:\nP")
5760 (display-buffer buffer-or-name 'same-window label)) 5760 (display-buffer buffer-or-name 'same-window label))
5761 5761
5762(defsubst display-buffer-same-frame (&optional buffer-or-name label) 5762(defsubst display-buffer-same-frame (&optional buffer-or-name label)
5763 "Display buffer specified by BUFFER-OR-NAME in a window on the same frame. 5763 "Display buffer specified by BUFFER-OR-NAME in a window on the same frame.
5764Another frame will be used only if there is no other choice. 5764Another frame will be used only if there is no other choice.
5765Optional argument BUFFER-OR-NAME and LABEL are as for 5765Optional argument BUFFER-OR-NAME and LABEL are as for
@@ -5767,7 +5767,7 @@ Optional argument BUFFER-OR-NAME and LABEL are as for
5767 (interactive "BDisplay buffer on same frame:\nP") 5767 (interactive "BDisplay buffer on same frame:\nP")
5768 (display-buffer buffer-or-name 'same-frame label)) 5768 (display-buffer buffer-or-name 'same-frame label))
5769 5769
5770(defsubst display-buffer-other-window (&optional buffer-or-name label) 5770(defsubst display-buffer-other-window (&optional buffer-or-name label)
5771 "Display buffer specified by BUFFER-OR-NAME in another window. 5771 "Display buffer specified by BUFFER-OR-NAME in another window.
5772The selected window will be used only if there is no other 5772The selected window will be used only if there is no other
5773choice. Windows on the selected frame are preferred to windows 5773choice. Windows on the selected frame are preferred to windows
@@ -5776,7 +5776,7 @@ for `display-buffer'."
5776 (interactive "BDisplay buffer in another window:\nP") 5776 (interactive "BDisplay buffer in another window:\nP")
5777 (display-buffer buffer-or-name 'other-window label)) 5777 (display-buffer buffer-or-name 'other-window label))
5778 5778
5779(defun display-buffer-same-frame-other-window (&optional buffer-or-name label) 5779(defun display-buffer-same-frame-other-window (&optional buffer-or-name label)
5780 "Display buffer specified by BUFFER-OR-NAME in another window on the same frame. 5780 "Display buffer specified by BUFFER-OR-NAME in another window on the same frame.
5781The selected window or another frame will be used only if there 5781The selected window or another frame will be used only if there
5782is no other choice. Optional argument BUFFER-OR-NAME and LABEL are 5782is no other choice. Optional argument BUFFER-OR-NAME and LABEL are
@@ -5797,31 +5797,30 @@ If this command uses another frame, it will also select that frame."
5797(defun pop-to-buffer (&optional buffer-or-name specifiers norecord label) 5797(defun pop-to-buffer (&optional buffer-or-name specifiers norecord label)
5798 "Display buffer specified by BUFFER-OR-NAME and select the window used. 5798 "Display buffer specified by BUFFER-OR-NAME and select the window used.
5799Optional argument BUFFER-OR-NAME may be a buffer, a string \(a 5799Optional argument BUFFER-OR-NAME may be a buffer, a string \(a
5800buffer name), or nil. If BUFFER-OR-NAME is a string not naming 5800buffer name), or nil. If BUFFER-OR-NAME is a string naming a buffer
5801an existent buffer, create a buffer with that name. If 5801that does not exist, create a buffer with that name. If
5802BUFFER-OR-NAME is nil or omitted, display the current buffer. 5802BUFFER-OR-NAME is nil or omitted, display the current buffer.
5803Interactively, prompt for the buffer name using the minibuffer. 5803Interactively, prompt for the buffer name using the minibuffer.
5804 5804
5805Optional second argument SPECIFIERS must be a list of buffer 5805Optional second argument SPECIFIERS can be: a list of buffer
5806display specifiers, a single location specifier, `t' which means 5806display specifiers (see `display-buffer-alist'); a single
5807the latter means to display the buffer in any but the selected 5807location specifier; t, which means to display the buffer in any
5808window, or nil which means to exclusively apply the specifiers 5808but the selected window; or nil, which means to exclusively apply
5809customized by the user. 5809the specifiers customized by the user. See `display-buffer' for
5810more details.
5810 5811
5811Optional argument NORECORD non-nil means do not put the buffer 5812Optional argument NORECORD non-nil means do not put the displayed
5812specified by BUFFER-OR-NAME at the front of the buffer list and 5813buffer at the front of the buffer list, and do not make the window
5813do not make the window displaying it the most recently selected 5814displaying it the most recently selected one.
5814one.
5815 5815
5816The optional argument LABEL, if non-nil, is a symbol specifying the 5816The optional argument LABEL, if non-nil, is a symbol specifying the
5817display purpose. Applications should set this when the buffer 5817display purpose. Applications should set this when the buffer
5818shall be displayed in a special way but BUFFER-OR-NAME does not 5818should be displayed in a special way but BUFFER-OR-NAME does not
5819identify the buffer as special. Buffers that typically fit into 5819identify the buffer as special. Buffers that typically fit into
5820this category are those whose names have been derived from the 5820this category are those whose names have been derived from the
5821name of the file they are visiting. 5821name of the file they are visiting.
5822 5822
5823Return the buffer specified by BUFFER-OR-NAME or nil if 5823Returns the displayed buffer, or nil if displaying the buffer failed.
5824displaying the buffer failed.
5825 5824
5826This uses the function `display-buffer' as a subroutine; see the 5825This uses the function `display-buffer' as a subroutine; see the
5827documentations of `display-buffer' and `display-buffer-alist' for 5826documentations of `display-buffer' and `display-buffer-alist' for
@@ -5853,7 +5852,7 @@ as for `pop-to-buffer'."
5853 (interactive "BPop to buffer in selected window:\nP") 5852 (interactive "BPop to buffer in selected window:\nP")
5854 (pop-to-buffer buffer-or-name 'same-window norecord label)) 5853 (pop-to-buffer buffer-or-name 'same-window norecord label))
5855 5854
5856(defsubst pop-to-buffer-same-frame (&optional buffer-or-name norecord label) 5855(defsubst pop-to-buffer-same-frame (&optional buffer-or-name norecord label)
5857 "Pop to buffer specified by BUFFER-OR-NAME in a window on the selected frame. 5856 "Pop to buffer specified by BUFFER-OR-NAME in a window on the selected frame.
5858Another frame will be used only if there is no other choice. 5857Another frame will be used only if there is no other choice.
5859Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for 5858Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for
@@ -5870,7 +5869,7 @@ LABEL are as for `pop-to-buffer'."
5870 (interactive "BPop to buffer in another window:\nP") 5869 (interactive "BPop to buffer in another window:\nP")
5871 (pop-to-buffer buffer-or-name 'other-window norecord)) 5870 (pop-to-buffer buffer-or-name 'other-window norecord))
5872 5871
5873(defsubst pop-to-buffer-same-frame-other-window (&optional buffer-or-name norecord label) 5872(defsubst pop-to-buffer-same-frame-other-window (&optional buffer-or-name norecord label)
5874 "Pop to buffer specified by BUFFER-OR-NAME in another window on the selected frame. 5873 "Pop to buffer specified by BUFFER-OR-NAME in another window on the selected frame.
5875The selected window or another frame will be used only if there 5874The selected window or another frame will be used only if there
5876is no other choice. Optional arguments BUFFER-OR-NAME, NORECORD 5875is no other choice. Optional arguments BUFFER-OR-NAME, NORECORD
@@ -6108,7 +6107,7 @@ BUFFER in a window on the selected frame.
6108 6107
6109If ARGS is a list whose car is a symbol, use (car ARGS) as a 6108If ARGS is a list whose car is a symbol, use (car ARGS) as a
6110function to do the work. Pass it BUFFER as first argument, 6109function to do the work. Pass it BUFFER as first argument,
6111and (cdr ARGS) as second." 6110and (cdr ARGS) as the rest of the arguments."
6112 (if (and args (symbolp (car args))) 6111 (if (and args (symbolp (car args)))
6113 (apply (car args) buffer (cdr args)) 6112 (apply (car args) buffer (cdr args))
6114 (let ((window (get-buffer-window buffer 0))) 6113 (let ((window (get-buffer-window buffer 0)))
@@ -6908,7 +6907,7 @@ WINDOW was scrolled."
6908 ;; window and the current buffer when we're done. 6907 ;; window and the current buffer when we're done.
6909 (setq window (window-normalize-live-window window)) 6908 (setq window (window-normalize-live-window window))
6910 ;; Can't resize a full height or fixed-size window. 6909 ;; Can't resize a full height or fixed-size window.
6911 (unless (or (window-size-fixed-p window) 6910 (unless (or (window-size-fixed-p window)
6912 (window-full-height-p window)) 6911 (window-full-height-p window))
6913 ;; `with-selected-window' should orderly restore the current buffer. 6912 ;; `with-selected-window' should orderly restore the current buffer.
6914 (with-selected-window window 6913 (with-selected-window window
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index 891fc8bc36f..a8744a844f3 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,4 +1,4 @@
1# alloca.m4 serial 12 1# alloca.m4 serial 13
2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation, 2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
@@ -76,17 +76,17 @@ wenotbecray
76if test $ac_cv_os_cray = yes; then 76if test $ac_cv_os_cray = yes; then
77 for ac_func in _getb67 GETB67 getb67; do 77 for ac_func in _getb67 GETB67 getb67; do
78 AC_CHECK_FUNC($ac_func, 78 AC_CHECK_FUNC($ac_func,
79 [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, 79 [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
80 [Define to one of `_getb67', `GETB67', 80 [Define to one of `_getb67', `GETB67',
81 `getb67' for Cray-2 and Cray-YMP 81 `getb67' for Cray-2 and Cray-YMP
82 systems. This function is required for 82 systems. This function is required for
83 `alloca.c' support on those systems.]) 83 `alloca.c' support on those systems.])
84 break]) 84 break])
85 done 85 done
86fi 86fi
87 87
88AC_CACHE_CHECK([stack direction for C alloca], 88AC_CACHE_CHECK([stack direction for C alloca],
89 [ac_cv_c_stack_direction], 89 [ac_cv_c_stack_direction],
90[AC_RUN_IFELSE([AC_LANG_SOURCE( 90[AC_RUN_IFELSE([AC_LANG_SOURCE(
91[AC_INCLUDES_DEFAULT 91[AC_INCLUDES_DEFAULT
92int 92int
@@ -105,16 +105,16 @@ main (int argc, char **argv)
105{ 105{
106 return find_stack_direction (0, argc + !argv + 20) < 0; 106 return find_stack_direction (0, argc + !argv + 20) < 0;
107}])], 107}])],
108 [ac_cv_c_stack_direction=1], 108 [ac_cv_c_stack_direction=1],
109 [ac_cv_c_stack_direction=-1], 109 [ac_cv_c_stack_direction=-1],
110 [ac_cv_c_stack_direction=0])]) 110 [ac_cv_c_stack_direction=0])])
111AH_VERBATIM([STACK_DIRECTION], 111AH_VERBATIM([STACK_DIRECTION],
112[/* If using the C implementation of alloca, define if you know the 112[/* If using the C implementation of alloca, define if you know the
113 direction of stack growth for your system; otherwise it will be 113 direction of stack growth for your system; otherwise it will be
114 automatically deduced at runtime. 114 automatically deduced at runtime.
115 STACK_DIRECTION > 0 => grows toward higher addresses 115 STACK_DIRECTION > 0 => grows toward higher addresses
116 STACK_DIRECTION < 0 => grows toward lower addresses 116 STACK_DIRECTION < 0 => grows toward lower addresses
117 STACK_DIRECTION = 0 => direction of growth unknown */ 117 STACK_DIRECTION = 0 => direction of growth unknown */
118@%:@undef STACK_DIRECTION])dnl 118@%:@undef STACK_DIRECTION])dnl
119AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) 119AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
120])# _AC_LIBOBJ_ALLOCA 120])# _AC_LIBOBJ_ALLOCA
diff --git a/src/ChangeLog b/src/ChangeLog
index 22d70bf54eb..b0fb0f213ab 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12011-07-05 Paul Eggert <eggert@cs.ucla.edu> 12011-07-06 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Assume support for memcmp, memcpy, memmove, memset. 3 Assume support for memcmp, memcpy, memmove, memset.
4 * lisp.h, sysdep.c (memcmp, memcpy, memmove, memset): 4 * lisp.h, sysdep.c (memcmp, memcpy, memmove, memset):
@@ -12,6 +12,52 @@
12 Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally 12 Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally
13 well either way, and we prefer signed to unsigned. 13 well either way, and we prefer signed to unsigned.
14 14
152011-07-06 Paul Eggert <eggert@cs.ucla.edu>
16
17 Remove unportable assumption about struct layout (Bug#8884).
18 * alloc.c (mark_buffer):
19 * buffer.c (reset_buffer_local_variables, Fbuffer_local_variables)
20 (clone_per_buffer_values): Don't assume that
21 sizeof (struct buffer) is a multiple of sizeof (Lisp_Object).
22 This isn't true in general, and it's particularly not true
23 if Emacs is configured with --with-wide-int.
24 * buffer.h (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER):
25 New macros, used in the buffer.c change.
26
272011-07-05 Jan Djärv <jan.h.d@swipnet.se>
28
29 * xsettings.c: Use both GConf and GSettings if both are available.
30 (store_config_changed_event): Add comment.
31 (dpyinfo_valid, store_font_name_changed, map_tool_bar_style)
32 (store_tool_bar_style_changed): New functions.
33 (store_monospaced_changed): Add comment. Call dpyinfo_valid.
34 (struct xsettings): Move font inside HAVE_XFT.
35 (GSETTINGS_TOOL_BAR_STYLE, GSETTINGS_FONT_NAME): New defines.
36 (GSETTINGS_MONO_FONT): Renamed from SYSTEM_MONO_FONT.
37 Move inside HAVE_XFT.
38 (something_changed_gsettingsCB): Renamed from something_changedCB.
39 Check for changes in GSETTINGS_TOOL_BAR_STYLE and GSETTINGS_FONT_NAME
40 also.
41 (GCONF_TOOL_BAR_STYLE, GCONF_FONT_NAME): New defines.
42 (GCONF_MONO_FONT): Renamed from SYSTEM_MONO_FONT. Move inside HAVE_XFT.
43 (something_changed_gconfCB): Renamed from something_changedCB.
44 Check for changes in GCONF_TOOL_BAR_STYLE and GCONF_FONT_NAME also.
45 (parse_settings): Move check for font inside HAVE_XFT.
46 (read_settings, apply_xft_settings): Add comment.
47 (read_and_apply_settings): Add comment. Call map_tool_bar_style and
48 store_tool_bar_style_changed. Move check for font inside HAVE_XFT and
49 call store_font_name_changed.
50 (xft_settings_event): Add comment.
51 (init_gsettings): Add comment. Get values for GSETTINGS_TOOL_BAR_STYLE
52 and GSETTINGS_FONT_NAME. Move check for fonts within HAVE_XFT.
53 (init_gconf): Add comment. Get values for GCONF_TOOL_BAR_STYLE
54 and GCONF_FONT_NAME. Move check for fonts within HAVE_XFT.
55 (xsettings_initialize): Call init_gsettings last.
56 (xsettings_get_system_font, xsettings_get_system_normal_font): Add
57 comment.
58
592011-07-05 Paul Eggert <eggert@cs.ucla.edu>
60
15 Random fixes. E.g., (random) never returned negative values. 61 Random fixes. E.g., (random) never returned negative values.
16 * fns.c (Frandom): Use GET_EMACS_TIME for random seed, and add the 62 * fns.c (Frandom): Use GET_EMACS_TIME for random seed, and add the
17 subseconds part to the entropy, as that's a bit more random. 63 subseconds part to the entropy, as that's a bit more random.
@@ -153,7 +199,7 @@
153 with value as argument. 199 with value as argument.
154 (init_gsettings): Check that GSETTINGS_SCHEMA exists before calling 200 (init_gsettings): Check that GSETTINGS_SCHEMA exists before calling
155 g_settings_new (Bug#8967). Do not create gsettings_obj. 201 g_settings_new (Bug#8967). Do not create gsettings_obj.
156 Remove calls to g_settings_bind. Connect something_changedCB to 202 Remove calls to g_settings_bind. Connect something_changedCB to
157 "changed". 203 "changed".
158 204
159 * xgselect.c: Add defined (HAVE_GSETTINGS). 205 * xgselect.c: Add defined (HAVE_GSETTINGS).
@@ -250,8 +296,8 @@
250 min_width/height (Bug#8919). 296 min_width/height (Bug#8919).
251 297
252 * gtkutil.c (xg_create_frame_widgets): Pass f to emacs_fixed_new. 298 * gtkutil.c (xg_create_frame_widgets): Pass f to emacs_fixed_new.
253 (x_wm_set_size_hint): Remove call to emacs_fixed_set_min_size. Fix 299 (x_wm_set_size_hint): Remove call to emacs_fixed_set_min_size.
254 indentation. 300 Fix indentation.
255 301
2562011-06-26 Eli Zaretskii <eliz@gnu.org> 3022011-06-26 Eli Zaretskii <eliz@gnu.org>
257 303
@@ -1812,7 +1858,7 @@
1812 and %.0c. Fix bug with strchr succeeding on '\0' when looking for 1858 and %.0c. Fix bug with strchr succeeding on '\0' when looking for
1813 flags. Fix bug with (format "%c" 256.0). Avoid integer overflow when 1859 flags. Fix bug with (format "%c" 256.0). Avoid integer overflow when
1814 formatting out-of-range floating point numbers with int 1860 formatting out-of-range floating point numbers with int
1815 formats. (Bug#8668) 1861 formats. (Bug#8668)
1816 1862
1817 * lisp.h (FIXNUM_OVERFLOW_P): Work even if arg is a NaN. 1863 * lisp.h (FIXNUM_OVERFLOW_P): Work even if arg is a NaN.
1818 1864
@@ -2776,9 +2822,9 @@
2776 :verify-hostname-error, :verify-error, and :verify-flags 2822 :verify-hostname-error, :verify-error, and :verify-flags
2777 parameters of `gnutls-boot' and documented those parameters in the 2823 parameters of `gnutls-boot' and documented those parameters in the
2778 docstring. Start callback support. 2824 docstring. Start callback support.
2779 (emacs_gnutls_handshake): Add Woe32 support. Retry handshake 2825 (emacs_gnutls_handshake): Add Woe32 support. Retry handshake
2780 unless a fatal error occured. Call gnutls_alert_send_appropriate 2826 unless a fatal error occurred. Call gnutls_alert_send_appropriate
2781 on error. Return error code. 2827 on error. Return error code.
2782 (emacs_gnutls_write): Call emacs_gnutls_handle_error. 2828 (emacs_gnutls_write): Call emacs_gnutls_handle_error.
2783 (emacs_gnutls_read): Likewise. 2829 (emacs_gnutls_read): Likewise.
2784 (Fgnutls_boot): Return handshake error code. 2830 (Fgnutls_boot): Return handshake error code.
diff --git a/src/alloc.c b/src/alloc.c
index 43befd722bb..f679787e95c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5619,7 +5619,8 @@ mark_buffer (Lisp_Object buf)
5619 /* buffer-local Lisp variables start at `undo_list', 5619 /* buffer-local Lisp variables start at `undo_list',
5620 tho only the ones from `name' on are GC'd normally. */ 5620 tho only the ones from `name' on are GC'd normally. */
5621 for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name); 5621 for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name);
5622 (char *)ptr < (char *)buffer + sizeof (struct buffer); 5622 ptr <= &PER_BUFFER_VALUE (buffer,
5623 PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER));
5623 ptr++) 5624 ptr++)
5624 mark_object (*ptr); 5625 mark_object (*ptr);
5625 5626
diff --git a/src/buffer.c b/src/buffer.c
index 2339416eb36..e2f34d629e9 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -471,8 +471,8 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
471 471
472 /* buffer-local Lisp variables start at `undo_list', 472 /* buffer-local Lisp variables start at `undo_list',
473 tho only the ones from `name' on are GC'd normally. */ 473 tho only the ones from `name' on are GC'd normally. */
474 for (offset = PER_BUFFER_VAR_OFFSET (undo_list); 474 for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
475 offset < sizeof *to; 475 offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
476 offset += sizeof (Lisp_Object)) 476 offset += sizeof (Lisp_Object))
477 { 477 {
478 Lisp_Object obj; 478 Lisp_Object obj;
@@ -830,8 +830,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
830 830
831 /* buffer-local Lisp variables start at `undo_list', 831 /* buffer-local Lisp variables start at `undo_list',
832 tho only the ones from `name' on are GC'd normally. */ 832 tho only the ones from `name' on are GC'd normally. */
833 for (offset = PER_BUFFER_VAR_OFFSET (undo_list); 833 for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
834 offset < sizeof *b; 834 offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
835 offset += sizeof (Lisp_Object)) 835 offset += sizeof (Lisp_Object))
836 { 836 {
837 int idx = PER_BUFFER_IDX (offset); 837 int idx = PER_BUFFER_IDX (offset);
@@ -1055,8 +1055,8 @@ No argument or nil as argument means use current buffer as BUFFER. */)
1055 1055
1056 /* buffer-local Lisp variables start at `undo_list', 1056 /* buffer-local Lisp variables start at `undo_list',
1057 tho only the ones from `name' on are GC'd normally. */ 1057 tho only the ones from `name' on are GC'd normally. */
1058 for (offset = PER_BUFFER_VAR_OFFSET (undo_list); 1058 for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
1059 offset < sizeof (struct buffer); 1059 offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
1060 /* sizeof EMACS_INT == sizeof Lisp_Object */ 1060 /* sizeof EMACS_INT == sizeof Lisp_Object */
1061 offset += (sizeof (EMACS_INT))) 1061 offset += (sizeof (EMACS_INT)))
1062 { 1062 {
diff --git a/src/buffer.h b/src/buffer.h
index 4643e0d9d0e..06864dd5789 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -612,6 +612,7 @@ struct buffer
612 /* Everything from here down must be a Lisp_Object. */ 612 /* Everything from here down must be a Lisp_Object. */
613 /* buffer-local Lisp variables start at `undo_list', 613 /* buffer-local Lisp variables start at `undo_list',
614 tho only the ones from `name' on are GC'd normally. */ 614 tho only the ones from `name' on are GC'd normally. */
615 #define FIRST_FIELD_PER_BUFFER undo_list
615 616
616 /* Changes in the buffer are recorded here for undo. 617 /* Changes in the buffer are recorded here for undo.
617 t means don't record anything. 618 t means don't record anything.
@@ -846,6 +847,9 @@ struct buffer
846 t means to use hollow box cursor. 847 t means to use hollow box cursor.
847 See `cursor-type' for other values. */ 848 See `cursor-type' for other values. */
848 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows); 849 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows);
850
851 /* This must be the last field in the above list. */
852 #define LAST_FIELD_PER_BUFFER cursor_in_non_selected_windows
849}; 853};
850 854
851 855
diff --git a/src/eval.c b/src/eval.c
index e8a3f947f9d..90d0df61858 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3162,7 +3162,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
3162 shouldn't bind any arguments, instead just call the byte-code 3162 shouldn't bind any arguments, instead just call the byte-code
3163 interpreter directly; it will push arguments as necessary. 3163 interpreter directly; it will push arguments as necessary.
3164 3164
3165 Byte-code objects with either a non-existant, or a nil value for 3165 Byte-code objects with either a non-existent, or a nil value for
3166 the `push args' slot (the default), have dynamically-bound 3166 the `push args' slot (the default), have dynamically-bound
3167 arguments, and use the argument-binding code below instead (as do 3167 arguments, and use the argument-binding code below instead (as do
3168 all interpreted functions, even lexically bound ones). */ 3168 all interpreted functions, even lexically bound ones). */
diff --git a/src/gnutls.c b/src/gnutls.c
index 55c7ff01c0c..76cfa5dcc98 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -379,7 +379,7 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte)
379 /* non-fatal error */ 379 /* non-fatal error */
380 return -1; 380 return -1;
381 else { 381 else {
382 /* a fatal error occured */ 382 /* a fatal error occurred */
383 return 0; 383 return 0;
384 } 384 }
385} 385}
diff --git a/src/xsettings.c b/src/xsettings.c
index 5411d3fc7fb..06718df5a3c 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -37,11 +37,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#ifdef HAVE_GSETTINGS 37#ifdef HAVE_GSETTINGS
38#include <glib-object.h> 38#include <glib-object.h>
39#include <gio/gio.h> 39#include <gio/gio.h>
40#else 40#endif
41
41#ifdef HAVE_GCONF 42#ifdef HAVE_GCONF
42#include <gconf/gconf-client.h> 43#include <gconf/gconf-client.h>
43#endif 44#endif
44#endif
45 45
46#ifdef HAVE_XFT 46#ifdef HAVE_XFT
47#include <X11/Xft/Xft.h> 47#include <X11/Xft/Xft.h>
@@ -54,6 +54,8 @@ static Lisp_Object Qmonospace_font_name, Qfont_name, Qfont_render,
54 Qtool_bar_style; 54 Qtool_bar_style;
55static Lisp_Object current_tool_bar_style; 55static Lisp_Object current_tool_bar_style;
56 56
57/* Store an config changed event in to the event queue. */
58
57static void 59static void
58store_config_changed_event (Lisp_Object arg, Lisp_Object display_name) 60store_config_changed_event (Lisp_Object arg, Lisp_Object display_name)
59{ 61{
@@ -65,6 +67,23 @@ store_config_changed_event (Lisp_Object arg, Lisp_Object display_name)
65 kbd_buffer_store_event (&event); 67 kbd_buffer_store_event (&event);
66} 68}
67 69
70/* Return non-zero if DPYINFO is still valid. */
71static int
72dpyinfo_valid (struct x_display_info *dpyinfo)
73{
74 int found = 0;
75 if (dpyinfo != NULL)
76 {
77 struct x_display_info *d;
78 for (d = x_display_list; !found && d; d = d->next)
79 found = d == dpyinfo && d->display == dpyinfo->display;
80 }
81 return found;
82}
83
84/* Store a monospace font change event if the monospaced font changed. */
85
86#ifdef HAVE_XFT
68static void 87static void
69store_monospaced_changed (const char *newfont) 88store_monospaced_changed (const char *newfont)
70{ 89{
@@ -74,28 +93,69 @@ store_monospaced_changed (const char *newfont)
74 xfree (current_mono_font); 93 xfree (current_mono_font);
75 current_mono_font = xstrdup (newfont); 94 current_mono_font = xstrdup (newfont);
76 95
77 if (first_dpyinfo != NULL && use_system_font) 96 if (dpyinfo_valid (first_dpyinfo) && use_system_font)
78 { 97 {
79 /* Check if display still open */ 98 store_config_changed_event (Qmonospace_font_name,
80 struct x_display_info *dpyinfo; 99 XCAR (first_dpyinfo->name_list_element));
81 int found = 0;
82 for (dpyinfo = x_display_list; !found && dpyinfo; dpyinfo = dpyinfo->next)
83 found = dpyinfo == first_dpyinfo;
84
85 if (found)
86 store_config_changed_event (Qmonospace_font_name,
87 XCAR (first_dpyinfo->name_list_element));
88 } 100 }
89} 101}
90 102
103/* Store a font name change event if the font name changed. */
91 104
92#ifdef HAVE_GSETTINGS 105static void
93static GSettings *gsettings_client; 106store_font_name_changed (const char *newfont)
94#else 107{
95#ifdef HAVE_GCONF 108 if (current_font != NULL && strcmp (newfont, current_font) == 0)
96static GConfClient *gconf_client; 109 return; /* No change. */
97#endif 110
98#endif 111 xfree (current_font);
112 current_font = xstrdup (newfont);
113
114 if (dpyinfo_valid (first_dpyinfo))
115 {
116 store_config_changed_event (Qfont_name,
117 XCAR (first_dpyinfo->name_list_element));
118 }
119}
120#endif /* HAVE_XFT */
121
122/* Map TOOL_BAR_STYLE from a string to its correspinding Lisp value.
123 Return Qnil if TOOL_BAR_STYLE is not known. */
124
125static Lisp_Object
126map_tool_bar_style (const char *tool_bar_style)
127{
128 Lisp_Object style = Qnil;
129 if (tool_bar_style)
130 {
131 if (strcmp (tool_bar_style, "both") == 0)
132 style = Qboth;
133 else if (strcmp (tool_bar_style, "both-horiz") == 0)
134 style = Qboth_horiz;
135 else if (strcmp (tool_bar_style, "icons") == 0)
136 style = Qimage;
137 else if (strcmp (tool_bar_style, "text") == 0)
138 style = Qtext;
139 }
140
141 return style;
142}
143
144/* Store a tool bar style change event if the tool bar style changed. */
145
146static void
147store_tool_bar_style_changed (const char *newstyle,
148 struct x_display_info *dpyinfo)
149{
150 Lisp_Object style = map_tool_bar_style (newstyle);
151 if (EQ (current_tool_bar_style, style))
152 return; /* No change. */
153
154 current_tool_bar_style = style;
155 if (dpyinfo_valid (dpyinfo))
156 store_config_changed_event (Qtool_bar_style,
157 XCAR (dpyinfo->name_list_element));
158}
99 159
100 160
101#define XSETTINGS_FONT_NAME "Gtk/FontName" 161#define XSETTINGS_FONT_NAME "Gtk/FontName"
@@ -117,67 +177,129 @@ struct xsettings
117 FcBool aa, hinting; 177 FcBool aa, hinting;
118 int rgba, lcdfilter, hintstyle; 178 int rgba, lcdfilter, hintstyle;
119 double dpi; 179 double dpi;
120#endif
121 180
122 char *font; 181 char *font;
182#endif
183
123 char *tb_style; 184 char *tb_style;
124 185
125 unsigned seen; 186 unsigned seen;
126}; 187};
127 188
128#ifdef HAVE_GSETTINGS 189#ifdef HAVE_GSETTINGS
129#define GSETTINGS_SCHEMA "org.gnome.desktop.interface" 190#define GSETTINGS_SCHEMA "org.gnome.desktop.interface"
130#define SYSTEM_MONO_FONT "monospace-font-name" 191#define GSETTINGS_TOOL_BAR_STYLE "toolbar-style"
192
193#ifdef HAVE_XFT
194#define GSETTINGS_MONO_FONT "monospace-font-name"
195#define GSETTINGS_FONT_NAME "font-name"
196#endif
197
198
199/* The single GSettings instance, or NULL if not connected to GSettings. */
200
201static GSettings *gsettings_client;
202
203/* Callback called when something changed in GSettings. */
131 204
132static void 205static void
133something_changedCB (GSettings *settings, 206something_changed_gsettingsCB (GSettings *settings,
134 gchar *key, 207 gchar *key,
135 gpointer user_data) 208 gpointer user_data)
136{ 209{
137 GVariant *val; 210 GVariant *val;
138 if (strcmp (key, SYSTEM_MONO_FONT) != 0) return; 211
139 val = g_settings_get_value (settings, SYSTEM_MONO_FONT); 212 if (strcmp (key, GSETTINGS_TOOL_BAR_STYLE) == 0)
140 if (val)
141 { 213 {
142 g_variant_ref_sink (val); 214 val = g_settings_get_value (settings, GSETTINGS_TOOL_BAR_STYLE);
143 if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING)) 215 if (val)
144 { 216 {
145 const gchar *newfont = g_variant_get_string (val, NULL); 217 g_variant_ref_sink (val);
146 store_monospaced_changed (newfont); 218 if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
219 {
220 const gchar *newstyle = g_variant_get_string (val, NULL);
221 store_tool_bar_style_changed (newstyle, first_dpyinfo);
222 }
223 g_variant_unref (val);
224 }
225 }
226#ifdef HAVE_XFT
227 else if (strcmp (key, GSETTINGS_MONO_FONT) == 0)
228 {
229 val = g_settings_get_value (settings, GSETTINGS_MONO_FONT);
230 if (val)
231 {
232 g_variant_ref_sink (val);
233 if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
234 {
235 const gchar *newfont = g_variant_get_string (val, NULL);
236 store_monospaced_changed (newfont);
237 }
238 g_variant_unref (val);
147 } 239 }
148 g_variant_unref (val);
149 } 240 }
241 else if (strcmp (key, GSETTINGS_FONT_NAME) == 0)
242 {
243 val = g_settings_get_value (settings, GSETTINGS_FONT_NAME);
244 if (val)
245 {
246 g_variant_ref_sink (val);
247 if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
248 {
249 const gchar *newfont = g_variant_get_string (val, NULL);
250 store_font_name_changed (newfont);
251 }
252 g_variant_unref (val);
253 }
254 }
255#endif /* HAVE_XFT */
150} 256}
151 257
152#else 258#endif /* HAVE_GSETTINGS */
153#ifdef HAVE_GCONF
154#define SYSTEM_MONO_FONT "/desktop/gnome/interface/monospace_font_name"
155 259
260#ifdef HAVE_GCONF
261#define GCONF_TOOL_BAR_STYLE "/desktop/gnome/interface/toolbar_style"
156#ifdef HAVE_XFT 262#ifdef HAVE_XFT
157# define SYSTEM_FONT "/desktop/gnome/interface/font_name" 263#define GCONF_MONO_FONT "/desktop/gnome/interface/monospace_font_name"
264#define GCONF_FONT_NAME "/desktop/gnome/interface/font_name"
158#endif 265#endif
159 266
160/* Callback called when something changed in GConf that we care about, 267/* The single GConf instance, or NULL if not connected to GConf. */
161 that is SYSTEM_MONO_FONT. */ 268
269static GConfClient *gconf_client;
270
271/* Callback called when something changed in GConf that we care about. */
162 272
163static void 273static void
164something_changedCB (GConfClient *client, 274something_changed_gconfCB (GConfClient *client,
165 guint cnxn_id, 275 guint cnxn_id,
166 GConfEntry *entry, 276 GConfEntry *entry,
167 gpointer user_data) 277 gpointer user_data)
168{ 278{
169 GConfValue *v = gconf_entry_get_value (entry); 279 GConfValue *v = gconf_entry_get_value (entry);
280 const char *key = gconf_entry_get_key (entry);
170 281
171 if (!v) return; 282 if (!v || v->type != GCONF_VALUE_STRING || ! key) return;
172 if (v->type == GCONF_VALUE_STRING) 283 if (strcmp (key, GCONF_TOOL_BAR_STYLE) == 0)
284 {
285 const char *value = gconf_value_get_string (v);
286 store_tool_bar_style_changed (value, first_dpyinfo);
287 }
288#ifdef HAVE_XFT
289 else if (strcmp (key, GCONF_MONO_FONT) == 0)
173 { 290 {
174 const char *value = gconf_value_get_string (v); 291 const char *value = gconf_value_get_string (v);
175 store_monospaced_changed (value); 292 store_monospaced_changed (value);
176 } 293 }
294 else if (strcmp (key, GCONF_FONT_NAME) == 0)
295 {
296 const char *value = gconf_value_get_string (v);
297 store_font_name_changed (value);
298 }
299#endif /* HAVE_XFT */
177} 300}
178 301
179#endif /* HAVE_GCONF */ 302#endif /* HAVE_GCONF */
180#endif /* ! HAVE_GSETTINGS */
181 303
182#ifdef HAVE_XFT 304#ifdef HAVE_XFT
183 305
@@ -319,14 +441,14 @@ parse_settings (unsigned char *prop,
319 bytes_parsed += 4; /* Skip serial for this value */ 441 bytes_parsed += 4; /* Skip serial for this value */
320 if (bytes_parsed > bytes) return BadLength; 442 if (bytes_parsed > bytes) return BadLength;
321 443
322 want_this = 444 want_this =
323#ifdef HAVE_XFT 445#ifdef HAVE_XFT
324 (nlen > 6 && strncmp (name, "Xft/", 4) == 0) 446 (nlen > 6 && strncmp (name, "Xft/", 4) == 0)
447 || strcmp (XSETTINGS_FONT_NAME, name) == 0
325 || 448 ||
326#endif 449#endif
327 (strcmp (XSETTINGS_FONT_NAME, name) == 0) 450 strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0;
328 || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0); 451
329
330 switch (type) 452 switch (type)
331 { 453 {
332 case 0: /* Integer */ 454 case 0: /* Integer */
@@ -367,17 +489,17 @@ parse_settings (unsigned char *prop,
367 if (want_this) 489 if (want_this)
368 { 490 {
369 ++settings_seen; 491 ++settings_seen;
370 if (strcmp (name, XSETTINGS_FONT_NAME) == 0) 492 if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0)
371 {
372 settings->font = xstrdup (sval);
373 settings->seen |= SEEN_FONT;
374 }
375 else if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0)
376 { 493 {
377 settings->tb_style = xstrdup (sval); 494 settings->tb_style = xstrdup (sval);
378 settings->seen |= SEEN_TB_STYLE; 495 settings->seen |= SEEN_TB_STYLE;
379 } 496 }
380#ifdef HAVE_XFT 497#ifdef HAVE_XFT
498 else if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
499 {
500 settings->font = xstrdup (sval);
501 settings->seen |= SEEN_FONT;
502 }
381 else if (strcmp (name, "Xft/Antialias") == 0) 503 else if (strcmp (name, "Xft/Antialias") == 0)
382 { 504 {
383 settings->seen |= SEEN_AA; 505 settings->seen |= SEEN_AA;
@@ -442,6 +564,10 @@ parse_settings (unsigned char *prop,
442 return settings_seen; 564 return settings_seen;
443} 565}
444 566
567/* Read settings from the XSettings property window on display for DPYINFO.
568 Store settings read in SETTINGS.
569 Return non-zero if successful, zero if not. */
570
445static int 571static int
446read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) 572read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
447{ 573{
@@ -471,6 +597,8 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
471 return rc != 0; 597 return rc != 0;
472} 598}
473 599
600/* Apply Xft settings in SETTINGS to the Xft library.
601 If SEND_EVENT_P is non-zero store a Lisp event that Xft settings changed. */
474 602
475static void 603static void
476apply_xft_settings (struct x_display_info *dpyinfo, 604apply_xft_settings (struct x_display_info *dpyinfo,
@@ -489,9 +617,9 @@ apply_xft_settings (struct x_display_info *dpyinfo,
489 pat); 617 pat);
490 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa); 618 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa);
491 FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting); 619 FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting);
492# ifdef FC_HINT_STYLE 620#ifdef FC_HINT_STYLE
493 FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle); 621 FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle);
494# endif 622#endif
495 FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter); 623 FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter);
496 FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba); 624 FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
497 FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi); 625 FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
@@ -530,7 +658,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
530 oldsettings.lcdfilter = settings->lcdfilter; 658 oldsettings.lcdfilter = settings->lcdfilter;
531 } 659 }
532 660
533# ifdef FC_HINT_STYLE 661#ifdef FC_HINT_STYLE
534 if ((settings->seen & SEEN_HINTSTYLE) != 0 662 if ((settings->seen & SEEN_HINTSTYLE) != 0
535 && oldsettings.hintstyle != settings->hintstyle) 663 && oldsettings.hintstyle != settings->hintstyle)
536 { 664 {
@@ -539,7 +667,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
539 ++changed; 667 ++changed;
540 oldsettings.hintstyle = settings->hintstyle; 668 oldsettings.hintstyle = settings->hintstyle;
541 } 669 }
542# endif 670#endif
543 671
544 if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi 672 if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi
545 && settings->dpi > 0) 673 && settings->dpi > 0)
@@ -590,11 +718,13 @@ apply_xft_settings (struct x_display_info *dpyinfo,
590#endif /* HAVE_XFT */ 718#endif /* HAVE_XFT */
591} 719}
592 720
721/* Read XSettings from the display for DPYINFO.
722 If SEND_EVENT_P is non-zero store a Lisp event settings that changed. */
723
593static void 724static void
594read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) 725read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
595{ 726{
596 struct xsettings settings; 727 struct xsettings settings;
597 Lisp_Object dpyname = XCAR (dpyinfo->name_list_element);
598 728
599 if (!read_settings (dpyinfo, &settings)) 729 if (!read_settings (dpyinfo, &settings))
600 return; 730 return;
@@ -602,38 +732,29 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
602 apply_xft_settings (dpyinfo, True, &settings); 732 apply_xft_settings (dpyinfo, True, &settings);
603 if (settings.seen & SEEN_TB_STYLE) 733 if (settings.seen & SEEN_TB_STYLE)
604 { 734 {
605 Lisp_Object style = Qnil; 735 if (send_event_p)
606 if (strcmp (settings.tb_style, "both") == 0) 736 store_tool_bar_style_changed (settings.tb_style, dpyinfo);
607 style = Qboth; 737 else
608 else if (strcmp (settings.tb_style, "both-horiz") == 0) 738 current_tool_bar_style = map_tool_bar_style (settings.tb_style);
609 style = Qboth_horiz;
610 else if (strcmp (settings.tb_style, "icons") == 0)
611 style = Qimage;
612 else if (strcmp (settings.tb_style, "text") == 0)
613 style = Qtext;
614 if (!NILP (style) && !EQ (style, current_tool_bar_style))
615 {
616 current_tool_bar_style = style;
617 if (send_event_p)
618 store_config_changed_event (Qtool_bar_style, dpyname);
619 }
620 xfree (settings.tb_style); 739 xfree (settings.tb_style);
621 } 740 }
622 741#ifdef HAVE_XFT
623 if (settings.seen & SEEN_FONT) 742 if (settings.seen & SEEN_FONT)
624 { 743 {
625 if (!current_font || strcmp (current_font, settings.font) != 0) 744 if (send_event_p)
745 store_font_name_changed (settings.font);
746 else
626 { 747 {
627 xfree (current_font); 748 xfree (current_font);
628 current_font = settings.font; 749 current_font = xstrdup (settings.font);
629 if (send_event_p)
630 store_config_changed_event (Qfont_name, dpyname);
631 } 750 }
632 else 751 xfree (settings.font);
633 xfree (settings.font);
634 } 752 }
753#endif
635} 754}
636 755
756/* Check if EVENT for the display in DPYINFO is XSettings related. */
757
637void 758void
638xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) 759xft_settings_event (struct x_display_info *dpyinfo, XEvent *event)
639{ 760{
@@ -675,6 +796,7 @@ xft_settings_event (struct x_display_info *dpyinfo, XEvent *event)
675 read_and_apply_settings (dpyinfo, True); 796 read_and_apply_settings (dpyinfo, True);
676} 797}
677 798
799/* Initialize GSettings and read startup values. */
678 800
679static void 801static void
680init_gsettings (void) 802init_gsettings (void)
@@ -697,8 +819,21 @@ init_gsettings (void)
697 gsettings_client = g_settings_new (GSETTINGS_SCHEMA); 819 gsettings_client = g_settings_new (GSETTINGS_SCHEMA);
698 if (!gsettings_client) return; 820 if (!gsettings_client) return;
699 g_object_ref_sink (G_OBJECT (gsettings_client)); 821 g_object_ref_sink (G_OBJECT (gsettings_client));
822 g_signal_connect (G_OBJECT (gsettings_client), "changed",
823 G_CALLBACK (something_changed_gsettingsCB), NULL);
824
825 val = g_settings_get_value (gsettings_client, GSETTINGS_TOOL_BAR_STYLE);
826 if (val)
827 {
828 g_variant_ref_sink (val);
829 if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
830 current_tool_bar_style
831 = map_tool_bar_style (g_variant_get_string (val, NULL));
832 g_variant_unref (val);
833 }
700 834
701 val = g_settings_get_value (gsettings_client, SYSTEM_MONO_FONT); 835#ifdef HAVE_XFT
836 val = g_settings_get_value (gsettings_client, GSETTINGS_MONO_FONT);
702 if (val) 837 if (val)
703 { 838 {
704 g_variant_ref_sink (val); 839 g_variant_ref_sink (val);
@@ -707,46 +842,84 @@ init_gsettings (void)
707 g_variant_unref (val); 842 g_variant_unref (val);
708 } 843 }
709 844
710 g_signal_connect (G_OBJECT (gsettings_client), "changed", 845 val = g_settings_get_value (gsettings_client, GSETTINGS_FONT_NAME);
711 G_CALLBACK (something_changedCB), NULL); 846 if (val)
847 {
848 g_variant_ref_sink (val);
849 if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
850 current_font = xstrdup (g_variant_get_string (val, NULL));
851 g_variant_unref (val);
852 }
853#endif /* HAVE_XFT */
854
712#endif /* HAVE_GSETTINGS */ 855#endif /* HAVE_GSETTINGS */
713} 856}
714 857
858/* Init GConf and read startup values. */
715 859
716static void 860static void
717init_gconf (void) 861init_gconf (void)
718{ 862{
719#if defined (HAVE_GCONF) && defined (HAVE_XFT) && ! defined (HAVE_GSETTINGS) 863#if defined (HAVE_GCONF)
720 char *s; 864 char *s;
721 865
722#ifdef HAVE_G_TYPE_INIT 866#ifdef HAVE_G_TYPE_INIT
723 g_type_init (); 867 g_type_init ();
724#endif 868#endif
869
725 gconf_client = gconf_client_get_default (); 870 gconf_client = gconf_client_get_default ();
726 s = gconf_client_get_string (gconf_client, SYSTEM_MONO_FONT, NULL); 871 gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE);
872 gconf_client_add_dir (gconf_client,
873 GCONF_TOOL_BAR_STYLE,
874 GCONF_CLIENT_PRELOAD_ONELEVEL,
875 NULL);
876 gconf_client_notify_add (gconf_client,
877 GCONF_TOOL_BAR_STYLE,
878 something_changed_gconfCB,
879 NULL, NULL, NULL);
880
881 s = gconf_client_get_string (gconf_client, GCONF_TOOL_BAR_STYLE, NULL);
882 if (s)
883 {
884 current_tool_bar_style = map_tool_bar_style (s);
885 g_free (s);
886 }
887
888#ifdef HAVE_XFT
889 s = gconf_client_get_string (gconf_client, GCONF_MONO_FONT, NULL);
727 if (s) 890 if (s)
728 { 891 {
729 current_mono_font = xstrdup (s); 892 current_mono_font = xstrdup (s);
730 g_free (s); 893 g_free (s);
731 } 894 }
732 s = gconf_client_get_string (gconf_client, SYSTEM_FONT, NULL); 895 s = gconf_client_get_string (gconf_client, GCONF_FONT_NAME, NULL);
733 if (s) 896 if (s)
734 { 897 {
735 current_font = xstrdup (s); 898 current_font = xstrdup (s);
736 g_free (s); 899 g_free (s);
737 } 900 }
738 gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE);
739 gconf_client_add_dir (gconf_client, 901 gconf_client_add_dir (gconf_client,
740 SYSTEM_MONO_FONT, 902 GCONF_MONO_FONT,
741 GCONF_CLIENT_PRELOAD_ONELEVEL, 903 GCONF_CLIENT_PRELOAD_ONELEVEL,
742 NULL); 904 NULL);
743 gconf_client_notify_add (gconf_client, 905 gconf_client_notify_add (gconf_client,
744 SYSTEM_MONO_FONT, 906 GCONF_MONO_FONT,
745 something_changedCB, 907 something_changed_gconfCB,
746 NULL, NULL, NULL); 908 NULL, NULL, NULL);
747#endif /* HAVE_GCONF && HAVE_XFT && ! HAVE_GSETTINGS */ 909 gconf_client_add_dir (gconf_client,
910 GCONF_FONT_NAME,
911 GCONF_CLIENT_PRELOAD_ONELEVEL,
912 NULL);
913 gconf_client_notify_add (gconf_client,
914 GCONF_FONT_NAME,
915 something_changed_gconfCB,
916 NULL, NULL, NULL);
917#endif /* HAVE_XFT */
918#endif /* HAVE_GCONF */
748} 919}
749 920
921/* Init Xsettings and read startup values. */
922
750static void 923static void
751init_xsettings (struct x_display_info *dpyinfo) 924init_xsettings (struct x_display_info *dpyinfo)
752{ 925{
@@ -769,11 +942,14 @@ void
769xsettings_initialize (struct x_display_info *dpyinfo) 942xsettings_initialize (struct x_display_info *dpyinfo)
770{ 943{
771 if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo; 944 if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo;
772 init_gsettings ();
773 init_gconf (); 945 init_gconf ();
774 init_xsettings (dpyinfo); 946 init_xsettings (dpyinfo);
947 init_gsettings ();
775} 948}
776 949
950/* Return the system monospaced font.
951 May be NULL if not known. */
952
777const char * 953const char *
778xsettings_get_system_font (void) 954xsettings_get_system_font (void)
779{ 955{
@@ -781,6 +957,9 @@ xsettings_get_system_font (void)
781} 957}
782 958
783#ifdef USE_LUCID 959#ifdef USE_LUCID
960/* Return the system font.
961 May be NULL if not known. */
962
784const char * 963const char *
785xsettings_get_system_normal_font (void) 964xsettings_get_system_normal_font (void)
786{ 965{
@@ -831,11 +1010,10 @@ syms_of_xsettings (void)
831 first_dpyinfo = NULL; 1010 first_dpyinfo = NULL;
832#ifdef HAVE_GSETTINGS 1011#ifdef HAVE_GSETTINGS
833 gsettings_client = NULL; 1012 gsettings_client = NULL;
834#else 1013#endif
835#ifdef HAVE_GCONF 1014#ifdef HAVE_GCONF
836 gconf_client = NULL; 1015 gconf_client = NULL;
837#endif 1016#endif
838#endif
839 1017
840 DEFSYM (Qmonospace_font_name, "monospace-font-name"); 1018 DEFSYM (Qmonospace_font_name, "monospace-font-name");
841 DEFSYM (Qfont_name, "font-name"); 1019 DEFSYM (Qfont_name, "font-name");