Merge from mainline.

This commit is contained in:
Xue Fuqiao 2013-12-26 06:27:00 +08:00
commit 77bbf3713d
37 changed files with 900 additions and 316 deletions

View file

@ -1,3 +1,11 @@
2013-12-24 Paul Eggert <eggert@cs.ucla.edu>
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 <schwab@linux-m68k.org>
* configure.ac: Replace obsolete macro AC_CONFIG_HEADER by

View file

@ -1,3 +1,10 @@
2013-12-24 Paul Eggert <eggert@cs.ucla.edu>
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 <xfq.free@gmail.com>
* admin.el (add-release-logs):

View file

@ -75,6 +75,9 @@ Root must be the root of an Emacs source tree."
(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."))))))

View file

@ -37,7 +37,8 @@ GNULIB_MODULES='
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
'

View file

@ -2,6 +2,8 @@ HOW TO MAINTAIN COPYRIGHT YEARS FOR GNU EMACS
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 @@ but should keep the full list in a comment in the source.
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

75
admin/update-copyright Executable file
View file

@ -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 <http://www.gnu.org/licenses/>.
# 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

274
build-aux/update-copyright Executable file
View file

@ -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 <http://www.gnu.org/licenses/>.
# 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 &copy; 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. &copy;
#
# 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{}|&copy;)';
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:

View file

@ -1,3 +1,11 @@
2013-12-25 Chong Yidong <cyd@gnu.org>
* glossary.texi (Glossary): Define MULE in modern terms.
2013-12-25 Xue Fuqiao <xfq.free@gmail.com>
* files.texi (Diff Mode): Add an index.
2013-12-24 Xue Fuqiao <xfq.free@gmail.com>
* trouble.texi (Understanding Bug Reporting): Minor update.

View file

@ -1419,6 +1419,7 @@ In a multi-file patch, kill the current file part.
@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.

View file

@ -953,9 +953,15 @@ another. The usual way to move text is by killing (q.v.@:) it and then
yanking (q.v.@:) it. @xref{Killing}.
@item MULE
MULE refers to the Emacs features for editing multilingual
non-@acronym{ASCII} text using multibyte characters (q.v.).
@xref{International}.
@cindex MULE
Prior to Emacs 23, @acronym{MULE} was the name of a software package
which provided a @dfn{MULtilingual Enhancement} to Emacs, by adding
support for multiple character sets (q.v.). @acronym{MULE} was later
integrated into Emacs, and much of it was replaced when Emacs gained
internal Unicode support in version 23.
Some parts of Emacs that deal with character set support still use the
@acronym{MULE} name. @xref{International}.
@item Multibyte Character
A multibyte character is a character that takes up several bytes in a

View file

@ -5,7 +5,6 @@
@chapter International Character Set Support
@c This node is referenced in the tutorial. When renaming or deleting
@c it, the tutorial needs to be adjusted. (TUTORIAL.de)
@cindex MULE
@cindex international scripts
@cindex multibyte characters
@cindex encoding of characters

View file

@ -1,3 +1,46 @@
2013-12-25 Chong Yidong <cyd@gnu.org>
* keymaps.texi (Active Keymaps): Re-organize the text.
(Searching Keymaps): Rewrite the pseudo-code for 24.4 changes.
(Controlling Active Maps): Note that set-transient-map uses
overriding-terminal-local-map.
* tips.texi (Coding Conventions): Tweak the coding system tip;
Emacs now uses utf-8 by default for Emacs Lisp source files.
* display.texi (Font Selection): Tweak example.
* commands.texi (Event Input Misc): Document new arg to
input-pending-p.
* nonascii.texi (Specifying Coding Systems): Don't refer to
emacs-mule-dos.
(Lisp and Coding Systems): Describe emacs-mule return value in
modern terms.
2013-12-25 Tassilo Horn <tsdh@gnu.org>
* control.texi (Pattern matching case statement): Rephrase lexical
binding requirement: the example needs it, not `pcase' itself.
2013-12-25 Chong Yidong <cyd@gnu.org>
* 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 <tsdh@gnu.org>
* 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 <xfq.free@gmail.com>
* eval.texi (Special Forms): Document `special-form-p'.

View file

@ -2739,12 +2739,16 @@ This function converts the string or vector @var{key} to a list of
individual events, which you can put in @code{unread-command-events}.
@end defun
@defun input-pending-p
@defun input-pending-p &optional check-timers
@cindex waiting for command key input
This function determines whether any command input is currently
available to be read. It returns immediately, with value @code{t} if
there is available input, @code{nil} otherwise. On rare occasions it
may return @code{t} when no input is available.
If the optional argument @var{check-timers} is non-@code{nil}, then if
no input is available, Emacs runs any timers which are ready.
@xref{Timers}.
@end defun
@defvar last-input-event

View file

@ -328,7 +328,7 @@ expression language could look like:
(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,20 @@ third elements and binds them to the variables @code{x} and @code{y}.
@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
@end example
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:

View file

@ -2962,11 +2962,11 @@ scalable font is enabled for use if its name matches any regular
expression in the list. For example,
@example
(setq scalable-fonts-allowed '("muleindian-2$"))
(setq scalable-fonts-allowed '("iso10646-1$"))
@end example
@noindent
allows the use of scalable fonts with registry @code{muleindian-2}.
allows the use of scalable fonts with registry @code{iso10646-1}.
@end defopt
@defvar face-font-rescale-alist

View file

@ -715,12 +715,18 @@ arguments.
@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

View file

@ -622,75 +622,67 @@ string for the keymap. The prompt string should be given for menu keymaps
@node Active Keymaps
@section Active Keymaps
@cindex active keymap
@cindex global keymap
Emacs contains many keymaps, but at any time only a few keymaps are
@dfn{active}. When Emacs receives user input, it translates the input
event (@pxref{Translation Keymaps}), and looks for a key binding in
the active keymaps.
Usually, the active keymaps are: (i) the keymap specified by the
@code{keymap} property, (ii) the keymaps of enabled minor modes, (iii)
the current buffer's local keymap, and (iv) the global keymap, in that
order. Emacs searches for each input key sequence in all these
keymaps.
Of these ``usual'' keymaps, the highest-precedence one is specified
by the @code{keymap} text or overlay property at point, if any. (For
a mouse input event, Emacs uses the event position instead of point;
@iftex
see the next section for details.)
@end iftex
@ifnottex
@pxref{Searching Keymaps}.)
@end ifnottex
Next in precedence are keymaps specified by enabled minor modes.
These keymaps, if any, are specified by the variables
@code{emulation-mode-map-alists},
@code{minor-mode-overriding-map-alist}, and
@code{minor-mode-map-alist}. @xref{Controlling Active Maps}.
@cindex local keymap
Emacs normally contains many keymaps; at any given time, just a few
of them are @dfn{active}, meaning that they participate in the
interpretation of user input. All the active keymaps are used
together to determine what command to execute when a key is entered.
Normally the active keymaps are the @code{keymap} property keymap,
the keymaps of any enabled minor modes, the current buffer's local
keymap, and the global keymap, in that order. Emacs searches for each
input key sequence in all these keymaps. @xref{Searching Keymaps},
for more details of this procedure.
When the key sequence starts with a mouse event,
the active keymaps are determined based on the
position in that event. If the event happened on a string embedded
with a @code{display}, @code{before-string}, or @code{after-string}
property (@pxref{Special Properties}), the non-@code{nil} map
properties of the string override those of the buffer (if the
underlying buffer text contains map properties in its text properties
or overlays, they are ignored).
The @dfn{global keymap} holds the bindings of keys that are defined
regardless of the current buffer, such as @kbd{C-f}. The variable
@code{global-map} holds this keymap, which is always active.
Each buffer may have another keymap, its @dfn{local keymap}, which
may contain new or overriding definitions for keys. The current
buffer's local keymap is always active except when
@code{overriding-local-map} overrides it. The @code{local-map} text
or overlay property can specify an alternative local keymap for certain
parts of the buffer; see @ref{Special Properties}.
Each minor mode can have a keymap; if it does, the keymap is active
when the minor mode is enabled. Modes for emulation can specify
additional active keymaps through the variable
@code{emulation-mode-map-alists}.
The highest precedence normal keymap comes from the @code{keymap}
text or overlay property. If that is non-@code{nil}, it is the first
keymap to be processed, in normal circumstances.
However, there are also special ways for programs to substitute
other keymaps for some of those. The variable
@code{overriding-local-map}, if non-@code{nil}, specifies a keymap
that replaces all the usual active keymaps except the global keymap.
The very highest precedence keymap comes from
@code{overriding-terminal-local-map}; it operates on a per-terminal basis and
is normally used for modal/transient keybindings.
Next in precedence is the buffer's @dfn{local keymap}, containing
key bindings specific to the buffer. The minibuffer also has a local
keymap (@pxref{Intro to Minibuffers}). If there is a @code{local-map}
text or overlay property at point, that specifies the local keymap to
use, in place of the buffer's default local keymap.
@cindex major mode keymap
Since every buffer that uses the same major mode normally uses the
same local keymap, you can think of the keymap as local to the mode. A
change to the local keymap of a buffer (using @code{local-set-key}, for
example) is seen also in the other buffers that share that keymap.
The local keymap is normally set by the buffer's major mode, and
every buffer with the same major mode shares the same local keymap.
Hence, if you call @code{local-set-key} (@pxref{Key Binding Commands})
to change the local keymap in one buffer, that also affects the local
keymaps in other buffers with the same major mode.
The local keymaps that are used for Lisp mode and some other major
modes exist even if they have not yet been used. These local keymaps are
the values of variables such as @code{lisp-mode-map}. For most major
modes, which are less frequently used, the local keymap is constructed
only when the mode is used for the first time in a session.
@cindex global keymap
Finally, the @dfn{global keymap} contains key bindings that are
defined regardless of the current buffer, such as @kbd{C-f}. It is
always active, and is bound to the variable @code{global-map}.
The minibuffer has local keymaps, too; they contain various completion
and exit commands. @xref{Intro to Minibuffers}.
Apart from the above ``usual'' keymaps, Emacs provides special ways
for programs to make other keymaps active. Firstly, the variable
@code{overriding-local-map} specifies a keymap that replaces the usual
active keymaps, except for the global keymap. Secondly, the
terminal-local variable @code{overriding-terminal-local-map} specifies
a keymap that takes precedence over @emph{all} other keymaps
(including @code{overriding-local-map}); this is normally used for
modal/transient keybindings (the function @code{set-transient-map}
provides a convenient interface for this). @xref{Controlling Active
Maps}, for details.
Emacs has other keymaps that are used in a different way---translating
events within @code{read-key-sequence}. @xref{Translation Keymaps}.
Making keymaps active is not the only way to use them. Keymaps are
also used in other ways, such as for translating events within
@code{read-key-sequence}. @xref{Translation Keymaps}.
@xref{Standard Keymaps}, for a list of some standard keymaps.
@ -727,7 +719,7 @@ If @var{position} is non-@code{nil}, it should be either a buffer
position or an event position like the value of @code{event-start}.
Then the maps consulted are determined based on @var{position}.
An error is signaled if @var{key} is not a string or a vector.
Emacs signals an error if @var{key} is not a string or a vector.
@example
@group
@ -741,49 +733,52 @@ An error is signaled if @var{key} is not a string or a vector.
@section Searching the Active Keymaps
@cindex searching active keymaps for keys
After translation of event subsequences (@pxref{Translation
Keymaps}) Emacs looks for them in the active keymaps. Here is a
pseudo-Lisp description of the order and conditions for searching
them:
Here is a pseudo-Lisp summary of how Emacs searches the active
keymaps:
@lisp
(or (@var{find-in} @var{transient-map})
(cond
(overriding-terminal-local-map
(@var{find-in} overriding-terminal-local-map))
(overriding-local-map
(@var{find-in} overriding-local-map))
((or (@var{find-in} (get-char-property (point) 'keymap))
(or (if overriding-terminal-local-map
(@var{find-in} overriding-terminal-local-map))
(if overriding-local-map
(@var{find-in} overriding-local-map)
(or (@var{find-in} (get-char-property (point) 'keymap))
(@var{find-in-any} emulation-mode-map-alists)
(@var{find-in-any} minor-mode-overriding-map-alist)
(@var{find-in-any} minor-mode-map-alist)
(if (get-text-property (point) 'local-map)
(@var{find-in} (get-char-property (point) 'local-map))
(@var{find-in} (current-local-map))))))
(@var{find-in} (current-local-map)))))
(@var{find-in} (current-global-map)))
@end lisp
@noindent
Here, @var{find-in} and @var{find-in-any} are pseudo functions that
search in one keymap and in an alist of keymaps, respectively.
(Searching a single keymap for a binding is called @dfn{key lookup};
see @ref{Key Lookup}.) @var{transient-map} is a pseudo variable that
represents the effect of a @code{set-transient-map} call
(@pxref{Controlling Active Maps}).
search in one keymap and in an alist of keymaps, respectively. Note
that the @code{set-transient-map} function works by setting
@code{overriding-terminal-local-map} (@pxref{Controlling Active
Maps}).
In the above pseudo-code, if a key sequence starts with a mouse
event, that event's position is used instead of point and the current
buffer. Mouse events on an embedded string use non-@code{nil} text
properties from that string instead of the buffer.
event (@pxref{Mouse Events}), that event's position is used instead of
point, and the event's buffer is used instead of the current buffer.
In particular, this affects how the @code{keymap} and @code{local-map}
properties are looked up. If a mouse event occurs on a string
embedded with a @code{display}, @code{before-string}, or
@code{after-string} property (@pxref{Special Properties}), and the
string has a non-@code{nil} @code{keymap} or @code{local-map}
property, that overrides the corresponding property in the underlying
buffer text (i.e., the property specified by the underlying text is
ignored).
When a match is found (@pxref{Key Lookup}), if the binding in the
keymap is a function, the search is over. However if the keymap entry
is a symbol with a value or a string, Emacs replaces the input key
sequences with the variable's value or the string, and restarts the
search of the active keymaps.
When a key binding is found in one of the active keymaps, and that
binding is a command, the search is over---the command is executed.
However, if the binding is a symbol with a value or a string, Emacs
replaces the input key sequences with the variable's value or the
string, and restarts the search of the active keymaps. @xref{Key
Lookup}.
The function finally found might also be remapped. @xref{Remapping
Commands}.
The command which is finally found might also be remapped.
@xref{Remapping Commands}.
@node Controlling Active Maps
@section Controlling the Active Keymaps
@ -860,7 +855,6 @@ keymap. @code{use-local-map} returns @code{nil}. Most major mode
commands use this function.
@end defun
@c Emacs 19 feature
@defvar minor-mode-map-alist
@anchor{Definition of minor-mode-map-alist}
This variable is an alist describing keymaps that may or may not be
@ -945,7 +939,7 @@ event is run directly by @code{read-event}. @xref{Special Events}.
@end defvar
@defvar emulation-mode-map-alists
This variable holds a list of keymap alists to use for emulations
This variable holds a list of keymap alists to use for emulation
modes. It is intended for modes or packages using multiple minor-mode
keymaps. Each element is a keymap alist which has the same format and
meaning as @code{minor-mode-map-alist}, or a symbol with a variable
@ -970,11 +964,9 @@ function is called with no arguments, prior to running each command,
while @var{keymap} is active; it should return non-@code{nil} if
@var{keymap} should stay active.
The transient keymap takes precedence over the ``overriding'' maps
(see above); and unlike them, if no match for a key is found in
@var{keymap}, the key lookup process continues. For a pseudo-Lisp
description of exactly how and when this keymap applies,
@xref{Searching Keymaps}.
This function works by adding and removing @code{keymap} from the
variable @code{overriding-terminal-local-map}, which takes precedence
over all other active keymaps (@pxref{Searching Keymaps}).
@end defun
@node Key Lookup

View file

@ -1289,17 +1289,18 @@ Sets}) supported by @var{coding-system}. Some coding systems that
support too many character sets to list them all yield special values:
@itemize @bullet
@item
If @var{coding-system} supports all the ISO-2022 charsets, the value
is @code{iso-2022}.
@item
If @var{coding-system} supports all Emacs characters, the value is
@code{(emacs)}.
@item
If @var{coding-system} supports all emacs-mule characters, the value
is @code{emacs-mule}.
@item
If @var{coding-system} supports all Unicode characters, the value is
@code{(unicode)}.
@item
If @var{coding-system} supports all ISO-2022 charsets, the value is
@code{iso-2022}.
@item
If @var{coding-system} supports all the characters in the internal
coding system used by Emacs version 21 (prior to the implementation of
internal Unicode support), the value is @code{emacs-mule}.
@end itemize
@end defun
@ -1617,8 +1618,7 @@ of the right way to use the variable:
@example
;; @r{Read the file with no character code conversion.}
;; @r{Assume @acronym{crlf} represents end-of-line.}
(let ((coding-system-for-read 'emacs-mule-dos))
(let ((coding-system-for-read 'no-conversion))
(insert-file-contents filename))
@end example

View file

@ -223,18 +223,13 @@ only for special-purpose buffers.) People will find Emacs more
coherent if all libraries use the same conventions.
@item
If your program contains non-ASCII characters in string or character
constants, you should make sure Emacs always decodes these characters
the same way, regardless of the user's settings. The easiest way to
do this is to use the coding system @code{utf-8-emacs} (@pxref{Coding
System Basics}), and specify that coding in the @samp{-*-} line or the
The default file coding system for Emacs Lisp source files is UTF-8
(@pxref{Text Representations}). In the rare event that your program
contains characters which are @emph{not} in UTF-8, you should specify
an appropriate coding system in the source file's @samp{-*-} line or
local variables list. @xref{File Variables, , Local Variables in
Files, emacs, The GNU Emacs Manual}.
@example
;; XXX.el -*- coding: utf-8-emacs; -*-
@end example
@item
Indent the file using the default indentation parameters.

View file

@ -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 @@ has room to execute.
@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.
cell (@pxref{Symbol Components}).
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.
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 @@ error is signaled.
@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 @@ binding can be accessed. @dfn{Extent} refers to @emph{when}, as the
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 @@ being executed.
@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 @@ at any point in the execution of the Lisp program is simply the most
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 @@ The function @code{getx} refers to @code{x}. This is a ``free''
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 @@ technique:
@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 @@ variables like @code{case-fold-search}:
@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
reference to the variable must be located textually within the binding
construct.
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.
Here is an example
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
@iftex
(see the next subsection, for how to actually enable lexical binding):
@end iftex
@ -969,6 +976,14 @@ wants the current value of a variable, it looks first in the lexical
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 @@ binding of @code{x} in that lexical environment.
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 @@ discouraged. Doing so gives rise to unspecified behavior when lexical
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

View file

@ -545,7 +545,7 @@ using the next face automatically.
*** New option `imenu-generic-skip-comments-and-strings'.
** Info
---
*** New face `info-index-match' is used to highlight matches in index
entries displayed by `Info-index-next', `Info-virtual-index' and
`info-apropos'.
@ -849,19 +849,23 @@ low-level libraries gfilenotify.c, inotify.c or w32notify.c.
* Incompatible Lisp Changes in Emacs 24.4
---
** `kill-region' lost its `yank-handler' optional argument.
+++
** `(input-pending-p)' no longer runs other timers which are ready to
run. The new optional CHECK-TIMERS param allows for the prior behavior.
** `defvar' and `defcustom' in a let-binding affect the "external" default.
---
** The syntax of ?» and ?« is now punctuation instead of matched parens.
Some languages match those as »...« and others as «...» so better stay neutral.
---
** In compiled Lisp files, the header no longer includes a timestamp.
+++
** The default file coding for Emacs Lisp files is now utf-8.
(See `file-coding-system-alist'.) In most cases, this change is
transparent, but files that contain unusual characters without
@ -869,6 +873,7 @@ specifying an explicit coding system may fail to load with obscure
errors. You should either convert them to utf-8 or add an explicit
`coding:' cookie.
+++
** `overriding-terminal-local-map' no longer replaces the local keymaps.
It used to disable the minor mode, major mode, and text-property keymaps,
whereas now it simply has higher precedence.
@ -881,9 +886,11 @@ Just as was the case in Emacs-22 and before, decoding of tty input according to
keyboard-coding-system is not performed in read-event any more. But contrary
to that past, it is still done before input-decode-map/function-key-map/...
** Removed inhibit-local-menu-bar-menus.
---
** Removed `inhibit-local-menu-bar-menus'.
** frame-local variables that affect redisplay do not work any more.
---
** Frame-local variables that affect redisplay do not work any more.
More specifically, the redisplay does not bother to check for a frame-local
value when looking up variables.
@ -916,6 +923,7 @@ something (not just adding elements to it).
* Lisp Changes in Emacs 24.4
+++
** The second argument of `eval' can now specify a lexical environment.
+++

View file

@ -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 @@ EXTRA_libgnu_a_SOURCES += unsetenv.c
## 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

View file

@ -1,3 +1,57 @@
2013-12-25 Lars Ingebrigtsen <larsi@gnus.org>
* net/shr.el (shr-visit-file): Remove debugging function.
2013-12-25 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el:
(python-nav--lisp-forward-sexp): New function.
(python-nav--lisp-forward-sexp-safe): Use it. Rename from
python-nav-lisp-forward-sexp-safe.
(python-nav--forward-sexp): New argument SAFE allows switching
forward sexp movement behavior for parens.
(python-nav-forward-sexp): Throw errors on unterminated parens
(Bug#16191).
(python-nav-backward-sexp, python-nav-forward-sexp-safe)
(python-nav-backward-sexp-safe): New functions.
(python-shell-buffer-substring): Use
`python-nav-forward-sexp-safe'.
2013-12-25 Lars Ingebrigtsen <larsi@gnus.org>
* net/shr.el (shr-find-fill-point): Don't break lines before a
quotation mark.
(shr-char-kinsoku-bol-p): The quotation mark isn't a kinsoky BOL char.
(shr-find-fill-point): Remove the special checks for the quotation
mark, since `shr-char-kinsoku-bol-p' should now return the right
thing.
2013-12-25 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
* net/eww.el (eww-form-textarea): Use a different face for
textareas than text input since they have different keymaps
(bug#16142).
2013-12-24 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el (python-nav-beginning-of-statement): Speed
up (Bug#15295).
2013-12-24 Lars Ingebrigtsen <larsi@gnus.org>
* net/eww.el (eww-bookmark-browse): Use `quit-window' to restore
the window configuration.
2013-12-24 Eli Zaretskii <eliz@gnu.org>
* 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 <rudalics@gmx.at>
* window.el (balance-windows-area): Call window-size instead of
window-height and window-width. Bug#16241.
2013-12-24 Lars Ingebrigtsen <larsi@gnus.org>
* net/eww.el (eww-bookmark-quit): Remove.

View file

@ -115,6 +115,14 @@ See also `eww-form-checkbox-selected-symbol'."
:version "24.4"
:group 'eww)
(defface eww-form-textarea
'((t (:background "#C0C0C0"
:foreground "black"
:box (:line-width 1))))
"Face for eww textarea inputs."
:version "24.4"
:group 'eww)
(defvar eww-current-url nil)
(defvar eww-current-dom nil)
(defvar eww-current-source nil)
@ -167,7 +175,10 @@ word(s) will be searched for via `eww-search-prefix'."
(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)))
@ -773,7 +784,7 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(when (> pad 0)
(insert (make-string pad ? ))))
(add-face-text-property (line-beginning-position)
(point) 'eww-form-text)
(point) 'eww-form-textarea)
(put-text-property (line-beginning-position) (point)
'local-map eww-textarea-map)
(forward-line 1))
@ -1083,8 +1094,6 @@ Differences in #targets are ignored."
;;; 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."
@ -1129,7 +1138,6 @@ Differences in #targets are ignored."
(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)
@ -1188,8 +1196,6 @@ Differences in #targets are ignored."
(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 ()

View file

@ -179,13 +179,6 @@ cid: URL as the argument.")
(goto-char begin)
(shr-insert-document dom))))
(defun shr-visit-file (file)
"Parse FILE as an HTML document, and render it in a new buffer."
(interactive "fHTML file name: ")
(with-temp-buffer
(insert-file-contents file)
(shr-render-buffer (current-buffer))))
;;;###autoload
(defun shr-insert-document (dom)
"Render the parsed document DOM into the current buffer.
@ -414,7 +407,9 @@ size, and full-buffer size."
;; of a line or the end of a line.
(defmacro shr-char-kinsoku-bol-p (char)
"Return non-nil if a line ought not to begin with CHAR."
`(aref (char-category-set ,char) ?>))
`(let ((char ,char))
(and (not (eq char ?'))
(aref (char-category-set char) ?>))))
(defmacro shr-char-kinsoku-eol-p (char)
"Return non-nil if a line ought not to end with CHAR."
`(aref (char-category-set ,char) ?<))
@ -489,30 +484,19 @@ size, and full-buffer size."
(eq (following-char) ? )
(shr-char-breakable-p (preceding-char))
(shr-char-breakable-p (following-char))
(if (eq (preceding-char) ?')
(not (memq (char-after (- (point) 2))
(list nil ?\n ? )))
(and (shr-char-kinsoku-bol-p (preceding-char))
(shr-char-breakable-p (following-char))
(not (shr-char-kinsoku-bol-p (following-char)))))
(and (shr-char-kinsoku-bol-p (preceding-char))
(shr-char-breakable-p (following-char))
(not (shr-char-kinsoku-bol-p (following-char))))
(shr-char-kinsoku-eol-p (following-char))))
(backward-char 1))
(if (and (not (or failed (eolp)))
(eq (preceding-char) ?'))
(while (not (or (setq failed (eolp))
(eq (following-char) ? )
(shr-char-breakable-p (following-char))
(shr-char-kinsoku-eol-p (following-char))))
(forward-char 1)))
(if failed
;; There's no breakable point, so we give it up.
(let (found)
(goto-char bp)
(unless shr-kinsoku-shorten
(while (and (setq found (re-search-forward
"\\(\\c>\\)\\| \\|\\c<\\|\\c|"
(line-end-position) 'move))
(eq (preceding-char) ?')))
(while (setq found (re-search-forward
"\\(\\c>\\)\\| \\|\\c<\\|\\c|"
(line-end-position) 'move)))
(if (and found (not (match-beginning 1)))
(goto-char (match-beginning 0)))))
(or

View file

@ -1279,15 +1279,21 @@ nested definitions."
(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)
@ -1418,25 +1424,36 @@ backward to previous block."
(and (goto-char starting-pos) nil)
(and (not (= (point) starting-pos)) (point-marker)))))
(defun python-nav-lisp-forward-sexp-safe (&optional arg)
"Safe version of standard `forward-sexp'.
When ARG > 0 move forward, else if ARG is < 0."
(or arg (setq arg 1))
(defun python-nav--lisp-forward-sexp (&optional arg)
"Standard version `forward-sexp'.
It ignores completely the value of `forward-sexp-function' by
setting it to nil before calling `forward-sexp'. With positive
ARG move forward only one sexp, else move backwards."
(let ((forward-sexp-function)
(paren-regexp
(if (> arg 0) (python-rx close-paren) (python-rx open-paren)))
(search-fn
(if (> arg 0) #'re-search-forward #'re-search-backward)))
(arg (if (or (not arg) (> arg 0)) 1 -1)))
(forward-sexp arg)))
(defun python-nav--lisp-forward-sexp-safe (&optional arg)
"Safe version of standard `forward-sexp'.
When at end of sexp (i.e. looking at a opening/closing paren)
skips it instead of throwing an error. With positive ARG move
forward only one sexp, else move backwards."
(let* ((arg (if (or (not arg) (> arg 0)) 1 -1))
(paren-regexp
(if (> arg 0) (python-rx close-paren) (python-rx open-paren)))
(search-fn
(if (> arg 0) #'re-search-forward #'re-search-backward)))
(condition-case nil
(forward-sexp arg)
(python-nav--lisp-forward-sexp arg)
(error
(while (and (funcall search-fn paren-regexp nil t)
(python-syntax-context 'paren)))))))
(defun python-nav--forward-sexp (&optional dir)
(defun python-nav--forward-sexp (&optional dir safe)
"Move to forward sexp.
With positive Optional argument DIR direction move forward, else
backwards."
With positive optional argument DIR direction move forward, else
backwards. When optional argument SAFE is non-nil do not throw
errors when at end of sexp, skip it instead."
(setq dir (or dir 1))
(unless (= dir 0)
(let* ((forward-p (if (> dir 0)
@ -1454,7 +1471,9 @@ backwards."
(eq (syntax-class (syntax-after (1- (point))))
(car (string-to-syntax ")")))))
;; Inside a paren or looking at it, lisp knows what to do.
(python-nav-lisp-forward-sexp-safe dir))
(if safe
(python-nav--lisp-forward-sexp-safe dir)
(python-nav--lisp-forward-sexp dir)))
(t
;; This part handles the lispy feel of
;; `python-nav-forward-sexp'. Knowing everything about the
@ -1468,7 +1487,9 @@ backwards."
((python-info-end-of-statement-p) 'statement-end)))
(next-sexp-pos
(save-excursion
(python-nav-lisp-forward-sexp-safe dir)
(if safe
(python-nav--lisp-forward-sexp-safe dir)
(python-nav--lisp-forward-sexp dir))
(point)))
(next-sexp-context
(save-excursion
@ -1522,23 +1543,48 @@ backwards."
(python-nav-beginning-of-statement))
(t (goto-char next-sexp-pos))))))))))
(defun python-nav--backward-sexp ()
"Move to backward sexp."
(python-nav--forward-sexp -1))
(defun python-nav-forward-sexp (&optional arg)
"Move forward across one block of code.
With ARG, do it that many times. Negative arg -N means
move backward N times."
"Move forward across expressions.
With ARG, do it that many times. Negative arg -N means move
backward N times."
(interactive "^p")
(or arg (setq arg 1))
(while (> arg 0)
(python-nav--forward-sexp)
(python-nav--forward-sexp 1)
(setq arg (1- arg)))
(while (< arg 0)
(python-nav--backward-sexp)
(python-nav--forward-sexp -1)
(setq arg (1+ arg))))
(defun python-nav-backward-sexp (&optional arg)
"Move backward across expressions.
With ARG, do it that many times. Negative arg -N means move
backward N times."
(interactive "^p")
(or arg (setq arg 1))
(python-nav-forward-sexp (- arg)))
(defun python-nav-forward-sexp-safe (&optional arg)
"Move forward safely across expressions.
With ARG, do it that many times. Negative arg -N means move
backward N times."
(interactive "^p")
(or arg (setq arg 1))
(while (> arg 0)
(python-nav--forward-sexp 1 t)
(setq arg (1- arg)))
(while (< arg 0)
(python-nav--forward-sexp -1 t)
(setq arg (1+ arg))))
(defun python-nav-backward-sexp-safe (&optional arg)
"Move backward safely across expressions.
With ARG, do it that many times. Negative arg -N means move
backward N times."
(interactive "^p")
(or arg (setq arg 1))
(python-nav-forward-sexp-safe (- arg)))
(defun python-nav--up-list (&optional dir)
"Internal implementation of `python-nav-up-list'.
DIR is always 1 or -1 and comes sanitized from
@ -2206,7 +2252,7 @@ the python shell:
(save-excursion
(when (python-nav-if-name-main)
(cons (point)
(progn (python-nav-forward-sexp)
(progn (python-nav-forward-sexp-safe)
(point)))))))
;; Oh destructuring bind, how I miss you.
(if-name-main-start (car if-name-main-start-end))

View file

@ -4681,12 +4681,12 @@ specific buffers."
;; (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 @@ specific buffers."
(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.

View file

@ -150,6 +150,7 @@ AC_DEFUN([gl_EARLY],
# 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 @@ AC_DEFUN([gl_FILE_LIST], [
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

View file

@ -344,7 +344,8 @@ echo "Making links to \`leim' and its subdirectories"
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'"

View file

@ -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.

View file

@ -1,3 +1,22 @@
2013-12-25 Eli Zaretskii <eliz@gnu.org>
* w32fns.c (Fw32_shell_execute): Make DOCUMENT absolute only if it
is a file name. (Bug#16252)
2013-12-25 Chong Yidong <cyd@gnu.org>
* keyboard.c (Voverriding_terminal_local_map):
(Voverriding_local_map): Doc fix.
* keymap.c (Vemulation_mode_map_alists): Doc fix.
2013-12-24 Eli Zaretskii <eliz@gnu.org>
* 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 <eliz@gnu.org>
* xdisp.c (tool_bar_height): Use WINDOW_PIXEL_WIDTH to set up the

View file

@ -676,6 +676,7 @@ find_interval (register INTERVAL tree, register ptrdiff_t position)
while (1)
{
eassert (tree);
if (relative_position < LEFT_TOTAL_LENGTH (tree))
{
tree = tree->left;

View file

@ -11415,18 +11415,19 @@ tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */);
DEFVAR_KBOARD ("overriding-terminal-local-map",
Voverriding_terminal_local_map,
doc: /* Per-terminal keymap that takes precedence over all other keymaps.
This variable is intended to let commands such as `universal-argument'
set up a different keymap for reading the next command.
`overriding-terminal-local-map' has a separate binding for each
terminal device.
See Info node `(elisp)Multiple Terminals'. */);
terminal device. See Info node `(elisp)Multiple Terminals'. */);
DEFVAR_LISP ("overriding-local-map", Voverriding_local_map,
doc: /* Keymap that overrides almost all other local keymaps.
If this variable is non-nil, it is used as a keymap--replacing the
buffer's local map, the minor mode keymaps, and char property keymaps. */);
doc: /* Keymap that replaces (overrides) local keymaps.
If this variable is non-nil, Emacs looks up key bindings in this
keymap INSTEAD OF the keymap char property, minor mode maps, and the
buffer's local map. Hence, the only active keymaps would be
`overriding-terminal-local-map', this keymap, and `global-keymap', in
order of precedence. */);
Voverriding_local_map = Qnil;
DEFVAR_LISP ("overriding-local-map-menu-flag", Voverriding_local_map_menu_flag,

View file

@ -3753,7 +3753,7 @@ it is provided for major modes to bind locally. */);
Vminor_mode_overriding_map_alist = Qnil;
DEFVAR_LISP ("emulation-mode-map-alists", Vemulation_mode_map_alists,
doc: /* List of keymap alists to use for emulations modes.
doc: /* List of keymap alists to use for emulation modes.
It is intended for modes or packages using multiple minor-mode keymaps.
Each element is a keymap alist just like `minor-mode-map-alist', or a
symbol with a variable binding which is a keymap alist, and it is used

View file

@ -6844,12 +6844,15 @@ handler application, but typically it is one of the following common
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
DOCUMENT is typically the name of a document file or a URL, but can
also be a program executable to run, or a directory to open in the
Windows Explorer.
Windows Explorer. If it is a file, it must be a local one; this
function does not support remote file names.
If DOCUMENT is a program executable, the optional third arg PARAMETERS
can be a string containing command line parameters that will be passed
@ -6873,22 +6876,19 @@ an integer representing a ShowWindow flag:
#ifndef CYGWIN
int use_unicode = w32_unicode_filenames;
char *doc_a = NULL, *params_a = NULL, *ops_a = NULL;
Lisp_Object absdoc;
#endif
CHECK_STRING (document);
#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 +6904,26 @@ an integer representing a ShowWindow flag:
(INTEGERP (show_flag)
? XINT (show_flag) : SW_SHOWDEFAULT));
#else /* !CYGWIN */
current_dir = ENCODE_FILE (current_dir);
/* We have a situation here. If DOCUMENT is a relative file name,
and is not in CURRENT_DIR, ShellExecute below will fail to find
it. So we need to make the file name absolute. But DOCUMENT
does not have to be a file, it can be a URL, for example. So we
make it absolute only if it is an existing file; if it is a file
that does not exist, tough. */
absdoc = Fexpand_file_name (document, Qnil);
if (!NILP (Ffile_exists_p (absdoc)))
document = absdoc;
document = ENCODE_FILE (document);
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 +6960,9 @@ an integer representing a ShowWindow flag:
{
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);

View file

@ -1,3 +1,9 @@
2013-12-25 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el
(python-nav-lisp-forward-sexp-safe-1): Remove test.
(python-nav-forward-sexp-safe-1): New test.
2013-12-20 Dmitry Gutov <dgutov@yandex.ru>
* automated/ruby-mode-tests.el: Add tests for

View file

@ -1339,28 +1339,6 @@ if request.user.is_authenticated():
(python-tests-look-at
"if request.user.is_authenticated():" -1)))))
(ert-deftest python-nav-lisp-forward-sexp-safe-1 ()
(python-tests-with-temp-buffer
"
profile = Profile.objects.create(user=request.user)
profile.notify()
"
(python-tests-look-at "profile =")
(python-nav-lisp-forward-sexp-safe 4)
(should (looking-at "(user=request.user)"))
(python-tests-look-at "user=request.user")
(python-nav-lisp-forward-sexp-safe -1)
(should (looking-at "(user=request.user)"))
(python-nav-lisp-forward-sexp-safe -4)
(should (looking-at "profile ="))
(python-tests-look-at "user=request.user")
(python-nav-lisp-forward-sexp-safe 3)
(should (looking-at ")"))
(python-nav-lisp-forward-sexp-safe 1)
(should (looking-at "$"))
(python-nav-lisp-forward-sexp-safe 1)
(should (looking-at ".notify()"))))
(ert-deftest python-nav-forward-sexp-1 ()
(python-tests-with-temp-buffer
"
@ -1477,6 +1455,29 @@ def another_statement():
(python-nav-forward-sexp -1)
(should (looking-at "from some_module import some_sub_module"))))
(ert-deftest python-nav-forward-sexp-safe-1 ()
(python-tests-with-temp-buffer
"
profile = Profile.objects.create(user=request.user)
profile.notify()
"
(python-tests-look-at "profile =")
(python-nav-forward-sexp-safe 1)
(should (looking-at "$"))
(beginning-of-line 1)
(python-tests-look-at "user=request.user")
(python-nav-forward-sexp-safe -1)
(should (looking-at "(user=request.user)"))
(python-nav-forward-sexp-safe -4)
(should (looking-at "profile ="))
(python-tests-look-at "user=request.user")
(python-nav-forward-sexp-safe 3)
(should (looking-at ")"))
(python-nav-forward-sexp-safe 1)
(should (looking-at "$"))
(python-nav-forward-sexp-safe 1)
(should (looking-at "$"))))
(ert-deftest python-nav-up-list-1 ()
(python-tests-with-temp-buffer
"