]> code.delx.au - gnu-emacs/commitdiff
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Wed, 28 Jan 2015 04:31:15 +0000 (01:31 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Wed, 28 Jan 2015 04:31:15 +0000 (01:31 -0300)
120 files changed:
ChangeLog
INSTALL.REPO
admin/ChangeLog
admin/notes/lel-TODO [new file with mode: 0644]
admin/update_autogen
configure.ac
doc/emacs/ChangeLog
doc/emacs/cmdargs.texi
doc/emacs/programs.texi
doc/lispref/ChangeLog
doc/lispref/commands.texi
doc/lispref/display.texi
doc/lispref/frames.texi
doc/lispref/searching.texi
doc/lispref/text.texi
doc/lispref/variables.texi
doc/man/grep-changelog.1 [new file with mode: 0644]
doc/misc/eww.texi
doc/misc/info.texi
etc/CONTRIBUTE [new file with mode: 0644]
etc/ChangeLog
etc/refcards/emacsver.tex [new file with mode: 0644]
etc/tutorials/TUTORIAL.he
lib-src/grep-changelog [new file with mode: 0755]
lib-src/test-distrib.c [new file with mode: 0644]
lib/alloca.in.h
lib/binary-io.h
lib/c-ctype.h
lib/c-strcasecmp.c
lib/c-strncasecmp.c
lib/careadlinkat.c
lib/close-stream.c
lib/dosname.h
lib/dup2.c
lib/filemode.h
lib/fpending.c
lib/fpending.h
lib/getgroups.c
lib/getloadavg.c
lib/getopt.in.h
lib/getopt1.c
lib/getopt_int.h
lib/gettext.h
lib/gettime.c
lib/gettimeofday.c
lib/group-member.c
lib/md5.c
lib/md5.h
lib/memrchr.c
lib/sha1.c
lib/sig2str.c
lib/stdarg.in.h [new file with mode: 0644]
lib/stdbool.in.h [new file with mode: 0644]
lib/stdlib.in.h
lib/strftime.c
lib/strtoimax.c
lib/strtol.c
lib/strtoll.c
lib/strtoull.c
lib/tempname.c
lib/time_r.c
lib/unsetenv.c
lib/xalloc-oversized.h
lisp/ChangeLog
lisp/button.el
lisp/erc/ChangeLog
lisp/erc/erc-backend.el
lisp/filenotify.el
lisp/files.el
lisp/gnus/gnus-setup.el [new file with mode: 0644]
lisp/net/net-utils.el
lisp/net/tramp.el
lisp/progmodes/cap-words.el [new file with mode: 0644]
lisp/progmodes/python.el
lisp/progmodes/sh-script.el
lisp/subr.el
lisp/textmodes/artist.el
lisp/w32-common-fns.el [new file with mode: 0644]
m4/alloca.m4
m4/dup2.m4
m4/filemode.m4
m4/getgroups.m4
m4/getloadavg.m4
m4/gettime.m4
m4/gettimeofday.m4
m4/group-member.m4
m4/memrchr.m4
m4/mktime.m4
m4/pathmax.m4
m4/sig2str.m4
m4/ssize_t.m4
m4/st_dm_mode.m4
m4/stat-time.m4
m4/stdarg.m4 [new file with mode: 0644]
m4/stdbool.m4 [new file with mode: 0644]
m4/strftime.m4
m4/strtoimax.m4
m4/strtoll.m4
m4/strtoull.m4
m4/strtoumax.m4
m4/time_h.m4
m4/timespec.m4
m4/utimbuf.m4
nt/addsection.c [new file with mode: 0644]
src/ChangeLog
src/coding.c
src/dired.c
src/emacs.c
src/indent.c
src/insdel.c
src/nsterm.m
src/w32.c
src/w32fns.c
src/w32heap.c
src/xdisp.c
src/xfns.c
test/ChangeLog
test/automated/package-x-test.el [new file with mode: 0644]
test/automated/python-tests.el
test/automated/regexp-tests.el

index 68a734135ac1a17ecccf22d4d0cf7aab832e89be..00a9d00a2bfc74a6f8135597b7a10eee35a8adee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * configure.ac (HAVE_W32): Abort with error message if
+       --without-toolkit-scroll-bars was specified.  See
+       http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00525.html
+       for the details.
+
 2015-01-27  Paul Eggert  <eggert@cs.ucla.edu>
 
        Port autogen.sh hook creation to private templates
index 3431ee480bf212f9a1de18f3eb5e90f4db84f114..61b16340d351abbf194861871db525fd4ba737b3 100644 (file)
@@ -1,3 +1,7 @@
+Copyright (C) 2002-2015 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
+
             Building and Installing Emacs from the Repository
 
 Simply run 'make'.  This should work if your files are freshly checked
index e692ca0dbfdd4196800161208847c66b4192f1ef..6cc59c47d060bc4a1cd2041af005c397c301c6b7 100644 (file)
@@ -1,3 +1,7 @@
+2015-01-03  Glenn Morris  <rgm@gnu.org>
+
+       * update_autogen (commit): Prepend "# " to commit message.
+
 2015-01-24  Paul Eggert  <eggert@cs.ucla.edu>
 
        Fix a couple of AM_V_GEN bugs
diff --git a/admin/notes/lel-TODO b/admin/notes/lel-TODO
new file mode 100644 (file)
index 0000000..c59e920
--- /dev/null
@@ -0,0 +1,124 @@
+Some lisp/emacs-lisp/ Features and Where They Are Documented
+
+Copyright (C) 2007-2015 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
+
+* Status Key
+  -      -- as yet unknown
+  n/a    -- not applicable (internal, uninteresting, etc)
+  obsolete -- an obsolete feature, to be removed in future
+  todo   -- not documented but should be
+  NODE   -- documented in or under info node NODE
+
+
+* Features
+  advice                  (elisp) Advising Functions
+  advice-preload          n/a
+  assoc                   -
+  authors                 -
+  autoload                (elisp) Autoload
+  avl-tree                -
+  backquote               n/a
+  benchmark               n/a
+  bindat                  (elisp) Byte Packing
+  byte-compile            (elisp) Byte Compilation
+  byte-opt                -
+  bytecomp                (elisp) Compilation Functions
+  checkdoc                (elisp) Documentation Tips
+  cl                      (cl)
+  cl-compat               n/a
+  cl-specs                n/a
+  copyright               -
+  crm                     -
+  cust-print              (elisp) Printing in Edebug
+  debug                   (elisp) Debugger
+  derived                 (elisp) Derived Modes
+  disass                  (elisp) Disassembly
+  easy-mmode              (elisp) Defining Minor Modes
+  easymenu                -
+  edebug                  (elisp) Edebug
+  eldoc                   -
+  elint                   -
+  elp                     n/a
+  ewoc                    (elisp) Separated Rendering
+  find-func               -
+  find-gc                 -
+  generic                 (elisp) Generic Modes
+  gulp                    n/a
+  helper                  -
+  levents                 obsolete
+  lisp-float-type         -
+  lisp-mnt                -
+  lisp-mode               n/a
+  lmenu                   obsolete
+  lucid                   obsolete
+  macroexp                (elisp) Expansion
+  pp                      (emacs) Program Indent
+  re-builder              -
+  regexp-opt              (elisp) Regexp Functions
+  regi                    -
+  ring                    (elisp) Rings
+  rx                      -
+  shadow                  -
+  sregex                  obsolete
+  syntax                  (elisp) Position Parse
+  testcover               -
+  timer                   (elisp) Timers
+  tq                      (elisp) Transaction Queues
+  trace                   -
+  unsafep                 (elisp) Function Safety
+  warnings                (elisp) Warnings
+
+
+* Above list created using default directory lisp/emacs-lisp/ with
+  (shell-command
+    "sed '/^(provide '\\''/!d;s//  /;s/).*//' *.el | sort | uniq")
+
+
+* How to use this file to improve Emacs
+  (loop
+   (let* ((feature (choose-one Features))
+          (status (feature-status feature)))
+     (if (or (eq '- status) (not (verify status)))
+         (update feature (current-docs feature))
+       (case status
+         (todo (let (doc patch feedback)
+                 (while (not (grok feature))
+                   (or (play-with feature)
+                       (grep feature Internet)
+                       (grep feature (wisdom-maybe "emacs-devel"))))
+                 (setq doc (write-documentation feature)
+                       patch (diff (current-docs) doc))
+                 (while (not (and (correct doc)
+                                  (well-placed doc)
+                                  (well-formed patch)))
+                   (setq doc (revise doc)
+                         patch (diff (current-docs) doc))
+                         feedback (wisdom-maybe "emacs-devel" patch))
+                 (when (install patch)
+                   (when (update feature (current-docs feature))
+                     (job-well-done user-login-name)))))
+         (n/a (job-well-done user-login-name))))))
+
+
+* Etc
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+  Local variables:
+  mode: outline
+  End:
index 1a84030a5b0b97482edbcb1c851df366f21db69b..73e8aebe3d82763c8e90e81b12337c66fe852630 100755 (executable)
@@ -228,7 +228,7 @@ commit ()
 
     echo "Committing..."
 
-    $vcs commit -m "Auto-commit of $type files." "$@" || return $?
+    $vcs commit -m "Auto-commit of $type files." "$@" || return $?
 
     [ "$vcs" = "git" ] && {
         $vcs push || return $?
index cd011b9720b8bb15255419e1f40fc5a248cef429..5776e4ef8ed9d5352bfc4b90d000e584941116bf 100644 (file)
@@ -1938,6 +1938,9 @@ CM_OBJ="cm.o"
 XARGS_LIMIT=
 if test "${HAVE_W32}" = "yes"; then
   AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.])
+  if test "$with_toolkit_scroll_bars" = "no"; then
+    AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for w32 build.])
+  fi
   AC_CHECK_TOOL(WINDRES, [windres],
                 [AC_MSG_ERROR([No resource compiler found.])])
   W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
index b7853a7f118c6231193bbc7159c418b13bdc9d21..718657a360b34c3cff8874dae394eabf68dfe36f 100644 (file)
@@ -1,3 +1,12 @@
+2015-01-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * cmdargs.texi (Action Arguments): Clarify into which buffer
+       '--insert' inserts.  (Bug#19694)
+
+2015-01-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * programs.texi (Custom C Indent): Fix a typo.  (Bug#19647)
+
 2015-01-27  Ivan Shmakov  <ivan@siamics.net>
 
        * files.texi (File Archives): Document "I" for tar-new-entry.
index f724f77e230b1bee11df869c4be7189bdcb9aff9..42c8e33d5c776af541d9107e128ba6d985ad81e1 100644 (file)
@@ -165,9 +165,12 @@ Evaluate Lisp expression @var{expression}.
 @item --insert=@var{file}
 @opindex --insert
 @cindex insert file contents, command-line argument
-Insert the contents of @var{file} into the @file{*scratch*} buffer
-(@pxref{Lisp Interaction}).  This is like what @kbd{M-x insert-file}
-does (@pxref{Misc File Ops}).
+Insert the contents of @var{file} into the buffer that is current when
+this command-line argument is processed.  Usually, this is the
+@file{*scratch*} buffer (@pxref{Lisp Interaction}), but if arguments
+earlier on the command line visit files or switch buffers, that might
+be a different buffer.  The effect of this command-line argument is
+like what @kbd{M-x insert-file} does (@pxref{Misc File Ops}).
 
 @item --kill
 @opindex --kill
index 8f6111dfa24f1a2ff160ba700ccf69060720d3c7..609392f6bb78725d69e76ca3bf4066492cb0b603 100644 (file)
@@ -546,7 +546,7 @@ your selected @dfn{style} with the syntactic construct and adds this
 onto the indentation of the @dfn{anchor statement}.
 
 @table @kbd
-@item C-c . @key{RET} @var{style} @key{RET}
+@item C-c . @var{style} @key{RET}
 Select a predefined style @var{style} (@code{c-set-style}).
 @end table
 
index 4c0c116ba5adc3a5f9705e2ab638bca146ed6d3e..3a1eeb2acb9de8af49a8947491e70d216edb6e81 100644 (file)
@@ -1,3 +1,31 @@
+2015-01-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * searching.texi (Regexp Search): Add a cross-reference to "Syntax
+       of Regexps".  (Bug#19668)
+
+2015-01-21  Daniel Koning  <dk@danielkoning.com>  (tiny change)
+
+       * commands.texi (Drag Events, Motion Events, Event Examples)
+       (Accessing Mouse): Describe actual range of values that mouse
+       position objects can have.
+
+2015-01-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * display.texi (Manipulating Buttons): Explain more about the
+       'action' property.  (Bug#19628)
+
+       * text.texi (Clickable Text): Improve indexing.  (Bug#19629)
+
+2015-01-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * variables.texi (Creating Buffer-Local): Improve indexing.
+       (Bug#19608)
+
+2015-01-04  Eli Zaretskii  <eliz@gnu.org>
+
+       * frames.texi (Display Feature Testing): Make the description of
+       x-server-version and x-server-vendor less X-specific.  (Bug#19502)
+
 2015-01-15  Eli Zaretskii  <eliz@gnu.org>
 
        * streams.texi (Input Functions): Document 'set-binary-mode'.
index 36c74450ed486bfa54c1990a5e4d54d71c7724c7..6fdc8e2ec797ab8a3083bde8658b3c61cc596552 100644 (file)
@@ -1489,8 +1489,10 @@ prefix @samp{drag-}.  For example, dragging the mouse with button 2
 held down generates a @code{drag-mouse-2} event.  The second and third
 elements of the event give the starting and ending position of the
 drag, as mouse position lists (@pxref{Click Events}).  You can access
-the second element of any mouse event in the same way, with no need to
-distinguish drag events from others.
+the second element of any mouse event in the same way.  However, the
+drag event may end outside the boundaries of the frame that was
+initially selected.  In that case, the third element's position list
+contains that frame in place of a window.
 
 The @samp{drag-} prefix follows the modifier key prefixes such as
 @samp{C-} and @samp{M-}.
@@ -1635,7 +1637,10 @@ represented by lists that look like this:
 
 @noindent
 @var{position} is a mouse position list (@pxref{Click Events}),
-specifying the current position of the mouse cursor.
+specifying the current position of the mouse cursor.  As with the
+end-position of a drag event, this position list may represent a
+location outside the boundaries of the initially selected frame, in
+which case the list contains that frame in place of a window.
 
 The special form @code{track-mouse} enables generation of motion
 events within its body.  Outside of @code{track-mouse} forms, Emacs
@@ -1850,6 +1855,14 @@ into another window.  That produces a pair of events like these:
                    -453816))
 @end smallexample
 
+The frame with input focus might not take up the entire screen, and
+the user might move the mouse outside the scope of the frame. Inside
+the @code{track-mouse} special form, that produces an event like this:
+
+@smallexample
+(mouse-movement (#<frame *ielm* 0x102849a30> nil (563 . 205) 532301936))
+@end smallexample
+
 To handle a SIGUSR1 signal, define an interactive function, and
 bind it to the @code{signal usr1} event sequence:
 
@@ -2014,7 +2027,9 @@ Events}); and @code{nil} otherwise.
 various parts of it:
 
 @defun posn-window position
-Return the window that @var{position} is in.
+Return the window that @var{position} is in.  If @var{position}
+represents a location outside the frame where the event was initiated,
+return that frame instead.
 @end defun
 
 @defun posn-area position
index 1b7f21da2826ecdfad37efcbe99e96bf20d0fec4..b09b82a6724a4bddeba7e5167896dae3a59507f9 100644 (file)
@@ -5735,10 +5735,12 @@ Set @var{button}'s @var{prop} property to @var{val}.
 @end defun
 
 @defun button-activate button &optional use-mouse-action
-Call @var{button}'s @code{action} property (i.e., invoke it).  If
-@var{use-mouse-action} is non-@code{nil}, try to invoke the button's
-@code{mouse-action} property instead of @code{action}; if the button
-has no @code{mouse-action} property, use @code{action} as normal.
+Call @var{button}'s @code{action} property (i.e., invoke the function
+that is the value of that property, passing it the single argument
+@var{button}).  If @var{use-mouse-action} is non-@code{nil}, try to
+invoke the button's @code{mouse-action} property instead of
+@code{action}; if the button has no @code{mouse-action} property, use
+@code{action} as normal.
 @end defun
 
 @defun button-label button
index 663207c5253c88ca690912f6078307b06497a3a0..a6f4081532d91e9177495cade2fdfa1adfd422db 100644 (file)
@@ -2782,20 +2782,26 @@ colors).
 This function returns the number of color cells the screen supports.
 @end defun
 
-  These functions obtain additional information specifically
-about X displays.
+  These functions obtain additional information about the window
+system in use where Emacs shows the specified @var{display}.  (Their
+names begin with @code{x-} for historical reasons.)
 
 @defun x-server-version &optional display
-This function returns the list of version numbers of the X server
-running the display.  The value is a list of three integers: the major
-and minor version numbers of the X protocol, and the
-distributor-specific release number of the X server software itself.
+This function returns the list of version numbers of the GUI window
+system running on @var{display}, such as the X server on GNU and Unix
+systems.  The value is a list of three integers: the major and minor
+version numbers of the protocol, and the distributor-specific release
+number of the window system software itself.  On GNU and Unix systems,
+these are normally the version of the X protocol and the
+distributor-specific release number of the X server software.  On
+MS-Windows, this is the version of the Windows OS.
 @end defun
 
 @defun x-server-vendor &optional display
-This function returns the ``vendor'' that provided the X server
-software (as a string).  Really this means whoever distributes the X
-server.
+This function returns the ``vendor'' that provided the window system
+software (as a string).  On GNU and Unix systems this really means
+whoever distributes the X server.  On MS-Windows this is the vendor ID
+string of the Windows OS (Microsoft).
 
 When the developers of X labeled software distributors as
 ``vendors'', they showed their false assumption that no system could
index 2032b151d07561daed959e80f40034f19151e46d..61fac78e4a8d16c0e4346832f677220c3794b456 100644 (file)
@@ -988,10 +988,11 @@ list of characters @var{chars}.
 @cindex searching for regexp
 
   In GNU Emacs, you can search for the next match for a regular
-expression either incrementally or not.  For incremental search
-commands, see @ref{Regexp Search, , Regular Expression Search, emacs,
-The GNU Emacs Manual}.  Here we describe only the search functions
-useful in programs.  The principal one is @code{re-search-forward}.
+expression (@pxref{Syntax of Regexps}) either incrementally or not.
+For incremental search commands, see @ref{Regexp Search, , Regular
+Expression Search, emacs, The GNU Emacs Manual}.  Here we describe
+only the search functions useful in programs.  The principal one is
+@code{re-search-forward}.
 
   These search functions convert the regular expression to multibyte if
 the buffer is multibyte; they convert the regular expression to unibyte
index 1b8897f59e7cef72b2b1526fe2ea31c801c7a215..a7cfb22e889059757326325e19d50f7041cc0f37 100644 (file)
@@ -3731,6 +3731,7 @@ clicks on the link quickly without moving the mouse.  This behavior is
 controlled by the user option @code{mouse-1-click-follows-link}.
 @xref{Mouse References,,, emacs, The GNU Emacs Manual}.
 
+@cindex follow-link (text or overlay property)
   To set up the link so that it obeys
 @code{mouse-1-click-follows-link}, you must either (1) apply a
 @code{follow-link} text or overlay property to the link text, or (2)
index 5d766e4ffa6a9d8c574c8807baa3420bcaf04325..27bc06109597ddc8c37abe7309c70bec4ece92a2 100644 (file)
@@ -1403,6 +1403,7 @@ buffer-local variable interactively, just as it is useful to create
 buffer-local variables interactively.
 @end deffn
 
+@cindex local variables, killed by major mode
 @defun kill-all-local-variables
 This function eliminates all the buffer-local variable bindings of the
 current buffer except for variables marked as ``permanent'' and local
diff --git a/doc/man/grep-changelog.1 b/doc/man/grep-changelog.1
new file mode 100644 (file)
index 0000000..1a08c6c
--- /dev/null
@@ -0,0 +1,80 @@
+.\" -*- nroff -*-
+.\" See section COPYING for copyright and redistribution information.
+.TH grep-changelog 1
+.SH NAME
+grep-changelog \- print ChangeLog entries matching criteria
+.SH SYNOPSIS
+.B grep-changelog
+.RI [ options ]
+.RI [ CHANGELOG .\|.\|.]
+.SH DESCRIPTION
+.B grep-changelog
+searches the named
+.IR CHANGELOG s
+(by default files matching the regular expressions
+.B ChangeLog
+and
+.BR "ChangeLog\e.[0-9]+" )
+for entries matching the specified criteria.  At least one option or
+file must be specified.  This program is distributed with
+.BR "GNU Emacs" .
+.PP
+.SH OPTIONS
+The program accepts unambiguous abbreviations for option names.
+.TP
+.B \-\-author=AUTHOR
+Print entries whose author matches regular expression
+.IR AUTHOR .
+.TP
+.B \-\-text=TEXT
+Print entries whose text matches regular expression
+.IR TEXT .
+.TP
+.B \-\-exclude=TEXT
+Exclude entries matching regular expression
+.IR TEXT .
+.TP
+.B \-\-from\-date=YYYY\-MM\-DD
+Only consider entries made on or after the given date.
+ChangeLog date entries not in the
+\*(lqYYYY\-MM\-DD\*(rq format are never matched.
+.TP
+.B \-\-to\-date=YYYY\-MM\-DD
+Only consider entries made on or before the given date.
+.TP
+.B \-\-rcs\-log
+Print output in a format suitable for RCS log entries.
+This format removes author lines, leading spaces, and file names.
+.TP
+.B \-\-with\-date
+In RCS log format, print short dates.
+.TP
+.B \-\-reverse
+Show matches in reverse order.
+.TP
+.B \-\-version
+Display version information.
+.TP
+.B \-\-help
+Display basic usage information.
+.
+.SH COPYING
+Copyright
+.if t \(co
+.if n (C)
+2008-2015 Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of this
+document provided the copyright notice and this permission notice are
+preserved on all copies.
+.PP
+Permission is granted to copy and distribute modified versions of
+this document under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of
+a permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+document into another language, under the above conditions for
+modified versions, except that this permission notice may be stated
+in a translation approved by the Free Software Foundation.
+.
index 8c1865d78a5f959c4b3b1b2243bbac57fca9f1e7..fd9f6f543e04d2f6c5ad6dd4a98280c9a92f4993 100644 (file)
@@ -8,7 +8,7 @@
 @copying
 This file documents the GNU Emacs Web Wowser (EWW) package.
 
-Copyright @copyright{} 2014-2015 Free Software Foundation, Inc.
+Copyright @copyright{} 2014--2015 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
index 0e2e64f2356dafd387418ac0c45029d9352af616..759956d21dc19e39206727679aa922ffaf42880c 100644 (file)
@@ -15,7 +15,7 @@
 This file describes how to use Info, the menu-driven GNU
 documentation system.
 
-Copyright @copyright{} 1989, 1992, 1996--2014 Free Software Foundation, Inc.
+Copyright @copyright{} 1989, 1992, 1996--2015 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/etc/CONTRIBUTE b/etc/CONTRIBUTE
new file mode 100644 (file)
index 0000000..92b4c9e
--- /dev/null
@@ -0,0 +1,227 @@
+Copyright (C) 2006-2015 Free Software Foundation, Inc.
+See end for license conditions.
+
+
+                       Contributing to Emacs
+
+Emacs is a collaborative project and we encourage contributions from
+anyone and everyone.  If you want to contribute in the way that will
+help us most, we recommend (1) fixing reported bugs and (2)
+implementing the feature ideas in etc/TODO.  However, if you think of
+new features to add, please suggest them too -- we might like your
+idea.  Porting to new platforms is also useful, when there is a new
+platform, but that is not common nowadays.
+
+For documentation on how to develop Emacs changes, refer to the Emacs
+Manual and the Emacs Lisp Reference Manual (both included in the Emacs
+distribution).  The web pages in http://www.gnu.org/software/emacs
+contain additional information.
+
+You may also want to submit your change so that can be considered for
+inclusion in a future version of Emacs (see below).
+
+If you don't feel up to hacking Emacs, there are many other ways to
+help.  You can answer questions on the mailing lists, write
+documentation, find and report bugs, check if existing bug reports
+are fixed in newer versions of Emacs, contribute to the Emacs web
+pages, or develop a package that works with Emacs.
+
+Here are some style and legal conventions for contributors to Emacs:
+
+
+* Coding Standards
+
+Contributed code should follow the GNU Coding Standards.
+
+If it doesn't, we'll need to find someone to fix the code before we
+can use it.
+
+Emacs has certain additional style and coding conventions.
+
+Ref: http://www.gnu.org/prep/standards/
+Ref: GNU Coding Standards Info Manual
+Ref: The "Tips" Appendix in the Emacs Lisp Reference.
+
+
+* Copyright Assignment
+
+The FSF (Free Software Foundation) is the copyright holder for GNU Emacs.
+The FSF is a nonprofit with a worldwide mission to promote computer
+user freedom and to defend the rights of all free software users.
+For general information, see the website http://www.fsf.org/ .
+
+Generally speaking, for non-trivial contributions to GNU Emacs we
+require that the copyright be assigned to the FSF.  For the reasons
+behind this, see: http://www.gnu.org/licenses/why-assign.html .
+
+Copyright assignment is a simple process.  Residents of some countries
+can do it entirely electronically.  We can help you get started, and
+answer any questions you may have (or point you to the people with the
+answers), at the emacs-devel@gnu.org mailing list.
+
+(Please note: general discussion about why some GNU projects ask
+for a copyright assignment is off-topic for emacs-devel.
+See gnu-misc-discuss instead.)
+
+A copyright disclaimer is also a possibility, but we prefer an assignment.
+Note that the disclaimer, like an assignment, involves you sending
+signed paperwork to the FSF (simply saying "this is in the public domain"
+is not enough).  Also, a disclaimer cannot be applied to future work, it
+has to be repeated each time you want to send something new.
+
+We can accept small changes (roughly, fewer than 15 lines) without
+an assignment.  This is a cumulative limit (e.g. three separate 5 line
+patches) over all your contributions.
+
+* Getting the Source Code
+
+The latest version of the Emacs source code can be downloaded from the
+Savannah web site.  It is important to write your patch based on the
+latest version.  If you start from an older version, your patch may be
+outdated (so that maintainers will have a hard time applying it), or
+changes in Emacs may have made your patch unnecessary.
+
+After you have downloaded the repository source, you should read the file
+INSTALL.REPO for build instructions (they differ to some extent from a
+normal build).
+
+Ref: http://savannah.gnu.org/projects/emacs
+
+
+* Submitting Patches
+
+Every patch must have several pieces of information before we
+can properly evaluate it.
+
+When you have all these pieces, bundle them up in a mail message and
+send it to the developers.  Sending it to bug-gnu-emacs@gnu.org
+(which is the bug/feature list) is recommended, because that list
+is coupled to a tracking system that makes it easier to locate patches.
+If your patch is not complete and you think it needs more discussion,
+you might want to send it to emacs-devel@gnu.org instead.  If you
+revise your patch, send it as a followup to the initial topic.
+
+** Description
+
+For bug fixes, a description of the bug and how your patch fixes it.
+
+For new features, a description of the feature and your implementation.
+
+** ChangeLog
+
+A ChangeLog entry as plaintext (separate from the patch).
+
+See the existing ChangeLog files for format and content.  Note that,
+unlike some other projects, we do require ChangeLogs also for
+documentation, i.e. Texinfo files.
+
+Ref: "Change Log Concepts" node of the GNU Coding Standards Info
+Manual, for how to write good log entries.
+
+When using git, commit messages should use ChangeLog format, with a
+single short line explaining the change, then an empty line, then
+unindented ChangeLog entries.  (Essentially, a commit message should
+be a duplicate of what the patch adds to the ChangeLog files.  We are
+planning to automate this better, to avoid the duplication.)
+
+** The patch itself.
+
+If you are accessing the Emacs repository, make sure your copy is
+up-to-date (e.g. with 'git pull').  You can commit your changes
+to a private branch and generate a patch from the master version
+by using
+       git format-patch master
+Or you can leave your changes uncommitted and use
+        git diff
+With no repository, you can use
+       diff -u OLD NEW
+
+** Mail format.
+
+We prefer to get the patches as plain text, either inline (be careful
+your mail client does not change line breaks) or as MIME attachments.
+
+** Please reread your patch before submitting it.
+
+** Do not mix changes.
+
+If you send several unrelated changes together, we will ask you to
+separate them so we can consider each of the changes by itself.
+
+** Do not make formatting changes.
+
+Making cosmetic formatting changes (indentation, etc) makes it harder
+to see what you have really changed.
+
+
+* Coding style and conventions.
+
+** Mandatory reading:
+
+The "Tips and Conventions" Appendix of the Emacs Lisp Reference.
+
+** Avoid using `defadvice' or `eval-after-load' for Lisp code to be
+included in Emacs.
+
+** Remove all trailing whitespace in all source and text files.
+
+** Use ?\s instead of ?  in Lisp code for a space character.
+
+
+* Supplemental information for Emacs Developers.
+
+** Write access to the Emacs repository.
+
+Once you become a frequent contributor to Emacs, we can consider
+giving you write access to the version-control repository.
+
+
+** Emacs Mailing lists.
+
+Discussion about Emacs development takes place on emacs-devel@gnu.org.
+
+Bug reports and fixes, feature requests and implementations should be
+sent to bug-gnu-emacs@gnu.org, the bug/feature list.  This is coupled
+to the tracker at http://debbugs.gnu.org .
+
+You can subscribe to the mailing lists, or see the list archives,
+by following links from http://savannah.gnu.org/mail/?group=emacs .
+
+** Document your changes.
+
+Any change that matters to end-users should have a NEWS entry.
+
+Think about whether your change requires updating the documentation
+(both manuals and doc-strings).  If you know it does not, mark the NEWS
+entry with "---".  If you know that *all* the necessary documentation
+updates have been made, mark the entry with "+++". Otherwise do not mark it.
+
+** Understanding Emacs Internals.
+
+The best way to understand Emacs Internals is to read the code,
+but the nodes "Tips" and "GNU Emacs Internals" in the Appendix
+of the Emacs Lisp Reference Manual may also help.
+
+The file etc/DEBUG describes how to debug Emacs bugs.
+
+
+\f
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+\f
+Local variables:
+mode: outline
+paragraph-separate: "[         \f]*$"
+end:
index 0677e441b83e32066dbca9e5e9195d8f1766a5c6..8e46cd0f7f6567693052b97c75836e08ad02c482 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * tutorials/TUTORIAL.he: Use u+05f4 HEBREW PUNCTUATION GERSHAYIM
+       instead of u+0022 QUOTATION MARK in Hebrew acronyms.
+
 2015-01-27  Ivan Shmakov  <ivan@siamics.net>
 
        * NEWS: Mention the new tar-new-entry command.  (Bug#19274)
diff --git a/etc/refcards/emacsver.tex b/etc/refcards/emacsver.tex
new file mode 100644 (file)
index 0000000..8b6e8c4
--- /dev/null
@@ -0,0 +1,4 @@
+%% This file is not generated by configure, because then the provided
+%% pdf files would always appear out-of-date.
+\def\versionemacs{24}           % major version of emacs
+\def\year{2015}                 % latest copyright year
index b3910989509112cc16bce705d30d0a523f856df3..beb406e0e918a97af67cd0bd4947a8b2ddec62fb 100644 (file)
 כדי להפסיק פקודה באמצע ההקשה, יש להקיש C-g.
 המחרוזת ">>" בקצה הימני מסמנת הוראות עבורכם כדי לנסות להשתמש בפקודה כלשהי.
 לדוגמה:
-<<שורות ריקות תתווספנה סביב השורה הבאה ע"י help-with-tutorial>>
+<<שורות ריקות תתווספנה סביב השורה הבאה ע״י help-with-tutorial>>
 [אמצע העמוד הושאר ריק למטרות לימודיות. הטקסט ממשיך להלן]
 >>  הקישו עתה C-v (הצג העמוד הבא) על־מנת להתקדם לעמוד הבא. (קדימה, נסו
-    זאת ע"י לחיצה והחזקה של מקש CONTROL והקשה על v.)
+    זאת ע״י לחיצה והחזקה של מקש CONTROL והקשה על v.)
     מעתה והלאה, עליכם לעשות זאת בכל פעם שתסיימו לקרוא את המוצג על המסך.
 
 שימו לב לחפיפה של שתי שורות כאשר אתם עוברים ממסך למשך, מה שמבטיח רציפות
@@ -99,7 +99,7 @@ P מ־previous (קודם), N מ־Next (הבא), B מ־Backward (אחורה)
 לתצוגה. לזה קוראים "גלילה". גלילה מאפשרת ל־Emacs להניע את הסמן למקום
 כלשהו בטקסט מבלי שהסמן ייעלם מהתצוגה.
 
->> נסו להניע את הסמן אל מחוץ לתצוגה ע"י הקשת C-n ושימו לב למה שקורה.
+>> נסו להניע את הסמן אל מחוץ לתצוגה ע״י הקשת C-n ושימו לב למה שקורה.
 
 אם תנועה תו־תו איטית מדי, תוכלו לנוע מילים שלמות. M-f ‏(META-f) מזיז
 את הסמן מילה אחת קדימה ואילו M-b זז מילה אחורה.
@@ -196,18 +196,18 @@ argument) משום מקישים אותו לפני הפקודה אליה הוא 
 >> נסו עתה להקיש C-u 8 C-v.
 
 כתוצאה, התצוגה היתה צריכה לזוז ב־8 שורות. אם ברצונכם לגלול בחזרה,
-אפשר להשיג זאת ע"י מתן ארגומנט ל־M-v.
+אפשר להשיג זאת ע״י מתן ארגומנט ל־M-v.
 
 אם הפעלתם את Emacs על־גבי תצוגה גרפית כגון X או MS-Windows, אתם
 צריכים לראות פס צר וגבוה, ששמו פס גלילה (scroll bar) בצידו של החלון
-של Emacs. ניתן לגלול את הטקסט ע"י הקלקת עכבר בתוך פס הגלילה.
+של Emacs. ניתן לגלול את הטקסט ע״י הקלקת עכבר בתוך פס הגלילה.
 
 אם העכבר שלכם מצויד בגלגל, תוכלו להשתמש גם בו לגלילת הטקסט.
 
 * אם Emacs מפסיק להגיב
 ----------------------
 
-אם Emacs מפסיק להגיב לפקודות, תוכלו להפסיק אותו בבטחה ע"י הקשת C-g.
+אם Emacs מפסיק להגיב לפקודות, תוכלו להפסיק אותו בבטחה ע״י הקשת C-g.
 פקודות שביצוען מתארך אף הן ניתנות להפסקה בעזרת C-g.
 
 בנוסף, תגרום הקשת C-g לביטול הארגומנט הנומרי או תחילת הפקודה שטרם
@@ -272,7 +272,7 @@ argument) משום מקישים אותו לפני הפקודה אליה הוא 
 יתכן שבמקלדת שלכם קיים מקש שעליו רשום <Delete>, אך זה אינו המקש שאנו
 קוראים לו <DEL>.
 
->> הקישו עתה מספר תוים, ואחר־כך מחקו אותם ע"י הקשות אחדות
+>> הקישו עתה מספר תוים, ואחר־כך מחקו אותם ע״י הקשות אחדות
    על <DEL>. אל תחששו לשנות את הקובץ הזה -- העותק המקורי
    של השיעור יישאר ללא שינוי. אתם עובדים על העותק האישי שלכם.
 
@@ -402,7 +402,7 @@ argument) משום מקישים אותו לפני הפקודה אליה הוא 
 אם שיניתם את הטקסט ואז החלטתם שהשינוי היה טעות, תוכלו לבטל את השינוי
 בעזרת פקודת הביטול, ‪C-/‬.
 
-בדרך כלל,‪C-/‬ מבטל את השינויים שבוצעו ע"י פקודה אחת. הפעלה חוזרת של
+בדרך כלל,‪C-/‬ מבטל את השינויים שבוצעו ע״י פקודה אחת. הפעלה חוזרת של
 ‪C-/‬ ברצף מבטלת שינויים של פקודות קודמות, אחת אחרי השניה.
 
 שני יוצאים מהכלל הזה: פקודות שאינן משנות טקסט (למשל פקודות הנעת הסמן
@@ -468,7 +468,7 @@ C-x u, אם־כי היא פחות נוחה להקשה מספר פעמים בזו
 
 פקודה זו שומרת בקובץ את הטקסט המוחזק בתוך Emacs. בפעם הראשונה שתפעילו
 פקודה זו, Emacs משנה את שם הקובץ המקורי לשם חדש כך שהמקור לא ילך
-לאיבוד. השם החדש נוצר ע"י הוספת "~" בסוף השם המקורי של הקובץ.
+לאיבוד. השם החדש נוצר ע״י הוספת "~" בסוף השם המקורי של הקובץ.
 
 כשהשמירה מסתיימת, Emacs מציג בשורה התחתונה את שם הקובץ שנשמר. נסו
 לשמור לעתים מזומנות על־מנת להימנע מלאבד יותר מדי מהעבודה שלכם אם המחשב
@@ -489,7 +489,7 @@ Emacs ייצור את הקובץ עם הטקסט שהקשתם. מאותו רגע
 --------
 
 אם תפתחו קובץ נוסף עם C-x C-f, הקובץ הראשון עדיין נשאר פתוח ב־Emacs.
-תוכלו לחזור אליו ע"י C-x C-f. כך תוכלו לפתוח מספר רב של קבצים.
+תוכלו לחזור אליו ע״י C-x C-f. כך תוכלו לפתוח מספר רב של קבצים.
 
 ‏Emacs מחזיק כל קובץ בתוך יישות בשם "חוצץ" ("buffer"). פתיחת קובץ יוצרת
 חוצץ חדש בתוך Emacs. כדי לראות את רשימת החוצצים הקיימים בתוך Emacs,
@@ -508,19 +508,19 @@ Emacs ייצור את הקובץ עם הטקסט שהקשתם. מאותו רגע
 כשקיימים מספר חוצצים, רק אחד מהם יכול להיות החוצץ "הנוכחי" בכל רגע
 נתון. זהו החוצץ בו אתם מבצעים עריכה באותו רגע. אם ברצונכם לערוך חוצץ
 אחר, עליכם "לעבור" חוצץ. עבור חוצצים שמתאימים לקבצים, ניתן לעשות זאת
"י C-x C-f שיפקוד את הקובץ בשנית. אבל קיימת דרך פשוטה יותר: שימוש
״י C-x C-f שיפקוד את הקובץ בשנית. אבל קיימת דרך פשוטה יותר: שימוש
 בפקודה C-x b. פקודה זו תחייב אותכם להקיש את שם החוצץ.
 
->> ניצור עתה קובץ בשם "foo" ע"י הקשת C-x C-f foo <Return>‎.
+>> ניצור עתה קובץ בשם "foo" ע״י הקשת C-x C-f foo <Return>‎.
    עתה חזרו לשיעור זה בעזרת C-x b TUTORIAL.he <Return>‎.
 
 ברוב המקרים שם החוצץ זהה לשם הקובץ (ללא שם התיקיה שלו). אבל אין זה
-תמיד כך. רשימת החוצצים שנוצרת ע"י C-x C-b תציג הן את שם החוצץ והן את
+תמיד כך. רשימת החוצצים שנוצרת ע״י C-x C-b תציג הן את שם החוצץ והן את
 שם הקובץ עבור כל החוצצים הקיימים ב־Emacs.
 
 כל טקסט שמוצג בחלון של Emacs הינו תמיד חלק של חוצץ כלשהו. קיימים
 חוצצים שאינם קשורים לשום קובץ. לדוגמא, החוצץ בשם "*Buffer List*"
-המחזיק את רשימת החוצצים שנוצרה ע"י C-x C-b אינו מציג שום קובץ. גם
+המחזיק את רשימת החוצצים שנוצרה ע״י C-x C-b אינו מציג שום קובץ. גם
 לחוצץ הנוכחי ששמו TUTORIAL.he לא היה קובץ עד שהקשתם על C-x C-s כדי
 לשמור אותו בקובץ.
 
@@ -545,18 +545,18 @@ C-x C-s. לכן קיימת פקודה
 
 >> הכניסו שורה של טקסט ואחר־כך הקישו C-x s.
    הוא צריך לשאול האם לשמור חוצץ בשם TUTORIAL.he.
-   השיבו בחיוב ע"י הקשה על "y".
+   השיבו בחיוב ע״י הקשה על "y".
 
 
 * הרחבת אוסף הפקודות
 --------------------
 
-מספר הפקודות ב־Emacs גדול בהרבה ממה שניתן להפעיל ע"י כל תוי ה־control
+מספר הפקודות ב־Emacs גדול בהרבה ממה שניתן להפעיל ע״י כל תוי ה־control
 וה־meta. כדי להתגבר על בעיה זו, Emacs משתמש בפקודות X המרחיבות (eXtend)
 את אוסף הפקודות הרגיל. פקודות הרחבה אלו הן שתים:
 
        ‏C-x     הרחבת תו. תו בודד שבא אחריו משלים את הפקודה.
-       ‏M-x     הרחבה ע"י שם הפקודה. אחריו בא שם ארוך של פקודה.
+       ‏M-x     הרחבה ע״י שם הפקודה. אחריו בא שם ארוך של פקודה.
 
 בעזרת שתי אלו ניתן להפעיל פקודות שימושיות שבהן משתמשים לעתים רחוקות
 יותר מאשר פקודות שלמדתם עד עכשיו. כמה מהן כבר ראיתם: C-x C-f לפתיחת
@@ -577,7 +577,7 @@ Emacs: הוא מחזיר אתכם לשורת הפקודות הבסיסית של
 תצטרכו להקיש את הפקודה "fg" או ‪"%emacs"‬.
 
 הרגע הנכון להשתמש ב־C-x C-c הוא כאשר אתם עומדים להתנתק (log out).
-כמו־כן, תצטרכו להשתמש בו כדי לצאת מ־Emacs שהופעל ע"י תוכניות אחרות
+כמו־כן, תצטרכו להשתמש בו כדי לצאת מ־Emacs שהופעל ע״י תוכניות אחרות
 כגון קריאת דואר אלקטרוני.
 
 קיימות פקודות C-x רבות מאד. להלן רשימת אלו שכבר למדתם:
@@ -591,17 +591,17 @@ Emacs: הוא מחזיר אתכם לשורת הפקודות הבסיסית של
        ‏C-x 1        השאר רק חלון אחד ומחק כל השאר
        ‏C-x u        בטל פקודה אחרונה
 
-הרחבה ע"י שם הפקודה שימושית עם פקודות עוד יותר נדירות או פקודות
+הרחבה ע״י שם הפקודה שימושית עם פקודות עוד יותר נדירות או פקודות
 ספציפיות רק לאופני פעולה (modes) מיוחדים. דוגמא לכך היא פקודה
 replace-string (החלף מחרוזת) אשר מחליפה מחרוזת אחת במשנה בכל החוצץ.
 אחרי שתקישו M-x, ‏Emacs מציג M-x בתחתית התצוגה ומחכה שתקישו את שם
 הפקודה, במקרה זה "replace-string". מספיק שתקישו "repl s<TAB>‎" ו־Emacs
 ישלים את השם המלא. (<TAB> הוא מקש Tab, בדרך כלל תמצאו אותו מעל מקש
 ה־CapsLock או Shift, ליד הקצה השמאלי של המקלדת.) סיימו את הזנת הפקודה
"י הקשת <Return>.
״י הקשת <Return>.
 
 הפקודה להחלפת מחרוזת זקוקה לשני ארגומנטים -- המחרוזת שתוחלף וזו שתחליף
-אותה. סיימו הקשה של כל אחת מהן ע"י <Return>.
+אותה. סיימו הקשה של כל אחת מהן ע״י <Return>.
 
 >> הביאו את הסמן שתי שורות מתחת לשורה זו.
    עתה הקישו M-x repl s<Return>changed<Return>altered<Return>‎.
@@ -703,7 +703,7 @@ Auto Fill mode. כאשר אופן זה מופעל, Emacs אוטומטית פות
 בסיום מילה אם הטקסט שהקשתם ארוך מדי בשביל שורה אחת.
 
 להפעלת Auto Fill mode יש להקיש M-x auto-fill-mode <Return>‎. כאשר אופן
-זה מופעל, ניתן לבטלו ע"י M-x auto-fill-mode <Return>‎. זאת אומרת, פקודה
+זה מופעל, ניתן לבטלו ע״י M-x auto-fill-mode <Return>‎. זאת אומרת, פקודה
 זו מפעילה את האופן כשאינו פעיל ומבטלת אותו כשהוא פעיל. לפעולה זו
 קוראים "מיתוג" -- הפקודה "ממתגת" את האופן.
 
@@ -717,7 +717,7 @@ Auto Fill mode. כאשר אופן זה מופעל, Emacs אוטומטית פות
 
 >> הקישו C-x f עם ארגומנט של 20. (C-u 2 0 C-x f). אחר־כך הקישו טקסט
    כלשהו ושימו לב ש־Emacs פותח שורות חדשות אחרי 20 תווים לכל היותר.
-   לבסוף, החזירו את הגדרת השוליים ל־70 ע"י שימוש חוזר ב־C-x f.
+   לבסוף, החזירו את הגדרת השוליים ל־70 ע״י שימוש חוזר ב־C-x f.
 
 אם ערכתם שינויים באמצע פסקה, Auto Fill mode לא ימלא שורות מחדש באופן
 אוטומטי.
@@ -766,7 +766,7 @@ Auto Fill mode. כאשר אופן זה מופעל, Emacs אוטומטית פות
 נמצא "סמ". עתה הקישו <DEL>. ה־"מ" נמחק מהמחרוזת והסמן חוזר למקום בו
 הוא מצא את "ס" לראשונה.
 
-אם במהלך החיפוש תפעילו פקודה כלשהי ע"י הקשה על מקש תוך לחיצה על
+אם במהלך החיפוש תפעילו פקודה כלשהי ע״י הקשה על מקש תוך לחיצה על
 CONTROL או META, החיפוש יסתיים. (כמה תווים יוצאים מכלל זה -- אלו תווים
 מיוחדים בעת חיפוש, כדוגמת C-s ו־C-r.)
 
@@ -800,7 +800,7 @@ CONTROL או META, החיפוש יסתיים. (כמה תווים יוצאים מ
    הסמן בחלון העליון יישאר במקום בו הוא היה לפני־כן.
 
 תוכלו להמשיך להשתמש ב־C-x o כדי לדלג בין החלונות. "החלון הנבחר", אותו
-חלון בו הנכם עורכים טקסט, מזוהה ע"י סמן בולט שמהבהב בזמן שאינכם
+חלון בו הנכם עורכים טקסט, מזוהה ע״י סמן בולט שמהבהב בזמן שאינכם
 מקלידים. לכל החלונות האחרים מיקום סמן משלהם; אם הפעלתם את Emacs על צג
 גרפי, מיקום הסמן בחלונות האחרים מוצג כתיבה ריקה שאינה מהבהבת.
 
@@ -809,9 +809,9 @@ CONTROL או META, החיפוש יסתיים. (כמה תווים יוצאים מ
 הנבחר.
 
 ‏C-M-v היא דוגמא אחת של פקודת CONTROL-META. אם במקלדת שלכם קיים מקש
-META (או Alt) אמיתי, תוכלו להקיש את הפקודה ע"י לחיצה והחזקה של מקשי
+META (או Alt) אמיתי, תוכלו להקיש את הפקודה ע״י לחיצה והחזקה של מקשי
 CONTROL ו־META גם יחד ואז להקיש v. הסדר שבו תלחצו על CONTROL ו־META
-אינו משנה כי שני המקשים הללו פועלים ע"י שינוי התו המוקש יחד איתם.
+אינו משנה כי שני המקשים הללו פועלים ע״י שינוי התו המוקש יחד איתם.
 
 אם אין במקלדת מקש META אמיתי ואתם משתמשים ב־<ESC> כתחליף, הסדר כן
 משנה: חייבים להקיש <ESC> ורק לאחר מכן CONTROL-v, וזאת משום
@@ -854,8 +854,8 @@ CONTROL ו־META גם יחד ואז להקיש v. הסדר שבו תלחצו ע
 >> הקישו M-x delete-frame <Return>‎.
    התבנית שבה הקשתם את הפקודה תיסגר ותיעלם מהמסך.
 
-כמו־כן, ניתן לסגור תבנית בדרך הרגילה הנתמכת ע"י התצוגה הגרפית של
-המערכת שלכם (בדרך־כלל, ע"י הקלקה על הכפתור המסומן ב־"X" בפינה עליונה
+כמו־כן, ניתן לסגור תבנית בדרך הרגילה הנתמכת ע״י התצוגה הגרפית של
+המערכת שלכם (בדרך־כלל, ע״י הקלקה על הכפתור המסומן ב־"X" בפינה עליונה
 של התבנית.) שום מידע אינו הולך לעיבוד כאשר סוגרים תבנית (או חלון).
 המידע הזה פשוט יורד מהתצוגה, אבל ניתן לאחזרו מאוחר יותר.
 
@@ -863,7 +863,7 @@ CONTROL ו־META גם יחד ואז להקיש v. הסדר שבו תלחצו ע
 * רמות עריכה רקורסיביות
 -----------------------
 
-יתכן ותיקלעו למצב שקרוי "רמת עריכה רקורסיבית". Emacs מציין זאת ע"י
+יתכן ותיקלעו למצב שקרוי "רמת עריכה רקורסיבית". Emacs מציין זאת ע״י
 סוגריים מרובעים בשורת הסטטוס מסביב לשם האופן הראשי. למשל, יוצג שם
 [(Fundamental)] במקום (Fundamental).
 
@@ -910,7 +910,7 @@ M-x help <Return>‎ כתחליף.)
 לציין מה הן עושות, השמות עשויים לשמש כתיעוד מקוצר -- מספיק כדי להזכיר
 לכם את הפקודות שלמדתם בעבר.
 
-ניתן לציין אחרי C-h c גם פקודות שמופעלות ע"י סדרת מקשים באורך גדול
+ניתן לציין אחרי C-h c גם פקודות שמופעלות ע״י סדרת מקשים באורך גדול
 מאחד, כגון C-x C-s או (אם אין מקש META או EDIT או ALT) ‏‎<ESC> v.
 
 לקבלת מידע מפורט יותר על פקודה, השתמשו בפקודה C-h k במקום C-h c.
@@ -934,7 +934,7 @@ M-x help <Return>‎ כתחליף.)
 
     ‏C-h a   פקודות בנוגע לנושא מסויים. הקישו מילת מפתח ו־Emacs
                יציג את רשימת הפקודות ששמותיהן מכילות את מילת המפתח.
-               כל הפקודות הללו ניתנות להפעלה ע"י META-x. עבור חלק
+               כל הפקודות הללו ניתנות להפעלה ע״י META-x. עבור חלק
                מהפקודות תוצג גם סדרת מקשים שמפעילה את הפקודה.
 
 >> הקישו C-h a file <Return>‎.
@@ -960,9 +960,9 @@ find-file.
 * עוד תכונות
 ------------
 
-תוכלו ללמוד עוד על־אודות Emacs ע"י קריאה במדריך למשתמש שלו, אם כספר
+תוכלו ללמוד עוד על־אודות Emacs ע״י קריאה במדריך למשתמש שלו, אם כספר
 מודפס או בגירסה מקוונת בתוך Emacs עצמו. (תוכלו להגיע אל המדריך דרך
-תפריט Help או ע"י הקשה על C-h r.) אולם שתי תכונות שבוודאי ימצאו חן
+תפריט Help או ע״י הקשה על C-h r.) אולם שתי תכונות שבוודאי ימצאו חן
 בעיניכם הן השלמה אשר חוסכת הקשות, ו־dired שמאפשרת טיפול נוח בקבצים.
 
 השלמה היא דרך להימנע מהקשות מיותרות. למשל, אם ברצונכם לעבור לחוצץ
@@ -991,7 +991,7 @@ find-file.
 --------------
 
 שיעור זה הינו צאצא של שורה ארוכה של שיעורים בשימוש ב־Emacs, החל מהגרסה
-הראשונה שנכתבה ע"י Stuart Cracraft עבור גירסת ה־Emacs המקורית.
+הראשונה שנכתבה ע״י Stuart Cracraft עבור גירסת ה־Emacs המקורית.
 
 גירסה זו של השיעור הינה חלק מחבילת GNU Emacs. היא מוגנת בזכויות יוצרים
 וניתנת להעתקה והפצת עותקים בתנאים מסויימים כדלקמן:
@@ -999,7 +999,7 @@ find-file.
                        Copyright (C) 2010-2015 Free Software Foundation, Inc.
 
 ‏GNU Emacs הינו תכנה חפשית; זכותכם להפיצו ו\או לשנותו בכפוף לתנאי
-הרשיון GNU General Public License, כפי שהוא יוצא לאור ע"י Free
+הרשיון GNU General Public License, כפי שהוא יוצא לאור ע״י Free
 Software Foundation, אם בגרסא 3 של הרשיון, ואם (כאופציה השמורה לכם)
 בכל גרסא מאוחרת יותר.
 
@@ -1012,7 +1012,7 @@ Software Foundation, אם בגרסא 3 של הרשיון, ואם (כאופציה
 
 הנכם מוזמנים לקרוא את הקובץ COPYING ואז אכן לחלק עותקים של GNU Emacs
 לחבריכם. עזרו לנו לחסל את "הבעלות" על תוכנה שאינה אלא חבלה בתוכנה,
-וזאת ע"י שימוש, כתיבה ושיתוף של תוכנה חופשית!
+וזאת ע״י שימוש, כתיבה ושיתוף של תוכנה חופשית!
 
 
 
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog
new file mode 100755 (executable)
index 0000000..3e08734
--- /dev/null
@@ -0,0 +1,265 @@
+#! /usr/bin/perl
+
+# Copyright (C) 1999-2015 Free Software Foundation, Inc.
+#
+# This file is part of GNU Emacs.
+
+# GNU Emacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# Extract entries from ChangeLogs matching specified criteria.
+# Optionally format the resulting output to a form suitable for RCS
+# logs, like they are used in Emacs, for example.  In this format,
+# author lines, leading spaces, and file names are removed.
+
+require 5;
+use strict;
+
+# Parse command line options.
+
+use vars qw($author $regexp $exclude $from_date $to_date
+            $rcs_log $with_date $version $help $reverse
+            @entries);
+
+use Getopt::Long;
+
+my $result;
+
+if (@ARGV == 0) {
+
+    # No arguments cannot possibly mean "show everything"!!
+    $result = 0;
+
+} else {
+
+    $result = GetOptions ("author=s" => \$author,
+                          "text=s"  => \$regexp,
+                          "exclude=s"  => \$exclude,
+                          "from-date=s" => \$from_date,
+                          "to-date=s" => \$to_date,
+                          "rcs-log" => \$rcs_log,
+                          "with-date" => \$with_date,
+                          "reverse!" => \$reverse,
+                          "version" => \$version,
+                          "help"    => \$help);
+
+    # If date options are specified, check that they have the format
+    # YYYY-MM-DD.
+
+    $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+    $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+}
+
+# Print usage information and exit when necessary.
+
+if ($result == 0 || $help) {
+    print <<USAGE;
+
+Usage: $0 [options] [CHANGELOG...]
+
+Print entries in ChangeLogs matching various criteria.
+Valid options are:
+
+  --author=AUTHOR         Match entries whose author line matches
+                         regular expression AUTHOR
+  --text=TEXT             Match entries whose text matches regular
+                         expression TEXT
+  --exclude=TEXT         Exclude entries matching TEXT
+  --from-date=YYYY-MM-DD  Match entries not older than given date
+  --to-date=YYYY-MM-DD    Match entries not younger than given date
+  --rcs-log              Format output suitable for RCS log entries
+  --with-date            Print short date line in RCS log
+  --reverse               Show entries in reverse (chronological) order
+  --version              Print version info
+  --help                 Print this help
+
+If no CHANGELOG is specified scan the files "ChangeLog" and
+"ChangeLog.N+" in the current directory.  Old-style dates in ChangeLogs
+are not recognized.
+USAGE
+    exit !$help;
+}
+
+# Print version info and exit if `--version' was specified.
+
+if ($version) {
+    print "0.3\n";
+    exit 0;
+}
+
+
+# Value is non-zero if HEADER matches according to command line
+# options specified, i.e. it matches $author, and its date is in
+# the range $from_date <= date <= $to_date.
+
+sub header_match_p {
+    my $header = shift;
+
+    return 0 unless $header;
+
+    # No match if AUTHOR-regexp specified and doesn't match.
+    return 0 if $author && $header !~ /$author/;
+
+    # Check that the date of the entry matches if date options
+    # `--from-date' and/or `--to-date' were specified .  Old-style
+    # dates in ChangeLogs are not recognized, and never match.
+    if ($from_date || $to_date) {
+       if ($header =~ /^(\d\d\d\d-\d\d-\d\d)/) {
+           my $date = $1;
+           return 0 if $from_date && $date lt $from_date;
+           return 0 if $to_date && $date gt $to_date;
+       } else {
+           # Don't bother recognizing old-style dates.
+           return 0;
+       }
+    }
+
+    return 1;
+}
+
+
+# Value is non-zero if ENTRY matches the criteria specified on the
+# command line, i.e. it matches $regexp, and it doesn't match
+# $exclude.
+
+sub entry_match_p {
+    my $entry = shift;
+
+    return 0 unless $entry;
+
+    if ($regexp) {
+       return 1 if ($entry =~ /$regexp/
+                    && (!$exclude || $entry !~ $exclude));
+    } else {
+       return 1 if !$exclude || $entry !~ $exclude;
+    }
+
+    return 0;
+}
+
+
+# Print HEADER and/or ENTRY in a format suitable for what was
+# specified on the command line.  If $rcs_log is specified, author
+# lines are not printed, and leading spaces and file names are removed
+# from ChangeLog entries.
+
+sub print_log {
+    my ($header, $entry) = @_;
+    my $output = '';
+
+    if ($rcs_log) {
+       # Remove leading whitespace from entry.
+       $entry =~ s/^\s+//mg;
+       # Remove file name parts.
+       $entry =~ s/^\*.*\(/(/mg;
+       # Remove file name parts, 2.
+       $entry =~ s/^\*.*://mg;
+        if ($with_date) {
+           $header =~ /(\d\d\d\d-\d\d-\d\d)/;
+           $output = "!changelog-date $1\n";
+       }
+       $output .= $entry;
+    } else {
+       $output .= $header . $entry;
+    }
+
+    if ($reverse) {
+        push @entries, $output;
+    } else {
+        print $output;
+    }
+}
+
+# Scan LOG for matching entries, and print them to standard output.
+
+sub parse_changelog {
+    my $log = shift;
+    my $entry = undef;
+    my $header = undef;
+
+    @entries = () if $reverse;
+
+    # Open the ChangeLog.
+    open (IN, "< $log") || die "Cannot open $log: $!";
+
+    while (defined(my $line = <IN>)) {
+       if ($line =~ /^\S/) {
+           # Line is an author-line.  Print previous entry if
+           # it matches.
+           print_log ($header, $entry)
+               if header_match_p ($header) && entry_match_p ($entry);
+
+           $entry = "";
+           $header = $line;
+
+           # Add empty lines below the header.
+           while (defined($line = <IN>) && $line =~ /^\s*$/) {
+               $header = "$header$line";
+           }
+        }
+
+        last unless defined $line;
+
+       if ($line =~ /^\s*\*/) {
+           # LINE is the first line of a ChangeLog entry.  Print
+           # previous entry if it matches.
+           print_log ($header, $entry)
+               if header_match_p ($header) && entry_match_p ($entry);
+           $entry = $line;
+       } else {
+           # Add LINE to the current entry.
+           $entry = "$entry$line";
+       }
+    }
+
+    # Print last entry if it matches.
+    print_log ($header, $entry)
+       if header_match_p ($header) && entry_match_p ($entry);
+
+    close IN;
+
+    if ($reverse) {
+        for (my $entry = @entries; $entry; $entry--) {
+            print $entries[$entry-1];
+        }
+    }
+}
+
+
+# Main program.  Process ChangeLogs.
+
+# If files were specified on the command line, parse those files in the
+# order supplied by the user; otherwise parse default files ChangeLog and
+# ChangeLog.NNN according to $reverse.
+unless (@ARGV > 0) {
+    @ARGV = ("ChangeLog");
+
+    push @ARGV,
+      map {"ChangeLog.$_"}
+        sort {$b <=> $a}
+          map {/\.(\d+)$/; $1}
+            do {
+                opendir D, '.';
+                grep /^ChangeLog\.\d+$/, readdir D;
+            };
+
+    @ARGV = reverse @ARGV if $reverse;
+}
+
+while (defined (my $log = shift @ARGV)) {
+    parse_changelog ($log) if -f $log;
+}
+
+
+# grep-changelog ends here.
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c
new file mode 100644 (file)
index 0000000..6a12201
--- /dev/null
@@ -0,0 +1,88 @@
+/* test-distrib.c --- testing distribution of nonprinting chars
+
+Copyright (C) 1987, 1993-1995, 1999, 2001-2015 Free Software Foundation,
+Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
+
+
+#include <config.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Break string in two parts to avoid buggy C compilers that ignore characters
+   after nulls in strings.  */
+
+static char string1[] = "Testing distribution of nonprinting chars:\n\
+Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\
+Should be 0000: ";
+
+static char string2[] = ".\n\
+This file is read by the `test-distribution' program.\n\
+If you change it, you will make that program fail.\n";
+
+/* Like `read' but keeps trying until it gets SIZE bytes or reaches eof.  */
+static int
+cool_read (int fd, char *buf, size_t size)
+{
+  ssize_t num;
+  ssize_t sofar = 0;
+
+  while (1)
+    {
+      if ((num = read (fd, buf + sofar, size - sofar)) == 0)
+       return sofar;
+      else if (num < 0)
+       return num;
+      sofar += num;
+    }
+}
+
+int
+main (int argc, char **argv)
+{
+  int fd;
+  char buf[300];
+
+  if (argc != 2)
+    {
+      fprintf (stderr, "Usage: %s testfile\n", argv[0]);
+      exit (EXIT_FAILURE);
+    }
+  fd = open (argv[1], O_RDONLY);
+  if (fd < 0)
+    {
+      perror (argv[1]);
+      exit (EXIT_FAILURE);
+    }
+  if (cool_read (fd, buf, sizeof string1) != sizeof string1 ||
+      strcmp (buf, string1) ||
+      cool_read (fd, buf, sizeof string2) != sizeof string2 - 1 ||
+      strncmp (buf, string2, sizeof string2 - 1))
+    {
+      fprintf (stderr, "Data in file `%s' has been damaged.\n\
+Most likely this means that many nonprinting characters\n\
+have been corrupted in the files of Emacs, and it will not work.\n",
+              argv[1]);
+      exit (EXIT_FAILURE);
+    }
+  close (fd);
+  return EXIT_SUCCESS;
+}
+
+
+/* test-distrib.c ends here */
index 906fe92379d9b11064ca152fd9e2d1e6827f28bd..b41c3934ad4dfae00b494732a141cf3834948a93 100644 (file)
@@ -1,7 +1,7 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software Foundation,
-   Inc.
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
index f5b66c790952beb98558aa513a243876b60eb49b..84780032b2a6732e99c28766cde6effa6afe7c18 100644 (file)
@@ -1,5 +1,6 @@
 /* Binary mode I/O.
-   Copyright (C) 2001, 2003, 2005, 2008-2015 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2008-2015 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 476447317829bff2802f6cf038429af0f58a04cd..53c443a38cd21f198d17f9e5fdb1e3afc0eea289 100644 (file)
@@ -5,7 +5,8 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation,
+   Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
index 6deb6d1236dfea18fa86bbdad319ba28fb141a2c..dbf17b2dcda4a824f12f55bbc1754c630418e59d 100644 (file)
@@ -1,5 +1,6 @@
 /* c-strcasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index b98e36838ca8f48e76a83537d3696d210d6e2ec3..580ea237729926482796661d2775abb44f244df1 100644 (file)
@@ -1,5 +1,6 @@
 /* c-strncasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index f2f5da23a38f002cc911f85edf11754bf297656f..3b3153e81ca89301051c3612609787261a202ccf 100644 (file)
@@ -1,7 +1,7 @@
 /* Read symbolic links into a buffer without size limitation, relative to fd.
 
-   Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software Foundation,
-   Inc.
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 6e3d8658d580e7a179b58ca4e85ae8c30c94ba07..1c4e74c1b6405c6ea60c32da75bb10c33c13a732 100644 (file)
@@ -1,6 +1,7 @@
 /* Close a stream, with nicer error checking than fclose's.
 
-   Copyright (C) 1998-2002, 2004, 2006-2015 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2004, 2006-2015 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 893baf6ccf3361dd55d675f55429614579b2fa36..25aba132b380e41660f0a943f376221de4886929 100644 (file)
@@ -1,6 +1,7 @@
 /* File names on MS-DOS/Windows systems.
 
-   Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 0e13214c82565bc7befe8bf1ca15d45536801816..94406dff481b738bb9dae883fbe7d50e97aff767 100644 (file)
@@ -1,6 +1,7 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
 
-   Copyright (C) 1999, 2004-2007, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004-2007, 2009-2015 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index ff0460a5e078453c3298b7f98a2b441a158fa34a..805bc5a24d9383fa9ebf95da93a607f4ca6c8c0c 100644 (file)
@@ -1,7 +1,7 @@
 /* Make a string describing file modes.
 
-   Copyright (C) 1998-1999, 2003, 2006, 2009-2015 Free Software Foundation,
-   Inc.
+   Copyright (C) 1998-1999, 2003, 2006, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index c4b4a5196113093f4b968d68bc91fcb125ec6a33..05e84d34e412734ee953e263dd51973e3d1df70c 100644 (file)
@@ -1,6 +1,6 @@
 /* fpending.c -- return the number of pending output bytes on a stream
-   Copyright (C) 2000, 2004, 2006-2007, 2009-2015 Free Software Foundation,
-   Inc.
+   Copyright (C) 2000, 2004, 2006-2007, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 5a1b2ad9442c168fa6f8f57a0ad1aa5ea5eb3d68..19442821ad8771e6e00190e84a44d9f19e21c72a 100644 (file)
@@ -1,7 +1,7 @@
 /* Declare __fpending.
 
-   Copyright (C) 2000, 2003, 2005-2006, 2009-2015 Free Software Foundation,
-   Inc.
+   Copyright (C) 2000, 2003, 2005-2006, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 5563dfb428096a2c24e65cefb10db4c7f769c827..a7f0f9e2a29347d70db908c28eec5115658dc7da 100644 (file)
@@ -1,6 +1,7 @@
 /* provide consistent interface to getgroups for systems that don't allow N==0
 
-   Copyright (C) 1996, 1999, 2003, 2006-2015 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1999, 2003, 2006-2015 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 0cbca265b2998af49d7d793d50ecba16e798a532..119a32b4408ca033c7738205040d0a25945d1683 100644 (file)
@@ -1,7 +1,7 @@
 /* Get the system load averages.
 
-   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2015 Free
+   Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with gnulib.
    Bugs can be reported to bug-gnulib@gnu.org.
index 9248f76ec8b1b54e2f8e792aac464816c6e46454..168863123ab93c01cd598164ff37b10a21a401e2 100644 (file)
@@ -1,6 +1,6 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free
+   Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index 2b1feb6eadb7277139f5f633be149db91567a520..60760ea2f9c4d3ad51866728eb08249fb6219ba1 100644 (file)
@@ -1,6 +1,6 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free
+   Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index e893a6e133f5b40de21eba3e2e18ea04cf9599b3..89c896a72b7bae4ebe675d46f5cc396d1af0f54d 100644 (file)
@@ -1,6 +1,6 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free
+   Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index 599a14ec1b3201e206247d473b27e927cda99e21..c10c702631bb8a63ab4b618261ef885e7c55a713 100644 (file)
@@ -1,6 +1,6 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free
+   Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 1c47e3b299579c250cde2f2cd64884d27b6e134a..3786231d9382329c852739b6d5a375f747cb275b 100644 (file)
@@ -1,6 +1,7 @@
 /* gettime -- get the system clock
 
-   Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index e0e2e696d044b8375c13a2381c5d6467e2ad4c2d..ff6940c05af221fc906088608e713cbee3cec0b0 100644 (file)
@@ -1,6 +1,7 @@
 /* Provide gettimeofday for systems that don't have it or for which it's broken.
 
-   Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 23074e4f693b4fc69cb6aeaa8aa540fccb37346c..a60fae9359754aec52e5df460377327e18dcf51a 100644 (file)
@@ -1,7 +1,7 @@
 /* group-member.c -- determine whether group id is in calling user's group list
 
-   Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2015 Free
+   Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 30525dc85da15440869056a3142616f8952be8e5..1a73b2a700cf335bc3344346282b8fd5605d7876 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,7 +1,7 @@
 /* Functions to compute MD5 message digest of files or memory blocks.
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2015 Free
+   Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify it
index 43add999ef0103dc8ebb8e6b015ea45f8c3550a3..eb6fff66b57f47a7f87f63a9d2913997076a75d0 100644 (file)
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,7 +1,7 @@
 /* Declaration of functions and data types used for MD5 sum computing
    library functions.
-   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2015 Free
+   Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify it
index 3827208d800df0d0523ba0ff36bea4f786192436..45402776c4232982f44bd111ef63a4edf8184195 100644 (file)
@@ -1,7 +1,7 @@
 /* memrchr -- find the last occurrence of a byte in a memory block
 
-   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free
+   Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
    with help from Dan Sahlin (dan@sics.se) and
index 4411ceec86351547a3a7cf4684e2296669676801..90faa4e43572931215237822e2e3aba1c0edfedc 100644 (file)
@@ -1,7 +1,8 @@
 /* sha1.c - Functions to compute SHA1 message digest of files or
    memory blocks according to the NIST specification FIPS-180-1.
 
-   Copyright (C) 2000-2001, 2003-2006, 2008-2015 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003-2006, 2008-2015 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
index 58154daac050e83fdf50170e754dc01f73f4aa44..0966dd525ae4df1b526b722277f098703ea4ea8e 100644 (file)
@@ -1,6 +1,7 @@
 /* sig2str.c -- convert between signal names and numbers
 
-   Copyright (C) 2002, 2004, 2006, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006, 2009-2015 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
new file mode 100644 (file)
index 0000000..5239f51
--- /dev/null
@@ -0,0 +1,35 @@
+/* Substitute for and wrapper around <stdarg.h>.
+   Copyright (C) 2008-2015 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_STDARG_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STDARG_H@
+
+#ifndef _@GUARD_PREFIX@_STDARG_H
+#define _@GUARD_PREFIX@_STDARG_H
+
+#ifndef va_copy
+# define va_copy(a,b) ((a) = (b))
+#endif
+
+#endif /* _@GUARD_PREFIX@_STDARG_H */
+#endif /* _@GUARD_PREFIX@_STDARG_H */
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
new file mode 100644 (file)
index 0000000..64a1761
--- /dev/null
@@ -0,0 +1,132 @@
+/* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc.
+   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_STDBOOL_H
+#define _GL_STDBOOL_H
+
+/* ISO C 99 <stdbool.h> for platforms that lack it.  */
+
+/* Usage suggestions:
+
+   Programs that use <stdbool.h> should be aware of some limitations
+   and standards compliance issues.
+
+   Standards compliance:
+
+       - <stdbool.h> must be #included before 'bool', 'false', 'true'
+         can be used.
+
+       - You cannot assume that sizeof (bool) == 1.
+
+       - Programs should not undefine the macros bool, true, and false,
+         as C99 lists that as an "obsolescent feature".
+
+   Limitations of this substitute, when used in a C89 environment:
+
+       - <stdbool.h> must be #included before the '_Bool' type can be used.
+
+       - You cannot assume that _Bool is a typedef; it might be a macro.
+
+       - Bit-fields of type 'bool' are not supported.  Portable code
+         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
+
+       - In C99, casts and automatic conversions to '_Bool' or 'bool' are
+         performed in such a way that every nonzero value gets converted
+         to 'true', and zero gets converted to 'false'.  This doesn't work
+         with this substitute.  With this substitute, only the values 0 and 1
+         give the expected result when converted to _Bool' or 'bool'.
+
+       - C99 allows the use of (_Bool)0.0 in constant expressions, but
+         this substitute cannot always provide this property.
+
+   Also, it is suggested that programs use 'bool' rather than '_Bool';
+   this isn't required, but 'bool' is more common.  */
+
+
+/* 7.16. Boolean type and values */
+
+/* BeOS <sys/socket.h> already #defines false 0, true 1.  We use the same
+   definitions below, but temporarily we have to #undef them.  */
+#if defined __BEOS__ && !defined __HAIKU__
+# include <OS.h> /* defines bool but not _Bool */
+# undef false
+# undef true
+#endif
+
+#ifdef __cplusplus
+# define _Bool bool
+# define bool bool
+#else
+# if defined __BEOS__ && !defined __HAIKU__
+  /* A compiler known to have 'bool'.  */
+  /* If the compiler already has both 'bool' and '_Bool', we can assume they
+     are the same types.  */
+#  if !@HAVE__BOOL@
+typedef bool _Bool;
+#  endif
+# else
+#  if !defined __GNUC__
+   /* If @HAVE__BOOL@:
+        Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
+        the built-in _Bool type is used.  See
+          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+        Similar bugs are likely with other compilers as well; this file
+        wouldn't be used if <stdbool.h> was working.
+        So we override the _Bool type.
+      If !@HAVE__BOOL@:
+        Need to define _Bool ourselves. As 'signed char' or as an enum type?
+        Use of a typedef, with SunPRO C, leads to a stupid
+          "warning: _Bool is a keyword in ISO C99".
+        Use of an enum type, with IRIX cc, leads to a stupid
+          "warning(1185): enumerated type mixed with another type".
+        Even the existence of an enum type, without a typedef,
+          "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
+        The only benefit of the enum, debuggability, is not important
+        with these compilers.  So use 'signed char' and no enum.  */
+#   define _Bool signed char
+#  else
+   /* With this compiler, trust the _Bool type if the compiler has it.  */
+#   if !@HAVE__BOOL@
+   /* For the sake of symbolic names in gdb, define true and false as
+      enum constants, not only as macros.
+      It is tempting to write
+         typedef enum { false = 0, true = 1 } _Bool;
+      so that gdb prints values of type 'bool' symbolically.  But then
+      values of type '_Bool' might promote to 'int' or 'unsigned int'
+      (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
+      (see ISO C 99 6.3.1.1.(2)).  So add a negative value to the
+      enum; this ensures that '_Bool' promotes to 'int'.  */
+typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
+#   endif
+#  endif
+# endif
+# define bool _Bool
+#endif
+
+/* The other macros must be usable in preprocessor directives.  */
+#ifdef __cplusplus
+# define false false
+# define true true
+#else
+# define false 0
+# define true 1
+#endif
+
+#define __bool_true_false_are_defined 1
+
+#endif /* _GL_STDBOOL_H */
index 428a119188c84d331314eb2d0cb66faa028452d1..490be4629faf9cd377414c808f66cb870da551f9 100644 (file)
@@ -1,6 +1,7 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 2426aae7052bba3cdff06d5109db213d619fd476..fdb87b50f18ddd05fffab0989aa2e210b3f92df4 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001, 2003-2007, 2009-2015 Free Software
+ * Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C Library.
    Bugs can be reported to bug-glibc@prep.ai.mit.edu.
index 8ff65cee4bc0bd28871a609306f3ab069e336b29..6575c8719ca571291f70acb81834e15b9a81c056 100644 (file)
@@ -1,7 +1,7 @@
 /* Convert string representation of a number into an intmax_t value.
 
-   Copyright (C) 1999, 2001-2004, 2006, 2009-2015 Free Software Foundation,
-   Inc.
+   Copyright (C) 1999, 2001-2004, 2006, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 1bc143985dbdafb48ed2f0fb984d34d3d1440d16..56b38af224ef6c05587bdb17b1b2781740ee4f13 100644 (file)
@@ -1,7 +1,7 @@
 /* Convert string representation of a number into an integer value.
 
-   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2015 Free Software
-   Foundation, Inc.
+   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2015 Free
+   Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to bug-glibc@gnu.org.
index d7123491f3b03da5feb666340d6fc8dd9f9964b6..e91cc29a010f05d7074d37a13121c5d060d6d7d9 100644 (file)
@@ -1,6 +1,6 @@
 /* Function to parse a 'long long int' from text.
-   Copyright (C) 1995-1997, 1999, 2001, 2009-2015 Free Software Foundation,
-   Inc.
+   Copyright (C) 1995-1997, 1999, 2001, 2009-2015 Free Software
+   Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index 5cd2554c719cad39e1c668aa9e5204b2170d7854..4d5e433553883c461cda263f240a507e6926ecb7 100644 (file)
@@ -1,5 +1,6 @@
 /* Function to parse an 'unsigned long long int' from text.
-   Copyright (C) 1995-1997, 1999, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 1999, 2009-2015 Free Software Foundation,
+   Inc.
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to bug-glibc@gnu.org.
 
index 088b224ab96784c2d6f856aeb7eebba4f219642e..55fad942219198f01459ece5d0e80042b2abd33e 100644 (file)
@@ -1,6 +1,7 @@
 /* tempname.c - generate the name of a temporary file.
 
-   Copyright (C) 1991-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 1991-2003, 2005-2007, 2009-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 0b512de99fe24be0163072d05acebb202656177a..222705bf8985944046103c43aca9b582dc0a5d61 100644 (file)
@@ -1,6 +1,7 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006-2007, 2010-2015 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2010-2015 Free Software Foundation,
+   Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 87f41d59a5071d821d5fb102ef38621ec03a810f..80810e78538f27e07280f42cb0bf304357555639 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation,
+   Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index f0e9778f7382bcdac604dcdc8deaaf8371c1ba2f..397a04bd0d1e032dadcd47c49dfb33b3492a9472 100644 (file)
@@ -1,6 +1,7 @@
 /* xalloc-oversized.h -- memory allocation size checking
 
-   Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software Foundation, Inc.
+   Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 0e22c76abe0a3178341281c5ef46d57334b0f210..eb6ef6b19d25ff25ddf33302c4499d8c0cf19f77 100644 (file)
@@ -1,3 +1,68 @@
+2015-01-26  Fabián Ezequiel Gallina  <fgallina@gnu.org>
+
+       python.el: New non-global state dependent indentation engine.
+       (Bug#18319, Bug#19595)
+
+       * progmodes/python.el (python-syntax-comment-or-string-p): Accept
+       PPSS as argument.
+       (python-syntax-closing-paren-p): New function.
+       (python-indent-current-level)
+       (python-indent-levels): Mark obsolete.
+       (python-indent-context): Return more context cases.
+       (python-indent--calculate-indentation)
+       (python-indent--calculate-levels): New functions.
+       (python-indent-calculate-levels): Use them.
+       (python-indent-calculate-indentation, python-indent-line):
+       (python-indent-line-function): Rewritten to use new API.
+       (python-indent-dedent-line): Simplify logic.
+       (python-indent-dedent-line-backspace): Use `unless`.
+       (python-indent-toggle-levels): Delete function.
+
+2015-01-21  Daniel Koning  <dk@danielkoning.com>  (tiny change)
+
+       * subr.el (posnp): Correct docstring of `posnp'.
+       (posn-col-row): Make it work with all mouse position objects.
+       * textmodes/artist.el (artist-mouse-draw-continously): Cancel
+       timers if an error occurs during continuous drawing.  (Bug#6130)
+
+2015-01-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * button.el (button-activate, push-button): Doc fix.  (Bug#19628)
+
+2015-01-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * filenotify.el (file-notify-descriptors, file-notify-handle-event):
+       Adapt docstring.
+       (file-notify--descriptor): New defun.
+       (file-notify-callback, file-notify-add-watch, file-notify-rm-watch):
+       Adapt docstring.  Handle multiple values for
+       `file-notify-descriptors' entries.  (Bug#18880)
+
+       * net/tramp.el (tramp-handle-file-notify-rm-watch): Do not check
+       `file-notify-descriptors', the implementation has been changed.
+
+2015-01-09  Eli Zaretskii  <eliz@gnu.org>
+
+       * net/net-utils.el (net-utils-run-program, net-utils-run-simple):
+       On MS-Windows, bind coding-system-for-read to the console output
+       codepage.  (Bug#19458)
+
+2015-01-04  Dmitry Gutov  <dgutov@yandex.ru>
+
+       Unbreak `mouse-action' property in text buttons.
+
+       * button.el (push-button): Fix regression from 2012-12-06.
+
+2015-01-06  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/sh-script.el (sh-mode): Doc fix.
+       (sh-basic-indent-line): Handle electric newline.  (Bug#18756)
+
+2015-01-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix dired quoting bug with "Hit`N`Hide".  Fixes Bug#19498.
+       * files.el (shell-quote-wildcard-pattern): Also quote "`".
+
 2015-01-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        Tighten up the tagcode used for eieio and cl-struct objects.
 2014-12-14  Steve Purcell  <steve@sanityinc.com>  (tiny change)
 
        * emacs-lisp/package.el (package-menu-mode): Use an extra column
-       for the "Version" column, to accomodate date-and-time-based
-       versions.
+       for the "Version" column, to accomodate date-and-time-based versions.
 
 2014-12-14  Cameron Desautels  <camdez@gmail.com>
 
index 189a1c23a4dac362042da42f502f5b9ff2d32364..e7602dd705096fa55a44b41f1b96cdc8684f4479 100644 (file)
@@ -224,10 +224,10 @@ changes to a supertype are not reflected in its subtypes)."
          prop val))))
 
 (defun button-activate (button &optional use-mouse-action)
-  "Call BUTTON's action property.
-If USE-MOUSE-ACTION is non-nil, invoke the button's mouse-action
-instead of its normal action; if the button has no mouse-action,
-the normal action is used instead.
+  "Call BUTTON's `action' property.
+If USE-MOUSE-ACTION is non-nil, invoke the button's `mouse-action'
+property instead of `action'; if the button has no `mouse-action',
+the value of `action' is used instead.
 
 The action can either be a marker or a function.  If it's a
 marker then goto it.  Otherwise it it is a function then it is
@@ -429,11 +429,13 @@ instead of starting at the next button."
 (defun push-button (&optional pos use-mouse-action)
   "Perform the action specified by a button at location POS.
 POS may be either a buffer position or a mouse-event.  If
-USE-MOUSE-ACTION is non-nil, invoke the button's mouse-action
-instead of its normal action; if the button has no mouse-action,
-the normal action is used instead.  The action may be either a
-function to call or a marker to display and is invoked using
-`button-activate' (which see).
+USE-MOUSE-ACTION is non-nil, invoke the button's `mouse-action'
+property instead of its `action' property; if the button has no
+`mouse-action', the value of `action' is used instead.
+
+The action in both cases may be either a function to call or a
+marker to display and is invoked using `button-activate' (which
+see).
 
 POS defaults to point, except when `push-button' is invoked
 interactively as the result of a mouse-event, in which case, the
index 28ac7d38b96a8c1ea878125442094a3a8c5ed47c..ba5d57e4d2eb6e4e566c69437a119421b0471719 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-14  Dima Kogan  <dima@secretsauce.net>
+
+       * erc-backend.el (define-erc-response-handler): Give hook-name
+       default value of nil and add-to-list (bug#19363)
+
 2015-01-22  Paul Eggert  <eggert@cs.ucla.edu>
 
        Don't downcase system diagnostics' first letters
index b8c67860e2014ff2227191a8d6be96f633e1e926..8ce199fbcbb02a57762073333f3e85caca66073f 100644 (file)
@@ -1162,8 +1162,11 @@ add things to `%s' instead."
           (cl-loop for alias in aliases
                    collect (intern (format "erc-server-%s-functions" alias)))))
     `(prog2
-         ;; Normal hook variable.
-         (defvar ,hook-name ',fn-name ,(format hook-doc name))
+         ;; Normal hook variable.  The variable may already have a
+         ;; value at this point, so I default to nil, and (add-hook)
+         ;; unconditionally
+         (defvar ,hook-name nil ,(format hook-doc name))
+         (add-to-list ',hook-name ',fn-name)
          ;; Handler function
          (defun ,fn-name (proc parsed)
            ,fn-doc
index 35181b63f3a977fe974d60c041400b2adaeb58e7..c94f631dde8b1550fa631a7641280a96215cdd64 100644 (file)
@@ -41,13 +41,21 @@ could use another implementation.")
   "Hash table for registered file notification descriptors.
 A key in this hash table is the descriptor as returned from
 `gfilenotify', `inotify', `w32notify' or a file name handler.
-The value in the hash table is the cons cell (DIR FILE CALLBACK).")
+The value in the hash table is a list
+
+  \(DIR (FILE . CALLBACK) (FILE . CALLBACK) ...)
+
+Several values for a given DIR happen only for `inotify', when
+different files from the same directory are watched.")
 
 ;; This function is used by `gfilenotify', `inotify' and `w32notify' events.
 ;;;###autoload
 (defun file-notify-handle-event (event)
   "Handle file system monitoring event.
-If EVENT is a filewatch event, call its callback.
+If EVENT is a filewatch event, call its callback.  It has the format
+
+  \(file-notify (DESCRIPTOR ACTIONS FILE COOKIE) CALLBACK)
+
 Otherwise, signal a `file-notify-error'."
   (interactive "e")
   (if (and (eq (car event) 'file-notify)
@@ -81,12 +89,23 @@ This is available in case a file has been moved."
 This is available in case a file has been moved."
   (nth 3 event))
 
+;; `inotify' returns the same descriptor when the file (directory)
+;; uses the same inode.  We want to distinguish, and apply a virtual
+;; descriptor which make the difference.
+(defun file-notify--descriptor (descriptor file)
+  "Return the descriptor to be used in `file-notify-*-watch'.
+For `gfilenotify' and `w32notify' it is the same descriptor as
+used in the low-level file notification package."
+  (if (and (natnump descriptor) (eq file-notify--library 'inotify))
+      (cons descriptor file)
+    descriptor))
+
 ;; The callback function used to map between specific flags of the
 ;; respective file notifications, and the ones we return.
 (defun file-notify-callback (event)
   "Handle an EVENT returned from file notification.
-EVENT is the same one as in `file-notify-handle-event' except the
-car of that event, which is the symbol `file-notify'."
+EVENT is the cdr of the event in `file-notify-handle-event'
+\(DESCRIPTOR ACTIONS FILE COOKIE)."
   (let* ((desc (car event))
         (registered (gethash desc file-notify-descriptors))
         (pending-event (assoc desc file-notify--pending-events))
@@ -97,99 +116,113 @@ car of that event, which is the symbol `file-notify'."
     ;; Make actions a list.
     (unless (consp actions) (setq actions (cons actions nil)))
 
-    ;; Check, that event is meant for us.
-    (unless (setq callback (nth 2 registered))
-      (setq actions nil))
-
-    ;; Loop over actions.  In fact, more than one action happens only
-    ;; for `inotify'.
-    (dolist (action actions)
-
-      ;; Send pending event, if it doesn't match.
-      (when (and pending-event
-                ;; The cookie doesn't match.
-                (not (eq (file-notify--event-cookie pending-event)
-                         (file-notify--event-cookie event)))
-                (or
-                 ;; inotify.
-                 (and (eq (nth 1 pending-event) 'moved-from)
-                      (not (eq action 'moved-to)))
-                 ;; w32notify.
-                 (and (eq (nth 1 pending-event) 'renamed-from)
-                      (not (eq action 'renamed-to)))))
-       (funcall callback
-                (list desc 'deleted
-                      (file-notify--event-file-name pending-event)))
-       (setq file-notify--pending-events
-             (delete pending-event file-notify--pending-events)))
-
-      ;; Map action.  We ignore all events which cannot be mapped.
-      (setq action
-           (cond
-            ;; gfilenotify.
-            ((memq action '(attribute-changed changed created deleted)) action)
-            ((eq action 'moved)
-             (setq file1 (file-notify--event-file1-name event))
-             'renamed)
-
-            ;; inotify.
-            ((eq action 'attrib) 'attribute-changed)
-            ((eq action 'create) 'created)
-            ((eq action 'modify) 'changed)
-            ((memq action '(delete 'delete-self move-self)) 'deleted)
-            ;; Make the event pending.
-            ((eq action 'moved-from)
-             (add-to-list 'file-notify--pending-events
-                          (list desc action file
-                                (file-notify--event-cookie event)))
-             nil)
-            ;; Look for pending event.
-            ((eq action 'moved-to)
-             (if (null pending-event)
-                 'created
-               (setq file1 file
-                     file (file-notify--event-file-name pending-event)
-                     file-notify--pending-events
-                     (delete pending-event file-notify--pending-events))
-               'renamed))
-
-            ;; w32notify.
-            ((eq action 'added) 'created)
-            ((eq action 'modified) 'changed)
-            ((eq action 'removed) 'deleted)
-            ;; Make the event pending.
-            ((eq 'renamed-from action)
-             (add-to-list 'file-notify--pending-events
-                          (list desc action file
-                                (file-notify--event-cookie event)))
-             nil)
-            ;; Look for pending event.
-            ((eq 'renamed-to action)
-             (if (null pending-event)
-                 'created
-               (setq file1 file
-                     file (file-notify--event-file-name pending-event)
-                     file-notify--pending-events
-                     (delete pending-event file-notify--pending-events))
-               'renamed))))
-
-      ;; Apply callback.
-      (when (and action
-                (or
-                 ;; If there is no relative file name for that watch,
-                 ;; we watch the whole directory.
-                 (null (nth 1 registered))
-                 ;; File matches.
-                 (string-equal
-                  (nth 1 registered) (file-name-nondirectory file))
-                 ;; File1 matches.
-                 (and (stringp file1)
-                      (string-equal
-                       (nth 1 registered) (file-name-nondirectory file1)))))
-       (if file1
-           (funcall callback (list desc action file file1))
-         (funcall callback (list desc action file)))))))
-
+    ;; Loop over registered entries.  In fact, more than one entry
+    ;; happens only for `inotify'.
+    (dolist (entry (cdr registered))
+
+      ;; Check, that event is meant for us.
+      (unless (setq callback (cdr entry))
+       (setq actions nil))
+
+      ;; Loop over actions.  In fact, more than one action happens only
+      ;; for `inotify'.
+      (dolist (action actions)
+
+       ;; Send pending event, if it doesn't match.
+       (when (and pending-event
+                  ;; The cookie doesn't match.
+                  (not (eq (file-notify--event-cookie pending-event)
+                           (file-notify--event-cookie event)))
+                  (or
+                   ;; inotify.
+                   (and (eq (nth 1 pending-event) 'moved-from)
+                        (not (eq action 'moved-to)))
+                   ;; w32notify.
+                   (and (eq (nth 1 pending-event) 'renamed-from)
+                        (not (eq action 'renamed-to)))))
+         (funcall callback
+                  (list desc 'deleted
+                        (file-notify--event-file-name pending-event)))
+         (setq file-notify--pending-events
+               (delete pending-event file-notify--pending-events)))
+
+       ;; Map action.  We ignore all events which cannot be mapped.
+       (setq action
+             (cond
+              ;; gfilenotify.
+              ((memq action '(attribute-changed changed created deleted))
+               action)
+              ((eq action 'moved)
+               (setq file1 (file-notify--event-file1-name event))
+               'renamed)
+
+              ;; inotify.
+              ((eq action 'attrib) 'attribute-changed)
+              ((eq action 'create) 'created)
+              ((eq action 'modify) 'changed)
+              ((memq action '(delete 'delete-self move-self)) 'deleted)
+              ;; Make the event pending.
+              ((eq action 'moved-from)
+               (add-to-list 'file-notify--pending-events
+                            (list desc action file
+                                  (file-notify--event-cookie event)))
+               nil)
+              ;; Look for pending event.
+              ((eq action 'moved-to)
+               (if (null pending-event)
+                   'created
+                 (setq file1 file
+                       file (file-notify--event-file-name pending-event)
+                       file-notify--pending-events
+                       (delete pending-event file-notify--pending-events))
+                 'renamed))
+
+              ;; w32notify.
+              ((eq action 'added) 'created)
+              ((eq action 'modified) 'changed)
+              ((eq action 'removed) 'deleted)
+              ;; Make the event pending.
+              ((eq action 'renamed-from)
+               (add-to-list 'file-notify--pending-events
+                            (list desc action file
+                                  (file-notify--event-cookie event)))
+               nil)
+              ;; Look for pending event.
+              ((eq action 'renamed-to)
+               (if (null pending-event)
+                   'created
+                 (setq file1 file
+                       file (file-notify--event-file-name pending-event)
+                       file-notify--pending-events
+                       (delete pending-event file-notify--pending-events))
+                 'renamed))))
+
+       ;; Apply callback.
+       (when (and action
+                  (or
+                   ;; If there is no relative file name for that watch,
+                   ;; we watch the whole directory.
+                   (null (nth 0 entry))
+                   ;; File matches.
+                   (string-equal
+                    (nth 0 entry) (file-name-nondirectory file))
+                   ;; File1 matches.
+                   (and (stringp file1)
+                        (string-equal
+                         (nth 0 entry) (file-name-nondirectory file1)))))
+         (if file1
+             (funcall
+              callback
+              `(,(file-notify--descriptor desc (nth 0 entry))
+                ,action ,file ,file1))
+           (funcall
+            callback
+            `(,(file-notify--descriptor desc (nth 0 entry))
+              ,action ,file))))))))
+
+;; `gfilenotify' and `w32notify' return a unique descriptor for every
+;; `file-notify-add-watch', while `inotify' returns a unique
+;; descriptor per inode only.
 (defun file-notify-add-watch (file flags callback)
   "Add a watch for filesystem events pertaining to FILE.
 This arranges for filesystem events pertaining to FILE to be reported
@@ -206,7 +239,7 @@ include the following symbols:
   `attribute-change' -- watch for file attributes changes, like
                         permissions or modification time
 
-If FILE is a directory, 'change' watches for file creation or
+If FILE is a directory, `change' watches for file creation or
 deletion in that directory.  This does not work recursively.
 
 When any event happens, Emacs will call the CALLBACK function passing
@@ -240,82 +273,96 @@ FILE is the name of the file whose event is being reported."
               (if (file-directory-p file)
                   file
                 (file-name-directory file))))
-       desc func l-flags)
-
-    ;; Check, whether this has been registered already.
-;    (maphash
-;     (lambda (key value)
-;       (when (equal (cons file callback) value) (setq desc key)))
-;     file-notify-descriptors)
-
-    (unless desc
-      (if handler
-         ;; A file name handler could exist even if there is no local
-         ;; file notification support.
-         (setq desc (funcall
-                     handler 'file-notify-add-watch dir flags callback))
-
-       ;; Check, whether Emacs has been compiled with file
-       ;; notification support.
-       (unless file-notify--library
-         (signal 'file-notify-error
-                 '("No file notification package available")))
-
-       ;; Determine low-level function to be called.
-       (setq func
-             (cond
-              ((eq file-notify--library 'gfilenotify) 'gfile-add-watch)
-              ((eq file-notify--library 'inotify) 'inotify-add-watch)
-              ((eq file-notify--library 'w32notify) 'w32notify-add-watch)))
-
-       ;; Determine respective flags.
-       (if (eq file-notify--library 'gfilenotify)
-           (setq l-flags '(watch-mounts send-moved))
-         (when (memq 'change flags)
-           (setq
-            l-flags
-            (cond
-             ((eq file-notify--library 'inotify) '(create modify move delete))
-             ((eq file-notify--library 'w32notify)
-              '(file-name directory-name size last-write-time)))))
-         (when (memq 'attribute-change flags)
-           (add-to-list
-            'l-flags
-            (cond
-             ((eq file-notify--library 'inotify) 'attrib)
-             ((eq file-notify--library 'w32notify) 'attributes)))))
-
-       ;; Call low-level function.
-       (setq desc (funcall func dir l-flags 'file-notify-callback))))
+       desc func l-flags registered)
+
+    (if handler
+       ;; A file name handler could exist even if there is no local
+       ;; file notification support.
+       (setq desc (funcall
+                   handler 'file-notify-add-watch dir flags callback))
+
+      ;; Check, whether Emacs has been compiled with file
+      ;; notification support.
+      (unless file-notify--library
+       (signal 'file-notify-error
+               '("No file notification package available")))
+
+      ;; Determine low-level function to be called.
+      (setq func
+           (cond
+            ((eq file-notify--library 'gfilenotify) 'gfile-add-watch)
+            ((eq file-notify--library 'inotify) 'inotify-add-watch)
+            ((eq file-notify--library 'w32notify) 'w32notify-add-watch)))
+
+      ;; Determine respective flags.
+      (if (eq file-notify--library 'gfilenotify)
+         (setq l-flags '(watch-mounts send-moved))
+       (when (memq 'change flags)
+         (setq
+          l-flags
+          (cond
+           ((eq file-notify--library 'inotify) '(create modify move delete))
+           ((eq file-notify--library 'w32notify)
+            '(file-name directory-name size last-write-time)))))
+       (when (memq 'attribute-change flags)
+         (add-to-list
+          'l-flags
+          (cond
+           ((eq file-notify--library 'inotify) 'attrib)
+           ((eq file-notify--library 'w32notify) 'attributes)))))
+
+      ;; Call low-level function.
+      (setq desc (funcall func dir l-flags 'file-notify-callback)))
+
+    ;; Modify `file-notify-descriptors'.
+    (setq registered (gethash desc file-notify-descriptors))
+    (puthash
+     desc
+     `(,dir
+       (,(unless (file-directory-p file) (file-name-nondirectory file))
+       . ,callback)
+       . ,(cdr registered))
+     file-notify-descriptors)
 
     ;; Return descriptor.
-    (puthash desc
-             (list (directory-file-name
-                   (if (file-directory-p dir) dir (file-name-directory dir)))
-                   (unless (file-directory-p file)
-                    (file-name-nondirectory file))
-                  callback)
-             file-notify-descriptors)
-    desc))
+    (file-notify--descriptor
+     desc (unless (file-directory-p file) (file-name-nondirectory file)))))
 
 (defun file-notify-rm-watch (descriptor)
   "Remove an existing watch specified by its DESCRIPTOR.
 DESCRIPTOR should be an object returned by `file-notify-add-watch'."
-  (let ((file (car (gethash descriptor file-notify-descriptors)))
-       handler)
-
-    (when (stringp file)
-      (setq handler (find-file-name-handler file 'file-notify-rm-watch))
-      (if handler
-         (funcall handler 'file-notify-rm-watch descriptor)
-       (funcall
-        (cond
-         ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch)
-         ((eq file-notify--library 'inotify) 'inotify-rm-watch)
-         ((eq file-notify--library 'w32notify) 'w32notify-rm-watch))
-        descriptor)))
-
-    (remhash descriptor file-notify-descriptors)))
+  (let* ((desc (if (consp descriptor) (car descriptor) descriptor))
+        (file (if (consp descriptor) (cdr descriptor)))
+        (dir (car (gethash desc file-notify-descriptors)))
+        handler registered)
+
+    (when (stringp dir)
+      (setq handler (find-file-name-handler dir 'file-notify-rm-watch))
+
+      ;; Modify `file-notify-descriptors'.
+      (if (not file)
+         (remhash desc file-notify-descriptors)
+
+       (setq registered (gethash desc file-notify-descriptors))
+       (setcdr registered
+               (delete (assoc file (cdr registered)) (cdr registered)))
+       (if (null (cdr registered))
+           (remhash desc file-notify-descriptors)
+         (puthash desc registered file-notify-descriptors)))
+
+      ;; Call low-level function.
+      (when (null (cdr registered))
+       (if handler
+           ;; A file name handler could exist even if there is no local
+           ;; file notification support.
+           (funcall handler 'file-notify-rm-watch desc)
+
+         (funcall
+          (cond
+           ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch)
+           ((eq file-notify--library 'inotify) 'inotify-rm-watch)
+           ((eq file-notify--library 'w32notify) 'w32notify-rm-watch))
+          desc))))))
 
 ;; The end:
 (provide 'filenotify)
index ed1943dfc28a39d027937cf642b9d373accfec95..40a4289741935b16c4151339c631d4acc22bd7d6 100644 (file)
@@ -6094,7 +6094,7 @@ and `list-directory-verbose-switches'."
 
 PATTERN is assumed to represent a file-name wildcard suitable for the
 underlying filesystem.  For Unix and GNU/Linux, each character from the
-set [ \\t\\n;<>&|()'\"#$] is quoted with a backslash; for DOS/Windows, all
+set [ \\t\\n;<>&|()`'\"#$] is quoted with a backslash; for DOS/Windows, all
 the parts of the pattern which don't include wildcard characters are
 quoted with double quotes.
 
@@ -6108,12 +6108,12 @@ need to be passed verbatim to shell commands."
       ;; argument has quotes, we can safely assume it is already
       ;; quoted by the caller.
       (if (or (string-match "[\"]" pattern)
-             ;; We quote [&()#$'] in case their shell is a port of a
+             ;; We quote [&()#$`'] in case their shell is a port of a
              ;; Unixy shell.  We quote [,=+] because stock DOS and
              ;; Windows shells require that in some cases, such as
              ;; passing arguments to batch files that use positional
              ;; arguments like %1.
-             (not (string-match "[ \t;&()#$',=+]" pattern)))
+             (not (string-match "[ \t;&()#$`',=+]" pattern)))
          pattern
        (let ((result "\"")
              (beg 0)
@@ -6128,7 +6128,7 @@ need to be passed verbatim to shell commands."
          (concat result (substring pattern beg) "\""))))
      (t
       (let ((beg 0))
-       (while (string-match "[ \t\n;<>&|()'\"#$]" pattern beg)
+       (while (string-match "[ \t\n;<>&|()`'\"#$]" pattern beg)
          (setq pattern
                (concat (substring pattern 0 (match-beginning 0))
                        "\\"
diff --git a/lisp/gnus/gnus-setup.el b/lisp/gnus/gnus-setup.el
new file mode 100644 (file)
index 0000000..86b3bff
--- /dev/null
@@ -0,0 +1,191 @@
+;;; gnus-setup.el --- Initialization & Setup for Gnus 5
+
+;; Copyright (C) 1995-1996, 2000-2015 Free Software Foundation, Inc.
+
+;; Author: Steven L. Baur <steve@miranova.com>
+;; Keywords: news
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; My head is starting to spin with all the different mail/news packages.
+;; Stop The Madness!
+
+;; Given that Emacs Lisp byte codes may be diverging, it is probably best
+;; not to byte compile this, and just arrange to have the .el loaded out
+;; of .emacs.
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+
+(defvar gnus-use-installed-gnus t
+  "*If non-nil use installed version of Gnus.")
+
+(defvar gnus-use-installed-mailcrypt (featurep 'xemacs)
+  "*If non-nil use installed version of mailcrypt.")
+
+(defvar gnus-emacs-lisp-directory (if (featurep 'xemacs)
+                                     "/usr/local/lib/xemacs/"
+                                   "/usr/local/share/emacs/")
+  "Directory where Emacs site lisp is located.")
+
+(defvar gnus-gnus-lisp-directory (concat gnus-emacs-lisp-directory
+                                        "gnus/lisp/")
+  "Directory where Gnus Emacs lisp is found.")
+
+(defvar gnus-mailcrypt-lisp-directory (concat gnus-emacs-lisp-directory
+                                             "site-lisp/mailcrypt/")
+  "Directory where Mailcrypt Emacs Lisp is found.")
+
+(defvar gnus-bbdb-lisp-directory (concat gnus-emacs-lisp-directory
+                                        "site-lisp/bbdb/")
+  "Directory where Big Brother Database is found.")
+
+(defvar gnus-use-mhe nil
+  "Set this if you want to use MH-E for mail reading.")
+(defvar gnus-use-rmail nil
+  "Set this if you want to use RMAIL for mail reading.")
+(defvar gnus-use-sendmail nil
+  "Set this if you want to use SENDMAIL for mail reading.")
+(defvar gnus-use-vm nil
+  "Set this if you want to use the VM package for mail reading.")
+(defvar gnus-use-sc nil
+  "Set this if you want to use Supercite.")
+(defvar gnus-use-mailcrypt t
+  "Set this if you want to use Mailcrypt for dealing with PGP messages.")
+(defvar gnus-use-bbdb nil
+  "Set this if you want to use the Big Brother DataBase.")
+
+(when (and (not gnus-use-installed-gnus)
+          (null (member gnus-gnus-lisp-directory load-path)))
+  (push gnus-gnus-lisp-directory load-path))
+
+;;; We can't do this until we know where Gnus is.
+(require 'message)
+
+;;; Mailcrypt by
+;;; Jin Choi <jin@atype.com>
+;;; Patrick LoPresti <patl@lcs.mit.edu>
+
+(when gnus-use-mailcrypt
+  (when (and (not gnus-use-installed-mailcrypt)
+            (null (member gnus-mailcrypt-lisp-directory load-path)))
+    (setq load-path (cons gnus-mailcrypt-lisp-directory load-path)))
+  (autoload 'mc-install-write-mode "mailcrypt" nil t)
+  (autoload 'mc-install-read-mode "mailcrypt" nil t)
+;;;   (add-hook 'message-mode-hook 'mc-install-write-mode)
+;;;   (add-hook 'gnus-summary-mode-hook 'mc-install-read-mode)
+  (when gnus-use-mhe
+    (add-hook 'mh-folder-mode-hook 'mc-install-read-mode)
+    (add-hook 'mh-letter-mode-hook 'mc-install-write-mode)))
+
+;;; BBDB by
+;;; Jamie Zawinski <jwz@lucid.com>
+
+(when gnus-use-bbdb
+  ;; bbdb will never be installed with emacs.
+  (when (null (member gnus-bbdb-lisp-directory load-path))
+    (setq load-path (cons gnus-bbdb-lisp-directory load-path)))
+  (autoload 'bbdb "bbdb-com"
+    "Insidious Big Brother Database" t)
+  (autoload 'bbdb-name "bbdb-com"
+    "Insidious Big Brother Database" t)
+  (autoload 'bbdb-company "bbdb-com"
+    "Insidious Big Brother Database" t)
+  (autoload 'bbdb-net "bbdb-com"
+    "Insidious Big Brother Database" t)
+  (autoload 'bbdb-notes "bbdb-com"
+    "Insidious Big Brother Database" t)
+
+  (when gnus-use-vm
+    (autoload 'bbdb-insinuate-vm "bbdb-vm"
+      "Hook BBDB into VM" t))
+
+  (when gnus-use-rmail
+    (autoload 'bbdb-insinuate-rmail "bbdb-rmail"
+      "Hook BBDB into RMAIL" t)
+    (add-hook 'rmail-mode-hook 'bbdb-insinuate-rmail))
+
+  (when gnus-use-mhe
+    (autoload 'bbdb-insinuate-mh "bbdb-mh"
+      "Hook BBDB into MH-E" t)
+    (add-hook 'mh-folder-mode-hook 'bbdb-insinuate-mh))
+
+  (autoload 'bbdb-insinuate-gnus "bbdb-gnus"
+    "Hook BBDB into Gnus" t)
+  (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
+
+  (when gnus-use-sendmail
+    (autoload 'bbdb-insinuate-sendmail "bbdb"
+      "Insidious Big Brother Database" t)
+    (add-hook 'mail-setup-hook 'bbdb-insinuate-sendmail)
+    (add-hook 'message-setup-hook 'bbdb-insinuate-sendmail)))
+
+(when gnus-use-sc
+  (add-hook 'mail-citation-hook 'sc-cite-original)
+  (setq message-cite-function 'sc-cite-original))
+\f
+;;;### (autoloads (gnus gnus-slave gnus-no-server) "gnus" "lisp/gnus.el" (12473 2137))
+;;; Generated autoloads from lisp/gnus.el
+
+;; Don't redo this if autoloads already exist
+(unless (fboundp 'gnus)
+  (autoload 'gnus-slave-no-server "gnus" "\
+Read network news as a slave without connecting to local server." t nil)
+
+  (autoload 'gnus-no-server "gnus" "\
+Read network news.
+If ARG is a positive number, Gnus will use that as the
+startup level.  If ARG is nil, Gnus will be started at level 2.
+If ARG is non-nil and not a positive number, Gnus will
+prompt the user for the name of an NNTP server to use.
+As opposed to `gnus', this command will not connect to the local server." t nil)
+
+  (autoload 'gnus-slave "gnus" "\
+Read news as a slave." t nil)
+
+  (autoload 'gnus "gnus" "\
+Read network news.
+If ARG is non-nil and a positive number, Gnus will use that as the
+startup level.  If ARG is non-nil and not a positive number, Gnus will
+prompt the user for the name of an NNTP server to use." t nil)
+
+;;;***
+
+;;; These have moved out of gnus.el into other files.
+;;; FIX FIX FIX: should other things be in gnus-setup? or these not in it?
+  (autoload 'gnus-update-format "gnus-spec" "\
+Update the format specification near point." t nil)
+
+  (autoload 'gnus-fetch-group "gnus-group" "\
+Start Gnus if necessary and enter GROUP.
+Returns whether the fetching was successful or not." t nil)
+
+  (defalias 'gnus-batch-kill 'gnus-batch-score)
+
+  (autoload 'gnus-batch-score "gnus-kill" "\
+Run batched scoring.
+Usage: emacs -batch -l gnus -f gnus-batch-score <newsgroups> ...
+Newsgroups is a list of strings in Bnews format.  If you want to score
+the comp hierarchy, you'd say \"comp.all\".  If you would not like to
+score the alt hierarchy, you'd say \"!alt.all\"." t nil))
+
+(provide 'gnus-setup)
+
+(run-hooks 'gnus-setup-load-hook)
+
+;;; gnus-setup.el ends here
index 28aa43117da3fcfd64f20b4e1c6384cd1319b917..ebcbc714ffb4631fac4df2a7f2cb470cfb208fac 100644 (file)
@@ -328,7 +328,15 @@ This variable is only used if the variable
 
 (defun net-utils-run-program (name header program args)
   "Run a network information program."
-  (let ((buf (get-buffer-create (concat "*" name "*"))))
+  (let ((buf (get-buffer-create (concat "*" name "*")))
+       (coding-system-for-read
+        ;; MS-Windows versions of network utilities output text
+        ;; encoded in the console (a.k.a. "OEM") codepage, which is
+        ;; different from the default system (a.k.a. "ANSI")
+        ;; codepage.
+        (if (eq system-type 'windows-nt)
+            (intern (format "cp%d" (w32-get-console-output-codepage)))
+          coding-system-for-read)))
     (set-buffer buf)
     (erase-buffer)
     (insert header "\n")
@@ -352,7 +360,15 @@ This variable is only used if the variable
       (when proc
         (set-process-filter proc nil)
         (delete-process proc)))
-    (let ((inhibit-read-only t))
+    (let ((inhibit-read-only t)
+       (coding-system-for-read
+        ;; MS-Windows versions of network utilities output text
+        ;; encoded in the console (a.k.a. "OEM") codepage, which is
+        ;; different from the default system (a.k.a. "ANSI")
+        ;; codepage.
+        (if (eq system-type 'windows-nt)
+            (intern (format "cp%d" (w32-get-console-output-codepage)))
+          coding-system-for-read)))
       (erase-buffer))
     (net-utils-mode)
     (setq-local net-utils--revert-cmd
index d44c8ea2f6d0a731c24ecb94a52a3c95e764e23b..ba0d13eab8bb31a4a45254dcba2648a76b4ce466 100644 (file)
@@ -64,7 +64,6 @@
 (defvar bkup-backup-directory-info)
 (defvar directory-sep-char)
 (defvar eshell-path-env)
-(defvar file-notify-descriptors)
 (defvar ls-lisp-use-insert-directory-program)
 (defvar outline-regexp)
 
@@ -3415,7 +3414,7 @@ of."
 (defun tramp-handle-file-notify-rm-watch (proc)
   "Like `file-notify-rm-watch' for Tramp files."
   ;; The descriptor must be a process object.
-  (unless (and (processp proc) (gethash proc file-notify-descriptors))
+  (unless (processp proc)
     (tramp-error proc 'file-notify-error "Not a valid descriptor %S" proc))
   (tramp-message proc 6 "Kill %S" proc)
   (kill-process proc))
diff --git a/lisp/progmodes/cap-words.el b/lisp/progmodes/cap-words.el
new file mode 100644 (file)
index 0000000..94e865d
--- /dev/null
@@ -0,0 +1,98 @@
+;;; cap-words.el --- minor mode for motion in CapitalizedWordIdentifiers
+
+;; Copyright (C) 2002-2015 Free Software Foundation, Inc.
+
+;; Author: Dave Love <fx@gnu.org>
+;; Keywords: languages
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides Capitalized Words minor mode for word movement in
+;; identifiers CapitalizedLikeThis.
+
+;; Note that the same effect could be obtained by frobbing the
+;; category of upper case characters to produce word boundaries, but
+;; the necessary processing isn't done for ASCII characters.
+
+;; Fixme: This doesn't work properly for mouse double clicks.
+
+;;; Code:
+
+(defun capitalized-find-word-boundary (pos limit)
+  "Function for use in `find-word-boundary-function-table'.
+Looks for word boundaries before capitals."
+  (save-excursion
+    (goto-char pos)
+    (let (case-fold-search)
+      (if (<= pos limit)
+         ;; Fixme: Are these regexps the best?
+         (or (and (re-search-forward "\\=.\\w*[[:upper:]]"
+                                     limit t)
+                  (progn (backward-char)
+                         t))
+             (re-search-forward "\\>" limit t))
+       (or (re-search-backward "[[:upper:]]\\w*\\=" limit t)
+           (re-search-backward "\\<" limit t))))
+    (point)))
+
+
+(defconst capitalized-find-word-boundary-function-table
+  (let ((tab (make-char-table nil)))
+    (set-char-table-range tab t #'capitalized-find-word-boundary)
+    tab)
+  "Assigned to `find-word-boundary-function-table' in Capitalized Words mode.")
+
+;;;###autoload
+(define-minor-mode capitalized-words-mode
+  "Toggle Capitalized Words mode.
+With a prefix argument ARG, enable Capitalized Words mode if ARG
+is positive, and disable it otherwise.  If called from Lisp,
+enable the mode if ARG is omitted or nil.
+
+Capitalized Words mode is a buffer-local minor mode.  When
+enabled, a word boundary occurs immediately before an uppercase
+letter in a symbol.  This is in addition to all the normal
+boundaries given by the syntax and category tables.  There is no
+restriction to ASCII.
+
+E.g. the beginning of words in the following identifier are as marked:
+
+  capitalizedWorDD
+  ^          ^  ^^
+
+Note that these word boundaries only apply for word motion and
+marking commands such as \\[forward-word].  This mode does not affect word
+boundaries found by regexp matching (`\\>', `\\w' &c).
+
+This style of identifiers is common in environments like Java ones,
+where underscores aren't trendy enough.  Capitalization rules are
+sometimes part of the language, e.g. Haskell, which may thus encourage
+such a style.  It is appropriate to add `capitalized-words-mode' to
+the mode hook for programming language modes in which you encounter
+variables like this, e.g. `java-mode-hook'.  It's unlikely to cause
+trouble if such identifiers aren't used.
+
+See also `glasses-mode' and `studlify-word'.
+Obsoletes `c-forward-into-nomenclature'."
+  nil " Caps" nil :group 'programming
+  (set (make-local-variable 'find-word-boundary-function-table)
+       capitalized-find-word-boundary-function-table))
+
+(provide 'cap-words)
+
+;;; cap-words.el ends here
index 13ff439bef29d7413ac30a1938034c6962206878..d340550a0174fd0ee75b17ec7740eaf13bf4dc1d 100644 (file)
@@ -463,9 +463,14 @@ The type returned can be `comment', `string' or `paren'."
      ((nth 8 ppss) (if (nth 4 ppss) 'comment 'string))
      ((nth 1 ppss) 'paren))))
 
-(defsubst python-syntax-comment-or-string-p ()
-  "Return non-nil if point is inside 'comment or 'string."
-  (nth 8 (syntax-ppss)))
+(defsubst python-syntax-comment-or-string-p (&optional ppss)
+  "Return non-nil if PPSS is inside 'comment or 'string."
+  (nth 8 (or ppss (syntax-ppss))))
+
+(defsubst python-syntax-closing-paren-p ()
+  "Return non-nil if char after point is a closing paren."
+  (= (syntax-class (syntax-after (point)))
+     (syntax-class (string-to-syntax ")"))))
 
 (define-obsolete-function-alias
   'python-info-ppss-context #'python-syntax-context "24.3")
@@ -704,11 +709,28 @@ It makes underscores and dots word constituent chars.")
   'python-guess-indent 'python-indent-guess-indent-offset "24.3")
 
 (defvar python-indent-current-level 0
-  "Current indentation level `python-indent-line-function' is using.")
+  "Deprecated var available for compatibility.")
 
 (defvar python-indent-levels '(0)
-  "Levels of indentation available for `python-indent-line-function'.
-Can also be `noindent' if automatic indentation can't be used.")
+  "Deprecated var available for compatibility.")
+
+(make-obsolete-variable
+ 'python-indent-current-level
+ "The indentation API changed to avoid global state.
+The function `python-indent-calculate-levels' does not use it
+anymore.  If you were defadvising it and or depended on this
+variable for indentation customizations, refactor your code to
+work on `python-indent-calculate-indentation' instead."
+ "24.5")
+
+(make-obsolete-variable
+ 'python-indent-levels
+ "The indentation API changed to avoid global state.
+The function `python-indent-calculate-levels' does not use it
+anymore.  If you were defadvising it and or depended on this
+variable for indentation customizations, refactor your code to
+work on `python-indent-calculate-indentation' instead."
+ "24.5")
 
 (defun python-indent-guess-indent-offset ()
   "Guess and set `python-indent-offset' for the current buffer."
@@ -748,362 +770,358 @@ Can also be `noindent' if automatic indentation can't be used.")
                      python-indent-offset)))))))
 
 (defun python-indent-context ()
-  "Get information on indentation context.
-Context information is returned with a cons with the form:
-    (STATUS . START)
-
-Where status can be any of the following symbols:
-
- * after-comment: When current line might continue a comment block
- * inside-paren: If point in between (), {} or []
- * inside-string: If point is inside a string
- * after-backslash: Previous line ends in a backslash
- * after-beginning-of-block: Point is after beginning of block
- * after-line: Point is after normal line
- * dedenter-statement: Point is on a dedenter statement.
- * no-indent: Point is at beginning of buffer or other special case
-START is the buffer position where the sexp starts."
+  "Get information about the current indentation context.
+Context is returned in a cons with the form (STATUS . START).
+
+STATUS can be one of the following:
+
+keyword
+-------
+
+:after-comment
+ - Point is after a comment line.
+ - START is the position of the \"#\" character.
+:inside-string
+ - Point is inside string.
+ - START is the position of the first quote that starts it.
+:no-indent
+ - No possible indentation case matches.
+ - START is always zero.
+
+:inside-paren
+ - Fallback case when point is inside paren.
+ - START is the first non space char position *after* the open paren.
+:inside-paren-at-closing-nested-paren
+ - Point is on a line that contains a nested paren closer.
+ - START is the position of the open paren it closes.
+:inside-paren-at-closing-paren
+ - Point is on a line that contains a paren closer.
+ - START is the position of the open paren.
+:inside-paren-newline-start
+ - Point is inside a paren with items starting in their own line.
+ - START is the position of the open paren.
+:inside-paren-newline-start-from-block
+ - Point is inside a paren with items starting in their own line
+   from a block start.
+ - START is the position of the open paren.
+
+:after-backslash
+ - Fallback case when point is after backslash.
+ - START is the char after the position of the backslash.
+:after-backslash-assignment-continuation
+ - Point is after a backslashed assignment.
+ - START is the char after the position of the backslash.
+:after-backslash-block-continuation
+ - Point is after a backslashed block continuation.
+ - START is the char after the position of the backslash.
+:after-backslash-dotted-continuation
+ - Point is after a backslashed dotted continuation.  Previous
+   line must contain a dot to align with.
+ - START is the char after the position of the backslash.
+:after-backslash-first-line
+ - First line following a backslashed continuation.
+ - START is the char after the position of the backslash.
+
+:after-block-end
+ - Point is after a line containing a block ender.
+ - START is the position where the ender starts.
+:after-block-start
+ - Point is after a line starting a block.
+ - START is the position where the block starts.
+:after-line
+ - Point is after a simple line.
+ - START is the position where the previous line starts.
+:at-dedenter-block-start
+ - Point is on a line starting a dedenter block.
+ - START is the position where the dedenter block starts."
   (save-restriction
     (widen)
-    (let ((ppss (save-excursion (beginning-of-line) (syntax-ppss)))
-          (start))
-      (cons
-       (cond
-        ;; Beginning of buffer
-        ((save-excursion
-           (goto-char (line-beginning-position))
-           (bobp))
-         'no-indent)
-        ;; Comment continuation
-        ((save-excursion
-           (when (and
-                  (or
-                   (python-info-current-line-comment-p)
-                   (python-info-current-line-empty-p))
-                  (progn
-                    (forward-comment -1)
-                    (python-info-current-line-comment-p)))
-             (setq start (point))
-             'after-comment)))
-        ;; Inside string
-        ((setq start (python-syntax-context 'string ppss))
-         'inside-string)
-        ;; Inside a paren
-        ((setq start (python-syntax-context 'paren ppss))
-         'inside-paren)
-        ;; After backslash
-        ((setq start (when (not (or (python-syntax-context 'string ppss)
-                                    (python-syntax-context 'comment ppss)))
-                       (let ((line-beg-pos (line-number-at-pos)))
-                         (python-info-line-ends-backslash-p
-                          (1- line-beg-pos)))))
-         'after-backslash)
-        ;; After beginning of block
-        ((setq start (save-excursion
-                       (when (progn
-                               (back-to-indentation)
-                               (python-util-forward-comment -1)
-                               (equal (char-before) ?:))
-                         ;; Move to the first block start that's not in within
-                         ;; a string, comment or paren and that's not a
-                         ;; continuation line.
-                         (while (and (re-search-backward
-                                      (python-rx block-start) nil t)
-                                     (or
-                                      (python-syntax-context-type)
-                                      (python-info-continuation-line-p))))
-                         (when (looking-at (python-rx block-start))
-                           (point-marker)))))
-         'after-beginning-of-block)
-        ((when (setq start (python-info-dedenter-statement-p))
-           'dedenter-statement))
-        ;; After normal line
-        ((setq start (save-excursion
+    (let ((ppss (save-excursion
+                  (beginning-of-line)
+                  (syntax-ppss))))
+      (cond
+       ;; Beginning of buffer.
+       ((= (line-number-at-pos) 1)
+        (cons :no-indent 0))
+       ;; Comment continuation (maybe).
+       ((save-excursion
+          (when (and
+                 (or
+                  (python-info-current-line-comment-p)
+                  (python-info-current-line-empty-p))
+                 (forward-comment -1)
+                 (python-info-current-line-comment-p))
+            (cons :after-comment (point)))))
+       ;; Inside a string.
+       ((let ((start (python-syntax-context 'string ppss)))
+          (when start
+            (cons :inside-string start))))
+       ;; Inside a paren.
+       ((let* ((start (python-syntax-context 'paren ppss))
+               (starts-in-newline
+                (when start
+                  (save-excursion
+                    (goto-char start)
+                    (forward-char)
+                    (not
+                     (= (line-number-at-pos)
+                        (progn
+                          (python-util-forward-comment)
+                          (line-number-at-pos))))))))
+          (when start
+            (cond
+             ;; Current line only holds the closing paren.
+             ((save-excursion
+                (skip-syntax-forward " ")
+                (when (and (python-syntax-closing-paren-p)
+                           (progn
+                             (forward-char 1)
+                             (not (python-syntax-context 'paren))))
+                  (cons :inside-paren-at-closing-paren start))))
+             ;; Current line only holds a closing paren for nested.
+             ((save-excursion
+                (back-to-indentation)
+                (python-syntax-closing-paren-p))
+              (cons :inside-paren-at-closing-nested-paren start))
+             ;; This line starts from a opening block in its own line.
+             ((save-excursion
+                (goto-char start)
+                (when (and
+                       starts-in-newline
+                       (save-excursion
+                         (back-to-indentation)
+                         (looking-at (python-rx block-start))))
+                  (cons
+                   :inside-paren-newline-start-from-block start))))
+             (starts-in-newline
+              (cons :inside-paren-newline-start start))
+             ;; General case.
+             (t (cons :inside-paren
+                      (save-excursion
+                        (goto-char (1+ start))
+                        (skip-syntax-forward "(" 1)
+                        (skip-syntax-forward " ")
+                        (point))))))))
+       ;; After backslash.
+       ((let ((start (when (not (python-syntax-comment-or-string-p ppss))
+                       (python-info-line-ends-backslash-p
+                        (1- (line-number-at-pos))))))
+          (when start
+            (cond
+             ;; Continuation of dotted expression.
+             ((save-excursion
+                (back-to-indentation)
+                (when (eq (char-after) ?\.)
+                  ;; Move point back until it's not inside a paren.
+                  (while (prog2
+                             (forward-line -1)
+                             (and (not (bobp))
+                                  (python-syntax-context 'paren))))
+                  (goto-char (line-end-position))
+                  (while (and (search-backward
+                               "." (line-beginning-position) t)
+                              (python-syntax-context-type)))
+                  ;; Ensure previous statement has dot to align with.
+                  (when (and (eq (char-after) ?\.)
+                             (not (python-syntax-context-type)))
+                    (cons :after-backslash-dotted-continuation (point))))))
+             ;; Continuation of block definition.
+             ((let ((block-continuation-start
+                     (python-info-block-continuation-line-p)))
+                (when block-continuation-start
+                  (save-excursion
+                    (goto-char block-continuation-start)
+                    (re-search-forward
+                     (python-rx block-start (* space))
+                     (line-end-position) t)
+                    (cons :after-backslash-block-continuation (point))))))
+             ;; Continuation of assignment.
+             ((let ((assignment-continuation-start
+                     (python-info-assignment-continuation-line-p)))
+                (when assignment-continuation-start
+                  (save-excursion
+                    (goto-char assignment-continuation-start)
+                    (cons :after-backslash-assignment-continuation (point))))))
+             ;; First line after backslash continuation start.
+             ((save-excursion
+                (goto-char start)
+                (when (or (= (line-number-at-pos) 1)
+                          (not (python-info-beginning-of-backslash
+                                (1- (line-number-at-pos)))))
+                  (cons :after-backslash-first-line start))))
+             ;; General case.
+             (t (cons :after-backslash start))))))
+       ;; After beginning of block.
+       ((let ((start (save-excursion
+                       (back-to-indentation)
+                       (python-util-forward-comment -1)
+                       (when (equal (char-before) ?:)
+                         (python-nav-beginning-of-block)))))
+          (when start
+            (cons :after-block-start start))))
+       ;; At dedenter statement.
+       ((let ((start (python-info-dedenter-statement-p)))
+          (when start
+            (cons :at-dedenter-block-start start))))
+       ;; After normal line.
+       ((let ((start (save-excursion
                        (back-to-indentation)
-                       (skip-chars-backward (rx (or whitespace ?\n)))
+                       (skip-chars-backward " \t\n")
                        (python-nav-beginning-of-statement)
-                       (point-marker)))
-         'after-line)
-        ;; Do not indent
-        (t 'no-indent))
-       start))))
-
-(defun python-indent-calculate-indentation ()
-  "Calculate correct indentation offset for the current line.
-Returns `noindent' if the indentation does not depend on Python syntax,
-such as in strings."
-  (let* ((indentation-context (python-indent-context))
-         (context-status (car indentation-context))
-         (context-start (cdr indentation-context)))
-    (save-restriction
-      (widen)
-      (save-excursion
-        (pcase context-status
-          (`no-indent 0)
-          (`after-comment
-           (goto-char context-start)
-           (current-indentation))
-          ;; When point is after beginning of block just add one level
-          ;; of indentation relative to the context-start
-          (`after-beginning-of-block
-           (goto-char context-start)
-           (+ (current-indentation) python-indent-offset))
-          ;; When after a simple line just use previous line
-          ;; indentation.
-          (`after-line
-           (let* ((pair (save-excursion
-                          (goto-char context-start)
-                          (cons
-                           (current-indentation)
-                           (python-info-beginning-of-block-p))))
-                  (context-indentation (car pair))
-                  ;; TODO: Separate block enders into its own case.
-                  (adjustment
-                   (if (save-excursion
-                         (python-util-forward-comment -1)
-                         (python-nav-beginning-of-statement)
-                         (looking-at (python-rx block-ender)))
-                       python-indent-offset
-                     0)))
-             (- context-indentation adjustment)))
-          ;; When point is on a dedenter statement, search for the
-          ;; opening block that corresponds to it and use its
-          ;; indentation.  If no opening block is found just remove
-          ;; indentation as this is an invalid python file.
-          (`dedenter-statement
-           (let ((block-start-point
-                  (python-info-dedenter-opening-block-position)))
-             (save-excursion
-               (if (not block-start-point)
-                   0
-                 (goto-char block-start-point)
-                 (current-indentation)))))
-          ;; When inside of a string, do nothing. just use the current
-          ;; indentation.  XXX: perhaps it would be a good idea to
-          ;; invoke standard text indentation here
-          (`inside-string 'noindent)
-          ;; After backslash we have several possibilities.
-          (`after-backslash
-           (cond
-            ;; Check if current line is a dot continuation.  For this
-            ;; the current line must start with a dot and previous
-            ;; line must contain a dot too.
-            ((save-excursion
-               (back-to-indentation)
-               (when (looking-at "\\.")
-                 ;; If after moving one line back point is inside a paren it
-                 ;; needs to move back until it's not anymore
-                 (while (prog2
-                            (forward-line -1)
-                            (and (not (bobp))
-                                 (python-syntax-context 'paren))))
-                 (goto-char (line-end-position))
-                 (while (and (re-search-backward
-                              "\\." (line-beginning-position) t)
-                             (python-syntax-context-type)))
-                 (if (and (looking-at "\\.")
-                          (not (python-syntax-context-type)))
-                     ;; The indentation is the same column of the
-                     ;; first matching dot that's not inside a
-                     ;; comment, a string or a paren
-                     (current-column)
-                   ;; No dot found on previous line, just add another
-                   ;; indentation level.
-                   (+ (current-indentation) python-indent-offset)))))
-            ;; Check if prev line is a block continuation
-            ((let ((block-continuation-start
-                    (python-info-block-continuation-line-p)))
-               (when block-continuation-start
-                 ;; If block-continuation-start is set jump to that
-                 ;; marker and use first column after the block start
-                 ;; as indentation value.
-                 (goto-char block-continuation-start)
-                 (re-search-forward
-                  (python-rx block-start (* space))
-                  (line-end-position) t)
-                 (current-column))))
-            ;; Check if current line is an assignment continuation
-            ((let ((assignment-continuation-start
-                    (python-info-assignment-continuation-line-p)))
-               (when assignment-continuation-start
-                 ;; If assignment-continuation is set jump to that
-                 ;; marker and use first column after the assignment
-                 ;; operator as indentation value.
-                 (goto-char assignment-continuation-start)
-                 (current-column))))
-            (t
-             (forward-line -1)
-             (goto-char (python-info-beginning-of-backslash))
-             (if (save-excursion
-                   (and
-                    (forward-line -1)
-                    (goto-char
-                     (or (python-info-beginning-of-backslash) (point)))
-                    (python-info-line-ends-backslash-p)))
-                 ;; The two previous lines ended in a backslash so we must
-                 ;; respect previous line indentation.
-                 (current-indentation)
-               ;; What happens here is that we are dealing with the second
-               ;; line of a backslash continuation, in that case we just going
-               ;; to add one indentation level.
-               (+ (current-indentation) python-indent-offset)))))
-          ;; When inside a paren there's a need to handle nesting
-          ;; correctly
-          (`inside-paren
-           (cond
-            ;; If current line closes the outermost open paren use the
-            ;; current indentation of the context-start line.
-            ((save-excursion
-               (skip-syntax-forward "\s" (line-end-position))
-               (when (and (looking-at (regexp-opt '(")" "]" "}")))
-                          (progn
-                            (forward-char 1)
-                            (not (python-syntax-context 'paren))))
-                 (goto-char context-start)
-                 (current-indentation))))
-            ;; If open paren is contained on a line by itself add another
-            ;; indentation level, else look for the first word after the
-            ;; opening paren and use it's column position as indentation
-            ;; level.
-            ((let* ((content-starts-in-newline)
-                    (indent
-                     (save-excursion
-                       (if (setq content-starts-in-newline
-                                 (progn
-                                   (goto-char context-start)
-                                   (forward-char)
-                                   (save-restriction
-                                     (narrow-to-region
-                                      (line-beginning-position)
-                                      (line-end-position))
-                                     (python-util-forward-comment))
-                                   (looking-at "$")))
-                           (+ (current-indentation) python-indent-offset)
-                         (current-column)))))
-               ;; Adjustments
-               (cond
-                ;; If current line closes a nested open paren de-indent one
-                ;; level.
-                ((progn
-                   (back-to-indentation)
-                   (looking-at (regexp-opt '(")" "]" "}"))))
-                 (- indent python-indent-offset))
-                ;; If the line of the opening paren that wraps the current
-                ;; line starts a block add another level of indentation to
-                ;; follow new pep8 recommendation. See: http://ur1.ca/5rojx
-                ((save-excursion
-                   (when (and content-starts-in-newline
-                              (progn
-                                (goto-char context-start)
-                                (back-to-indentation)
-                                (looking-at (python-rx block-start))))
-                     (+ indent python-indent-offset))))
-                (t indent)))))))))))
-
-(defun python-indent-calculate-levels ()
-  "Calculate `python-indent-levels' and reset `python-indent-current-level'."
-  (if (or (python-info-continuation-line-p)
-          (not (python-info-dedenter-statement-p)))
-      ;; XXX: This asks for a refactor.  Even if point is on a
-      ;; dedenter statement, it could be multiline and in that case
-      ;; the continuation lines should be indented with normal rules.
-      (let* ((indentation (python-indent-calculate-indentation)))
-        (if (not (numberp indentation))
-            (setq python-indent-levels indentation)
-          (let* ((remainder (% indentation python-indent-offset))
-                 (steps (/ (- indentation remainder) python-indent-offset)))
-            (setq python-indent-levels (list 0))
-            (dotimes (step steps)
-              (push (* python-indent-offset (1+ step)) python-indent-levels))
-            (when (not (eq 0 remainder))
-              (push (+ (* python-indent-offset steps) remainder)
-                    python-indent-levels)))))
-    (setq python-indent-levels
-          (or
-           (mapcar (lambda (pos)
-                     (save-excursion
-                       (goto-char pos)
-                       (current-indentation)))
-                   (python-info-dedenter-opening-block-positions))
-           (list 0))))
-  (when (listp python-indent-levels)
-    (setq python-indent-current-level (1- (length python-indent-levels))
-          python-indent-levels (nreverse python-indent-levels))))
-
-(defun python-indent-toggle-levels ()
-  "Toggle `python-indent-current-level' over `python-indent-levels'."
-  (setq python-indent-current-level (1- python-indent-current-level))
-  (when (< python-indent-current-level 0)
-    (setq python-indent-current-level (1- (length python-indent-levels)))))
-
-(defun python-indent-line (&optional force-toggle)
+                       (point))))
+          (when start
+            (if (save-excursion
+                  (python-util-forward-comment -1)
+                  (python-nav-beginning-of-statement)
+                  (looking-at (python-rx block-ender)))
+                (cons :after-block-end start)
+              (cons :after-line start)))))
+       ;; Default case: do not indent.
+       (t (cons :no-indent 0))))))
+
+(defun python-indent--calculate-indentation ()
+  "Internal implementation of `python-indent-calculate-indentation'.
+May return an integer for the maximum possible indentation at
+current context or a list of integers.  The latter case is only
+happening for :at-dedenter-block-start context since the
+possibilities can be narrowed to especific indentation points."
+  (save-restriction
+    (widen)
+    (save-excursion
+      (pcase (python-indent-context)
+        (`(:no-indent . ,_) 0)
+        (`(,(or :after-line
+                :after-comment
+                :inside-string
+                :after-backslash
+                :inside-paren-at-closing-paren
+                :inside-paren-at-closing-nested-paren) . ,start)
+         ;; Copy previous indentation.
+         (goto-char start)
+         (current-indentation))
+        (`(,(or :after-block-start
+                :after-backslash-first-line
+                :inside-paren-newline-start) . ,start)
+         ;; Add one indentation level.
+         (goto-char start)
+         (+ (current-indentation) python-indent-offset))
+        (`(,(or :inside-paren
+                :after-backslash-block-continuation
+                :after-backslash-assignment-continuation
+                :after-backslash-dotted-continuation) . ,start)
+         ;; Use the column given by the context.
+         (goto-char start)
+         (current-column))
+        (`(:after-block-end . ,start)
+         ;; Subtract one indentation level.
+         (goto-char start)
+         (- (current-indentation) python-indent-offset))
+        (`(:at-dedenter-block-start . ,_)
+         ;; List all possible indentation levels from opening blocks.
+         (let ((opening-block-start-points
+                (python-info-dedenter-opening-block-positions)))
+           (if (not opening-block-start-points)
+               0  ; if not found default to first column
+             (mapcar (lambda (pos)
+                       (save-excursion
+                         (goto-char pos)
+                         (current-indentation)))
+                     opening-block-start-points))))
+        (`(,(or :inside-paren-newline-start-from-block) . ,start)
+         ;; Add two indentation levels to make the suite stand out.
+         (goto-char start)
+         (+ (current-indentation) (* python-indent-offset 2)))))))
+
+(defun python-indent--calculate-levels (indentation)
+  "Calculate levels list given INDENTATION.
+Argument INDENTATION can either be an integer or a list of
+integers.  Levels are returned in ascending order, and in the
+case INDENTATION is a list, this order is enforced."
+  (if (listp indentation)
+      (sort (copy-sequence indentation) #'<)
+    (let* ((remainder (% indentation python-indent-offset))
+           (steps (/ (- indentation remainder) python-indent-offset))
+           (levels (mapcar (lambda (step)
+                             (* python-indent-offset step))
+                           (number-sequence steps 0 -1))))
+      (reverse
+       (if (not (zerop remainder))
+           (cons indentation levels)
+         levels)))))
+
+(defun python-indent--previous-level (levels indentation)
+  "Return previous level from LEVELS relative to INDENTATION."
+  (let* ((levels (sort (copy-sequence levels) #'>))
+         (default (car levels)))
+    (catch 'return
+      (dolist (level levels)
+        (when (funcall #'< level indentation)
+          (throw 'return level)))
+      default)))
+
+(defun python-indent-calculate-indentation (&optional previous)
+  "Calculate indentation.
+Get indentation of PREVIOUS level when argument is non-nil.
+Return the max level of the cycle when indentation reaches the
+minimum."
+  (let* ((indentation (python-indent--calculate-indentation))
+         (levels (python-indent--calculate-levels indentation)))
+    (if previous
+        (python-indent--previous-level levels (current-indentation))
+      (apply #'max levels))))
+
+(defun python-indent-line (&optional previous)
   "Internal implementation of `python-indent-line-function'.
-Uses the offset calculated in
-`python-indent-calculate-indentation' and available levels
-indicated by the variable `python-indent-levels' to set the
-current indentation.
+Use the PREVIOUS level when argument is non-nil, otherwise indent
+to the maxium available level.  When indentation is the minimum
+possible and PREVIOUS is non-nil, cycle back to the maximum
+level."
+  (let ((follow-indentation-p
+         ;; Check if point is within indentation.
+         (and (<= (line-beginning-position) (point))
+              (>= (+ (line-beginning-position)
+                     (current-indentation))
+                  (point)))))
+    (save-excursion
+      (indent-line-to
+       (python-indent-calculate-indentation previous))
+      (python-info-dedenter-opening-block-message))
+    (when follow-indentation-p
+      (back-to-indentation))))
 
-When the variable `last-command' is equal to one of the symbols
-inside `python-indent-trigger-commands' or FORCE-TOGGLE is
-non-nil it cycles levels indicated in the variable
-`python-indent-levels' by setting the current level in the
-variable `python-indent-current-level'.
-
-When the variable `last-command' is not equal to one of the
-symbols inside `python-indent-trigger-commands' and FORCE-TOGGLE
-is nil it calculates possible indentation levels and saves them
-in the variable `python-indent-levels'.  Afterwards it sets the
-variable `python-indent-current-level' correctly so offset is
-equal to
-   (nth python-indent-current-level python-indent-levels)"
-  (if (and (or (and (memq this-command python-indent-trigger-commands)
-                    (eq last-command this-command))
-               force-toggle)
-           (not (equal python-indent-levels '(0))))
-      (if (listp python-indent-levels)
-          (python-indent-toggle-levels))
-    (python-indent-calculate-levels))
-  (if (eq python-indent-levels 'noindent)
-      python-indent-levels
-    (let* ((starting-pos (point-marker))
-           (indent-ending-position
-            (+ (line-beginning-position) (current-indentation)))
-           (follow-indentation-p
-            (or (bolp)
-                (and (<= (line-beginning-position) starting-pos)
-                     (>= indent-ending-position starting-pos))))
-           (next-indent (nth python-indent-current-level python-indent-levels)))
-      (unless (= next-indent (current-indentation))
-        (beginning-of-line)
-        (delete-horizontal-space)
-        (indent-to next-indent)
-        (goto-char starting-pos))
-      (and follow-indentation-p (back-to-indentation)))
-    (python-info-dedenter-opening-block-message)))
+(defun python-indent-calculate-levels ()
+  "Return possible indentation levels."
+  (python-indent--calculate-levels
+   (python-indent--calculate-indentation)))
 
 (defun python-indent-line-function ()
   "`indent-line-function' for Python mode.
-See `python-indent-line' for details."
-  (python-indent-line))
+When the variable `last-command' is equal to one of the symbols
+inside `python-indent-trigger-commands' it cycles possible
+indentation levels from right to left."
+  (python-indent-line
+   (and (memq this-command python-indent-trigger-commands)
+        (eq last-command this-command))))
 
 (defun python-indent-dedent-line ()
   "De-indent current line."
   (interactive "*")
-  (when (and (not (python-syntax-comment-or-string-p))
-             (<= (point) (save-excursion
-                                  (back-to-indentation)
-                           (point)))
-             (> (current-column) 0))
-    (python-indent-line t)
-    t))
+  (when (and (not (bolp))
+           (not (python-syntax-comment-or-string-p))
+           (= (+ (line-beginning-position)
+                 (current-indentation))
+              (point)))
+      (python-indent-line t)
+      t))
 
 (defun python-indent-dedent-line-backspace (arg)
   "De-indent current line.
 Argument ARG is passed to `backward-delete-char-untabify' when
 point is not in between the indentation."
   (interactive "*p")
-  (when (not (python-indent-dedent-line))
+  (unless (python-indent-dedent-line)
     (backward-delete-char-untabify arg)))
+
 (put 'python-indent-dedent-line-backspace 'delete-selection 'supersede)
 
 (defun python-indent-region (start end)
index e8b6bf5adf77ff84e478c7a4edad5352e1a37bea..135f945dbb9f19bda60e2b3005cb0ce2f0d37154 100644 (file)
@@ -1,7 +1,6 @@
 ;;; sh-script.el --- shell-script editing commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1993-1997, 1999, 2001-2015 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1993-1997, 1999, 2001-2015 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
 ;; Version: 2.0f
@@ -1599,7 +1598,6 @@ buffer indents as it currently is indented.
 
 
 \\[backward-delete-char-untabify]       Delete backward one position, even if it was a tab.
-\\[newline-and-indent]  Delete unquoted space and indent new line same as this one.
 \\[sh-end-of-command]   Go to end of successive commands.
 \\[sh-beginning-of-command]     Go to beginning of successive commands.
 \\[sh-set-shell]        Set this buffer's shell, and maybe its magic number.
@@ -2501,7 +2499,8 @@ Lines containing only comments are considered empty."
                    (current-column)))
        current)
     (save-excursion
-      (indent-to (if (eq this-command 'newline-and-indent)
+      (indent-to (if (or (eq this-command 'newline-and-indent)
+                         (and electric-indent-mode (eq this-command 'newline)))
                     previous
                   (if (< (current-column)
                          (setq current (progn (back-to-indentation)
index 05345853edc73d2625a40970238c5b9740650fa4..68cd230c5e24324d0c2169afe717e78779309552 100644 (file)
@@ -1082,7 +1082,12 @@ The return value is a positive integer."
 ;;;; Extracting fields of the positions in an event.
 
 (defun posnp (obj)
-  "Return non-nil if OBJ appears to be a valid `posn' object."
+  "Return non-nil if OBJ appears to be a valid `posn' object specifying a window.
+If OBJ is a valid `posn' object, but specifies a frame rather
+than a window, return nil."
+  ;; FIXME: Correct the behavior of this function so that all valid
+  ;; `posn' objects are recognized, after updating other code that
+  ;; depends on its present behavior.
   (and (windowp (car-safe obj))
        (atom (car-safe (setq obj (cdr obj))))                ;AREA-OR-POS.
        (integerp (car-safe (car-safe (setq obj (cdr obj))))) ;XOFFSET.
@@ -1142,24 +1147,28 @@ For a scroll-bar event, the result column is 0, and the row
 corresponds to the vertical position of the click in the scroll bar.
 POSITION should be a list of the form returned by the `event-start'
 and `event-end' functions."
-  (let* ((pair   (posn-x-y position))
-        (window (posn-window position))
-        (area   (posn-area position)))
+  (let* ((pair            (posn-x-y position))
+         (frame-or-window (posn-window position))
+         (frame           (if (framep frame-or-window)
+                              frame-or-window
+                            (window-frame frame-or-window)))
+         (window          (when (windowp frame-or-window) frame-or-window))
+         (area            (posn-area position)))
     (cond
-     ((null window)
+     ((null frame-or-window)
       '(0 . 0))
      ((eq area 'vertical-scroll-bar)
       (cons 0 (scroll-bar-scale pair (1- (window-height window)))))
      ((eq area 'horizontal-scroll-bar)
       (cons (scroll-bar-scale pair (window-width window)) 0))
      (t
-      (let* ((frame (if (framep window) window (window-frame window)))
-            ;; FIXME: This should take line-spacing properties on
-            ;; newlines into account.
-            (spacing (when (display-graphic-p frame)
-                       (or (with-current-buffer (window-buffer window)
-                             line-spacing)
-                           (frame-parameter frame 'line-spacing)))))
+      ;; FIXME: This should take line-spacing properties on
+      ;; newlines into account.
+      (let* ((spacing (when (display-graphic-p frame)
+                        (or (with-current-buffer
+                                (window-buffer (frame-selected-window frame))
+                              line-spacing)
+                            (frame-parameter frame 'line-spacing)))))
        (cond ((floatp spacing)
               (setq spacing (truncate (* spacing
                                          (frame-char-height frame)))))
index 8a2383c12ffbcd6e83dc822594d8214209c1b6a9..85d9410868a31272d7cf135b430dce8ddfbffc96 100644 (file)
@@ -4963,52 +4963,55 @@ The event, EV, is the mouse event."
     (artist-funcall init-fn x1 y1)
     (if (not artist-rubber-banding)
        (artist-no-rb-set-point1 x1 y1))
-    (track-mouse
-      (while (or (mouse-movement-p ev)
-                (member 'down (event-modifiers ev)))
-       (setq ev-start-pos (artist-coord-win-to-buf
-                           (posn-col-row (event-start ev))))
-       (setq x1 (car ev-start-pos))
-       (setq y1 (cdr ev-start-pos))
-
-       ;; Cancel previous timer
-       (if timer
-           (cancel-timer timer))
-
-       (if (not (eq initial-win (posn-window (event-start ev))))
-           ;; If we moved outside the window, do nothing
-           nil
-
-         ;; Still in same window:
-         ;;
-         ;; Check if user presses or releases shift key
-         (if (artist-shift-has-changed shift-state ev)
-
-             ;; First check that the draw-how is the same as we
-             ;; already have. Otherwise, ignore the changed shift-state.
-             (if (not (eq draw-how
-                          (artist-go-get-draw-how-from-symbol
-                           (if (not shift-state) shifted unshifted))))
-                 (message "Cannot switch to shifted operation")
-
-               ;; progn is "implicit" since this is the else-part
-               (setq shift-state (not shift-state))
-               (setq op          (if shift-state shifted unshifted))
-               (setq draw-how    (artist-go-get-draw-how-from-symbol op))
-               (setq draw-fn     (artist-go-get-draw-fn-from-symbol op))))
-
-         ;; Draw the new shape
-         (setq shape (artist-funcall draw-fn x1 y1))
-         (artist-move-to-xy x1 y1)
-
-         ;; Start the timer to call `draw-fn' repeatedly every
-         ;; `interval' second
-         (if (and interval draw-fn)
-             (setq timer (run-at-time interval interval draw-fn x1 y1))))
-
-       ;; Read next event
-       (setq ev (read-event))))
-
+    (unwind-protect
+        (track-mouse
+          (while (or (mouse-movement-p ev)
+                     (member 'down (event-modifiers ev)))
+            (setq ev-start-pos (artist-coord-win-to-buf
+                                (posn-col-row (event-start ev))))
+            (setq x1 (car ev-start-pos))
+            (setq y1 (cdr ev-start-pos))
+
+            ;; Cancel previous timer
+            (if timer
+                (cancel-timer timer))
+
+            (if (not (eq initial-win (posn-window (event-start ev))))
+                ;; If we moved outside the window, do nothing
+                nil
+
+              ;; Still in same window:
+              ;;
+              ;; Check if user presses or releases shift key
+              (if (artist-shift-has-changed shift-state ev)
+
+                  ;; First check that the draw-how is the same as we
+                  ;; already have. Otherwise, ignore the changed shift-state.
+                  (if (not (eq draw-how
+                               (artist-go-get-draw-how-from-symbol
+                                (if (not shift-state) shifted unshifted))))
+                      (message "Cannot switch to shifted operation")
+
+                    ;; progn is "implicit" since this is the else-part
+                    (setq shift-state (not shift-state))
+                    (setq op          (if shift-state shifted unshifted))
+                    (setq draw-how    (artist-go-get-draw-how-from-symbol op))
+                    (setq draw-fn     (artist-go-get-draw-fn-from-symbol op))))
+
+              ;; Draw the new shape
+              (setq shape (artist-funcall draw-fn x1 y1))
+              (artist-move-to-xy x1 y1)
+
+              ;; Start the timer to call `draw-fn' repeatedly every
+              ;; `interval' second
+              (if (and interval draw-fn)
+                  (setq timer (run-at-time interval interval draw-fn x1 y1))))
+
+            ;; Read next event
+            (setq ev (read-event))))
+      ;; Cleanup: get rid of any active timer.
+      (if timer
+          (cancel-timer timer)))
     ;; Cancel any timers
     (if timer
        (cancel-timer timer))
diff --git a/lisp/w32-common-fns.el b/lisp/w32-common-fns.el
new file mode 100644 (file)
index 0000000..1e4e9fe
--- /dev/null
@@ -0,0 +1,134 @@
+;;; w32-common-fns.el --- Lisp routines for Windows and Cygwin-w32
+
+;; Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;;
+;;; This file contains functions that are used by both native NT Emacs
+;;; and Cygwin Emacs compiled to use the native Windows widget
+;;; library.
+
+(declare-function x-server-version "w32fns.c" (&optional terminal))
+
+(defun w32-version ()
+  "Return the MS-Windows version numbers.
+The value is a list of three integers: the major and minor version
+numbers, and the build number."
+  (x-server-version))
+
+(defun w32-using-nt ()
+  "Return non-nil if running on a Windows NT descendant.
+That includes all Windows systems except for 9X/Me."
+  (getenv "SystemRoot"))
+
+(declare-function w32-get-clipboard-data "w32select.c")
+(declare-function w32-set-clipboard-data "w32select.c")
+(declare-function x-server-version "w32fns.c" (&optional display))
+
+;;; Fix interface to (X-specific) mouse.el
+(defun x-set-selection (type data)
+  "Make an X selection of type TYPE and value DATA.
+The argument TYPE (nil means `PRIMARY') says which selection, and
+DATA specifies the contents.  TYPE must be a symbol.  \(It can also
+be a string, which stands for the symbol with that name, but this
+is considered obsolete.)  DATA may be a string, a symbol, an
+integer (or a cons of two integers or list of two integers).
+
+The selection may also be a cons of two markers pointing to the same buffer,
+or an overlay.  In these cases, the selection is considered to be the text
+between the markers *at whatever time the selection is examined*.
+Thus, editing done in the buffer after you specify the selection
+can alter the effective value of the selection.
+
+The data may also be a vector of valid non-vector selection values.
+
+The return value is DATA.
+
+Interactively, this command sets the primary selection.  Without
+prefix argument, it reads the selection in the minibuffer.  With
+prefix argument, it uses the text of the region as the selection value.
+
+Note that on MS-Windows, primary and secondary selections set by Emacs
+are not available to other programs."
+  (put 'x-selections (or type 'PRIMARY) data))
+
+(defun x-get-selection (&optional type _data-type)
+  "Return the value of an X Windows selection.
+The argument TYPE (default `PRIMARY') says which selection,
+and the argument DATA-TYPE (default `STRING') says
+how to convert the data.
+
+TYPE may be any symbol \(but nil stands for `PRIMARY').  However,
+only a few symbols are commonly used.  They conventionally have
+all upper-case names.  The most often used ones, in addition to
+`PRIMARY', are `SECONDARY' and `CLIPBOARD'.
+
+DATA-TYPE is usually `STRING', but can also be one of the symbols
+in `selection-converter-alist', which see.  This argument is
+ignored on MS-Windows and MS-DOS."
+  (get 'x-selections (or type 'PRIMARY)))
+
+;; x-selection-owner-p is used in simple.el
+(defun x-selection-owner-p (&optional selection _terminal)
+  "" ; placeholder for doc.c
+  (and (memq selection '(nil PRIMARY SECONDARY))
+       (get 'x-selections (or selection 'PRIMARY))))
+
+;; The "Windows" keys on newer keyboards bring up the Start menu
+;; whether you want it or not - make Emacs ignore these keystrokes
+;; rather than beep.
+(global-set-key [lwindow] 'ignore)
+(global-set-key [rwindow] 'ignore)
+
+(defvar w32-charset-info-alist)                ; w32font.c
+
+\f
+;;;; Selections
+
+;; We keep track of the last text selected here, so we can check the
+;; current selection against it, and avoid passing back our own text
+;; from x-selection-value.
+(defvar x-last-selected-text nil)
+(defvar x-select-enable-clipboard)
+
+(defun x-get-selection-value ()
+  "Return the value of the current selection.
+Consult the selection.  Treat empty strings as if they were unset."
+  (if x-select-enable-clipboard
+      (let (text)
+       ;; Don't die if x-get-selection signals an error.
+       (with-demoted-errors "w32-get-clipboard-data:%s"
+         (setq text (w32-get-clipboard-data)))
+       (if (string= text "") (setq text nil))
+       (cond
+        ((not text) nil)
+        ((eq text x-last-selected-text) nil)
+        ((string= text x-last-selected-text)
+         ;; Record the newer string, so subsequent calls can use the 'eq' test.
+         (setq x-last-selected-text text)
+         nil)
+        (t
+         (setq x-last-selected-text text))))))
+\f
+(defalias 'x-selection-value 'x-get-selection-value)
+
+;; Arrange for the kill and yank functions to set and check the clipboard.
+(setq interprogram-cut-function 'x-select-text)
+(setq interprogram-paste-function 'x-get-selection-value)
+
+(provide 'w32-common-fns)
index 8408bed2882a3eff189abc3c823f72b1076088cd..e89f19bf69741afe7d24cfa2475a627d6ed820a5 100644 (file)
@@ -1,6 +1,6 @@
 # alloca.m4 serial 14
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software Foundation,
-dnl Inc.
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software
+dnl Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 0354c6ad478fc65dcc3222a72ef739374cfc4a5c..bae6d01cd53cf9c97af6a2f34fbc9c8ef38d248d 100644 (file)
@@ -1,5 +1,6 @@
 #serial 20
-dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index e2a195c04ef640c83cef842aaeb126893ef84913..343719a5d56512472dba07be1ff93749d2c92f8f 100644 (file)
@@ -1,5 +1,6 @@
 # filemode.m4 serial 8
-dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 16e72c7bf3cdb6fb16d6c5b3de57451a54605617..8989a5ce430dabbf692e2fa1ac2ad09596f972f0 100644 (file)
@@ -3,7 +3,8 @@
 dnl From Jim Meyering.
 dnl A wrapper around AC_FUNC_GETGROUPS.
 
-# Copyright (C) 1996-1997, 1999-2004, 2008-2015 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2004, 2008-2015 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 1234ba9fe2bcb02681b23d37dc3702698040057e..4844ae37a150f1f03b702659b7a78e7152e78825 100644 (file)
@@ -1,7 +1,7 @@
 # Check for getloadavg.
 
-# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2015 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2015 Free
+# Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index cd499ff5d79c956445886e58d018d0f731c6fa83..175e482050a72ab11e726c56b2d67a280220cff9 100644 (file)
@@ -1,5 +1,6 @@
 # gettime.m4 serial 8
-dnl Copyright (C) 2002, 2004-2006, 2009-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004-2006, 2009-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index ce246e18bc2b7d452c19d56818f4527abd7f07f1..95317d3c1e846b276f8195832590a0e24697fe57 100644 (file)
@@ -1,6 +1,7 @@
 # serial 21
 
-# Copyright (C) 2001-2003, 2005, 2007, 2009-2015 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2015 Free Software
+# Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
index 526a67a895b496a9aa0ffdd5bb5b40218c781d8d..b18e95bead239bbc0e64ecb9690ea81e8d88eb2c 100644 (file)
@@ -1,6 +1,7 @@
 # serial 14
 
-# Copyright (C) 1999-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
+# Copyright (C) 1999-2001, 2003-2007, 2009-2015 Free Software
+# Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index f3f74b82cc077b255c911a200bf586370e730ae5..bac0a7a95a02e9a1ccf5cacad1ec7c0dac8526cf 100644 (file)
@@ -1,6 +1,6 @@
 # memrchr.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
-dnl Inc.
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software
+dnl Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 3f0e1eee44082fab2bf9eeeb2066a18012d55159..aa1b98564e05502166c91f92ef4b2017a5f0fcb1 100644 (file)
@@ -1,6 +1,6 @@
 # serial 25
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
-dnl Inc.
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software
+dnl Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 0e3db7a237bd5d55aae50f4030dd958d130a5e0a..ee4ed0b179919dee24fb295b49e249ba76022248 100644 (file)
@@ -1,6 +1,6 @@
 # pathmax.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation,
-dnl Inc.
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software
+dnl Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 71cfa4b2bfaaaf7411c348072312bc1ed8137918..f9b2e118907a0c417e281c1159580a318351b29d 100644 (file)
@@ -1,5 +1,6 @@
 # serial 7
-dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 25bd45143438219b005f5643c6ba793d58660708..06d3b60eeac98e9ba9da67b54331b85b65a79760 100644 (file)
@@ -1,5 +1,6 @@
 # ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 6543bf625b556eaeb1ea2f4dd46ac253149edf61..df69a8413c6bde0e655a0c2aa717be8e41bb9a43 100644 (file)
@@ -1,6 +1,7 @@
 # serial 6
 
-# Copyright (C) 1998-1999, 2001, 2009-2015 Free Software Foundation, Inc.
+# Copyright (C) 1998-1999, 2001, 2009-2015 Free Software Foundation,
+# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
index 9c8ceec189396c37c2ff42e156586e7d4df4dfb5..c7cacaa494f238e20988c46968d432c75fa65e52 100644 (file)
@@ -1,7 +1,7 @@
 # Checks for stat-related time functions.
 
-# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free Software
-# Foundation, Inc.
+# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free
+# Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/stdarg.m4 b/m4/stdarg.m4
new file mode 100644 (file)
index 0000000..d208eb3
--- /dev/null
@@ -0,0 +1,78 @@
+# stdarg.m4 serial 6
+dnl Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Provide a working va_copy in combination with <stdarg.h>.
+
+AC_DEFUN([gl_STDARG_H],
+[
+  STDARG_H=''
+  NEXT_STDARG_H='<stdarg.h>'
+  AC_MSG_CHECKING([for va_copy])
+  AC_CACHE_VAL([gl_cv_func_va_copy], [
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[#include <stdarg.h>]],
+         [[
+#ifndef va_copy
+void (*func) (va_list, va_list) = va_copy;
+#endif
+         ]])],
+      [gl_cv_func_va_copy=yes],
+      [gl_cv_func_va_copy=no])])
+  AC_MSG_RESULT([$gl_cv_func_va_copy])
+  if test $gl_cv_func_va_copy = no; then
+    dnl Provide a substitute.
+    dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5
+    dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h>
+    dnl which does '#undef va_copy', leading to a missing va_copy symbol. For
+    dnl this platform, we use an <stdarg.h> substitute. But we cannot use this
+    dnl approach on other platforms, because <stdarg.h> often defines only
+    dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do
+    dnl not work in this situation.
+    AC_EGREP_CPP([vaccine],
+      [#if defined _AIX && !defined __GNUC__
+        AIX vaccine
+       #endif
+      ], [gl_aixcc=yes], [gl_aixcc=no])
+    if test $gl_aixcc = yes; then
+      dnl Provide a substitute <stdarg.h> file.
+      STDARG_H=stdarg.h
+      gl_NEXT_HEADERS([stdarg.h])
+      dnl Fallback for the case when <stdarg.h> contains only macro definitions.
+      if test "$gl_cv_next_stdarg_h" = '""'; then
+        gl_cv_next_stdarg_h='"///usr/include/stdarg.h"'
+        NEXT_STDARG_H="$gl_cv_next_stdarg_h"
+      fi
+    else
+      dnl Provide a substitute in <config.h>, either __va_copy or as a simple
+      dnl assignment.
+      gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[#include <stdarg.h>]],
+             [[
+#ifndef __va_copy
+error, bail out
+#endif
+             ]])],
+          [gl_cv_func___va_copy=yes],
+          [gl_cv_func___va_copy=no])])
+      if test $gl_cv_func___va_copy = yes; then
+        AC_DEFINE([va_copy], [__va_copy],
+          [Define as a macro for copying va_list variables.])
+      else
+        AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed.  */
+#define gl_va_copy(a,b) ((a) = (b))])
+        AC_DEFINE([va_copy], [gl_va_copy],
+          [Define as a macro for copying va_list variables.])
+      fi
+    fi
+  fi
+  AC_SUBST([STDARG_H])
+  AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"])
+  AC_SUBST([NEXT_STDARG_H])
+])
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4
new file mode 100644 (file)
index 0000000..7273b82
--- /dev/null
@@ -0,0 +1,100 @@
+# Check for stdbool.h that conforms to C99.
+
+dnl Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# Prepare for substituting <stdbool.h> if it is not supported.
+
+AC_DEFUN([AM_STDBOOL_H],
+[
+  AC_REQUIRE([AC_CHECK_HEADER_STDBOOL])
+
+  # Define two additional variables used in the Makefile substitution.
+
+  if test "$ac_cv_header_stdbool_h" = yes; then
+    STDBOOL_H=''
+  else
+    STDBOOL_H='stdbool.h'
+  fi
+  AC_SUBST([STDBOOL_H])
+  AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"])
+
+  if test "$ac_cv_type__Bool" = yes; then
+    HAVE__BOOL=1
+  else
+    HAVE__BOOL=0
+  fi
+  AC_SUBST([HAVE__BOOL])
+])
+
+# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
+AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
+
+# This version of the macro is needed in autoconf <= 2.68.
+
+AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
+  [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
+     [ac_cv_header_stdbool_h],
+     [AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
+             #include <stdbool.h>
+             #ifndef bool
+              "error: bool is not defined"
+             #endif
+             #ifndef false
+              "error: false is not defined"
+             #endif
+             #if false
+              "error: false is not 0"
+             #endif
+             #ifndef true
+              "error: true is not defined"
+             #endif
+             #if true != 1
+              "error: true is not 1"
+             #endif
+             #ifndef __bool_true_false_are_defined
+              "error: __bool_true_false_are_defined is not defined"
+             #endif
+
+             struct s { _Bool s: 1; _Bool t; } s;
+
+             char a[true == 1 ? 1 : -1];
+             char b[false == 0 ? 1 : -1];
+             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+             char d[(bool) 0.5 == true ? 1 : -1];
+             /* See body of main program for 'e'.  */
+             char f[(_Bool) 0.0 == false ? 1 : -1];
+             char g[true];
+             char h[sizeof (_Bool)];
+             char i[sizeof s.t];
+             enum { j = false, k = true, l = false * true, m = true * 256 };
+             /* The following fails for
+                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+             _Bool n[m];
+             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+             /* Catch a bug in an HP-UX C compiler.  See
+                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+              */
+             _Bool q = true;
+             _Bool *pq = &q;
+           ]],
+           [[
+             bool e = &s;
+             *pq |= q;
+             *pq |= ! q;
+             /* Refer to every declared value, to avoid compiler optimizations.  */
+             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                     + !m + !n + !o + !p + !q + !pq);
+           ]])],
+        [ac_cv_header_stdbool_h=yes],
+        [ac_cv_header_stdbool_h=no])])
+   AC_CHECK_TYPES([_Bool])
+])
index 4557626ae08ab8130ec420f7633eedff303160bc..dafcbaa733b90f7e68dde959b397e0d9d16d5224 100644 (file)
@@ -1,6 +1,7 @@
 # serial 33
 
-# Copyright (C) 1996-1997, 1999-2007, 2009-2015 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2007, 2009-2015 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index fde732aa90af2200c737203bb8e2f7047d90e4c2..7662cf8b3725a08553ce4a349bb3659076da0699 100644 (file)
@@ -1,5 +1,6 @@
 # strtoimax.m4 serial 14
-dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 666f44a6ba25f1ae99d6a2f58d264ca051cd3a89..43365e140d8d0bfe302732241258da19510e7df1 100644 (file)
@@ -1,5 +1,6 @@
 # strtoll.m4 serial 7
-dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 4267bd72569737c69e0840f31a00d1e6849bcc76..982286259bd88bae3c253acf2cde3832d2194970 100644 (file)
@@ -1,5 +1,6 @@
 # strtoull.m4 serial 7
-dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 5312ef4d5180604e49108fdcc194d7a8c5a87ca1..d9d7893f1fb48d76bfcbfa2d25e8bc2dfa2c8d38 100644 (file)
@@ -1,5 +1,6 @@
 # strtoumax.m4 serial 12
-dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 0f0b7d9a2acecd15f6e26d7ac7ed6322fe6b7e8e..03579a3ae373de4400e74179ff64fca580a45057 100644 (file)
@@ -1,6 +1,7 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software
+# Foundation, Inc.
 
 # serial 8
 
index 06b3533e42f653087b0795efc7e364f997b0765d..e5dc48d8ec49720b0fe22f1b1a67dbdc3710008b 100644 (file)
@@ -1,6 +1,7 @@
 #serial 15
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software
+# Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 7c33ae9492398cca1ea046f22563d72b35b3710a..fae96f1a2daa166b3588c1436e48894c407fc925 100644 (file)
@@ -1,7 +1,7 @@
 # serial 9
 
-# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/nt/addsection.c b/nt/addsection.c
new file mode 100644 (file)
index 0000000..61b2fda
--- /dev/null
@@ -0,0 +1,544 @@
+/* Add an uninitialized data section to an executable.
+   Copyright (C) 1999, 2001-2015 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+
+   Andrew Innes <andrewi@harlequin.co.uk>       04-Jan-1999
+     based on code from unexw32.c
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <time.h>
+#if defined(__GNUC__) && !defined(MINGW_W64)
+#define _ANONYMOUS_UNION
+#define _ANONYMOUS_STRUCT
+#endif
+#include <windows.h>
+
+/* Include relevant definitions from IMAGEHLP.H, which can be found
+   in \\win32sdk\mstools\samples\image\include\imagehlp.h. */
+
+PIMAGE_NT_HEADERS
+(__stdcall * pfnCheckSumMappedFile) (PVOID BaseAddress,
+                                    DWORD_PTR FileLength,
+                                    PDWORD_PTR HeaderSum,
+                                    PDWORD_PTR CheckSum);
+
+#undef min
+#undef max
+#define min(x, y) (((x) < (y)) ? (x) : (y))
+#define max(x, y) (((x) > (y)) ? (x) : (y))
+
+
+/* File handling.  */
+
+typedef struct file_data {
+  const char    *name;
+  unsigned long  size;
+  HANDLE         file;
+  HANDLE         file_mapping;
+  unsigned char *file_base;
+} file_data;
+
+int
+open_input_file (file_data *p_file, const char *filename)
+{
+  HANDLE file;
+  HANDLE file_mapping;
+  void  *file_base;
+  unsigned long size, upper_size;
+
+  file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL,
+                    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+  if (file == INVALID_HANDLE_VALUE)
+    return FALSE;
+
+  size = GetFileSize (file, &upper_size);
+  file_mapping = CreateFileMapping (file, NULL, PAGE_READONLY,
+                                   0, size, NULL);
+  if (!file_mapping)
+    return FALSE;
+
+  file_base = MapViewOfFile (file_mapping, FILE_MAP_READ, 0, 0, size);
+  if (file_base == 0)
+    return FALSE;
+
+  p_file->name = filename;
+  p_file->size = size;
+  p_file->file = file;
+  p_file->file_mapping = file_mapping;
+  p_file->file_base = file_base;
+
+  return TRUE;
+}
+
+int
+open_output_file (file_data *p_file, const char *filename, unsigned long size)
+{
+  HANDLE file;
+  HANDLE file_mapping;
+  void  *file_base;
+
+  file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+                    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+  if (file == INVALID_HANDLE_VALUE)
+    return FALSE;
+
+  file_mapping = CreateFileMapping (file, NULL, PAGE_READWRITE,
+                                   0, size, NULL);
+  if (!file_mapping)
+    return FALSE;
+
+  file_base = MapViewOfFile (file_mapping, FILE_MAP_WRITE, 0, 0, size);
+  if (file_base == 0)
+    return FALSE;
+
+  p_file->name = filename;
+  p_file->size = size;
+  p_file->file = file;
+  p_file->file_mapping = file_mapping;
+  p_file->file_base = file_base;
+
+  return TRUE;
+}
+
+/* Close the system structures associated with the given file.  */
+void
+close_file_data (file_data *p_file)
+{
+  UnmapViewOfFile (p_file->file_base);
+  CloseHandle (p_file->file_mapping);
+  /* For the case of output files, set final size.  */
+  SetFilePointer (p_file->file, p_file->size, NULL, FILE_BEGIN);
+  SetEndOfFile (p_file->file);
+  CloseHandle (p_file->file);
+}
+
+
+/* Routines to manipulate NT executable file sections.  */
+
+unsigned long
+get_unrounded_section_size (PIMAGE_SECTION_HEADER p_section)
+{
+  /* The true section size, before rounding, for an initialized data or
+     code section.  (Supposedly some linkers swap the meaning of these
+     two values.)  */
+  return min (p_section->SizeOfRawData,
+             p_section->Misc.VirtualSize);
+}
+
+/* Return pointer to section header for named section. */
+IMAGE_SECTION_HEADER *
+find_section (const char *name, IMAGE_NT_HEADERS *nt_header)
+{
+  PIMAGE_SECTION_HEADER section;
+  int i;
+
+  section = IMAGE_FIRST_SECTION (nt_header);
+
+  for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
+    {
+      if (strcmp (section->Name, name) == 0)
+       return section;
+      section++;
+    }
+  return NULL;
+}
+
+/* Return pointer to section header for section containing the given
+   relative virtual address. */
+IMAGE_SECTION_HEADER *
+rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
+{
+  PIMAGE_SECTION_HEADER section;
+  int i;
+
+  section = IMAGE_FIRST_SECTION (nt_header);
+
+  for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
+    {
+      /* Some linkers (eg. the NT SDK linker I believe) swapped the
+        meaning of these two values - or rather, they ignored
+        VirtualSize entirely and always set it to zero.  This affects
+        some very old exes (eg. gzip dated Dec 1993).  Since
+        w32_executable_type relies on this function to work reliably,
+        we need to cope with this.  */
+      DWORD_PTR real_size = max (section->SizeOfRawData,
+                            section->Misc.VirtualSize);
+      if (rva >= section->VirtualAddress
+         && rva < section->VirtualAddress + real_size)
+       return section;
+      section++;
+    }
+  return NULL;
+}
+
+/* Return pointer to section header for section containing the given
+   offset in its raw data area. */
+IMAGE_SECTION_HEADER *
+offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
+{
+  PIMAGE_SECTION_HEADER section;
+  int i;
+
+  section = IMAGE_FIRST_SECTION (nt_header);
+
+  for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
+    {
+      if (offset >= section->PointerToRawData
+         && offset < section->PointerToRawData + section->SizeOfRawData)
+       return section;
+      section++;
+    }
+  return NULL;
+}
+
+/* Return offset to an object in dst, given offset in src.  We assume
+   there is at least one section in both src and dst images, and that
+   the some sections may have been added to dst (after sections in src).  */
+static DWORD_PTR
+relocate_offset (DWORD_PTR offset,
+                IMAGE_NT_HEADERS * src_nt_header,
+                IMAGE_NT_HEADERS * dst_nt_header)
+{
+  PIMAGE_SECTION_HEADER src_section = IMAGE_FIRST_SECTION (src_nt_header);
+  PIMAGE_SECTION_HEADER dst_section = IMAGE_FIRST_SECTION (dst_nt_header);
+  int i = 0;
+
+  while (offset >= src_section->PointerToRawData)
+    {
+      if (offset < src_section->PointerToRawData + src_section->SizeOfRawData)
+       break;
+      i++;
+      if (i == src_nt_header->FileHeader.NumberOfSections)
+       {
+         /* Handle offsets after the last section.  */
+         dst_section = IMAGE_FIRST_SECTION (dst_nt_header);
+         dst_section += dst_nt_header->FileHeader.NumberOfSections - 1;
+         while (dst_section->PointerToRawData == 0)
+           dst_section--;
+         while (src_section->PointerToRawData == 0)
+           src_section--;
+         return offset
+           + (dst_section->PointerToRawData + dst_section->SizeOfRawData)
+           - (src_section->PointerToRawData + src_section->SizeOfRawData);
+       }
+      src_section++;
+      dst_section++;
+    }
+  return offset +
+    (dst_section->PointerToRawData - src_section->PointerToRawData);
+}
+
+#define OFFSET_TO_RVA(offset, section) \
+         (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData))
+
+#define RVA_TO_OFFSET(rva, section) \
+         (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress))
+
+#define RVA_TO_SECTION_OFFSET(rva, section) \
+         ((DWORD_PTR)(rva) - section->VirtualAddress)
+
+/* Convert address in executing image to RVA.  */
+#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
+
+#define PTR_TO_OFFSET(ptr, pfile_data) \
+          ((unsigned const char *)(ptr) - (pfile_data)->file_base)
+
+#define OFFSET_TO_PTR(offset, pfile_data) \
+          ((pfile_data)->file_base + (DWORD_PTR)(offset))
+
+#define ROUND_UP(p, align) \
+         (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1))
+#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1))
+
+
+static void
+copy_executable_and_add_section (file_data *p_infile,
+                                file_data *p_outfile,
+                                const char *new_section_name,
+                                DWORD_PTR new_section_size)
+{
+  unsigned char *dst;
+  PIMAGE_DOS_HEADER dos_header;
+  PIMAGE_NT_HEADERS nt_header;
+  PIMAGE_NT_HEADERS dst_nt_header;
+  PIMAGE_SECTION_HEADER section;
+  PIMAGE_SECTION_HEADER dst_section;
+  DWORD_PTR offset;
+  int i;
+  int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0;
+
+#define COPY_CHUNK(message, src, size, verbose)                                        \
+  do {                                                                         \
+    unsigned const char *s = (void *)(src);                                            \
+    unsigned long count = (size);                                              \
+    if (verbose)                                                               \
+      {                                                                                \
+       printf ("%s\n", (message));                                             \
+       printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base);   \
+       printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \
+       printf ("\t0x%08x Size in bytes.\n", count);                            \
+      }                                                                                \
+    memcpy (dst, s, count);                                                    \
+    dst += count;                                                              \
+  } while (0)
+
+#define DST_TO_OFFSET()  PTR_TO_OFFSET (dst, p_outfile)
+#define ROUND_UP_DST_AND_ZERO(align)                                           \
+  do {                                                                         \
+    unsigned char *newdst = p_outfile->file_base                               \
+      + ROUND_UP (DST_TO_OFFSET (), (align));                                  \
+    /* Zero the alignment slop; it may actually initialize real data.  */      \
+    memset (dst, 0, newdst - dst);                                             \
+    dst = newdst;                                                              \
+  } while (0)
+
+  /* Copy the source image sequentially, ie. section by section after
+     copying the headers and section table, to simplify the process of
+     adding an extra section table entry (which might force the raw
+     section data to be relocated).
+
+     Note that dst is updated implicitly by each COPY_CHUNK.  */
+
+  dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base;
+  nt_header = (PIMAGE_NT_HEADERS) (((unsigned char *) dos_header) +
+                                  dos_header->e_lfanew);
+  section = IMAGE_FIRST_SECTION (nt_header);
+
+  dst = (unsigned char *) p_outfile->file_base;
+
+  COPY_CHUNK ("Copying DOS header...", dos_header,
+             (DWORD_PTR) nt_header - (DWORD_PTR) dos_header, be_verbose);
+  dst_nt_header = (PIMAGE_NT_HEADERS) dst;
+  COPY_CHUNK ("Copying NT header...", nt_header,
+             (DWORD_PTR) section - (DWORD_PTR) nt_header, be_verbose);
+  dst_section = (PIMAGE_SECTION_HEADER) dst;
+  COPY_CHUNK ("Copying section table...", section,
+             nt_header->FileHeader.NumberOfSections * sizeof (*section),
+             be_verbose);
+
+  /* To improve the efficiency of demand loading, make the file
+     alignment match the section alignment (VC++ 6.0 does this by
+     default anyway).  */
+  dst_nt_header->OptionalHeader.FileAlignment =
+    dst_nt_header->OptionalHeader.SectionAlignment;
+
+  /* Add an uninitialized data section at the end, of the specified name
+     and virtual size.  */
+  if (find_section (new_section_name, nt_header) == NULL)
+    /* Leave room for extra section table entry; filled in below.  */
+    dst += sizeof (*section);
+  else
+    new_section_name = NULL;
+
+  /* Align the first section's raw data area, and set the header size
+     field accordingly.  */
+  ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment);
+  dst_nt_header->OptionalHeader.SizeOfHeaders = DST_TO_OFFSET ();
+
+  for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
+    {
+      char msg[100];
+      /* Windows section names are fixed 8-char strings, only
+        zero-terminated if the name is shorter than 8 characters.  */
+      sprintf (msg, "Copying raw data for %.8s...", section->Name);
+
+      /* Update the file-relative offset for this section's raw data (if
+         it has any) in case things have been relocated; we will update
+         the other offsets below once we know where everything is.  */
+      if (dst_section->PointerToRawData)
+       dst_section->PointerToRawData = DST_TO_OFFSET ();
+
+      /* Can always copy the original raw data.  */
+      COPY_CHUNK
+       (msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile),
+        section->SizeOfRawData, be_verbose);
+
+      /* Round up the raw data size to the new alignment.  */
+      dst_section->SizeOfRawData =
+       ROUND_UP (dst_section->SizeOfRawData,
+                 dst_nt_header->OptionalHeader.FileAlignment);
+
+      /* Align the next section's raw data area.  */
+      ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment);
+
+      section++;
+      dst_section++;
+    }
+
+  /* Add the extra section entry (which adds no raw data).  */
+  if (new_section_name != NULL)
+    {
+      dst_nt_header->FileHeader.NumberOfSections++;
+      dst_nt_header->OptionalHeader.SizeOfImage += new_section_size;
+      strncpy (dst_section->Name, new_section_name, sizeof (dst_section->Name));
+      dst_section->VirtualAddress =
+       section[-1].VirtualAddress
+       + ROUND_UP (section[-1].Misc.VirtualSize,
+                   dst_nt_header->OptionalHeader.SectionAlignment);
+      dst_section->Misc.VirtualSize = new_section_size;
+      dst_section->PointerToRawData = 0;
+      dst_section->SizeOfRawData = 0;
+      dst_section->Characteristics =
+       IMAGE_SCN_CNT_UNINITIALIZED_DATA
+       | IMAGE_SCN_MEM_READ
+       | IMAGE_SCN_MEM_WRITE;
+    }
+
+  /* Copy remainder of source image.  */
+  section--;
+  offset = ROUND_UP (section->PointerToRawData + section->SizeOfRawData,
+                    nt_header->OptionalHeader.FileAlignment);
+  COPY_CHUNK
+    ("Copying remainder of executable...",
+     OFFSET_TO_PTR (offset, p_infile),
+     p_infile->size - offset, be_verbose);
+
+  /* Final size for new image.  */
+  p_outfile->size = DST_TO_OFFSET ();
+
+  /* Now patch up remaining file-relative offsets.  */
+  section = IMAGE_FIRST_SECTION (nt_header);
+  dst_section = IMAGE_FIRST_SECTION (dst_nt_header);
+
+#define ADJUST_OFFSET(var)                                             \
+  do {                                                                 \
+    if ((var) != 0)                                                    \
+      (var) = relocate_offset ((var), nt_header, dst_nt_header);       \
+  } while (0)
+
+  dst_nt_header->OptionalHeader.SizeOfInitializedData = 0;
+  dst_nt_header->OptionalHeader.SizeOfUninitializedData = 0;
+  for (i = 0; i < dst_nt_header->FileHeader.NumberOfSections; i++)
+    {
+      /* Recompute data sizes for completeness.  */
+      if (dst_section[i].Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA)
+       dst_nt_header->OptionalHeader.SizeOfInitializedData +=
+         ROUND_UP (dst_section[i].Misc.VirtualSize, dst_nt_header->OptionalHeader.FileAlignment);
+      else if (dst_section[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
+       dst_nt_header->OptionalHeader.SizeOfUninitializedData +=
+         ROUND_UP (dst_section[i].Misc.VirtualSize, dst_nt_header->OptionalHeader.FileAlignment);
+
+      ADJUST_OFFSET (dst_section[i].PointerToLinenumbers);
+    }
+
+  ADJUST_OFFSET (dst_nt_header->FileHeader.PointerToSymbolTable);
+
+  /* Update offsets in debug directory entries. */
+  {
+    IMAGE_DATA_DIRECTORY debug_dir =
+      dst_nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG];
+    PIMAGE_DEBUG_DIRECTORY debug_entry;
+
+    section = rva_to_section (debug_dir.VirtualAddress, dst_nt_header);
+    if (section)
+      {
+       debug_entry = (PIMAGE_DEBUG_DIRECTORY)
+         (RVA_TO_OFFSET (debug_dir.VirtualAddress, section) + p_outfile->file_base);
+       debug_dir.Size /= sizeof (IMAGE_DEBUG_DIRECTORY);
+
+       for (i = 0; i < debug_dir.Size; i++, debug_entry++)
+         ADJUST_OFFSET (debug_entry->PointerToRawData);
+      }
+  }
+}
+
+
+int
+main (int argc, char **argv)
+{
+  file_data in_file, out_file;
+  char out_filename[MAX_PATH], in_filename[MAX_PATH];
+  unsigned long size;
+  PIMAGE_DOS_HEADER dos_header;
+  PIMAGE_NT_HEADERS nt_header;
+
+#define OLD_NAME        argv[1]
+#define NEW_NAME        argv[2]
+#define SECTION_NAME    argv[3]
+#define SECTION_SIZE    argv[4]
+
+  strcpy (in_filename, OLD_NAME);
+  strcpy (out_filename, NEW_NAME);
+
+  printf ("Dumping from %s\n", in_filename);
+  printf ("          to %s\n", out_filename);
+
+  /* Open the undumped executable file.  */
+  if (!open_input_file (&in_file, in_filename))
+    {
+      printf ("Failed to open %s (%d)...bailing.\n",
+             in_filename, GetLastError ());
+      exit (1);
+    }
+  dos_header = (PIMAGE_DOS_HEADER) in_file.file_base;
+  nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew);
+  /* Allow for expansion due to increasing file align to section align.
+     We can overestimate here, since close_file_data will update the
+     size exactly.  */
+  size = in_file.size
+    + nt_header->OptionalHeader.SectionAlignment
+    * nt_header->FileHeader.NumberOfSections;
+  if (!open_output_file (&out_file, out_filename, size))
+    {
+      printf ("Failed to open %s (%d)...bailing.\n",
+             out_filename, GetLastError ());
+      exit (1);
+    }
+
+  copy_executable_and_add_section (&in_file, &out_file,
+                                  SECTION_NAME,
+                                  atoi (SECTION_SIZE) * 1024 * 1024);
+
+  /* Patch up header fields; profiler is picky about this. */
+  {
+    HANDLE hImagehelp = LoadLibrary ("imagehlp.dll");
+    DWORD_PTR  headersum;
+    DWORD_PTR  checksum;
+
+    dos_header = (PIMAGE_DOS_HEADER) out_file.file_base;
+    nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew);
+
+    nt_header->OptionalHeader.CheckSum = 0;
+//    nt_header->FileHeader.TimeDateStamp = time (NULL);
+//    dos_header->e_cp = size / 512;
+//    nt_header->OptionalHeader.SizeOfImage = size;
+
+    pfnCheckSumMappedFile = (void *) GetProcAddress (hImagehelp, "CheckSumMappedFile");
+    if (pfnCheckSumMappedFile)
+      {
+//     nt_header->FileHeader.TimeDateStamp = time (NULL);
+       pfnCheckSumMappedFile (out_file.file_base,
+                              out_file.size,
+                              &headersum,
+                              &checksum);
+       nt_header->OptionalHeader.CheckSum = checksum;
+      }
+    FreeLibrary (hImagehelp);
+  }
+
+  close_file_data (&in_file);
+  close_file_data (&out_file);
+
+  return 0;
+}
+
+/* eof */
+
index e8e216e0e920d35268af9eda163454bf588e14f7..1df4f6ae0ba71e1e619e73de4181d767858546ad 100644 (file)
@@ -1,3 +1,62 @@
+2015-01-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * dired.c (directory_files_internal) [WINDOWSNT]: If readdir
+       returns NULL and errno is ENOTDIR, behave as if opendir failed to
+       open the directory.  (Bug#19701)
+
+       * w32.c (sys_readdir): If FindFirstFile fails because the
+       directory doesn't exist, set errno to ENOTDIR.
+
+2015-01-24  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (drawRect:): Add block/unblock_input (Bug#19660).
+
+2015-01-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix coding.c subscript error
+       * coding.c (CODING_ISO_INVOKED_CHARSET):
+       Avoid undefined behavior if CODING_ISO_INVOCATION returns negative.
+
+2015-01-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (produce_image_glyph): Fix display of images in R2L
+       screen lines: prepend the new glyph to the ones already there
+       instead of appending it.
+
+2015-01-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32fns.c (w32_set_title_bar_text): New function, including
+       support for titles with non-ASCII characters outside of the
+       current system codepage.
+       (x_set_name, x_set_title): Use it.  (Bug#19590)
+
+2015-01-10  Eli Zaretskii  <eliz@gnu.org>
+
+       * indent.c (Fvertical_motion): Return zero if we started from ZV
+       and there's an overlay after-string there.  (Bug#19553)
+
+2015-01-09  Eli Zaretskii  <eliz@gnu.org>
+
+       * emacs.c (usage_message): Fix the description of the -nl switch.
+       (Bug#19542)
+
+2015-01-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (move_it_to, try_cursor_movement): Don't use the window
+       end information if the window_end_valid flag is unset.
+       (try_window_id): If the call to display_line invalidated the
+       window end information, give up the try_window_id optimization.
+       (Bug#19511)
+
+2015-01-04  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32fns.c (Fx_server_version, Fx_server_vendor): Doc fix.
+
+       * xfns.c (Fx_server_version, Fx_server_vendor): Doc fix.
+
+       * emacs.c (syms_of_emacs) <system-configuration>: Doc fix.
+       (Bug#19502)
+
 2015-01-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * lisp.mk (lisp): Add cl-preloaded.
index 54811588c6a015e9c34dd1ab4d574810e4050148..a7128ee3e7391bda96ed9db67033656be3119555 100644 (file)
@@ -350,7 +350,8 @@ static Lisp_Object Vbig5_coding_system;
 #define CODING_ISO_BOL(coding) \
   ((coding)->spec.iso_2022.bol)
 #define CODING_ISO_INVOKED_CHARSET(coding, plane)      \
-  CODING_ISO_DESIGNATION ((coding), CODING_ISO_INVOCATION ((coding), (plane)))
+  (CODING_ISO_INVOCATION (coding, plane) < 0 ? -1      \
+   : CODING_ISO_DESIGNATION (coding, CODING_ISO_INVOCATION (coding, plane)))
 #define CODING_ISO_CMP_STATUS(coding)  \
   (&(coding)->spec.iso_2022.cmp_status)
 #define CODING_ISO_EXTSEGMENT_LEN(coding)      \
index e31fdf87ac29d81a38991366ef32647be41dccd9..757eb6d30cda5105b5fe058c53113324e407a921 100644 (file)
@@ -238,6 +238,19 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
              QUIT;
              continue;
            }
+#ifdef WINDOWSNT
+         /* The MS-Windows implementation of 'opendir' doesn't
+            actually open a directory until the first call to
+            'readdir'.  If 'readdir' fails to open the directory, it
+            sets errno to ENOTDIR; we convert it here to ENOENT so
+            that the error message is similar to what happens on
+            Posix hosts in such cases.  */
+         if (errno == ENOTDIR)
+           {
+             errno = ENOENT;
+             report_file_error ("Opening directory", directory);
+           }
+#endif
          break;
        }
 
index 345fe3e75b82a40f59f8f966f1e9e32b40a66cee..fdd17d1e062c511bf97862954cb2f70babee6a08 100644 (file)
@@ -231,7 +231,7 @@ Initialization options:\n\
     "\
 --no-desktop                do not load a saved desktop\n\
 --no-init-file, -q          load neither ~/.emacs nor default.el\n\
---no-shared-memory, -nl     do not use shared memory\n\
+--no-loadup, -nl            do not load loadup.el into bare Emacs\n\
 --no-site-file              do not load site-start.el\n\
 --no-site-lisp, -nsl        do not add site-lisp directories to load-path\n\
 --no-splash                 do not display a splash screen on startup\n\
@@ -2392,9 +2392,7 @@ hpux, irix, usg-unix-v) indicates some sort of Unix system.  */);
   /* See configure.ac (and config.nt) for the possible SYSTEM_TYPEs.  */
 
   DEFVAR_LISP ("system-configuration", Vsystem_configuration,
-              doc: /* Value is string indicating configuration Emacs was built for.
-On MS-Windows, the value reflects the OS flavor and version on which
-Emacs is running.  */);
+              doc: /* Value is string indicating configuration Emacs was built for.  */);
   Vsystem_configuration = build_string (EMACS_CONFIGURATION);
 
   DEFVAR_LISP ("system-configuration-options", Vsystem_configuration_options,
index 589aeb9c0052c7e36ac1ac6abd760b08152b020a..8660400e1cec8775f416098e7b848bd4aa442206 100644 (file)
@@ -2137,10 +2137,15 @@ whether or not it is currently displayed in some window.  */)
              if (nlines > 1)
                move_it_by_lines (&it, min (PTRDIFF_MAX, nlines - 1));
            }
-         else
+         else  /* it_start = ZV */
            {
              it.vpos = 0;
              move_it_by_lines (&it, min (PTRDIFF_MAX, nlines));
+             /* We could have some display or overlay string at ZV,
+                in which case it.vpos will be nonzero now, while
+                actually we didn't move vertically at all.  */
+             if (IT_CHARPOS (it) == CHARPOS (pt) && CHARPOS (pt) == it_start)
+               it.vpos = 0;
            }
        }
 
index 3b5b520aac8331816b866741c97c36e8692815aa..80650be25aeb9c2fa4ad0f3993024a8761be19d1 100644 (file)
@@ -1,7 +1,6 @@
 /* Buffer insertion/deletion and gap motion for GNU Emacs.
-
-Copyright (C) 1985-1986, 1993-1995, 1997-2015 Free Software Foundation,
-Inc.
+   Copyright (C) 1985-1986, 1993-1995, 1997-2015 Free Software
+   Foundation, Inc.
 
 This file is part of GNU Emacs.
 
index ee1268ef8506ccf9bf54fe9a8c627e80a6db4243..e90c3d70db3b3b98270367cf1f5fdba18bbe7652 100644 (file)
@@ -6773,7 +6773,9 @@ if (cols > 0 && rows > 0)
     return;
 
   ns_clear_frame_area (emacsframe, x, y, width, height);
+  block_input ();
   expose_frame (emacsframe, x, y, width, height);
+  unblock_input ();
 
   /*
     drawRect: may be called (at least in OS X 10.5) for invisible
index 31b13289b575e738715ce2ce393113cde7eb6240..acd06ba260128b11634e683828992c547eb9e976 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -3433,7 +3433,22 @@ sys_readdir (DIR *dirp)
        }
 
       if (dir_find_handle == INVALID_HANDLE_VALUE)
-       return NULL;
+       {
+         switch (GetLastError ())
+           {
+           case ERROR_PATH_NOT_FOUND:
+           case ERROR_ACCESS_DENIED:
+           case ERROR_INVALID_DRIVE:
+           case ERROR_BAD_NETPATH:
+             /* This special value will be noticed by
+                directory_files_internal, which see.  */
+             errno = ENOTDIR;
+             break;
+           default:
+             break;
+           }
+         return NULL;
+       }
     }
   else if (w32_unicode_filenames)
     {
index c269c4f8e68a14f1058c6af7025fa5dda3feef7b..777819edd52a0d0f04d45204433099f5acbb5f52 100644 (file)
@@ -1759,6 +1759,50 @@ x_change_tool_bar_height (struct frame *f, int height)
     x_clear_under_internal_border (f);
 }
 
+static void
+w32_set_title_bar_text (struct frame *f, Lisp_Object name)
+{
+  if (FRAME_W32_WINDOW (f))
+    {
+      block_input ();
+#ifdef __CYGWIN__
+      GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
+                              GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
+#else
+      /* The frame's title many times shows the name of the file
+        visited in the selected window's buffer, so it makes sense to
+        support non-ASCII characters outside of the current system
+        codepage in the title.  */
+      if (w32_unicode_filenames)
+       {
+         Lisp_Object encoded_title = ENCODE_UTF_8 (name);
+         wchar_t *title_w;
+         int tlen = pMultiByteToWideChar (CP_UTF8, 0, SSDATA (encoded_title),
+                                          -1, NULL, 0);
+
+         if (tlen > 0)
+           {
+             /* Windows truncates the title text beyond what fits on
+                a single line, so we can limit the length to some
+                reasonably large value, and use alloca.  */
+             if (tlen > 10000)
+               tlen = 10000;
+             title_w = alloca ((tlen + 1) * sizeof (wchar_t));
+             pMultiByteToWideChar (CP_UTF8, 0, SSDATA (encoded_title), -1,
+                                   title_w, tlen);
+             title_w[tlen] = L'\0';
+             SetWindowTextW (FRAME_W32_WINDOW (f), title_w);
+           }
+         else  /* Conversion to UTF-16 failed, so we punt.  */
+           SetWindowTextA (FRAME_W32_WINDOW (f),
+                           SSDATA (ENCODE_SYSTEM (name)));
+       }
+      else
+       SetWindowTextA (FRAME_W32_WINDOW (f), SSDATA (ENCODE_SYSTEM (name)));
+#endif
+      unblock_input ();
+    }
+}
 
 /* Change the name of frame F to NAME.  If NAME is nil, set F's name to
        w32_id_name.
@@ -1812,13 +1856,7 @@ x_set_name (struct frame *f, Lisp_Object name, bool explicit)
   if (! NILP (f->title))
     name = f->title;
 
-  if (FRAME_W32_WINDOW (f))
-    {
-      block_input ();
-      GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
-                              GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
-      unblock_input ();
-    }
+  w32_set_title_bar_text (f, name);
 }
 
 /* This function should be called when the user's lisp code has
@@ -1856,13 +1894,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
   if (NILP (name))
     name = f->name;
 
-  if (FRAME_W32_WINDOW (f))
-    {
-      block_input ();
-      GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
-                              GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
-      unblock_input ();
-    }
+  w32_set_title_bar_text (f, name);
 }
 
 void
@@ -4895,25 +4927,38 @@ If omitted or nil, that stands for the selected frame's display.  */)
 }
 
 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
-       doc: /* Return the "vendor ID" string of the W32 system (Microsoft).
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
+       doc: /* Return the "vendor ID" string of the GUI software on TERMINAL.
+
+\(Labeling every distributor as a "vendor" embodies the false assumption
+that operating systems cannot be developed and distributed noncommercially.)
+
+For GNU and Unix systems, this queries the X server software; for
+MS-Windows, this queries the OS.
+
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (Lisp_Object display)
+  (Lisp_Object terminal)
 {
   return build_string ("Microsoft Corp.");
 }
 
 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
-       doc: /* Return the version numbers of the server of DISPLAY.
-The value is a list of three integers: the major and minor
-version numbers of the X Protocol in use, and the distributor-specific
-release number.  See also the function `x-server-vendor'.
+       doc: /* Return the version numbers of the GUI software on TERMINAL.
+The value is a list of three integers specifying the version of the GUI
+software in use.
 
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
+For GNU and Unix system, the first 2 numbers are the version of the X
+Protocol used on TERMINAL and the 3rd number is the distributor-specific
+release number.  For MS-Windows, the 3 numbers report the version and
+the build number of the OS.
+
+See also the function `x-server-vendor'.
+
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (Lisp_Object display)
+  (Lisp_Object terminal)
 {
   return list3i (w32_major_version, w32_minor_version, w32_build_number);
 }
index d5a9dae0aa42e9724e586232f2b881ac8f6b92e6..ee0eb161502e448f80e1931d7d9b0375f7f406f3 100644 (file)
@@ -1,5 +1,5 @@
-/* Heap management routines for GNU Emacs on the Microsoft Windows
-   API.  Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc.
+/* Heap management routines for GNU Emacs on the Microsoft Windows API.
+   Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc.
 
    This file is part of GNU Emacs.
 
index 71871ec588538c3865c991b5adee398b1a7f57d0..18e27e705c9aad39bb479d261c3642c72e1ba45d 100644 (file)
@@ -9263,6 +9263,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
       && it->current_x == it->last_visible_x - 1
       && it->c != '\n'
       && it->c != '\t'
+      && it->w->window_end_valid
       && it->vpos < it->w->window_end_vpos)
     {
       it->continuation_lines_width += it->current_x;
@@ -15383,7 +15384,8 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
   /* Likewise there was a check whether window_end_vpos is nil or larger
      than the window.  Now window_end_vpos is int and so never nil, but
      let's leave eassert to check whether it fits in the window.  */
-  eassert (w->window_end_vpos < w->current_matrix->nrows);
+  eassert (!w->window_end_valid
+          || w->window_end_vpos < w->current_matrix->nrows);
 
   /* Handle case where text has not changed, only point, and it has
      not moved off the frame.  */
@@ -18123,6 +18125,21 @@ try_window_id (struct window *w)
   if (f->fonts_changed)
     return -1;
 
+  /* The redisplay iterations in display_line above could have
+     triggered font-lock, which could have done something that
+     invalidates IT->w window's end-point information, on which we
+     rely below.  E.g., one package, which will remain unnamed, used
+     to install a font-lock-fontify-region-function that called
+     bury-buffer, whose side effect is to switch the buffer displayed
+     by IT->w, and that predictably resets IT->w's window_end_valid
+     flag, which we already tested at the entry to this function.
+     Amply punish such packages/modes by giving up on this
+     optimization in those cases.  */
+  if (!w->window_end_valid)
+    {
+      clear_glyph_matrix (w->desired_matrix);
+      return -1;
+    }
 
   /* Compute differences in buffer positions, y-positions etc.  for
      lines reused at the bottom of the window.  Compute what we can
@@ -25594,6 +25611,15 @@ produce_image_glyph (struct it *it)
       enum glyph_row_area area = it->area;
 
       glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
+      if (it->glyph_row->reversed_p)
+       {
+         struct glyph *g;
+
+         /* Make room for the new glyph.  */
+         for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
+           g[1] = *g;
+         glyph = it->glyph_row->glyphs[it->area];
+       }
       if (glyph < it->glyph_row->glyphs[area + 1])
        {
          glyph->charpos = CHARPOS (it->position);
index 9dd00868d7bb1ee86e5b737e02caa2007f5cb01f..234915a8ce2435f109c014dd800931bd8102cf1b 100644 (file)
@@ -3542,10 +3542,15 @@ If omitted or nil, that stands for the selected frame's display.  */)
 }
 
 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
-       doc: /* Return the "vendor ID" string of the X server of display TERMINAL.
+       doc: /* Return the "vendor ID" string of the GUI software on TERMINAL.
+
 \(Labeling every distributor as a "vendor" embodies the false assumption
 that operating systems cannot be developed and distributed noncommercially.)
 The optional argument TERMINAL specifies which display to ask about.
+
+For GNU and Unix systems, this queries the X server software; for
+MS-Windows, this queries the OS.
+
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
   (Lisp_Object terminal)
@@ -3558,10 +3563,16 @@ If omitted or nil, that stands for the selected frame's display.  */)
 }
 
 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
