mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-21 21:20:44 -08:00
auto upstream
This commit is contained in:
commit
c655adbbab
21 changed files with 517 additions and 357 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
2013-01-11 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
* lib/getopt_.h: Regenerate.
|
||||||
|
|
||||||
2013-01-10 Paul Eggert <eggert@cs.ucla.edu>
|
2013-01-10 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
Merge from gnulib, incorporating:
|
Merge from gnulib, incorporating:
|
||||||
|
|
|
||||||
568
lib/getopt_.h
568
lib/getopt_.h
|
|
@ -1,283 +1,285 @@
|
||||||
/* Declarations for getopt.
|
/* Declarations for getopt.
|
||||||
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free
|
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software
|
||||||
Software Foundation, Inc.
|
Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 3 of the License, or
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#ifndef _GL_GETOPT_H
|
#ifndef _GL_GETOPT_H
|
||||||
|
|
||||||
#if __GNUC__ >= 3
|
#if __GNUC__ >= 3
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* The include_next requires a split double-inclusion guard. We must
|
/* The include_next requires a split double-inclusion guard. We must
|
||||||
also inform the replacement unistd.h to not recursively use
|
also inform the replacement unistd.h to not recursively use
|
||||||
<getopt.h>; our definitions will be present soon enough. */
|
<getopt.h>; our definitions will be present soon enough. */
|
||||||
#if HAVE_GETOPT_H
|
#if HAVE_GETOPT_H
|
||||||
# define _GL_SYSTEM_GETOPT
|
# define _GL_SYSTEM_GETOPT
|
||||||
# ifndef __GNUC__
|
# ifndef __GNUC__
|
||||||
# include <next_getopt.h>
|
# include <next_getopt.h>
|
||||||
# else
|
# else
|
||||||
# include_next <getopt.h>
|
# include_next <getopt.h>
|
||||||
# endif
|
# endif
|
||||||
# undef _GL_SYSTEM_GETOPT
|
# undef _GL_SYSTEM_GETOPT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _GL_GETOPT_H
|
#ifndef _GL_GETOPT_H
|
||||||
|
|
||||||
#ifndef __need_getopt
|
#ifndef __need_getopt
|
||||||
# define _GL_GETOPT_H 1
|
# define _GL_GETOPT_H 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||||
identifier that prefixes the external functions and variables
|
identifier that prefixes the external functions and variables
|
||||||
defined in this header. When this happens, include the
|
defined in this header. When this happens, include the
|
||||||
headers that might declare getopt so that they will not cause
|
headers that might declare getopt so that they will not cause
|
||||||
confusion if included after this file (if the system had <getopt.h>,
|
confusion if included after this file (if the system had <getopt.h>,
|
||||||
we have already included it). Then systematically rename
|
we have already included it). Then systematically rename
|
||||||
identifiers so that they do not collide with the system functions
|
identifiers so that they do not collide with the system functions
|
||||||
and variables. Renaming avoids problems with some compilers and
|
and variables. Renaming avoids problems with some compilers and
|
||||||
linkers. */
|
linkers. */
|
||||||
#if defined __GETOPT_PREFIX && !defined __need_getopt
|
#if defined __GETOPT_PREFIX && !defined __need_getopt
|
||||||
# if !HAVE_GETOPT_H
|
# if !HAVE_GETOPT_H
|
||||||
# include <stdlib.h>
|
# define __need_system_stdlib_h
|
||||||
# include <stdio.h>
|
# include <stdlib.h>
|
||||||
# include <unistd.h>
|
# undef __need_system_stdlib_h
|
||||||
# endif
|
# include <stdio.h>
|
||||||
# undef __need_getopt
|
# include <unistd.h>
|
||||||
# undef getopt
|
# endif
|
||||||
# undef getopt_long
|
# undef __need_getopt
|
||||||
# undef getopt_long_only
|
# undef getopt
|
||||||
# undef optarg
|
# undef getopt_long
|
||||||
# undef opterr
|
# undef getopt_long_only
|
||||||
# undef optind
|
# undef optarg
|
||||||
# undef optopt
|
# undef opterr
|
||||||
# undef option
|
# undef optind
|
||||||
# define __GETOPT_CONCAT(x, y) x ## y
|
# undef optopt
|
||||||
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
# undef option
|
||||||
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
# define __GETOPT_CONCAT(x, y) x ## y
|
||||||
# define getopt __GETOPT_ID (getopt)
|
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
||||||
# define getopt_long __GETOPT_ID (getopt_long)
|
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
||||||
# define getopt_long_only __GETOPT_ID (getopt_long_only)
|
# define getopt __GETOPT_ID (getopt)
|
||||||
# define optarg __GETOPT_ID (optarg)
|
# define getopt_long __GETOPT_ID (getopt_long)
|
||||||
# define opterr __GETOPT_ID (opterr)
|
# define getopt_long_only __GETOPT_ID (getopt_long_only)
|
||||||
# define optind __GETOPT_ID (optind)
|
# define optarg __GETOPT_ID (optarg)
|
||||||
# define optopt __GETOPT_ID (optopt)
|
# define opterr __GETOPT_ID (opterr)
|
||||||
# define option __GETOPT_ID (option)
|
# define optind __GETOPT_ID (optind)
|
||||||
# define _getopt_internal __GETOPT_ID (getopt_internal)
|
# define optopt __GETOPT_ID (optopt)
|
||||||
#endif
|
# define option __GETOPT_ID (option)
|
||||||
|
# define _getopt_internal __GETOPT_ID (getopt_internal)
|
||||||
/* Standalone applications get correct prototypes for getopt_long and
|
#endif
|
||||||
getopt_long_only; they declare "char **argv". libc uses prototypes
|
|
||||||
with "char *const *argv" that are incorrect because getopt_long and
|
/* Standalone applications get correct prototypes for getopt_long and
|
||||||
getopt_long_only can permute argv; this is required for backward
|
getopt_long_only; they declare "char **argv". libc uses prototypes
|
||||||
compatibility (e.g., for LSB 2.0.1).
|
with "char *const *argv" that are incorrect because getopt_long and
|
||||||
|
getopt_long_only can permute argv; this is required for backward
|
||||||
This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
|
compatibility (e.g., for LSB 2.0.1).
|
||||||
but it caused redefinition warnings if both unistd.h and getopt.h were
|
|
||||||
included, since unistd.h includes getopt.h having previously defined
|
This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
|
||||||
__need_getopt.
|
but it caused redefinition warnings if both unistd.h and getopt.h were
|
||||||
|
included, since unistd.h includes getopt.h having previously defined
|
||||||
The only place where __getopt_argv_const is used is in definitions
|
__need_getopt.
|
||||||
of getopt_long and getopt_long_only below, but these are visible
|
|
||||||
only if __need_getopt is not defined, so it is quite safe to rewrite
|
The only place where __getopt_argv_const is used is in definitions
|
||||||
the conditional as follows:
|
of getopt_long and getopt_long_only below, but these are visible
|
||||||
*/
|
only if __need_getopt is not defined, so it is quite safe to rewrite
|
||||||
#if !defined __need_getopt
|
the conditional as follows:
|
||||||
# if defined __GETOPT_PREFIX
|
*/
|
||||||
# define __getopt_argv_const /* empty */
|
#if !defined __need_getopt
|
||||||
# else
|
# if defined __GETOPT_PREFIX
|
||||||
# define __getopt_argv_const const
|
# define __getopt_argv_const /* empty */
|
||||||
# endif
|
# else
|
||||||
#endif
|
# define __getopt_argv_const const
|
||||||
|
# endif
|
||||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
#endif
|
||||||
standalone, or this is the first header included in the source file.
|
|
||||||
If we are being used with glibc, we need to include <features.h>, but
|
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
standalone, or this is the first header included in the source file.
|
||||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
If we are being used with glibc, we need to include <features.h>, but
|
||||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||||
#if !defined __GNU_LIBRARY__
|
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||||
# include <ctype.h>
|
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||||
#endif
|
#if !defined __GNU_LIBRARY__
|
||||||
|
# include <ctype.h>
|
||||||
#ifndef __THROW
|
#endif
|
||||||
# ifndef __GNUC_PREREQ
|
|
||||||
# define __GNUC_PREREQ(maj, min) (0)
|
#ifndef __THROW
|
||||||
# endif
|
# ifndef __GNUC_PREREQ
|
||||||
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
# define __GNUC_PREREQ(maj, min) (0)
|
||||||
# define __THROW throw ()
|
# endif
|
||||||
# else
|
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||||
# define __THROW
|
# define __THROW throw ()
|
||||||
# endif
|
# else
|
||||||
#endif
|
# define __THROW
|
||||||
|
# endif
|
||||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
#endif
|
||||||
/* A C macro for declaring that specific arguments must not be NULL.
|
|
||||||
Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||||
|
/* A C macro for declaring that specific arguments must not be NULL.
|
||||||
This program is free software: you can redistribute it and/or modify it
|
Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||||
under the terms of the GNU General Public License as published
|
|
||||||
by the Free Software Foundation; either version 3 of the License, or
|
This program is free software: you can redistribute it and/or modify it
|
||||||
(at your option) any later version.
|
under the terms of the GNU General Public License as published
|
||||||
|
by the Free Software Foundation; either version 3 of the License, or
|
||||||
This program is distributed in the hope that it will be useful,
|
(at your option) any later version.
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
This program is distributed in the hope that it will be useful,
|
||||||
General Public License for more details.
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
You should have received a copy of the GNU General Public License
|
General Public License for more details.
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
that the values passed as arguments n, ..., m must be non-NULL pointers.
|
|
||||||
n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
||||||
#ifndef _GL_ARG_NONNULL
|
that the values passed as arguments n, ..., m must be non-NULL pointers.
|
||||||
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
||||||
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
#ifndef _GL_ARG_NONNULL
|
||||||
# else
|
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
||||||
# define _GL_ARG_NONNULL(params)
|
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
||||||
# endif
|
# else
|
||||||
#endif
|
# define _GL_ARG_NONNULL(params)
|
||||||
|
# endif
|
||||||
#ifdef __cplusplus
|
#endif
|
||||||
extern "C" {
|
|
||||||
#endif
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
/* For communication from 'getopt' to the caller.
|
#endif
|
||||||
When 'getopt' finds an option that takes an argument,
|
|
||||||
the argument value is returned here.
|
/* For communication from 'getopt' to the caller.
|
||||||
Also, when 'ordering' is RETURN_IN_ORDER,
|
When 'getopt' finds an option that takes an argument,
|
||||||
each non-option ARGV-element is returned here. */
|
the argument value is returned here.
|
||||||
|
Also, when 'ordering' is RETURN_IN_ORDER,
|
||||||
extern char *optarg;
|
each non-option ARGV-element is returned here. */
|
||||||
|
|
||||||
/* Index in ARGV of the next element to be scanned.
|
extern char *optarg;
|
||||||
This is used for communication to and from the caller
|
|
||||||
and for communication between successive calls to 'getopt'.
|
/* Index in ARGV of the next element to be scanned.
|
||||||
|
This is used for communication to and from the caller
|
||||||
On entry to 'getopt', zero means this is the first call; initialize.
|
and for communication between successive calls to 'getopt'.
|
||||||
|
|
||||||
When 'getopt' returns -1, this is the index of the first of the
|
On entry to 'getopt', zero means this is the first call; initialize.
|
||||||
non-option elements that the caller should itself scan.
|
|
||||||
|
When 'getopt' returns -1, this is the index of the first of the
|
||||||
Otherwise, 'optind' communicates from one call to the next
|
non-option elements that the caller should itself scan.
|
||||||
how much of ARGV has been scanned so far. */
|
|
||||||
|
Otherwise, 'optind' communicates from one call to the next
|
||||||
extern int optind;
|
how much of ARGV has been scanned so far. */
|
||||||
|
|
||||||
/* Callers store zero here to inhibit the error message 'getopt' prints
|
extern int optind;
|
||||||
for unrecognized options. */
|
|
||||||
|
/* Callers store zero here to inhibit the error message 'getopt' prints
|
||||||
extern int opterr;
|
for unrecognized options. */
|
||||||
|
|
||||||
/* Set to an option character which was unrecognized. */
|
extern int opterr;
|
||||||
|
|
||||||
extern int optopt;
|
/* Set to an option character which was unrecognized. */
|
||||||
|
|
||||||
#ifndef __need_getopt
|
extern int optopt;
|
||||||
/* Describe the long-named options requested by the application.
|
|
||||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
#ifndef __need_getopt
|
||||||
of 'struct option' terminated by an element containing a name which is
|
/* Describe the long-named options requested by the application.
|
||||||
zero.
|
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||||
|
of 'struct option' terminated by an element containing a name which is
|
||||||
The field 'has_arg' is:
|
zero.
|
||||||
no_argument (or 0) if the option does not take an argument,
|
|
||||||
required_argument (or 1) if the option requires an argument,
|
The field 'has_arg' is:
|
||||||
optional_argument (or 2) if the option takes an optional argument.
|
no_argument (or 0) if the option does not take an argument,
|
||||||
|
required_argument (or 1) if the option requires an argument,
|
||||||
If the field 'flag' is not NULL, it points to a variable that is set
|
optional_argument (or 2) if the option takes an optional argument.
|
||||||
to the value given in the field 'val' when the option is found, but
|
|
||||||
left unchanged if the option is not found.
|
If the field 'flag' is not NULL, it points to a variable that is set
|
||||||
|
to the value given in the field 'val' when the option is found, but
|
||||||
To have a long-named option do something other than set an 'int' to
|
left unchanged if the option is not found.
|
||||||
a compiled-in constant, such as set a value from 'optarg', set the
|
|
||||||
option's 'flag' field to zero and its 'val' field to a nonzero
|
To have a long-named option do something other than set an 'int' to
|
||||||
value (the equivalent single-letter option character, if there is
|
a compiled-in constant, such as set a value from 'optarg', set the
|
||||||
one). For long options that have a zero 'flag' field, 'getopt'
|
option's 'flag' field to zero and its 'val' field to a nonzero
|
||||||
returns the contents of the 'val' field. */
|
value (the equivalent single-letter option character, if there is
|
||||||
|
one). For long options that have a zero 'flag' field, 'getopt'
|
||||||
# if !GNULIB_defined_struct_option
|
returns the contents of the 'val' field. */
|
||||||
struct option
|
|
||||||
{
|
# if !GNULIB_defined_struct_option
|
||||||
const char *name;
|
struct option
|
||||||
/* has_arg can't be an enum because some compilers complain about
|
{
|
||||||
type mismatches in all the code that assumes it is an int. */
|
const char *name;
|
||||||
int has_arg;
|
/* has_arg can't be an enum because some compilers complain about
|
||||||
int *flag;
|
type mismatches in all the code that assumes it is an int. */
|
||||||
int val;
|
int has_arg;
|
||||||
};
|
int *flag;
|
||||||
# define GNULIB_defined_struct_option 1
|
int val;
|
||||||
# endif
|
};
|
||||||
|
# define GNULIB_defined_struct_option 1
|
||||||
/* Names for the values of the 'has_arg' field of 'struct option'. */
|
# endif
|
||||||
|
|
||||||
# define no_argument 0
|
/* Names for the values of the 'has_arg' field of 'struct option'. */
|
||||||
# define required_argument 1
|
|
||||||
# define optional_argument 2
|
# define no_argument 0
|
||||||
#endif /* need getopt */
|
# define required_argument 1
|
||||||
|
# define optional_argument 2
|
||||||
|
#endif /* need getopt */
|
||||||
/* Get definitions and prototypes for functions to process the
|
|
||||||
arguments in ARGV (ARGC of them, minus the program name) for
|
|
||||||
options given in OPTS.
|
/* Get definitions and prototypes for functions to process the
|
||||||
|
arguments in ARGV (ARGC of them, minus the program name) for
|
||||||
Return the option character from OPTS just read. Return -1 when
|
options given in OPTS.
|
||||||
there are no more options. For unrecognized options, or options
|
|
||||||
missing arguments, 'optopt' is set to the option letter, and '?' is
|
Return the option character from OPTS just read. Return -1 when
|
||||||
returned.
|
there are no more options. For unrecognized options, or options
|
||||||
|
missing arguments, 'optopt' is set to the option letter, and '?' is
|
||||||
The OPTS string is a list of characters which are recognized option
|
returned.
|
||||||
letters, optionally followed by colons, specifying that that letter
|
|
||||||
takes an argument, to be placed in 'optarg'.
|
The OPTS string is a list of characters which are recognized option
|
||||||
|
letters, optionally followed by colons, specifying that that letter
|
||||||
If a letter in OPTS is followed by two colons, its argument is
|
takes an argument, to be placed in 'optarg'.
|
||||||
optional. This behavior is specific to the GNU 'getopt'.
|
|
||||||
|
If a letter in OPTS is followed by two colons, its argument is
|
||||||
The argument '--' causes premature termination of argument
|
optional. This behavior is specific to the GNU 'getopt'.
|
||||||
scanning, explicitly telling 'getopt' that there are no more
|
|
||||||
options.
|
The argument '--' causes premature termination of argument
|
||||||
|
scanning, explicitly telling 'getopt' that there are no more
|
||||||
If OPTS begins with '-', then non-option arguments are treated as
|
options.
|
||||||
arguments to the option '\1'. This behavior is specific to the GNU
|
|
||||||
'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
|
If OPTS begins with '-', then non-option arguments are treated as
|
||||||
the environment, then do not permute arguments. */
|
arguments to the option '\1'. This behavior is specific to the GNU
|
||||||
|
'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
|
||||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
|
the environment, then do not permute arguments. */
|
||||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
|
||||||
|
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
|
||||||
#ifndef __need_getopt
|
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||||
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
|
|
||||||
const char *__shortopts,
|
#ifndef __need_getopt
|
||||||
const struct option *__longopts, int *__longind)
|
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
|
||||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
const char *__shortopts,
|
||||||
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
|
const struct option *__longopts, int *__longind)
|
||||||
const char *__shortopts,
|
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||||
const struct option *__longopts, int *__longind)
|
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
|
||||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
const char *__shortopts,
|
||||||
|
const struct option *__longopts, int *__longind)
|
||||||
#endif
|
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif
|
||||||
}
|
|
||||||
#endif
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
/* Make sure we later can get all the definitions and declarations. */
|
#endif
|
||||||
#undef __need_getopt
|
|
||||||
|
/* Make sure we later can get all the definitions and declarations. */
|
||||||
#endif /* _GL_GETOPT_H */
|
#undef __need_getopt
|
||||||
#endif /* _GL_GETOPT_H */
|
|
||||||
|
#endif /* _GL_GETOPT_H */
|
||||||
|
#endif /* _GL_GETOPT_H */
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,34 @@
|
||||||
|
2013-01-11 Michael Albinus <michael.albinus@gmx.de>
|
||||||
|
|
||||||
|
* autorevert.el (top): Require 'cl in order to pacify byte compiler.
|
||||||
|
(auto-revert-notify-rm-watch): Ignore errors.
|
||||||
|
(auto-revert-notify-add-watch): Ignore errors. Use '(modify) for
|
||||||
|
inotify, and '(size last-write-time) for w32notify. Set
|
||||||
|
buffer-local `auto-revert-use-notify' to nil when adding a file
|
||||||
|
watch fails - this is a fallback to the file modification check.
|
||||||
|
(auto-revert-notify-event-p, auto-revert-notify-event-descriptor)
|
||||||
|
(auto-revert-notify-event-action)
|
||||||
|
(auto-revert-notify-event-file-name): New defuns.
|
||||||
|
(auto-revert-notify-handler): Use them. Implement first
|
||||||
|
plausibility checks.
|
||||||
|
(auto-revert-handler): Handle also `auto-revert-tail-mode'.
|
||||||
|
|
||||||
|
2013-01-11 Julien Danjou <julien@danjou.info>
|
||||||
|
|
||||||
|
* color.el (color-rgb-to-hsv): Fix conversion computing in case min and
|
||||||
|
max are almost equal. Also return the correct value for V which is
|
||||||
|
already between 0 and 1.
|
||||||
|
|
||||||
|
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||||
|
|
||||||
|
* emacs-lisp/ert.el (ert-run-test): Use point-max-marker.
|
||||||
|
|
||||||
|
2013-01-11 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
* autorevert.el (auto-revert-notify-rm-watch)
|
||||||
|
(auto-revert-notify-add-watch): Fix typos in w32notify function
|
||||||
|
names.
|
||||||
|
|
||||||
2013-01-10 Michael Albinus <michael.albinus@gmx.de>
|
2013-01-10 Michael Albinus <michael.albinus@gmx.de>
|
||||||
|
|
||||||
* autorevert.el (auto-revert-notify-enabled): Move up.
|
* autorevert.el (auto-revert-notify-enabled): Move up.
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@
|
||||||
|
|
||||||
;; Dependencies:
|
;; Dependencies:
|
||||||
|
|
||||||
|
(eval-when-compile (require 'cl))
|
||||||
(require 'timer)
|
(require 'timer)
|
||||||
|
|
||||||
;; Custom Group:
|
;; Custom Group:
|
||||||
|
|
@ -466,8 +467,10 @@ will use an up-to-date value of `auto-revert-interval'"
|
||||||
(defun auto-revert-notify-rm-watch ()
|
(defun auto-revert-notify-rm-watch ()
|
||||||
"Disable file watch for current buffer's associated file."
|
"Disable file watch for current buffer's associated file."
|
||||||
(when auto-revert-notify-watch-descriptor
|
(when auto-revert-notify-watch-descriptor
|
||||||
(funcall (if (fboundp 'inotify-rm-watch) 'inotify-rm-watch 'w32-rm-watch)
|
(ignore-errors
|
||||||
auto-revert-notify-watch-descriptor)
|
(funcall (if (fboundp 'inotify-rm-watch)
|
||||||
|
'inotify-rm-watch 'w32notify-rm-watch)
|
||||||
|
auto-revert-notify-watch-descriptor))
|
||||||
(remhash auto-revert-notify-watch-descriptor
|
(remhash auto-revert-notify-watch-descriptor
|
||||||
auto-revert-notify-watch-descriptor-hash-list))
|
auto-revert-notify-watch-descriptor-hash-list))
|
||||||
(setq auto-revert-notify-watch-descriptor nil
|
(setq auto-revert-notify-watch-descriptor nil
|
||||||
|
|
@ -478,21 +481,62 @@ will use an up-to-date value of `auto-revert-interval'"
|
||||||
(when (and buffer-file-name auto-revert-use-notify)
|
(when (and buffer-file-name auto-revert-use-notify)
|
||||||
(auto-revert-notify-rm-watch)
|
(auto-revert-notify-rm-watch)
|
||||||
(let ((func (if (fboundp 'inotify-add-watch)
|
(let ((func (if (fboundp 'inotify-add-watch)
|
||||||
'inotify-add-watch 'w32-add-watch))
|
'inotify-add-watch 'w32notify-add-watch))
|
||||||
(aspect (if (fboundp 'inotify-add-watch)
|
(aspect (if (fboundp 'inotify-add-watch)
|
||||||
'(close-write) '(last-write-time))))
|
'(modify) '(size last-write-time))))
|
||||||
(setq auto-revert-notify-watch-descriptor
|
(setq auto-revert-notify-watch-descriptor
|
||||||
(funcall func buffer-file-name aspect 'auto-revert-notify-handler))
|
(ignore-errors
|
||||||
(puthash auto-revert-notify-watch-descriptor
|
(funcall
|
||||||
(current-buffer)
|
func buffer-file-name aspect 'auto-revert-notify-handler)))
|
||||||
auto-revert-notify-watch-descriptor-hash-list))))
|
(if auto-revert-notify-watch-descriptor
|
||||||
|
(puthash auto-revert-notify-watch-descriptor
|
||||||
|
(current-buffer)
|
||||||
|
auto-revert-notify-watch-descriptor-hash-list)
|
||||||
|
;; Fallback to file checks.
|
||||||
|
(set (make-local-variable 'auto-revert-use-notify) nil)))))
|
||||||
|
|
||||||
|
(defun auto-revert-notify-event-p (event)
|
||||||
|
"Check that event is a file watch event."
|
||||||
|
(cond ((featurep 'inotify)
|
||||||
|
(and (listp event) (= (length event) 4)))
|
||||||
|
((featurep 'w32notify)
|
||||||
|
(and (listp event) (= (length event) 3) (stringp (nth 2 event))))))
|
||||||
|
|
||||||
|
(defun auto-revert-notify-event-descriptor (event)
|
||||||
|
"Return watch descriptor of notification event, or nil."
|
||||||
|
(and (auto-revert-notify-event-p event) (car event)))
|
||||||
|
|
||||||
|
(defun auto-revert-notify-event-action (event)
|
||||||
|
"Return action of notification event, or nil."
|
||||||
|
(and (auto-revert-notify-event-p event) (nth 1 event)))
|
||||||
|
|
||||||
|
(defun auto-revert-notify-event-file-name (event)
|
||||||
|
"Return file name of notification event, or nil."
|
||||||
|
(and (auto-revert-notify-event-p event)
|
||||||
|
(cond ((featurep 'inotify) (nth 3 event))
|
||||||
|
((featurep 'w32notify) (nth 2 event)))))
|
||||||
|
|
||||||
(defun auto-revert-notify-handler (event)
|
(defun auto-revert-notify-handler (event)
|
||||||
"Handle an event returned from file watch."
|
"Handle an event returned from file watch."
|
||||||
(when (listp event)
|
(when (auto-revert-notify-event-p event)
|
||||||
(let ((buffer
|
(let* ((descriptor (auto-revert-notify-event-descriptor event))
|
||||||
(gethash (car event) auto-revert-notify-watch-descriptor-hash-list)))
|
(action (auto-revert-notify-event-action event))
|
||||||
(when (bufferp buffer)
|
(file (auto-revert-notify-event-file-name event))
|
||||||
|
(buffer (gethash descriptor
|
||||||
|
auto-revert-notify-watch-descriptor-hash-list)))
|
||||||
|
(ignore-errors
|
||||||
|
;; Check, that event is meant for us.
|
||||||
|
;; TODO: Filter events which stop watching, like `move' or `removed'.
|
||||||
|
(assert descriptor)
|
||||||
|
(when (featurep 'inotify) (assert (memq 'modify descriptor)))
|
||||||
|
(when (featurep 'w32notify) (assert (eq 'modified descriptor)))
|
||||||
|
(assert (bufferp buffer))
|
||||||
|
(when (stringp file)
|
||||||
|
(assert (string-equal
|
||||||
|
(directory-file-name file)
|
||||||
|
(directory-file-name (buffer-file-name buffer)))))
|
||||||
|
|
||||||
|
;; Mark buffer modified.
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(setq auto-revert-notify-modified-p t))))))
|
(setq auto-revert-notify-modified-p t))))))
|
||||||
|
|
||||||
|
|
@ -513,6 +557,8 @@ This is an internal function used by Auto-Revert Mode."
|
||||||
(let* ((buffer (current-buffer)) size
|
(let* ((buffer (current-buffer)) size
|
||||||
(revert
|
(revert
|
||||||
(or (and buffer-file-name
|
(or (and buffer-file-name
|
||||||
|
(or (not auto-revert-use-notify)
|
||||||
|
auto-revert-notify-modified-p)
|
||||||
(if auto-revert-tail-mode
|
(if auto-revert-tail-mode
|
||||||
;; Tramp caches the file attributes. Setting
|
;; Tramp caches the file attributes. Setting
|
||||||
;; `remote-file-name-inhibit-cache' forces Tramp
|
;; `remote-file-name-inhibit-cache' forces Tramp
|
||||||
|
|
@ -523,12 +569,9 @@ This is an internal function used by Auto-Revert Mode."
|
||||||
(setq size
|
(setq size
|
||||||
(nth 7 (file-attributes
|
(nth 7 (file-attributes
|
||||||
buffer-file-name))))))
|
buffer-file-name))))))
|
||||||
(if auto-revert-use-notify
|
(and (not (file-remote-p buffer-file-name))
|
||||||
;; There are file watches.
|
(file-readable-p buffer-file-name)
|
||||||
auto-revert-notify-modified-p
|
(not (verify-visited-file-modtime buffer)))))
|
||||||
(and (not (file-remote-p buffer-file-name))
|
|
||||||
(file-readable-p buffer-file-name)
|
|
||||||
(not (verify-visited-file-modtime buffer))))))
|
|
||||||
(and (or auto-revert-mode
|
(and (or auto-revert-mode
|
||||||
global-auto-revert-non-file-buffers)
|
global-auto-revert-non-file-buffers)
|
||||||
revert-buffer-function
|
revert-buffer-function
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ inclusive."
|
||||||
(max (max r g b))
|
(max (max r g b))
|
||||||
(min (min r g b)))
|
(min (min r g b)))
|
||||||
(if (< (- max min) 1e-8)
|
(if (< (- max min) 1e-8)
|
||||||
(list 0.0 0.0 0.0)
|
(list 0.0 0.0 min)
|
||||||
(list
|
(list
|
||||||
(/ (* 2 float-pi
|
(/ (* 2 float-pi
|
||||||
(cond ((and (= r g) (= g b)) 0)
|
(cond ((and (= r g) (= g b)) 0)
|
||||||
|
|
@ -146,7 +146,7 @@ inclusive."
|
||||||
(+ 240 (* 60 (/ (- r g) (- max min)))))))
|
(+ 240 (* 60 (/ (- r g) (- max min)))))))
|
||||||
360)
|
360)
|
||||||
(if (= max 0) 0 (- 1 (/ min max)))
|
(if (= max 0) 0 (- 1 (/ min max)))
|
||||||
(/ max 255.0)))))
|
max))))
|
||||||
|
|
||||||
(defun color-rgb-to-hsl (red green blue)
|
(defun color-rgb-to-hsl (red green blue)
|
||||||
"Convert RGB colors to their HSL representation.
|
"Convert RGB colors to their HSL representation.
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@ Returns the result and stores it in ERT-TEST's `most-recent-result' slot."
|
||||||
(cl-block error
|
(cl-block error
|
||||||
(let ((begin-marker
|
(let ((begin-marker
|
||||||
(with-current-buffer (get-buffer-create "*Messages*")
|
(with-current-buffer (get-buffer-create "*Messages*")
|
||||||
(set-marker (make-marker) (point-max)))))
|
(point-max-marker))))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(let ((info (make-ert--test-execution-info
|
(let ((info (make-ert--test-execution-info
|
||||||
:test ert-test
|
:test ert-test
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||||
|
|
||||||
|
* erc-dcc.el (erc-dcc-send-file): Use point-min-marker.
|
||||||
|
(erc-dcc-chat-setup): Use point-max-marker.
|
||||||
|
|
||||||
2013-01-04 Glenn Morris <rgm@gnu.org>
|
2013-01-04 Glenn Morris <rgm@gnu.org>
|
||||||
|
|
||||||
* erc-backend.el (312): Fix typo. (Bug#13235)
|
* erc-backend.el (312): Fix typo. (Bug#13235)
|
||||||
|
|
|
||||||
|
|
@ -897,7 +897,7 @@ other client."
|
||||||
(let* ((buffer (erc-dcc-find-file file))
|
(let* ((buffer (erc-dcc-find-file file))
|
||||||
(size (buffer-size buffer))
|
(size (buffer-size buffer))
|
||||||
(start (with-current-buffer buffer
|
(start (with-current-buffer buffer
|
||||||
(set-marker (make-marker) (point-min))))
|
(point-min-marker)))
|
||||||
(sproc (erc-dcc-server "dcc-send"
|
(sproc (erc-dcc-server "dcc-send"
|
||||||
'erc-dcc-send-filter
|
'erc-dcc-send-filter
|
||||||
'erc-dcc-send-sentinel))
|
'erc-dcc-send-sentinel))
|
||||||
|
|
@ -1166,7 +1166,7 @@ other client."
|
||||||
(setq erc-dcc-from nick)
|
(setq erc-dcc-from nick)
|
||||||
(setq erc-dcc-entry-data entry)
|
(setq erc-dcc-entry-data entry)
|
||||||
(setq erc-dcc-unprocessed-output "")
|
(setq erc-dcc-unprocessed-output "")
|
||||||
(setq erc-insert-marker (set-marker (make-marker) (point-max)))
|
(setq erc-insert-marker (point-max-marker))
|
||||||
(setq erc-input-marker (make-marker))
|
(setq erc-input-marker (make-marker))
|
||||||
(erc-display-prompt buffer (point-max))
|
(erc-display-prompt buffer (point-max))
|
||||||
(set-process-buffer proc buffer)
|
(set-process-buffer proc buffer)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,15 @@
|
||||||
|
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||||
|
|
||||||
|
* gnus-art.el (gnus-mime-display-security): Use point-min-marker
|
||||||
|
and point-max-marker.
|
||||||
|
* gnus-async.el (gnus-async-article-callback): Use point-max-marker.
|
||||||
|
|
||||||
|
2013-01-10 Uwe Brauer <oub@mat.ucm.es> (tiny change)
|
||||||
|
|
||||||
|
* mml-smime.el (mml-smime-encrypt-to-self): New user option analogous
|
||||||
|
to mml2015-encrypt-to-self.
|
||||||
|
(mml-smime-epg-encrypt): Respect mml-smime-encrypt-to-self.
|
||||||
|
|
||||||
2013-01-09 Daiki Ueno <ueno@gnu.org>
|
2013-01-09 Daiki Ueno <ueno@gnu.org>
|
||||||
|
|
||||||
* mml-smime.el (epg-sub-key-fingerprint): Autoload for
|
* mml-smime.el (epg-sub-key-fingerprint): Autoload for
|
||||||
|
|
|
||||||
|
|
@ -8688,9 +8688,7 @@ For example:
|
||||||
gnus-mime-security-button-end-line-format))
|
gnus-mime-security-button-end-line-format))
|
||||||
(gnus-insert-mime-security-button handle)))
|
(gnus-insert-mime-security-button handle)))
|
||||||
(mm-set-handle-multipart-parameter
|
(mm-set-handle-multipart-parameter
|
||||||
handle 'gnus-region
|
handle 'gnus-region (cons (point-min-marker) (point-max-marker)))
|
||||||
(cons (set-marker (make-marker) (point-min))
|
|
||||||
(set-marker (make-marker) (point-max))))
|
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
|
|
||||||
(defun gnus-mime-security-run-function (function)
|
(defun gnus-mime-security-run-function (function)
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ that was fetched."
|
||||||
gnus-async-article-alist
|
gnus-async-article-alist
|
||||||
(cons (list (intern (format "%s-%d" group article)
|
(cons (list (intern (format "%s-%d" group article)
|
||||||
gnus-async-hashtb)
|
gnus-async-hashtb)
|
||||||
mark (set-marker (make-marker) (point-max))
|
mark (point-max-marker)
|
||||||
group article)
|
group article)
|
||||||
gnus-async-article-alist))))
|
gnus-async-article-alist))))
|
||||||
(if (not (gnus-buffer-live-p summary))
|
(if (not (gnus-buffer-live-p summary))
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,12 @@ Whether the passphrase is cached at all is controlled by
|
||||||
:version "24.4"
|
:version "24.4"
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom mml-smime-encrypt-to-self nil
|
||||||
|
"If t, add your own key ID to recipient list when encryption."
|
||||||
|
:group 'mime-security
|
||||||
|
:version "24.4"
|
||||||
|
:type 'boolean)
|
||||||
|
|
||||||
(defun mml-smime-sign (cont)
|
(defun mml-smime-sign (cont)
|
||||||
(let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist))))
|
(let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist))))
|
||||||
(if func
|
(if func
|
||||||
|
|
@ -475,13 +481,17 @@ Content-Disposition: attachment; filename=smime.p7s
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
|
|
||||||
(defun mml-smime-epg-encrypt (cont)
|
(defun mml-smime-epg-encrypt (cont)
|
||||||
(let ((inhibit-redisplay t)
|
(let* ((inhibit-redisplay t)
|
||||||
(context (epg-make-context 'CMS))
|
(context (epg-make-context 'CMS))
|
||||||
(config (epg-configuration))
|
(config (epg-configuration))
|
||||||
(recipients (message-options-get 'mml-smime-epg-recipients))
|
(recipients (message-options-get 'mml-smime-epg-recipients))
|
||||||
cipher signers
|
cipher signers
|
||||||
(boundary (mml-compute-boundary cont))
|
(sender (message-options-get 'message-sender))
|
||||||
recipient-key)
|
(signer-names (or mml-smime-signers
|
||||||
|
(if (and mml-smime-sign-with-sender sender)
|
||||||
|
(list (concat "<" sender ">")))))
|
||||||
|
(boundary (mml-compute-boundary cont))
|
||||||
|
recipient-key)
|
||||||
(unless recipients
|
(unless recipients
|
||||||
(setq recipients
|
(setq recipients
|
||||||
(apply #'nconc
|
(apply #'nconc
|
||||||
|
|
@ -494,6 +504,10 @@ Content-Disposition: attachment; filename=smime.p7s
|
||||||
(message-options-set 'message-recipients
|
(message-options-set 'message-recipients
|
||||||
(read-string "Recipients: ")))
|
(read-string "Recipients: ")))
|
||||||
"[ \f\t\n\r\v,]+"))))
|
"[ \f\t\n\r\v,]+"))))
|
||||||
|
(when mml-smime-encrypt-to-self
|
||||||
|
(unless signer-names
|
||||||
|
(error "Neither message sender nor mml-smime-signers are set"))
|
||||||
|
(setq recipients (nconc recipients signer-names)))
|
||||||
(if (eq mm-encrypt-option 'guided)
|
(if (eq mm-encrypt-option 'guided)
|
||||||
(setq recipients
|
(setq recipients
|
||||||
(epa-select-keys context "\
|
(epa-select-keys context "\
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2013-01-11 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
* inc/unistd.h (O_IGNORE_CTTY): Define, as it is unconditionally
|
||||||
|
used in term.c. (Bug#13387)
|
||||||
|
|
||||||
2013-01-09 Juanma Barranquero <lekktu@gmail.com>
|
2013-01-09 Juanma Barranquero <lekktu@gmail.com>
|
||||||
|
|
||||||
* config.nt: Sync with autogen/config.in.
|
* config.nt: Sync with autogen/config.in.
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ extern int faccessat (int, char const *, int, int);
|
||||||
#define AT_SYMLINK_NOFOLLOW 4096
|
#define AT_SYMLINK_NOFOLLOW 4096
|
||||||
|
|
||||||
#define O_NOCTTY 0
|
#define O_NOCTTY 0
|
||||||
|
#define O_IGNORE_CTTY 0
|
||||||
|
|
||||||
/* This is normally on stdlib.h, but we don't override that header. */
|
/* This is normally on stdlib.h, but we don't override that header. */
|
||||||
extern int unsetenv (const char *);
|
extern int unsetenv (const char *);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,28 @@
|
||||||
|
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||||
|
|
||||||
|
Avoid unnecessary byte position calculation for the gap movement.
|
||||||
|
Since all users of move_gap do CHAR_TO_BYTE for other purposes
|
||||||
|
anyway, all of them should use move_gap_both instead.
|
||||||
|
* lisp.h (move_gap): Remove prototype.
|
||||||
|
* insdel.c (move_gap): Remove.
|
||||||
|
(move_gap_both): Add eassert.
|
||||||
|
* editfns.c (Ftranspose_regions): Tweak to use move_gap_both.
|
||||||
|
* xml.c (parse_region): Likewise.
|
||||||
|
|
||||||
|
2013-01-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
emacsclient -t should not suspend Emacs server (Bug#13387)
|
||||||
|
* lisp.h, sysdep.c (block_tty_out_signal, unblock_tty_out_signal):
|
||||||
|
New functions.
|
||||||
|
* term.c (init_tty): Use them instead of rolling our own code.
|
||||||
|
* sysdep.c (tcsetpgrp_without_stopping): Likewise. Here, this
|
||||||
|
switches from 'signal' to 'pthread_sigmask', which is safer in
|
||||||
|
multithreaded applications.
|
||||||
|
* term.c (Fresume_tty): Don't bother dissociating if O_IGNORE_CTTY,
|
||||||
|
which has already arranged for that.
|
||||||
|
(dissociate_if_controlling_tty): If setsid fails, fall back on TIOCNOTTY.
|
||||||
|
This is the main part of the bug fix.
|
||||||
|
|
||||||
2013-01-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> (tiny change)
|
2013-01-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> (tiny change)
|
||||||
|
|
||||||
* gtkutil.c (xg_initialize): Add ifdef HAVE_FREETYPE around
|
* gtkutil.c (xg_initialize): Add ifdef HAVE_FREETYPE around
|
||||||
|
|
|
||||||
|
|
@ -4522,7 +4522,7 @@ Transposing beyond buffer boundaries is an error. */)
|
||||||
(Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
|
(Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
|
||||||
{
|
{
|
||||||
register ptrdiff_t start1, end1, start2, end2;
|
register ptrdiff_t start1, end1, start2, end2;
|
||||||
ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte;
|
ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte, end2_byte;
|
||||||
ptrdiff_t gap, len1, len_mid, len2;
|
ptrdiff_t gap, len1, len_mid, len2;
|
||||||
unsigned char *start1_addr, *start2_addr, *temp;
|
unsigned char *start1_addr, *start2_addr, *temp;
|
||||||
|
|
||||||
|
|
@ -4583,20 +4583,22 @@ Transposing beyond buffer boundaries is an error. */)
|
||||||
the gap the minimum distance to get it out of the way, and then
|
the gap the minimum distance to get it out of the way, and then
|
||||||
deal with an unbroken array. */
|
deal with an unbroken array. */
|
||||||
|
|
||||||
|
start1_byte = CHAR_TO_BYTE (start1);
|
||||||
|
end2_byte = CHAR_TO_BYTE (end2);
|
||||||
|
|
||||||
/* Make sure the gap won't interfere, by moving it out of the text
|
/* Make sure the gap won't interfere, by moving it out of the text
|
||||||
we will operate on. */
|
we will operate on. */
|
||||||
if (start1 < gap && gap < end2)
|
if (start1 < gap && gap < end2)
|
||||||
{
|
{
|
||||||
if (gap - start1 < end2 - gap)
|
if (gap - start1 < end2 - gap)
|
||||||
move_gap (start1);
|
move_gap_both (start1, start1_byte);
|
||||||
else
|
else
|
||||||
move_gap (end2);
|
move_gap_both (end2, end2_byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
start1_byte = CHAR_TO_BYTE (start1);
|
|
||||||
start2_byte = CHAR_TO_BYTE (start2);
|
start2_byte = CHAR_TO_BYTE (start2);
|
||||||
len1_byte = CHAR_TO_BYTE (end1) - start1_byte;
|
len1_byte = CHAR_TO_BYTE (end1) - start1_byte;
|
||||||
len2_byte = CHAR_TO_BYTE (end2) - start2_byte;
|
len2_byte = end2_byte - start2_byte;
|
||||||
|
|
||||||
#ifdef BYTE_COMBINING_DEBUG
|
#ifdef BYTE_COMBINING_DEBUG
|
||||||
if (end1 == start2)
|
if (end1 == start2)
|
||||||
|
|
|
||||||
11
src/insdel.c
11
src/insdel.c
|
|
@ -84,21 +84,14 @@ check_markers (void)
|
||||||
|
|
||||||
#endif /* MARKER_DEBUG */
|
#endif /* MARKER_DEBUG */
|
||||||
|
|
||||||
/* Move gap to position CHARPOS.
|
|
||||||
Note that this can quit! */
|
|
||||||
|
|
||||||
void
|
|
||||||
move_gap (ptrdiff_t charpos)
|
|
||||||
{
|
|
||||||
move_gap_both (charpos, CHAR_TO_BYTE (charpos));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move gap to byte position BYTEPOS, which is also char position CHARPOS.
|
/* Move gap to byte position BYTEPOS, which is also char position CHARPOS.
|
||||||
Note that this can quit! */
|
Note that this can quit! */
|
||||||
|
|
||||||
void
|
void
|
||||||
move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos)
|
move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos)
|
||||||
{
|
{
|
||||||
|
eassert (charpos == BYTE_TO_CHAR (bytepos)
|
||||||
|
&& bytepos == CHAR_TO_BYTE (charpos));
|
||||||
if (bytepos < GPT_BYTE)
|
if (bytepos < GPT_BYTE)
|
||||||
gap_left (charpos, bytepos, 0);
|
gap_left (charpos, bytepos, 0);
|
||||||
else if (bytepos > GPT_BYTE)
|
else if (bytepos > GPT_BYTE)
|
||||||
|
|
|
||||||
|
|
@ -2780,7 +2780,6 @@ extern void syms_of_image (void);
|
||||||
|
|
||||||
/* Defined in insdel.c. */
|
/* Defined in insdel.c. */
|
||||||
extern Lisp_Object Qinhibit_modification_hooks;
|
extern Lisp_Object Qinhibit_modification_hooks;
|
||||||
extern void move_gap (ptrdiff_t);
|
|
||||||
extern void move_gap_both (ptrdiff_t, ptrdiff_t);
|
extern void move_gap_both (ptrdiff_t, ptrdiff_t);
|
||||||
extern _Noreturn void buffer_overflow (void);
|
extern _Noreturn void buffer_overflow (void);
|
||||||
extern void make_gap (ptrdiff_t);
|
extern void make_gap (ptrdiff_t);
|
||||||
|
|
@ -3467,6 +3466,8 @@ extern void init_sigio (int);
|
||||||
extern void sys_subshell (void);
|
extern void sys_subshell (void);
|
||||||
extern void sys_suspend (void);
|
extern void sys_suspend (void);
|
||||||
extern void discard_tty_input (void);
|
extern void discard_tty_input (void);
|
||||||
|
extern void block_tty_out_signal (void);
|
||||||
|
extern void unblock_tty_out_signal (void);
|
||||||
extern void init_sys_modes (struct tty_display_info *);
|
extern void init_sys_modes (struct tty_display_info *);
|
||||||
extern void reset_sys_modes (struct tty_display_info *);
|
extern void reset_sys_modes (struct tty_display_info *);
|
||||||
extern void init_all_sys_modes (void);
|
extern void init_all_sys_modes (void);
|
||||||
|
|
|
||||||
26
src/sysdep.c
26
src/sysdep.c
|
|
@ -714,6 +714,27 @@ init_foreground_group (void)
|
||||||
inherited_pgroup = getpid () == pgrp ? 0 : pgrp;
|
inherited_pgroup = getpid () == pgrp ? 0 : pgrp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Block and unblock SIGTTOU. */
|
||||||
|
|
||||||
|
void
|
||||||
|
block_tty_out_signal (void)
|
||||||
|
{
|
||||||
|
#ifdef SIGTTOU
|
||||||
|
sigset_t blocked;
|
||||||
|
sigemptyset (&blocked);
|
||||||
|
sigaddset (&blocked, SIGTTOU);
|
||||||
|
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
unblock_tty_out_signal (void)
|
||||||
|
{
|
||||||
|
#ifdef SIGTTOU
|
||||||
|
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Safely set a controlling terminal FD's process group to PGID.
|
/* Safely set a controlling terminal FD's process group to PGID.
|
||||||
If we are not in the foreground already, POSIX requires tcsetpgrp
|
If we are not in the foreground already, POSIX requires tcsetpgrp
|
||||||
to deliver a SIGTTOU signal, which would stop us. This is an
|
to deliver a SIGTTOU signal, which would stop us. This is an
|
||||||
|
|
@ -725,11 +746,10 @@ static void
|
||||||
tcsetpgrp_without_stopping (int fd, pid_t pgid)
|
tcsetpgrp_without_stopping (int fd, pid_t pgid)
|
||||||
{
|
{
|
||||||
#ifdef SIGTTOU
|
#ifdef SIGTTOU
|
||||||
signal_handler_t handler;
|
|
||||||
block_input ();
|
block_input ();
|
||||||
handler = signal (SIGTTOU, SIG_IGN);
|
block_tty_out_signal ();
|
||||||
tcsetpgrp (fd, pgid);
|
tcsetpgrp (fd, pgid);
|
||||||
signal (SIGTTOU, handler);
|
unblock_tty_out_signal ();
|
||||||
unblock_input ();
|
unblock_input ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
src/term.c
31
src/term.c
|
|
@ -2423,7 +2423,7 @@ frame's terminal). */)
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
|
error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
|
||||||
|
|
||||||
if (strcmp (t->display_info.tty->name, DEV_TTY))
|
if (!O_IGNORE_CTTY && strcmp (t->display_info.tty->name, DEV_TTY) != 0)
|
||||||
dissociate_if_controlling_tty (fd);
|
dissociate_if_controlling_tty (fd);
|
||||||
|
|
||||||
t->display_info.tty->output = fdopen (fd, "w+");
|
t->display_info.tty->output = fdopen (fd, "w+");
|
||||||
|
|
@ -2903,13 +2903,23 @@ set_tty_hooks (struct terminal *terminal)
|
||||||
terminal->delete_terminal_hook = &delete_tty;
|
terminal->delete_terminal_hook = &delete_tty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Drop the controlling terminal if fd is the same device. */
|
/* If FD is the controlling terminal, drop it. */
|
||||||
static void
|
static void
|
||||||
dissociate_if_controlling_tty (int fd)
|
dissociate_if_controlling_tty (int fd)
|
||||||
{
|
{
|
||||||
pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
|
/* If tcgetpgrp succeeds, fd is the controlling terminal,
|
||||||
if (0 <= pgid)
|
so dissociate it by invoking setsid. */
|
||||||
setsid ();
|
if (0 <= tcgetpgrp (fd) && setsid () < 0)
|
||||||
|
{
|
||||||
|
#ifdef TIOCNOTTY
|
||||||
|
/* setsid failed, presumably because Emacs is already a process
|
||||||
|
group leader. Fall back on the obsolescent way to dissociate
|
||||||
|
a controlling tty. */
|
||||||
|
block_tty_out_signal ();
|
||||||
|
ioctl (fd, TIOCNOTTY, 0);
|
||||||
|
unblock_tty_out_signal ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a termcap display on the tty device with the given name and
|
/* Create a termcap display on the tty device with the given name and
|
||||||
|
|
@ -3030,14 +3040,9 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
|
||||||
|
|
||||||
/* On some systems, tgetent tries to access the controlling
|
/* On some systems, tgetent tries to access the controlling
|
||||||
terminal. */
|
terminal. */
|
||||||
{
|
block_tty_out_signal ();
|
||||||
sigset_t blocked;
|
status = tgetent (tty->termcap_term_buffer, terminal_type);
|
||||||
sigemptyset (&blocked);
|
unblock_tty_out_signal ();
|
||||||
sigaddset (&blocked, SIGTTOU);
|
|
||||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
|
||||||
status = tgetent (tty->termcap_term_buffer, terminal_type);
|
|
||||||
pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
17
src/xml.c
17
src/xml.c
|
|
@ -180,8 +180,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
|
||||||
xmlDoc *doc;
|
xmlDoc *doc;
|
||||||
Lisp_Object result = Qnil;
|
Lisp_Object result = Qnil;
|
||||||
const char *burl = "";
|
const char *burl = "";
|
||||||
ptrdiff_t bytes;
|
ptrdiff_t istart, iend, istart_byte, iend_byte;
|
||||||
ptrdiff_t istart, iend;
|
|
||||||
|
|
||||||
fn_xmlCheckVersion (LIBXML_VERSION);
|
fn_xmlCheckVersion (LIBXML_VERSION);
|
||||||
|
|
||||||
|
|
@ -189,9 +188,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
|
||||||
|
|
||||||
istart = XINT (start);
|
istart = XINT (start);
|
||||||
iend = XINT (end);
|
iend = XINT (end);
|
||||||
|
istart_byte = CHAR_TO_BYTE (istart);
|
||||||
|
iend_byte = CHAR_TO_BYTE (iend);
|
||||||
|
|
||||||
if (istart < GPT && GPT < iend)
|
if (istart < GPT && GPT < iend)
|
||||||
move_gap (iend);
|
move_gap_both (iend, iend_byte);
|
||||||
|
|
||||||
if (! NILP (base_url))
|
if (! NILP (base_url))
|
||||||
{
|
{
|
||||||
|
|
@ -199,17 +200,15 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
|
||||||
burl = SSDATA (base_url);
|
burl = SSDATA (base_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
|
|
||||||
|
|
||||||
if (htmlp)
|
if (htmlp)
|
||||||
doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
|
doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
|
||||||
bytes, burl, "utf-8",
|
iend_byte - istart_byte, burl, "utf-8",
|
||||||
HTML_PARSE_RECOVER|HTML_PARSE_NONET|
|
HTML_PARSE_RECOVER|HTML_PARSE_NONET|
|
||||||
HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
|
HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
|
||||||
HTML_PARSE_NOBLANKS);
|
HTML_PARSE_NOBLANKS);
|
||||||
else
|
else
|
||||||
doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
|
doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
|
||||||
bytes, burl, "utf-8",
|
iend_byte - istart_byte, burl, "utf-8",
|
||||||
XML_PARSE_NONET|XML_PARSE_NOWARNING|
|
XML_PARSE_NONET|XML_PARSE_NOWARNING|
|
||||||
XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
|
XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue