------------------------------------------------------------ revno: 115739 committer: Tassilo Horn branch nick: trunk timestamp: Wed 2013-12-25 10:12:24 +0100 message: Rephrase lexical binding requirement sentence. * doc/lispref/control.texi (Pattern matching case statement): Rephrase lexical binding requirement: the example needs it, not `pcase' itself. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-12-25 03:05:11 +0000 +++ doc/lispref/ChangeLog 2013-12-25 09:12:24 +0000 @@ -1,3 +1,8 @@ +2013-12-25 Tassilo Horn + + * control.texi (Pattern matching case statement): Rephrase lexical + binding requirement: the example needs it, not `pcase' itself. + 2013-12-25 Chong Yidong * eval.texi (Eval): Document the LEXICAL arg to eval. === modified file 'doc/lispref/control.texi' --- doc/lispref/control.texi 2013-12-24 15:30:59 +0000 +++ doc/lispref/control.texi 2013-12-25 09:12:24 +0000 @@ -342,19 +342,20 @@ @code{(pred numberp)} is a pattern that simply checks that @code{exp} is a number, and @code{_} is the catch-all pattern that matches anything. +Note that the the lambda being the result of the @code{fn} clause is a +closure (@pxref{Closures}), so the file defining @code{evaluate} must +have lexical binding enabled (@pxref{Using Lexical Binding}, for how +to enable it). + Here are some sample programs including their evaluation results: @example (evaluate '(add 1 2) nil) ;=> 3 (evaluate '(add x y) '((x . 1) (y . 2))) ;=> 3 (evaluate '(call (fn x (add 1 x)) 2) nil) ;=> 3 -(evaluate '(sub 1 2) nil) ;=> (error "Unknown expression (sub 1 2)") +(evaluate '(sub 1 2) nil) ;=> error @end example -Note that (parts of) @code{pcase} only work as expected with lexical -binding, so lisp files using @code{pcase} should have enable it -(@pxref{Using Lexical Binding}, for how to enable lexical binding). - There are two kinds of patterns involved in @code{pcase}, called @emph{U-patterns} and @emph{Q-patterns}. The @var{upattern} mentioned above are U-patterns and can take the following forms: ------------------------------------------------------------ revno: 115738 committer: Chong Yidong branch nick: trunk timestamp: Wed 2013-12-25 11:05:11 +0800 message: Document `eval' changes. * doc/lispref/eval.texi (Eval): Document the LEXICAL arg to eval. * doc/lispref/variables.texi (Variables, Void Variables): Use "scoping rule" terminology consistently. (Variable Scoping): Add index entries, and use "dynamic scope" terminology in place of "indefinite scope" to reduce confusion. (Lexical Binding): Document lexical environment format. (Using Lexical Binding): Add index entries for error messages. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-12-24 15:30:59 +0000 +++ doc/lispref/ChangeLog 2013-12-25 03:05:11 +0000 @@ -1,3 +1,14 @@ +2013-12-25 Chong Yidong + + * eval.texi (Eval): Document the LEXICAL arg to eval. + + * variables.texi (Variables, Void Variables): Use "scoping rule" + terminology consistently. + (Variable Scoping): Add index entries, and use "dynamic scope" + terminology in place of "indefinite scope" to reduce confusion. + (Lexical Binding): Document lexical environment format. + (Using Lexical Binding): Add index entries for error messages. + 2013-12-24 Tassilo Horn * control.texi (Pattern matching case statement): Fix missing === modified file 'doc/lispref/eval.texi' --- doc/lispref/eval.texi 2013-12-23 11:27:29 +0000 +++ doc/lispref/eval.texi 2013-12-25 03:05:11 +0000 @@ -715,12 +715,18 @@ @defun eval form &optional lexical This is the basic function for evaluating an expression. It evaluates -@var{form} in the current environment and returns the result. How the -evaluation proceeds depends on the type of the object (@pxref{Forms}). +@var{form} in the current environment, and returns the result. The +type of the @var{form} object determines how it is evaluated. +@xref{Forms}. -The argument @var{lexical}, if non-@code{nil}, means to evaluate -@var{form} using lexical scoping rules for variables, instead of the -default dynamic scoping rules. @xref{Lexical Binding}. +The argument @var{lexical} specifies the scoping rule for local +variables (@pxref{Variable Scoping}). If it is omitted or @code{nil}, +that means to evaluate @var{form} using the default dynamic scoping +rule. If it is @code{t}, that means to use the lexical scoping rule. +The value of @var{lexical} can also be a non-empty alist specifying a +particular @dfn{lexical environment} for lexical bindings; however, +this feature is only useful for specialized purposes, such as in Emacs +Lisp debuggers. @xref{Lexical Binding}. Since @code{eval} is a function, the argument expression that appears in a call to @code{eval} is evaluated twice: once as preparation before === modified file 'doc/lispref/variables.texi' --- doc/lispref/variables.texi 2013-12-22 06:15:17 +0000 +++ doc/lispref/variables.texi 2013-12-25 03:05:11 +0000 @@ -10,10 +10,10 @@ In Lisp, each variable is represented by a Lisp symbol (@pxref{Symbols}). The variable name is simply the symbol's name, and the variable's value is stored in the symbol's value cell@footnote{To -be precise, under the default @dfn{dynamic binding} rules the value +be precise, under the default @dfn{dynamic scoping} rule, the value cell always holds the variable's current value, but this is not the -case under @dfn{lexical binding} rules. @xref{Variable Scoping}, for -details.}. @xref{Symbol Components}. In Emacs Lisp, the use of a +case under the @dfn{lexical scoping} rule. @xref{Variable Scoping}, +for details.}. @xref{Symbol Components}. In Emacs Lisp, the use of a symbol as a variable is independent of its use as a function name. As previously noted in this manual, a Lisp program is represented @@ -292,20 +292,22 @@ @cindex void variable We say that a variable is void if its symbol has an unassigned value -cell (@pxref{Symbol Components}). Under Emacs Lisp's default dynamic -binding rules (@pxref{Variable Scoping}), the value cell stores the -variable's current (local or global) value. Note that an unassigned -value cell is @emph{not} the same as having @code{nil} in the value -cell. The symbol @code{nil} is a Lisp object and can be the value of -a variable, just as any other object can be; but it is still a value. -If a variable is void, trying to evaluate the variable signals a -@code{void-variable} error rather than a value. - - Under lexical binding rules, the value cell only holds the -variable's global value, i.e., the value outside of any lexical -binding construct. When a variable is lexically bound, the local value -is determined by the lexical environment; the variable may have a -local value if its symbol's value cell is unassigned. +cell (@pxref{Symbol Components}). + + Under Emacs Lisp's default dynamic scoping rule (@pxref{Variable +Scoping}), the value cell stores the variable's current (local or +global) value. Note that an unassigned value cell is @emph{not} the +same as having @code{nil} in the value cell. The symbol @code{nil} is +a Lisp object and can be the value of a variable, just as any other +object can be; but it is still a value. If a variable is void, trying +to evaluate the variable signals a @code{void-variable} error, instead +of returning a value. + + Under the optional lexical scoping rule, the value cell only holds +the variable's global value---the value outside of any lexical binding +construct. When a variable is lexically bound, the local value is +determined by the lexical environment; hence, variables can have local +values even if their symbols' value cells are unassigned. @defun makunbound symbol This function empties out the value cell of @var{symbol}, making the @@ -761,6 +763,7 @@ @node Variable Scoping @section Scoping Rules for Variable Bindings +@cindex scoping rule When you create a local binding for a variable, that binding takes effect only within a limited portion of the program (@pxref{Local @@ -774,12 +777,12 @@ program is executing, the binding exists. @cindex dynamic binding -@cindex indefinite scope +@cindex dynamic scope @cindex dynamic extent By default, the local bindings that Emacs creates are @dfn{dynamic -bindings}. Such a binding has @dfn{indefinite scope}, meaning that -any part of the program can potentially access the variable binding. -It also has @dfn{dynamic extent}, meaning that the binding lasts only +bindings}. Such a binding has @dfn{dynamic scope}, meaning that any +part of the program can potentially access the variable binding. It +also has @dfn{dynamic extent}, meaning that the binding lasts only while the binding construct (such as the body of a @code{let} form) is being executed. @@ -788,11 +791,12 @@ @cindex indefinite extent Emacs can optionally create @dfn{lexical bindings}. A lexical binding has @dfn{lexical scope}, meaning that any reference to the -variable must be located textually within the binding construct. It -also has @dfn{indefinite extent}, meaning that under some -circumstances the binding can live on even after the binding construct -has finished executing, by means of special objects called -@dfn{closures}. +variable must be located textually within the binding +construct@footnote{With some exceptions; for instance, a lexical +binding can also be accessed from the Lisp debugger.}. It also has +@dfn{indefinite extent}, meaning that under some circumstances the +binding can live on even after the binding construct has finished +executing, by means of special objects called @dfn{closures}. The following subsections describe dynamic binding and lexical binding in greater detail, and how to enable lexical binding in Emacs @@ -814,8 +818,8 @@ recently-created dynamic local binding for that symbol, or the global binding if there is no such local binding. - Dynamic bindings have indefinite scope and dynamic extent, as shown -by the following example: + Dynamic bindings have dynamic scope and extent, as shown by the +following example: @example @group @@ -841,9 +845,9 @@ reference, in the sense that there is no binding for @code{x} within that @code{defun} construct itself. When we call @code{getx} from within a @code{let} form in which @code{x} is (dynamically) bound, it -retrieves the local value of @code{x} (i.e., 1). But when we call -@code{getx} outside the @code{let} form, it retrieves the global value -of @code{x} (i.e., -99). +retrieves the local value (i.e., 1). But when we call @code{getx} +outside the @code{let} form, it retrieves the global value (i.e., +-99). Here is another example, which illustrates setting a dynamically bound variable using @code{setq}: @@ -888,12 +892,11 @@ @itemize @bullet @item If a variable has no global definition, use it as a local variable -only within a binding construct, e.g., the body of the @code{let} -form where the variable was bound, or the body of the function for an -argument variable. If this convention is followed consistently -throughout a program, the value of the variable will not affect, nor -be affected by, any uses of the same variable symbol elsewhere in the -program. +only within a binding construct, such as the body of the @code{let} +form where the variable was bound. If this convention is followed +consistently throughout a program, the value of the variable will not +affect, nor be affected by, any uses of the same variable symbol +elsewhere in the program. @item Otherwise, define the variable with @code{defvar}, @code{defconst}, or @@ -925,12 +928,16 @@ @node Lexical Binding @subsection Lexical Binding -Optionally, you can create lexical bindings in Emacs Lisp. A -lexically bound variable has @dfn{lexical scope}, meaning that any + Lexical binding was introduced to Emacs, as an optional feature, in +version 24.1. We expect its importance to increase in the future. +Lexical binding opens up many more opportunities for optimization, so +programs using it are likely to run faster in future Emacs versions. +Lexical binding is also more compatible with concurrency, which we +want to add to Emacs in the future. + + A lexically-bound variable has @dfn{lexical scope}, meaning that any reference to the variable must be located textually within the binding -construct. - - Here is an example +construct. Here is an example @iftex (see the next subsection, for how to actually enable lexical binding): @end iftex @@ -969,6 +976,14 @@ environment; if the variable is not specified in there, it looks in the symbol's value cell, where the dynamic value is stored. + (Internally, the lexical environment is an alist of symbol-value +pairs, with the final element in the alist being the symbol @code{t} +rather than a cons cell. Such an alist can be passed as the second +argument to the @code{eval} function, in order to specify a lexical +environment in which to evaluate a form. @xref{Eval}. Most Emacs +Lisp programs, however, should not interact directly with lexical +environments in this way; only specialized programs like debuggers.) + @cindex closures, example of using Lexical bindings have indefinite extent. Even after a binding construct has finished executing, its lexical environment can be @@ -1019,13 +1034,6 @@ the body of a @code{defun} or @code{defmacro} cannot refer to surrounding lexical variables. - Currently, lexical binding is not much used within the Emacs -sources. However, we expect its importance to increase in the future. -Lexical binding opens up a lot more opportunities for optimization, so -Emacs Lisp code that makes use of lexical binding is likely to run -faster in future Emacs versions. Such code is also much more friendly -to concurrency, which we want to add to Emacs in the near future. - @node Using Lexical Binding @subsection Using Lexical Binding @@ -1069,12 +1077,15 @@ binding mode is enabled (it may use lexical binding sometimes, and dynamic binding other times). - Converting an Emacs Lisp program to lexical binding is pretty easy. -First, add a file-local variable setting of @code{lexical-binding} to -@code{t} in the Emacs Lisp source file. Second, check that every -variable in the program which needs to be dynamically bound has a -variable definition, so that it is not inadvertently bound lexically. + Converting an Emacs Lisp program to lexical binding is easy. First, +add a file-local variable setting of @code{lexical-binding} to +@code{t} in the header line of the Emacs Lisp source file (@pxref{File +Local Variables}). Second, check that every variable in the program +which needs to be dynamically bound has a variable definition, so that +it is not inadvertently bound lexically. +@cindex free variable +@cindex unused lexical variable A simple way to find out which variables need a variable definition is to byte-compile the source file. @xref{Byte Compilation}. If a non-special variable is used outside of a @code{let} form, the === modified file 'etc/NEWS' --- etc/NEWS 2013-12-24 04:14:17 +0000 +++ etc/NEWS 2013-12-25 03:05:11 +0000 @@ -916,6 +916,7 @@ * Lisp Changes in Emacs 24.4 ++++ ** The second argument of `eval' can now specify a lexical environment. +++ ------------------------------------------------------------ revno: 115737 committer: Xue Fuqiao branch nick: trunk timestamp: Wed 2013-12-25 10:18:43 +0800 message: Doc fixes (index and comment). diff: === modified file 'admin/admin.el' --- admin/admin.el 2013-12-24 06:52:10 +0000 +++ admin/admin.el 2013-12-25 02:18:43 +0000 @@ -75,6 +75,9 @@ (interactive "DEmacs root directory: \nsVersion number: ") (unless (file-exists-p (expand-file-name "src/emacs.c" root)) (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) + ;; There's also a "version 3" (standing for GPLv3) at the end of + ;; `README', but since `set-version-in-file' only replaces the first + ;; occurence, it won't be replaced. (set-version-in-file root "README" version (rx (and "version" (1+ space) (submatch (1+ (in "0-9.")))))) === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-12-24 08:33:02 +0000 +++ doc/emacs/ChangeLog 2013-12-25 02:18:43 +0000 @@ -1,3 +1,7 @@ +2013-12-25 Xue Fuqiao + + * files.texi (Diff Mode): Add an index. + 2013-12-24 Xue Fuqiao * trouble.texi (Understanding Bug Reporting): Minor update. === modified file 'doc/emacs/files.texi' --- doc/emacs/files.texi 2013-12-22 05:20:03 +0000 +++ doc/emacs/files.texi 2013-12-25 02:18:43 +0000 @@ -1419,6 +1419,7 @@ @item C-c C-a @findex diff-apply-hunk +@cindex patches, applying Apply this hunk to its target file (@code{diff-apply-hunk}). With a prefix argument of @kbd{C-u}, revert this hunk. ------------------------------------------------------------ revno: 115736 fixes bug: http://debbugs.gnu.org/15295 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Tue 2013-12-24 16:48:40 -0300 message: * lisp/progmodes/python.el (python-nav-beginning-of-statement): Speed up. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-24 18:07:55 +0000 +++ lisp/ChangeLog 2013-12-24 19:48:40 +0000 @@ -1,3 +1,8 @@ +2013-12-24 Fabián Ezequiel Gallina + + * progmodes/python.el (python-nav-beginning-of-statement): Speed + up (Bug#15295). + 2013-12-24 Lars Ingebrigtsen * net/eww.el (eww-bookmark-browse): Use `quit-window' to restore === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2013-12-13 00:56:12 +0000 +++ lisp/progmodes/python.el 2013-12-24 19:48:40 +0000 @@ -1279,15 +1279,21 @@ (defun python-nav-beginning-of-statement () "Move to start of current statement." (interactive "^") - (while (and (or (back-to-indentation) t) - (not (bobp)) - (when (or - (save-excursion - (forward-line -1) - (python-info-line-ends-backslash-p)) - (python-syntax-context 'string) - (python-syntax-context 'paren)) - (forward-line -1)))) + (back-to-indentation) + (let* ((ppss (syntax-ppss)) + (context-point + (or + (python-syntax-context 'paren ppss) + (python-syntax-context 'string ppss)))) + (cond ((bobp)) + (context-point + (goto-char context-point) + (python-nav-beginning-of-statement)) + ((save-excursion + (forward-line -1) + (python-info-line-ends-backslash-p)) + (forward-line -1) + (python-nav-beginning-of-statement)))) (point-marker)) (defun python-nav-end-of-statement (&optional noend) ------------------------------------------------------------ revno: 115735 committer: Paul Eggert branch nick: trunk timestamp: Tue 2013-12-24 10:27:53 -0800 message: Automate the procedure for updating copyright year. * admin/merge-gnulib (GNULIB_MODULES): Add update-copyright. * admin/notes/years: Mention admin/update-copyright. * admin/update-copyright: New file. * build-aux/update-copyright: New file. * make-dist: Distribute it. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * msdos/autogen/Makefile.in: Update copyright year. diff: === modified file 'ChangeLog' --- ChangeLog 2013-12-23 15:13:14 +0000 +++ ChangeLog 2013-12-24 18:27:53 +0000 @@ -1,3 +1,11 @@ +2013-12-24 Paul Eggert + + Automate the procedure for updating copyright year. + * build-aux/update-copyright: New file. + * make-dist: Distribute it. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + * msdos/autogen/Makefile.in: Update copyright year. + 2013-12-23 Andreas Schwab * configure.ac: Replace obsolete macro AC_CONFIG_HEADER by === modified file 'admin/ChangeLog' --- admin/ChangeLog 2013-12-24 04:41:18 +0000 +++ admin/ChangeLog 2013-12-24 18:27:53 +0000 @@ -1,3 +1,10 @@ +2013-12-24 Paul Eggert + + Automate the procedure for updating copyright year. + * merge-gnulib (GNULIB_MODULES): Add update-copyright. + * notes/years: Mention admin/update-copyright. + * update-copyright: New file. + 2013-12-24 Xue Fuqiao * admin.el (add-release-logs): === modified file 'admin/merge-gnulib' --- admin/merge-gnulib 2013-12-11 05:37:30 +0000 +++ admin/merge-gnulib 2013-12-24 18:27:53 +0000 @@ -37,7 +37,8 @@ pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat - sys_time time timer-time timespec-add timespec-sub unsetenv utimens + sys_time time timer-time timespec-add timespec-sub + unsetenv update-copyright utimens warnings ' === modified file 'admin/notes/years' --- admin/notes/years 2011-04-26 04:45:37 +0000 +++ admin/notes/years 2013-12-24 18:27:53 +0000 @@ -2,6 +2,8 @@ Maintaining copyright years is now very simple: every time a new year rolls around, add that year to every FSF (and AIST) copyright notice. +Do this by running the 'admin/update-copyright' script on a fresh bzr +checkout. Inspect the results for plausiblity, then commit them. There's no need to worry about whether an individual file has changed in a given year - it's sufficient that Emacs as a whole has changed. @@ -28,10 +30,10 @@ since Emacs 21 came out in 2001, all the subsequent years[1]. We don't need to check whether *that file* was changed in those years. It's sufficient that *Emacs* was changed in those years (and it was!). - + For those files that have been added since then, we should add the year it was added to Emacs, and all subsequent years." - + --RMS, 2005-07-13 [1] Note that this includes 2001 - see === added file 'admin/update-copyright' --- admin/update-copyright 1970-01-01 00:00:00 +0000 +++ admin/update-copyright 2013-12-24 18:27:53 +0000 @@ -0,0 +1,75 @@ +#! /bin/sh +# Update the copyright dates in Emacs sources. +# Typical usage: +# +# admin/update-copyright +# +# By default, this script uses the local-time calendar year. +# Set the UPDATE_COPYRIGHT_YEAR environment variable to override the default. + +# Copyright 2013 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 . + +# written by Paul Eggert + +# FIXME: The file 'notes/copyright' says that the AIST copyright years +# should be updated, but by inspection it appears that some should be +# updated and some should not be, due to registration numbers, so +# this script leaves these copyright years alone for now. + +: ${UPDATE_COPYRIGHT_USE_INTERVALS=1} +export UPDATE_COPYRIGHT_USE_INTERVALS + +: ${UPDATE_COPYRIGHT_YEAR=$(date +%Y)} +export UPDATE_COPYRIGHT_YEAR + +emacsver=etc/refcards/emacsver.tex +sed 's/\\def\\year[{][0-9]*[}]/\\def\\year{'"$UPDATE_COPYRIGHT_YEAR"'}'/g \ + $emacsver >$emacsver.aux && +{ cmp -s $emacsver $emacsver.aux || + cp $emacsver.aux $emacsver +} && +rm $emacsver.aux && + +bzr_files=$(bzr ls -RV --kind file) && + +# Do not update the copyright of files that have one or more of the +# following problems: +# . They are license files, maintained by the FSF, with their own dates. +# . Their format cannot withstand changing the contents of copyright strings. + +updatable_files=$(find $bzr_files \ + ! -name COPYING \ + ! -name doclicense.texi \ + ! -name gpl.texi \ + ! -name '*-gzipped' \ + ! -name '*.ico' \ + ! -name '*.icns' \ + ! -name '*.pbm' \ + ! -name '*.pdf' \ + ! -name '*.png' \ + ! -name '*.sig' \ + ! -name '*.tar' \ + ! -name '*.tiff' \ + ! -name '*.xpm' \ + ! -name eterm-color \ + ! -name hand.cur \ + ! -name key.pub \ + ! -name key.sec \ + -print) && + +build-aux/update-copyright $updatable_files === added file 'build-aux/update-copyright' --- build-aux/update-copyright 1970-01-01 00:00:00 +0000 +++ build-aux/update-copyright 2013-12-24 18:27:53 +0000 @@ -0,0 +1,274 @@ +eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}' + & eval 'exec perl -wS -0777 -pi "$0" $argv:q' + if 0; +# Update an FSF copyright year list to include the current year. + +my $VERSION = '2013-01-03.09:41'; # UTC + +# Copyright (C) 2009-2013 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 . + +# Written by Jim Meyering and Joel E. Denny + +# The arguments to this script should be names of files that contain +# copyright statements to be updated. The copyright holder's name +# defaults to "Free Software Foundation, Inc." but may be changed to +# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment +# variable. +# +# For example, you might wish to use the update-copyright target rule +# in maint.mk from gnulib's maintainer-makefile module. +# +# Iff a copyright statement is recognized in a file and the final +# year is not the current year, then the statement is updated for the +# new year and it is reformatted to: +# +# 1. Fit within 72 columns. +# 2. Convert 2-digit years to 4-digit years by prepending "19". +# 3. Expand copyright year intervals. (See "Environment variables" +# below.) +# +# A warning is printed for every file for which no copyright +# statement is recognized. +# +# Each file's copyright statement must be formatted correctly in +# order to be recognized. For example, each of these is fine: +# +# Copyright @copyright{} 1990-2005, 2007-2009 Free Software +# Foundation, Inc. +# +# # Copyright (C) 1990-2005, 2007-2009 Free Software +# # Foundation, Inc. +# +# /* +# * Copyright © 90,2005,2007-2009 +# * Free Software Foundation, Inc. +# */ +# +# However, the following format is not recognized because the line +# prefix changes after the first line: +# +# ## Copyright (C) 1990-2005, 2007-2009 Free Software +# # Foundation, Inc. +# +# However, any correctly formatted copyright statement following +# a non-matching copyright statements would be recognized. +# +# The exact conditions that a file's copyright statement must meet +# to be recognized are: +# +# 1. It is the first copyright statement that meets all of the +# following conditions. Subsequent copyright statements are +# ignored. +# 2. Its format is "Copyright (C)", then a list of copyright years, +# and then the name of the copyright holder. +# 3. The "(C)" takes one of the following forms or is omitted +# entirely: +# +# A. (C) +# B. (c) +# C. @copyright{} +# D. © +# +# 4. The "Copyright" appears at the beginning of a line, except that it +# may be prefixed by any sequence (e.g., a comment) of no more than +# 5 characters -- including white space. +# 5. Iff such a prefix is present, the same prefix appears at the +# beginning of each remaining line within the FSF copyright +# statement. There is one exception in order to support C-style +# comments: if the first line's prefix contains nothing but +# whitespace surrounding a "/*", then the prefix for all subsequent +# lines is the same as the first line's prefix except with each of +# "/" and possibly "*" replaced by a " ". The replacement of "*" +# by " " is consistent throughout all subsequent lines. +# 6. Blank lines, even if preceded by the prefix, do not appear +# within the FSF copyright statement. +# 7. Each copyright year is 2 or 4 digits, and years are separated by +# commas or dashes. Whitespace may appear after commas. +# +# Environment variables: +# +# 1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement +# is reformatted even if it does not need updating for the new +# year. If unset or set to 0, only updated FSF copyright +# statements are reformatted. +# 2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive +# copyright years (such as 90, 1991, 1992-2007, 2008) in a +# reformatted FSF copyright statement is collapsed to a single +# interval (such as 1990-2008). If unset or set to 0, all existing +# copyright year intervals in a reformatted FSF copyright statement +# are expanded instead. +# If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps +# to the minimal containing range. For example, convert +# 2000, 2004-2007, 2009 to 2000-2009. +# 3. For testing purposes, you can set the assumed current year in +# UPDATE_COPYRIGHT_YEAR. +# 4. The default maximum line length for a copyright line is 72. +# Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length. +# 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other +# than "Free Software Foundation, Inc.". + +use strict; +use warnings; + +my $copyright_re = 'Copyright'; +my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)'; +my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER}; +$holder ||= 'Free Software Foundation, Inc.'; +my $prefix_max = 5; +my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH}; +!$margin || $margin !~ m/^\d+$/ + and $margin = 72; + +my $tab_width = 8; + +my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR}; +if (!$this_year || $this_year !~ m/^\d{4}$/) + { + my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ()); + $this_year = $year + 1900; + } + +# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead. +my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n"; + +my $leading; +my $prefix; +my $ws_re; +my $stmt_re; +while (/(^|\n)(.{0,$prefix_max})$copyright_re/g) + { + $leading = "$1$2"; + $prefix = $2; + if ($prefix =~ /^(\s*\/)\*(\s*)$/) + { + $prefix =~ s,/, ,; + my $prefix_ws = $prefix; + $prefix_ws =~ s/\*/ /; # Only whitespace. + if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/) + { + $prefix = $prefix_ws; + } + } + $ws_re = '[ \t\r\f]'; # \s without \n + $ws_re = + "(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)"; + my $holder_re = $holder; + $holder_re =~ s/\s/$ws_re/g; + my $stmt_remainder_re = + "(?:$ws_re$circle_c_re)?" + . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*" + . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re"; + if (/\G$stmt_remainder_re/) + { + $stmt_re = + quotemeta($leading) . "($copyright_re$stmt_remainder_re)"; + last; + } + } +if (defined $stmt_re) + { + /$stmt_re/ or die; # Should never die. + my $stmt = $1; + my $final_year_orig = $2; + + # Handle two-digit year numbers like "98" and "99". + my $final_year = $final_year_orig; + $final_year <= 99 + and $final_year += 1900; + + if ($final_year != $this_year) + { + # Update the year. + $stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/; + } + if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'}) + { + # Normalize all whitespace including newline-prefix sequences. + $stmt =~ s/$ws_re/ /g; + + # Put spaces after commas. + $stmt =~ s/, ?/, /g; + + # Convert 2-digit to 4-digit years. + $stmt =~ s/(\b\d\d\b)/19$1/g; + + # Make the use of intervals consistent. + if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS}) + { + $stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg; + } + else + { + $stmt =~ + s/ + (\d{4}) + (?: + (,\ |-) + ((??{ + if ($2 eq '-') { '\d{4}'; } + elsif (!$3) { $1 + 1; } + else { $3 + 1; } + })) + )+ + /$1-$3/gx; + + # When it's 2, emit a single range encompassing all year numbers. + $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2 + and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/; + } + + # Format within margin. + my $stmt_wrapped; + my $text_margin = $margin - length($prefix); + if ($prefix =~ /^(\t+)/) + { + $text_margin -= length($1) * ($tab_width - 1); + } + while (length $stmt) + { + if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//) + || ($stmt =~ s/^([\S]+)(?: |$)//)) + { + my $line = $1; + $stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading; + $stmt_wrapped .= $line; + } + else + { + # Should be unreachable, but we don't want an infinite + # loop if it can be reached. + die; + } + } + + # Replace the old copyright statement. + s/$stmt_re/$stmt_wrapped/; + } + } +else + { + print STDERR "$ARGV: warning: copyright statement not found\n"; + } + +# Local variables: +# mode: perl +# indent-tabs-mode: nil +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "my $VERSION = '" +# time-stamp-format: "%:y-%02m-%02d.%02H:%02M" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "'; # UTC" +# End: === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2013-12-17 20:43:43 +0000 +++ lib/gnulib.mk 2013-12-24 18:27:53 +0000 @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv update-copyright utimens warnings MOSTLYCLEANFILES += core *.stackdump @@ -1802,6 +1802,13 @@ ## end gnulib module unsetenv +## begin gnulib module update-copyright + + +EXTRA_DIST += $(top_srcdir)/build-aux/update-copyright + +## end gnulib module update-copyright + ## begin gnulib module utimens libgnu_a_SOURCES += utimens.c === modified file 'm4/gnulib-comp.m4' --- m4/gnulib-comp.m4 2013-12-08 08:05:36 +0000 +++ m4/gnulib-comp.m4 2013-12-24 18:27:53 +0000 @@ -150,6 +150,7 @@ # Code from module u64: # Code from module unistd: # Code from module unsetenv: + # Code from module update-copyright: # Code from module utimens: # Code from module verify: # Code from module warnings: @@ -791,6 +792,7 @@ build-aux/snippet/arg-nonnull.h build-aux/snippet/c++defs.h build-aux/snippet/warn-on-use.h + build-aux/update-copyright lib/acl-errno-valid.c lib/acl-internal.h lib/acl.h === modified file 'make-dist' --- make-dist 2013-12-12 09:39:13 +0000 +++ make-dist 2013-12-24 18:27:53 +0000 @@ -344,7 +344,8 @@ echo "Making links to \`build-aux'" (cd build-aux ln compile config.guess config.sub depcomp msys-to-w32 ../${tempdir}/build-aux - ln install-sh missing move-if-change update-subdirs ../${tempdir}/build-aux + ln install-sh missing move-if-change ../${tempdir}/build-aux + ln update-copyright update-subdirs ../${tempdir}/build-aux ln dir_top make-info-dir ../${tempdir}/build-aux) echo "Making links to \`build-aux/snippet'" === modified file 'msdos/autogen/Makefile.in' --- msdos/autogen/Makefile.in 2013-11-05 07:54:03 +0000 +++ msdos/autogen/Makefile.in 2013-12-24 18:27:53 +0000 @@ -1,9 +1,7 @@ # Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2009, 2013 Free Software Foundation, Inc. # This Makefile.in 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. ------------------------------------------------------------ revno: 115734 committer: Lars Ingebrigtsen branch nick: trunk timestamp: Tue 2013-12-24 19:07:55 +0100 message: eww bookmark window restoration * net/eww.el (eww-bookmark-browse): Use `quit-window' to restore the window configuration. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-24 17:23:56 +0000 +++ lisp/ChangeLog 2013-12-24 18:07:55 +0000 @@ -1,3 +1,8 @@ +2013-12-24 Lars Ingebrigtsen + + * net/eww.el (eww-bookmark-browse): Use `quit-window' to restore + the window configuration. + 2013-12-24 Eli Zaretskii * net/eww.el (eww-open-file): Ensure 3 slashes after "file:" when === modified file 'lisp/net/eww.el' --- lisp/net/eww.el 2013-12-24 17:23:56 +0000 +++ lisp/net/eww.el 2013-12-24 18:07:55 +0000 @@ -1086,8 +1086,6 @@ ;;; Bookmarks code (defvar eww-bookmarks nil) -(defvar eww-previous-window-configuration nil) -(make-variable-buffer-local 'eww-previous-window-configuration) (defun eww-add-bookmark () "Add the current page to the bookmarks." @@ -1132,7 +1130,6 @@ (unless eww-bookmarks (user-error "No bookmarks are defined")) (set-buffer (get-buffer-create "*eww bookmarks*")) - (setq eww-previous-window-configuration (current-window-configuration)) (eww-bookmark-mode) (let ((format "%-40s %s") (inhibit-read-only t) @@ -1191,8 +1188,6 @@ (unless bookmark (user-error "No bookmark on the current line")) (quit-window) - (when eww-previous-window-configuration - (set-window-configuration eww-previous-window-configuration)) (eww-browse-url (plist-get bookmark :url)))) (defun eww-next-bookmark () ------------------------------------------------------------ revno: 115733 fixes bug: http://debbugs.gnu.org/16234 committer: Eli Zaretskii branch nick: trunk timestamp: Tue 2013-12-24 19:55:07 +0200 message: Attempt to catch backtrace of segfault in bug #16234. diff: === modified file 'src/intervals.c' --- src/intervals.c 2013-11-24 18:28:33 +0000 +++ src/intervals.c 2013-12-24 17:55:07 +0000 @@ -676,6 +676,7 @@ while (1) { + eassert (tree); if (relative_position < LEFT_TOTAL_LENGTH (tree)) { tree = tree->left; ------------------------------------------------------------ revno: 115732 committer: Eli Zaretskii branch nick: trunk timestamp: Tue 2013-12-24 19:23:56 +0200 message: Fix eww-open-file for MS-Windows and MS-DOS. lisp/net/eww.el (eww-open-file): Ensure 3 slashes after "file:" when we run on MS-Windows or MS-DOS. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-24 16:42:03 +0000 +++ lisp/ChangeLog 2013-12-24 17:23:56 +0000 @@ -1,3 +1,8 @@ +2013-12-24 Eli Zaretskii + + * net/eww.el (eww-open-file): Ensure 3 slashes after "file:" when + we run on MS-Windows or MS-DOS. + 2013-12-24 Martin Rudalics * window.el (balance-windows-area): Call window-size instead of === modified file 'lisp/net/eww.el' --- lisp/net/eww.el 2013-12-24 07:25:27 +0000 +++ lisp/net/eww.el 2013-12-24 17:23:56 +0000 @@ -167,7 +167,10 @@ (defun eww-open-file (file) "Render a file using EWW." (interactive "fFile: ") - (eww (concat "file://" (expand-file-name file)))) + (eww (concat "file://" + (and (memq system-type '(windows-nt ms-dos)) + "/") + (expand-file-name file)))) (defun eww-render (status url &optional point) (let ((redirect (plist-get status :redirect))) ------------------------------------------------------------ revno: 115731 committer: Eli Zaretskii branch nick: trunk timestamp: Tue 2013-12-24 19:21:06 +0200 message: Minor fixes in w32-shell-execute. src/w32fns.c (Fw32_shell_execute): Ensure DOCUMENT is an absolute file name when it is submitted to ShellExecute. Simplify code. Don't test DOCUMENT for being a string, as that is enforced by CHECK_STRING. Doc fix. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-23 19:24:25 +0000 +++ src/ChangeLog 2013-12-24 17:21:06 +0000 @@ -1,3 +1,10 @@ +2013-12-24 Eli Zaretskii + + * w32fns.c (Fw32_shell_execute): Ensure DOCUMENT is an absolute + file name when it is submitted to ShellExecute. Simplify code. + Don't test DOCUMENT for being a string, as that is enforced by + CHECK_STRING. Doc fix. + 2013-12-23 Eli Zaretskii * xdisp.c (tool_bar_height): Use WINDOW_PIXEL_WIDTH to set up the === modified file 'src/w32fns.c' --- src/w32fns.c 2013-12-20 10:48:36 +0000 +++ src/w32fns.c 2013-12-24 17:21:06 +0000 @@ -6844,6 +6844,8 @@ specified DOCUMENT \"find\" - initiate search starting from DOCUMENT which must specify a directory + \"runas\" - run DOCUMENT, which must be an excutable file, with + elevated privileges (a.k.a. \"as Administrator\"). nil - invoke the default OPERATION, or \"open\" if default is not defined or unavailable @@ -6879,16 +6881,12 @@ #ifdef CYGWIN current_dir = Fcygwin_convert_file_name_to_windows (current_dir, Qt); - if (STRINGP (document)) - document = Fcygwin_convert_file_name_to_windows (document, Qt); + document = Fcygwin_convert_file_name_to_windows (document, Qt); /* Encode filename, current directory and parameters. */ current_dir = GUI_ENCODE_FILE (current_dir); - if (STRINGP (document)) - { - document = GUI_ENCODE_FILE (document); - doc_w = GUI_SDATA (document); - } + document = GUI_ENCODE_FILE (document); + doc_w = GUI_SDATA (document); if (STRINGP (parameters)) { parameters = GUI_ENCODE_SYSTEM (parameters); @@ -6904,20 +6902,17 @@ (INTEGERP (show_flag) ? XINT (show_flag) : SW_SHOWDEFAULT)); #else /* !CYGWIN */ + current_dir = ENCODE_FILE (current_dir); + document = ENCODE_FILE (Fexpand_file_name (document, Qnil)); if (use_unicode) { wchar_t document_w[MAX_PATH], current_dir_w[MAX_PATH]; /* Encode filename, current directory and parameters, and convert operation to UTF-16. */ - current_dir = ENCODE_FILE (current_dir); filename_to_utf16 (SSDATA (current_dir), current_dir_w); - if (STRINGP (document)) - { - document = ENCODE_FILE (document); - filename_to_utf16 (SSDATA (document), document_w); - doc_w = document_w; - } + filename_to_utf16 (SSDATA (document), document_w); + doc_w = document_w; if (STRINGP (parameters)) { int len; @@ -6954,14 +6949,9 @@ { char document_a[MAX_PATH], current_dir_a[MAX_PATH]; - current_dir = ENCODE_FILE (current_dir); filename_to_ansi (SSDATA (current_dir), current_dir_a); - if (STRINGP (document)) - { - ENCODE_FILE (document); - filename_to_ansi (SSDATA (document), document_a); - doc_a = document_a; - } + filename_to_ansi (SSDATA (document), document_a); + doc_a = document_a; if (STRINGP (parameters)) { parameters = ENCODE_SYSTEM (parameters); ------------------------------------------------------------ revno: 115730 committer: martin rudalics branch nick: trunk timestamp: Tue 2013-12-24 17:42:03 +0100 message: In balance-windows-area don't call window-height and window-width. Bug#16241. * window.el (balance-windows-area): Call window-size instead of window-height and window-width. Bug#16241. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-24 07:25:27 +0000 +++ lisp/ChangeLog 2013-12-24 16:42:03 +0000 @@ -1,3 +1,8 @@ +2013-12-24 Martin Rudalics + + * window.el (balance-windows-area): Call window-size instead of + window-height and window-width. Bug#16241. + 2013-12-24 Lars Ingebrigtsen * net/eww.el (eww-bookmark-quit): Remove. === modified file 'lisp/window.el' --- lisp/window.el 2013-12-20 10:48:36 +0000 +++ lisp/window.el 2013-12-24 16:42:03 +0000 @@ -4681,12 +4681,12 @@ ;; (assert (eq next (or (cadr (member win wins)) (car wins)))) (let* ((horiz (< (car (window-pixel-edges win)) (car (window-pixel-edges next)))) - (areadiff (/ (- (* (window-height next pixelwise) - (window-width next pixelwise) + (areadiff (/ (- (* (window-size next nil pixelwise) + (window-size next t pixelwise) (buffer-local-value 'window-area-factor (window-buffer next))) - (* (window-height win pixelwise) - (window-width win pixelwise) + (* (window-size win nil pixelwise) + (window-size win t pixelwise) (buffer-local-value 'window-area-factor (window-buffer win)))) (max (buffer-local-value 'window-area-factor @@ -4694,10 +4694,10 @@ (buffer-local-value 'window-area-factor (window-buffer next))))) (edgesize (if horiz - (+ (window-height win pixelwise) - (window-height next pixelwise)) - (+ (window-width win pixelwise) - (window-width next pixelwise)))) + (+ (window-size win nil pixelwise) + (window-size next nil pixelwise)) + (+ (window-size win t pixelwise) + (window-size next t pixelwise)))) (diff (/ areadiff edgesize))) (when (zerop diff) ;; Maybe diff is actually closer to 1 than to 0. ------------------------------------------------------------ revno: 115729 fixes bug: http://debbugs.gnu.org/16238 committer: Tassilo Horn branch nick: trunk timestamp: Tue 2013-12-24 16:30:59 +0100 message: Fix missing arg in pcase example. * doc/lispref/control.texi (Pattern matching case statement): Fix missing argument in simple expression language sample. Add some sample programs written in that language. Mention that `pcase' requires lexical binding. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-12-23 11:27:29 +0000 +++ doc/lispref/ChangeLog 2013-12-24 15:30:59 +0000 @@ -1,3 +1,10 @@ +2013-12-24 Tassilo Horn + + * control.texi (Pattern matching case statement): Fix missing + argument in simple expression language sample (Bug#16238). Add + some sample programs written in that language. Mention that + `pcase' requires lexical binding. + 2013-12-23 Xue Fuqiao * eval.texi (Special Forms): Document `special-form-p'. === modified file 'doc/lispref/control.texi' --- doc/lispref/control.texi 2013-10-09 17:17:20 +0000 +++ doc/lispref/control.texi 2013-12-24 15:30:59 +0000 @@ -328,7 +328,7 @@ (defun evaluate (exp env) (pcase exp (`(add ,x ,y) (+ (evaluate x env) (evaluate y env))) - (`(call ,fun ,arg) (funcall (evaluate fun) (evaluate arg env))) + (`(call ,fun ,arg) (funcall (evaluate fun env) (evaluate arg env))) (`(fn ,arg ,body) (lambda (val) (evaluate body (cons (cons arg val) env)))) ((pred numberp) exp) @@ -342,6 +342,19 @@ @code{(pred numberp)} is a pattern that simply checks that @code{exp} is a number, and @code{_} is the catch-all pattern that matches anything. +Here are some sample programs including their evaluation results: + +@example +(evaluate '(add 1 2) nil) ;=> 3 +(evaluate '(add x y) '((x . 1) (y . 2))) ;=> 3 +(evaluate '(call (fn x (add 1 x)) 2) nil) ;=> 3 +(evaluate '(sub 1 2) nil) ;=> (error "Unknown expression (sub 1 2)") +@end example + +Note that (parts of) @code{pcase} only work as expected with lexical +binding, so lisp files using @code{pcase} should have enable it +(@pxref{Using Lexical Binding}, for how to enable lexical binding). + There are two kinds of patterns involved in @code{pcase}, called @emph{U-patterns} and @emph{Q-patterns}. The @var{upattern} mentioned above are U-patterns and can take the following forms: ------------------------------------------------------------ revno: 115728 committer: Xue Fuqiao branch nick: trunk timestamp: Tue 2013-12-24 16:33:02 +0800 message: * doc/emacs/trouble.texi (Checklist): Fix a cross-reference. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-12-24 03:07:21 +0000 +++ doc/emacs/ChangeLog 2013-12-24 08:33:02 +0000 @@ -1,6 +1,7 @@ 2013-12-24 Xue Fuqiao * trouble.texi (Understanding Bug Reporting): Minor update. + (Checklist): Fix a cross-reference. 2013-12-23 Xue Fuqiao === modified file 'doc/emacs/trouble.texi' --- doc/emacs/trouble.texi 2013-12-24 03:07:21 +0000 +++ doc/emacs/trouble.texi 2013-12-24 08:33:02 +0000 @@ -852,9 +852,9 @@ before the error happens (that is to say, you must give that command and then make the bug happen). This causes the error to start the Lisp debugger, which shows you a backtrace. Copy the text of the -debugger's backtrace into the bug report. @xref{Debugger,, The Lisp -Debugger, elisp, the Emacs Lisp Reference Manual}, for information on -debugging Emacs Lisp programs with the Edebug package. +debugger's backtrace into the bug report. @xref{Edebug,, Edebug, +elisp, the Emacs Lisp Reference Manual}, for information on debugging +Emacs Lisp programs with the Edebug package. This use of the debugger is possible only if you know how to make the bug happen again. If you can't make it happen again, at least copy === modified file 'lisp/emacs-lisp/rx.el' --- lisp/emacs-lisp/rx.el 2013-01-01 09:11:05 +0000 +++ lisp/emacs-lisp/rx.el 2013-12-24 08:33:02 +0000 @@ -871,7 +871,7 @@ REGEXPS is a non-empty sequence of forms of the sort listed below. Note that `rx' is a Lisp macro; when used in a Lisp program being - compiled, the translation is performed by the compiler. +compiled, the translation is performed by the compiler. See `rx-to-string' for how to do such a translation at run-time. The following are valid subforms of regular expressions in sexp