-       doc: /* Return the version numbers of the X server of display TERMINAL.
-The value is a list of three integers: the major and minor
-version numbers of the X Protocol in use, and the distributor-specific release
-number.  See also the function `x-server-vendor'.
+       doc: /* Return the version numbers of the GUI software on TERMINAL.
+The value is a list of three integers specifying the version of the GUI
+software in use.
+
+For GNU and Unix system, the first 2 numbers are the version of the X
+Protocol used on TERMINAL and the 3rd number is the distributor-specific
+release number.  For MS-Windows, the 3 numbers report the version and
+the build number of the OS.
+
+See also the function `x-server-vendor'.
 
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
index 61ab8b6595a5fe3ea5ed5d5bf22d4a6b9157253f..66535ac42a39208d304b589c778f4f5204cfe4eb 100644 (file)
@@ -1,3 +1,30 @@
+2015-01-26  Fabián Ezequiel Gallina  <fgallina@gnu.org>
+
+       * automated/python-tests.el (python-indent-pep8-1)
+       (python-indent-pep8-2, python-indent-pep8-3)
+       (python-indent-after-comment-1, python-indent-after-comment-2)
+       (python-indent-inside-paren-1, python-indent-inside-paren-2)
+       (python-indent-after-block-1, python-indent-after-block-2)
+       (python-indent-after-backslash-1, python-indent-after-backslash-2)
+       (python-indent-after-backslash-3, python-indent-block-enders-1)
+       (python-indent-block-enders-2, python-indent-block-enders-3)
+       (python-indent-block-enders-4, python-indent-block-enders-5)
+       (python-indent-dedenters-1, python-indent-dedenters-2)
+       (python-indent-dedenters-3, python-indent-dedenters-4)
+       (python-indent-dedenters-5, python-indent-dedenters-6)
+       (python-indent-dedenters-7, python-indent-dedenters-8): Fix tests.
+       (python-indent-base-case, python-indent-after-block-3)
+       (python-indent-after-backslash-5, python-indent-inside-paren-3)
+       (python-indent-inside-paren-4, python-indent-inside-paren-5)
+       (python-indent-inside-paren-6, python-indent-inside-string-1)
+       (python-indent-inside-string-2, python-indent-inside-string-3)
+       (python-indent-dedent-line-backspace-1): New Tests.
+
+2015-01-24  Glenn Morris  <rgm@gnu.org>
+
+       * automated/regexp-tests.el: Require regexp-opt, which is
+       not preloaded --without-x.
+
 2015-01-26  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * automated/cl-generic-tests.el: Try and make sure cl-lib is not
diff --git a/test/automated/package-x-test.el b/test/automated/package-x-test.el
new file mode 100644 (file)
index 0000000..70c9d96
--- /dev/null
@@ -0,0 +1,110 @@
+;;; package-test.el --- Tests for the Emacs package system
+
+;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
+
+;; Author: Daniel Hackney <dan@haxney.org>
+;; Version: 1.0
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; You may want to run this from a separate Emacs instance from your
+;; main one, because a bug in the code below could mess with your
+;; installed packages.
+
+;; Run this in a clean Emacs session using:
+;;
+;;     $ emacs -Q --batch -L . -l package-x-test.el -f ert-run-tests-batch-and-exit
+
+;;; Code:
+
+(require 'package-x)
+(require 'ert)
+(require 'cl-lib)
+(eval-when-compile (require 'package-test))
+
+;; package-test is not normally in `load-path', so temporarily set
+;; `load-path' to contain the current directory.
+(let ((load-path (append (list (file-name-directory (or load-file-name
+                                                        buffer-file-name)))
+                         load-path)))
+  (require 'package-test))
+
+(defvar package-x-test--single-archive-entry-1-3
+  (cons 'simple-single
+        (package-make-ac-desc '(1 3) nil
+                              "A single-file package with no dependencies"
+                              'single
+                              '((:url . "http://doodles.au"))))
+  "Expected contents of the archive entry from the \"simple-single\" package.")
+
+(defvar package-x-test--single-archive-entry-1-4
+  (cons 'simple-single
+        (package-make-ac-desc '(1 4) nil
+                              "A single-file package with no dependencies"
+                              'single
+                              nil))
+  "Expected contents of the archive entry from the updated \"simple-single\" package.")
+
+(ert-deftest package-x-test-upload-buffer ()
+  "Test creating an \"archive-contents\" file"
+  (with-package-test (:basedir "data/package"
+                               :file "simple-single-1.3.el"
+                               :upload-base t)
+    (package-upload-buffer)
+    (should (file-exists-p (expand-file-name "archive-contents"
+                                             package-archive-upload-base)))
+    (should (file-exists-p (expand-file-name "simple-single-1.3.el"
+                                             package-archive-upload-base)))
+    (should (file-exists-p (expand-file-name "simple-single-readme.txt"
+                                             package-archive-upload-base)))
+
+    (let (archive-contents)
+      (with-temp-buffer
+        (insert-file-contents
+         (expand-file-name "archive-contents"
+                           package-archive-upload-base))
+        (setq archive-contents
+              (package-read-from-string
+               (buffer-substring (point-min) (point-max)))))
+      (should (equal archive-contents
+                     (list 1 package-x-test--single-archive-entry-1-3))))))
+
+(ert-deftest package-x-test-upload-new-version ()
+  "Test uploading a new version of a package"
+  (with-package-test (:basedir "data/package"
+                               :file "simple-single-1.3.el"
+                               :upload-base t)
+    (package-upload-buffer)
+    (with-temp-buffer
+      (insert-file-contents "newer-versions/simple-single-1.4.el")
+      (package-upload-buffer))
+
+    (let (archive-contents)
+      (with-temp-buffer
+        (insert-file-contents
+         (expand-file-name "archive-contents"
+                           package-archive-upload-base))
+        (setq archive-contents
+              (package-read-from-string
+               (buffer-substring (point-min) (point-max)))))
+      (should (equal archive-contents
+                     (list 1 package-x-test--single-archive-entry-1-4))))))
+
+(provide 'package-x-test)
+
+;;; package-x-test.el ends here
index e989ccb6792f26c3eaa8620c5b4fe7275c844602..672b05c39de55e05109d851415b55fbc9b567789 100644 (file)
@@ -174,13 +174,13 @@ aliqua."
 foo = long_function_name(var_one, var_two,
                          var_three, var_four)
 "
-   (should (eq (car (python-indent-context)) 'no-indent))
+   (should (eq (car (python-indent-context)) :no-indent))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "foo = long_function_name(var_one, var_two,")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "var_three, var_four)")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren))
    (should (= (python-indent-calculate-indentation) 25))))
 
 (ert-deftest python-indent-pep8-2 ()
@@ -192,19 +192,22 @@ def long_function_name(
         var_four):
     print (var_one)
 "
-   (should (eq (car (python-indent-context)) 'no-indent))
+   (should (eq (car (python-indent-context)) :no-indent))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "def long_function_name(")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "var_one, var_two, var_three,")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-newline-start-from-block))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "var_four):")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-newline-start-from-block))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "print (var_one)")
-   (should (eq (car (python-indent-context)) 'after-beginning-of-block))
+   (should (eq (car (python-indent-context))
+               :after-block-start))
    (should (= (python-indent-calculate-indentation) 4))))
 
 (ert-deftest python-indent-pep8-3 ()
@@ -215,18 +218,34 @@ foo = long_function_name(
   var_one, var_two,
   var_three, var_four)
 "
-   (should (eq (car (python-indent-context)) 'no-indent))
+   (should (eq (car (python-indent-context)) :no-indent))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "foo = long_function_name(")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "var_one, var_two,")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "var_three, var_four)")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 4))))
 
+(ert-deftest python-indent-base-case ()
+  "Check base case does not trigger errors."
+  (python-tests-with-temp-buffer
+   "
+
+"
+   (goto-char (point-min))
+   (should (eq (car (python-indent-context)) :no-indent))
+   (should (= (python-indent-calculate-indentation) 0))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))))
+
 (ert-deftest python-indent-after-comment-1 ()
   "The most simple after-comment case that shouldn't fail."
   (python-tests-with-temp-buffer
@@ -240,23 +259,23 @@ class Blag(object):
 # with the exception with which the first child failed.
 "
    (python-tests-look-at "# We only complete")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-block-end))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "# terminal state")
-   (should (eq (car (python-indent-context)) 'after-comment))
+   (should (eq (car (python-indent-context)) :after-comment))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "# with the exception")
-   (should (eq (car (python-indent-context)) 'after-comment))
+   (should (eq (car (python-indent-context)) :after-comment))
    ;; This one indents relative to previous block, even given the fact
    ;; that it was under-indented.
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "# terminal state" -1)
    ;; It doesn't hurt to check again.
-   (should (eq (car (python-indent-context)) 'after-comment))
+   (should (eq (car (python-indent-context)) :after-comment))
    (python-indent-line)
    (should (= (current-indentation) 8))
    (python-tests-look-at "# with the exception")
-   (should (eq (car (python-indent-context)) 'after-comment))
+   (should (eq (car (python-indent-context)) :after-comment))
    ;; Now everything should be lined up.
    (should (= (python-indent-calculate-indentation) 8))))
 
@@ -275,33 +294,33 @@ now_we_do_mess_cause_this_is_not_a_comment = 1
 # yeah, that.
 "
    (python-tests-look-at "# I don't do much")
-   (should (eq (car (python-indent-context)) 'after-beginning-of-block))
+   (should (eq (car (python-indent-context)) :after-block-start))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "return arg")
    ;; Comment here just gets ignored, this line is not a comment so
    ;; the rules won't apply here.
-   (should (eq (car (python-indent-context)) 'after-beginning-of-block))
+   (should (eq (car (python-indent-context)) :after-block-start))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "# This comment is badly")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-block-end))
    ;; The return keyword moves indentation backwards 4 spaces, but
    ;; let's assume this comment was placed there because the user
    ;; wanted to (manually adding spaces or whatever).
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "# but we won't mess")
-   (should (eq (car (python-indent-context)) 'after-comment))
+   (should (eq (car (python-indent-context)) :after-comment))
    (should (= (python-indent-calculate-indentation) 4))
    ;; Behave the same for blank lines: potentially a comment.
    (forward-line 1)
-   (should (eq (car (python-indent-context)) 'after-comment))
+   (should (eq (car (python-indent-context)) :after-comment))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "now_we_do_mess")
    ;; Here is where comment indentation starts to get ignored and
    ;; where the user can't freely indent anymore.
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-block-end))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "# yeah, that.")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))))
 
 (ert-deftest python-indent-inside-paren-1 ()
@@ -325,49 +344,53 @@ data = {
 }
 "
    (python-tests-look-at "data = {")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "'key':")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "{")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "'objlist': [")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "{")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 12))
    (python-tests-look-at "'pk': 1,")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 16))
    (python-tests-look-at "'name': 'first',")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 16))
    (python-tests-look-at "},")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-at-closing-nested-paren))
    (should (= (python-indent-calculate-indentation) 12))
    (python-tests-look-at "{")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 12))
    (python-tests-look-at "'pk': 2,")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 16))
    (python-tests-look-at "'name': 'second',")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 16))
    (python-tests-look-at "}")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-at-closing-nested-paren))
    (should (= (python-indent-calculate-indentation) 12))
    (python-tests-look-at "]")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-at-closing-nested-paren))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "}")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-at-closing-nested-paren))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "}")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren))
    (should (= (python-indent-calculate-indentation) 0))))
 
 (ert-deftest python-indent-inside-paren-2 ()
@@ -384,43 +407,121 @@ data = {'key': {
 }}
 "
    (python-tests-look-at "data = {")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "'objlist': [")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "{'pk': 1,")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "'name': 'first'},")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren))
    (should (= (python-indent-calculate-indentation) 9))
    (python-tests-look-at "{'pk': 2,")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 8))
    (python-tests-look-at "'name': 'second'}")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren))
    (should (= (python-indent-calculate-indentation) 9))
    (python-tests-look-at "]")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-at-closing-nested-paren))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "}}")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context))
+               :inside-paren-at-closing-nested-paren))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "}")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren))
    (should (= (python-indent-calculate-indentation) 0))))
 
+(ert-deftest python-indent-inside-paren-3 ()
+  "The simplest case possible."
+  (python-tests-with-temp-buffer
+   "
+data = ('these',
+        'are',
+        'the',
+        'tokens')
+"
+   (python-tests-look-at "data = ('these',")
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren))
+   (should (= (python-indent-calculate-indentation) 8))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren))
+   (should (= (python-indent-calculate-indentation) 8))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren))
+   (should (= (python-indent-calculate-indentation) 8))))
+
+(ert-deftest python-indent-inside-paren-4 ()
+  "Respect indentation of first column."
+  (python-tests-with-temp-buffer
+   "
+data = [ [ 'these', 'are'],
+         ['the', 'tokens' ] ]
+"
+   (python-tests-look-at "data = [ [ 'these', 'are'],")
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren))
+   (should (= (python-indent-calculate-indentation) 9))))
+
+(ert-deftest python-indent-inside-paren-5 ()
+  "Test when :inside-paren initial parens are skipped in context start."
+  (python-tests-with-temp-buffer
+   "
+while ((not some_condition) and
+       another_condition):
+    do_something_interesting(
+        with_some_arg)
+"
+   (python-tests-look-at "while ((not some_condition) and")
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren))
+   (should (= (python-indent-calculate-indentation) 7))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :after-block-start))
+   (should (= (python-indent-calculate-indentation) 4))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
+   (should (= (python-indent-calculate-indentation) 8))))
+
+(ert-deftest python-indent-inside-paren-6 ()
+  "This should be aligned.."
+  (python-tests-with-temp-buffer
+   "
+CHOICES = (('some', 'choice'),
+           ('another', 'choice'),
+           ('more', 'choices'))
+"
+   (python-tests-look-at "CHOICES = (('some', 'choice'),")
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren))
+   (should (= (python-indent-calculate-indentation) 11))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :inside-paren))
+   (should (= (python-indent-calculate-indentation) 11))))
+
 (ert-deftest python-indent-after-block-1 ()
   "The most simple after-block case that shouldn't fail."
   (python-tests-with-temp-buffer
    "
 def foo(a, b, c=True):
 "
-   (should (eq (car (python-indent-context)) 'no-indent))
+   (should (eq (car (python-indent-context)) :no-indent))
    (should (= (python-indent-calculate-indentation) 0))
    (goto-char (point-max))
-   (should (eq (car (python-indent-context)) 'after-beginning-of-block))
+   (should (eq (car (python-indent-context)) :after-block-start))
    (should (= (python-indent-calculate-indentation) 4))))
 
 (ert-deftest python-indent-after-block-2 ()
@@ -432,9 +533,28 @@ def foo(a, b, c={
 }):
 "
    (goto-char (point-max))
-   (should (eq (car (python-indent-context)) 'after-beginning-of-block))
+   (should (eq (car (python-indent-context)) :after-block-start))
    (should (= (python-indent-calculate-indentation) 4))))
 
+(ert-deftest python-indent-after-block-3 ()
+  "A weird (malformed) sample, usually found in python shells."
+  (python-tests-with-temp-buffer
+   "
+In [1]:
+def func():
+pass
+
+In [2]:
+something
+"
+   (python-tests-look-at "pass")
+   (should (eq (car (python-indent-context)) :after-block-start))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "something")
+   (end-of-line)
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))))
+
 (ert-deftest python-indent-after-backslash-1 ()
   "The most common case."
   (python-tests-with-temp-buffer
@@ -444,16 +564,16 @@ from foo.bar.baz import something, something_1 \\\\
     something_4, something_5
 "
    (python-tests-look-at "from foo.bar.baz import something, something_1")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at "something_2 something_3,")
-   (should (eq (car (python-indent-context)) 'after-backslash))
+   (should (eq (car (python-indent-context)) :after-backslash-first-line))
    (should (= (python-indent-calculate-indentation) 4))
    (python-tests-look-at "something_4, something_5")
-   (should (eq (car (python-indent-context)) 'after-backslash))
+   (should (eq (car (python-indent-context)) :after-backslash))
    (should (= (python-indent-calculate-indentation) 4))
    (goto-char (point-max))
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))))
 
 (ert-deftest python-indent-after-backslash-2 ()
@@ -471,40 +591,104 @@ objects = Thing.objects.all() \\\\
                        .values_list()
 "
    (python-tests-look-at "objects = Thing.objects.all()")
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))
    (python-tests-look-at ".filter(")
-   (should (eq (car (python-indent-context)) 'after-backslash))
+   (should (eq (car (python-indent-context))
+               :after-backslash-dotted-continuation))
    (should (= (python-indent-calculate-indentation) 23))
    (python-tests-look-at "type='toy',")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 27))
    (python-tests-look-at "status='bought'")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 27))
    (python-tests-look-at ") \\\\")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren))
    (should (= (python-indent-calculate-indentation) 23))
    (python-tests-look-at ".aggregate(")
-   (should (eq (car (python-indent-context)) 'after-backslash))
+   (should (eq (car (python-indent-context))
+               :after-backslash-dotted-continuation))
    (should (= (python-indent-calculate-indentation) 23))
    (python-tests-look-at "Sum('amount')")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 27))
    (python-tests-look-at ") \\\\")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren))
    (should (= (python-indent-calculate-indentation) 23))
    (python-tests-look-at ".values_list()")
-   (should (eq (car (python-indent-context)) 'after-backslash))
+   (should (eq (car (python-indent-context))
+               :after-backslash-dotted-continuation))
    (should (= (python-indent-calculate-indentation) 23))
    (forward-line 1)
-   (should (eq (car (python-indent-context)) 'after-line))
+   (should (eq (car (python-indent-context)) :after-line))
    (should (= (python-indent-calculate-indentation) 0))))
 
+(ert-deftest python-indent-after-backslash-3 ()
+  "Backslash continuation from block start."
+  (python-tests-with-temp-buffer
+   "
+with open('/path/to/some/file/you/want/to/read') as file_1, \\\\
+     open('/path/to/some/file/being/written', 'w') as file_2:
+    file_2.write(file_1.read())
+"
+   (python-tests-look-at
+    "with open('/path/to/some/file/you/want/to/read') as file_1, \\\\")
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (python-tests-look-at
+    "open('/path/to/some/file/being/written', 'w') as file_2")
+   (should (eq (car (python-indent-context))
+               :after-backslash-block-continuation))
+   (should (= (python-indent-calculate-indentation) 5))
+   (python-tests-look-at "file_2.write(file_1.read())")
+   (should (eq (car (python-indent-context)) :after-block-start))
+   (should (= (python-indent-calculate-indentation) 4))))
+
+(ert-deftest python-indent-after-backslash-4 ()
+  "Backslash continuation from assignment."
+  (python-tests-with-temp-buffer
+   "
+super_awful_assignment = some_calculation() and \\\\
+                         another_calculation() and \\\\
+                         some_final_calculation()
+"
+   (python-tests-look-at
+    "super_awful_assignment = some_calculation() and \\\\")
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (python-tests-look-at "another_calculation() and \\\\")
+   (should (eq (car (python-indent-context))
+               :after-backslash-assignment-continuation))
+   (should (= (python-indent-calculate-indentation) 25))
+   (python-tests-look-at "some_final_calculation()")
+   (should (eq (car (python-indent-context)) :after-backslash))
+   (should (= (python-indent-calculate-indentation) 25))))
+
+(ert-deftest python-indent-after-backslash-5 ()
+  "Dotted continuation bizarre example."
+  (python-tests-with-temp-buffer
+   "
+def delete_all_things():
+    Thing \\\\
+        .objects.all() \\\\
+                .delete()
+"
+   (python-tests-look-at "Thing \\\\")
+   (should (eq (car (python-indent-context)) :after-block-start))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at ".objects.all() \\\\")
+   (should (eq (car (python-indent-context)) :after-backslash-first-line))
+   (should (= (python-indent-calculate-indentation) 8))
+   (python-tests-look-at ".delete()")
+   (should (eq (car (python-indent-context))
+               :after-backslash-dotted-continuation))
+   (should (= (python-indent-calculate-indentation) 16))))
+
 (ert-deftest python-indent-block-enders-1 ()
   "Test de-indentation for pass keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 Class foo(object):
 
     def bar(self):
@@ -516,17 +700,18 @@ Class foo(object):
         else:
             pass
 "
-    (python-tests-look-at "3)")
-    (forward-line 1)
-    (should (= (python-indent-calculate-indentation) 8))
-    (python-tests-look-at "pass")
-    (forward-line 1)
-    (should (= (python-indent-calculate-indentation) 8))))
+   (python-tests-look-at "3)")
+   (forward-line 1)
+   (should (= (python-indent-calculate-indentation) 8))
+   (python-tests-look-at "pass")
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :after-block-end))
+   (should (= (python-indent-calculate-indentation) 8))))
 
 (ert-deftest python-indent-block-enders-2 ()
   "Test de-indentation for return keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 Class foo(object):
     '''raise lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
 
@@ -539,64 +724,68 @@ Class foo(object):
                     2,
                     3)
 "
-    (python-tests-look-at "def")
-    (should (= (python-indent-calculate-indentation) 4))
-    (python-tests-look-at "if")
-    (should (= (python-indent-calculate-indentation) 8))
-    (python-tests-look-at "return")
-    (should (= (python-indent-calculate-indentation) 12))
-    (goto-char (point-max))
-    (should (= (python-indent-calculate-indentation) 8))))
+   (python-tests-look-at "def")
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "if")
+   (should (= (python-indent-calculate-indentation) 8))
+   (python-tests-look-at "return")
+   (should (= (python-indent-calculate-indentation) 12))
+   (goto-char (point-max))
+   (should (eq (car (python-indent-context)) :after-block-end))
+   (should (= (python-indent-calculate-indentation) 8))))
 
 (ert-deftest python-indent-block-enders-3 ()
   "Test de-indentation for continue keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 for element in lst:
     if element is None:
         continue
 "
-    (python-tests-look-at "if")
-    (should (= (python-indent-calculate-indentation) 4))
-    (python-tests-look-at "continue")
-    (should (= (python-indent-calculate-indentation) 8))
-    (forward-line 1)
-    (should (= (python-indent-calculate-indentation) 4))))
+   (python-tests-look-at "if")
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "continue")
+   (should (= (python-indent-calculate-indentation) 8))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :after-block-end))
+   (should (= (python-indent-calculate-indentation) 4))))
 
 (ert-deftest python-indent-block-enders-4 ()
   "Test de-indentation for break keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 for element in lst:
     if element is None:
         break
 "
-    (python-tests-look-at "if")
-    (should (= (python-indent-calculate-indentation) 4))
-    (python-tests-look-at "break")
-    (should (= (python-indent-calculate-indentation) 8))
-    (forward-line 1)
-    (should (= (python-indent-calculate-indentation) 4))))
+   (python-tests-look-at "if")
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "break")
+   (should (= (python-indent-calculate-indentation) 8))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :after-block-end))
+   (should (= (python-indent-calculate-indentation) 4))))
 
 (ert-deftest python-indent-block-enders-5 ()
   "Test de-indentation for raise keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 for element in lst:
     if element is None:
         raise ValueError('Element cannot be None')
 "
-    (python-tests-look-at "if")
-    (should (= (python-indent-calculate-indentation) 4))
-    (python-tests-look-at "raise")
-    (should (= (python-indent-calculate-indentation) 8))
-    (forward-line 1)
-    (should (= (python-indent-calculate-indentation) 4))))
+   (python-tests-look-at "if")
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "raise")
+   (should (= (python-indent-calculate-indentation) 8))
+   (forward-line 1)
+   (should (eq (car (python-indent-context)) :after-block-end))
+   (should (= (python-indent-calculate-indentation) 4))))
 
 (ert-deftest python-indent-dedenters-1 ()
   "Test de-indentation for the elif keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 if save:
     try:
         write_to_disk(data)
@@ -604,15 +793,15 @@ if save:
         cleanup()
         elif
 "
-    (python-tests-look-at "elif\n")
-    (should (eq (car (python-indent-context)) 'dedenter-statement))
-    (should (= (python-indent-calculate-indentation) 0))
-    (should (equal (python-indent-calculate-levels) '(0)))))
+   (python-tests-look-at "elif\n")
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 0))
+   (should (= (python-indent-calculate-indentation t) 0))))
 
 (ert-deftest python-indent-dedenters-2 ()
   "Test de-indentation for the else keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 if save:
     try:
         write_to_disk(data)
@@ -627,43 +816,50 @@ if save:
     finally:
         data.free()
 "
-    (python-tests-look-at "else\n")
-    (should (eq (car (python-indent-context)) 'dedenter-statement))
-    (should (= (python-indent-calculate-indentation) 8))
-    (should (equal (python-indent-calculate-levels) '(0 4 8)))))
+   (python-tests-look-at "else\n")
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 8))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation t) 4))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation t) 0))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation t) 8))))
 
 (ert-deftest python-indent-dedenters-3 ()
   "Test de-indentation for the except keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 if save:
     try:
         write_to_disk(data)
         except
 "
-    (python-tests-look-at "except\n")
-    (should (eq (car (python-indent-context)) 'dedenter-statement))
-    (should (= (python-indent-calculate-indentation) 4))
-    (should (equal (python-indent-calculate-levels) '(4)))))
+   (python-tests-look-at "except\n")
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation t) 4))))
 
 (ert-deftest python-indent-dedenters-4 ()
   "Test de-indentation for the finally keyword."
   (python-tests-with-temp-buffer
-      "
+   "
 if save:
     try:
         write_to_disk(data)
         finally
 "
-    (python-tests-look-at "finally\n")
-    (should (eq (car (python-indent-context)) 'dedenter-statement))
-    (should (= (python-indent-calculate-indentation) 4))
-    (should (equal (python-indent-calculate-levels) '(4)))))
+   (python-tests-look-at "finally\n")
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation) 4))))
 
 (ert-deftest python-indent-dedenters-5 ()
   "Test invalid levels are skipped in a complex example."
   (python-tests-with-temp-buffer
-      "
+   "
 if save:
     try:
         write_to_disk(data)
@@ -676,29 +872,31 @@ if save:
             do_cleanup()
         else
 "
-    (python-tests-look-at "else\n")
-    (should (eq (car (python-indent-context)) 'dedenter-statement))
-    (should (= (python-indent-calculate-indentation) 8))
-    (should (equal (python-indent-calculate-levels) '(0 8)))))
+   (python-tests-look-at "else\n")
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 8))
+   (should (= (python-indent-calculate-indentation t) 0))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation t) 8))))
 
 (ert-deftest python-indent-dedenters-6 ()
   "Test indentation is zero when no opening block for dedenter."
   (python-tests-with-temp-buffer
-      "
+   "
 try:
     # if save:
         write_to_disk(data)
         else
 "
-    (python-tests-look-at "else\n")
-    (should (eq (car (python-indent-context)) 'dedenter-statement))
-    (should (= (python-indent-calculate-indentation) 0))
-    (should (equal (python-indent-calculate-levels) '(0)))))
+   (python-tests-look-at "else\n")
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 0))
+   (should (= (python-indent-calculate-indentation t) 0))))
 
 (ert-deftest python-indent-dedenters-7 ()
   "Test indentation case from Bug#15163."
   (python-tests-with-temp-buffer
-      "
+   "
 if a:
     if b:
         pass
@@ -706,10 +904,10 @@ if a:
         pass
         else:
 "
-    (python-tests-look-at "else:" 2)
-    (should (eq (car (python-indent-context)) 'dedenter-statement))
-    (should (= (python-indent-calculate-indentation) 0))
-    (should (equal (python-indent-calculate-levels) '(0)))))
+   (python-tests-look-at "else:" 2)
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 0))
+   (should (= (python-indent-calculate-indentation t) 0))))
 
 (ert-deftest python-indent-dedenters-8 ()
   "Test indentation for Bug#18432."
@@ -721,10 +919,99 @@ if (a == 1 or
 elif (a == 3 or
 a == 4):
 "
+   (python-tests-look-at "elif (a == 3 or")
+   (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+   (should (= (python-indent-calculate-indentation) 0))
+   (should (= (python-indent-calculate-indentation t) 0))
    (python-tests-look-at "a == 4):\n")
-   (should (eq (car (python-indent-context)) 'inside-paren))
+   (should (eq (car (python-indent-context)) :inside-paren))
    (should (= (python-indent-calculate-indentation) 6))
-   (should (equal (python-indent-calculate-levels) '(0 4 6)))))
+   (python-indent-line)
+   (should (= (python-indent-calculate-indentation t) 4))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation t) 0))
+   (python-indent-line t)
+   (should (= (python-indent-calculate-indentation t) 6))))
+
+(ert-deftest python-indent-inside-string-1 ()
+  "Test indentation for strings."
+  (python-tests-with-temp-buffer
+   "
+multiline = '''
+bunch
+of
+lines
+'''
+"
+   (python-tests-look-at "multiline = '''")
+   (should (eq (car (python-indent-context)) :after-line))
+   (should (= (python-indent-calculate-indentation) 0))
+   (python-tests-look-at "bunch")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 0))
+   (python-tests-look-at "of")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 0))
+   (python-tests-look-at "lines")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 0))
+   (python-tests-look-at "'''")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 0))))
+
+(ert-deftest python-indent-inside-string-2 ()
+  "Test indentation for docstrings."
+  (python-tests-with-temp-buffer
+   "
+def fn(a, b, c=True):
+    '''docstring
+    bunch
+    of
+    lines
+    '''
+"
+   (python-tests-look-at "'''docstring")
+   (should (eq (car (python-indent-context)) :after-block-start))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "bunch")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "of")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "lines")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "'''")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))))
+
+(ert-deftest python-indent-inside-string-3 ()
+  "Test indentation for nested strings."
+  (python-tests-with-temp-buffer
+   "
+def fn(a, b, c=True):
+    some_var = '''
+    bunch
+    of
+    lines
+    '''
+"
+   (python-tests-look-at "some_var = '''")
+   (should (eq (car (python-indent-context)) :after-block-start))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "bunch")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "of")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "lines")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "'''")
+   (should (eq (car (python-indent-context)) :inside-string))
+   (should (= (python-indent-calculate-indentation) 4))))
 
 (ert-deftest python-indent-electric-colon-1 ()
   "Test indentation case from Bug#18228."
@@ -1802,6 +2089,23 @@ def f():
    (python-nav-backward-up-list)
    (should (looking-at "def f():"))))
 
+(ert-deftest python-indent-dedent-line-backspace-1 ()
+  "Check de-indentation on first call.  Bug#18319."
+  (python-tests-with-temp-buffer
+   "
+if True:
+    x ()
+    if False:
+"
+   (python-tests-look-at "if False:")
+   (call-interactively #'python-indent-dedent-line-backspace)
+   (should (zerop (current-indentation)))
+   ;; XXX: This should be a call to `undo' but it's triggering errors.
+   (insert "    ")
+   (should (= (current-indentation) 4))
+   (call-interactively #'python-indent-dedent-line-backspace)
+   (should (zerop (current-indentation)))))
+
 \f
 ;;; Shell integration
 
index 31a4ee958c6f584df052af8162ca432f09b39b5d..ee177b3e2e9a6543bab7aabb045ac5783f167ee3 100644 (file)
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'regexp-opt)
+
 (ert-deftest regexp-test-regexp-opt ()
   "Test the `compilation-error-regexp-alist' regexps.
 The test data is in `compile-tests--test-regexps-data'."