mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
upstream
This commit is contained in:
commit
e6206db426
138 changed files with 5977 additions and 2129 deletions
24
ChangeLog
24
ChangeLog
|
|
@ -1,3 +1,27 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* configure.ac: Do not check for fcntl.h.
|
||||
* lib/gnulib.mk: Regenerate.
|
||||
|
||||
2012-11-16 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Remove no-longer-used pty_max_bytes variable.
|
||||
* configure.ac (fpathconf): Remove unnecessary check.
|
||||
|
||||
2012-11-14 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Use faccessat, not access, when checking file permissions (Bug#12632).
|
||||
* .bzrignore: Add lib/fcntl.h.
|
||||
* configure.ac (euidaccess): Remove check; gnulib does this for us now.
|
||||
(gl_FCNTL_O_FLAGS): Define a dummy version.
|
||||
* lib/at-func.c, lib/euidaccess.c, lib/faccessat.c, lib/fcntl.in.h:
|
||||
* lib/getgroups.c, lib/group-member.c, lib/root-uid.h:
|
||||
* lib/xalloc-oversized.h, m4/euidaccess.m4, m4/faccessat.m4:
|
||||
* m4/fcntl_h.m4, m4/getgroups.m4, m4/group-member.m4:
|
||||
New files, from gnulib.
|
||||
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
|
||||
|
||||
2012-11-05 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume at least POSIX.1-1988 for getpgrp, setpgid, setsid (Bug#12800).
|
||||
|
|
|
|||
|
|
@ -150,9 +150,7 @@ HAVE_ENDGRENT
|
|||
HAVE_ENDPWENT
|
||||
HAVE_ENVIRON_DECL
|
||||
HAVE_EUIDACCESS
|
||||
HAVE_FCNTL_H
|
||||
HAVE_FORK
|
||||
HAVE_FPATHCONF
|
||||
HAVE_FREEIFADDRS
|
||||
HAVE_FREETYPE
|
||||
HAVE_FSEEKO
|
||||
|
|
@ -420,8 +418,6 @@ NSIG
|
|||
NSIG_MINIMUM
|
||||
NULL_DEVICE
|
||||
ORDINARY_LINK
|
||||
O_RDONLY
|
||||
O_RDWR
|
||||
PAGESIZE
|
||||
PREFER_VSUSP
|
||||
PTY_ITERATION
|
||||
|
|
|
|||
|
|
@ -1,3 +1,22 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* CPP-DEFINES (O_RDONLY, O_RDWR, HAVE_FCNTL_H): Remove.
|
||||
* merge-gnulib (GNULIB_MODULES): Add fcntl-h.
|
||||
|
||||
2012-11-16 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Remove no-longer-used pty_max_bytes variable.
|
||||
* CPP-DEFINES (HAVE_FPATHCONF): Remove.
|
||||
|
||||
2012-11-14 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Use faccessat, not access, when checking file permissions (Bug#12632).
|
||||
* merge-gnulib (GNULIB_MODULES): Add faccessat.
|
||||
(GNULIB_TOOL_FLAGS): Avoid at-internal, fchdir, malloc-posix,
|
||||
openat-die, openat-h, save-cwd. Do not avoid fcntl-h.
|
||||
Omit gnulib's m4/fcntl-o.m4.
|
||||
|
||||
2012-11-05 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume at least POSIX.1-1988 for getpgrp, setpgid, setsid (Bug#12800).
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ GNULIB_URL=git://git.savannah.gnu.org/gnulib.git
|
|||
GNULIB_MODULES='
|
||||
alloca-opt c-ctype c-strcase
|
||||
careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
|
||||
dtoastr dtotimespec dup2 environ execinfo
|
||||
filemode getloadavg getopt-gnu gettime gettimeofday
|
||||
dtoastr dtotimespec dup2 environ execinfo faccessat
|
||||
fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday
|
||||
ignore-value intprops largefile lstat
|
||||
manywarnings mktime pselect pthread_sigmask readlink
|
||||
socklen stat-time stdalign stdarg stdbool stdio
|
||||
|
|
@ -39,9 +39,12 @@ GNULIB_MODULES='
|
|||
'
|
||||
|
||||
GNULIB_TOOL_FLAGS='
|
||||
--avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat
|
||||
--avoid=msvc-inval --avoid=msvc-nothrow
|
||||
--avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types
|
||||
--avoid=at-internal
|
||||
--avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat
|
||||
--avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow
|
||||
--avoid=openat-die --avoid=openat-h
|
||||
--avoid=raise
|
||||
--avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types
|
||||
--avoid=threadlib
|
||||
--conditional-dependencies --import --no-changelog --no-vc-files
|
||||
--makefile-name=gnulib.mk
|
||||
|
|
@ -85,7 +88,7 @@ test -x "$gnulib_srcdir"/gnulib-tool || {
|
|||
}
|
||||
|
||||
"$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES &&
|
||||
rm -- "$src"m4/gnulib-cache.m4 "$src"m4/warn-on-use.m4 &&
|
||||
rm -- "$src"m4/fcntl-o.m4 "$src"m4/gnulib-cache.m4 "$src"m4/warn-on-use.m4 &&
|
||||
cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc &&
|
||||
cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux &&
|
||||
autoreconf -i -I m4 -- ${src:+"$src"}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --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 c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub 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=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --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 c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
|
|
@ -66,14 +66,17 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
|
|||
$(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/c-strtod.m4 \
|
||||
$(top_srcdir)/m4/clock_time.m4 \
|
||||
$(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/dup2.m4 \
|
||||
$(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/execinfo.m4 \
|
||||
$(top_srcdir)/m4/extensions.m4 \
|
||||
$(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/filemode.m4 \
|
||||
$(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/getloadavg.m4 \
|
||||
$(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/euidaccess.m4 \
|
||||
$(top_srcdir)/m4/execinfo.m4 $(top_srcdir)/m4/extensions.m4 \
|
||||
$(top_srcdir)/m4/extern-inline.m4 \
|
||||
$(top_srcdir)/m4/faccessat.m4 $(top_srcdir)/m4/fcntl_h.m4 \
|
||||
$(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/fpending.m4 \
|
||||
$(top_srcdir)/m4/getgroups.m4 $(top_srcdir)/m4/getloadavg.m4 \
|
||||
$(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettime.m4 \
|
||||
$(top_srcdir)/m4/gettimeofday.m4 \
|
||||
$(top_srcdir)/m4/gnulib-common.m4 \
|
||||
$(top_srcdir)/m4/gnulib-comp.m4 \
|
||||
$(top_srcdir)/m4/group-member.m4 \
|
||||
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inttypes.m4 \
|
||||
$(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/manywarnings.m4 \
|
||||
|
|
@ -213,6 +216,7 @@ GNULIB_FCHDIR = @GNULIB_FCHDIR@
|
|||
GNULIB_FCHMODAT = @GNULIB_FCHMODAT@
|
||||
GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@
|
||||
GNULIB_FCLOSE = @GNULIB_FCLOSE@
|
||||
GNULIB_FCNTL = @GNULIB_FCNTL@
|
||||
GNULIB_FDATASYNC = @GNULIB_FDATASYNC@
|
||||
GNULIB_FDOPEN = @GNULIB_FDOPEN@
|
||||
GNULIB_FFLUSH = @GNULIB_FFLUSH@
|
||||
|
|
@ -279,8 +283,11 @@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
|
|||
GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@
|
||||
GNULIB_MKTIME = @GNULIB_MKTIME@
|
||||
GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@
|
||||
GNULIB_NONBLOCKING = @GNULIB_NONBLOCKING@
|
||||
GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@
|
||||
GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@
|
||||
GNULIB_OPEN = @GNULIB_OPEN@
|
||||
GNULIB_OPENAT = @GNULIB_OPENAT@
|
||||
GNULIB_PCLOSE = @GNULIB_PCLOSE@
|
||||
GNULIB_PERROR = @GNULIB_PERROR@
|
||||
GNULIB_PIPE = @GNULIB_PIPE@
|
||||
|
|
@ -408,6 +415,7 @@ HAVE_FACCESSAT = @HAVE_FACCESSAT@
|
|||
HAVE_FCHDIR = @HAVE_FCHDIR@
|
||||
HAVE_FCHMODAT = @HAVE_FCHMODAT@
|
||||
HAVE_FCHOWNAT = @HAVE_FCHOWNAT@
|
||||
HAVE_FCNTL = @HAVE_FCNTL@
|
||||
HAVE_FDATASYNC = @HAVE_FDATASYNC@
|
||||
HAVE_FSEEKO = @HAVE_FSEEKO@
|
||||
HAVE_FSTATAT = @HAVE_FSTATAT@
|
||||
|
|
@ -444,6 +452,7 @@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
|
|||
HAVE_MKSTEMP = @HAVE_MKSTEMP@
|
||||
HAVE_MKSTEMPS = @HAVE_MKSTEMPS@
|
||||
HAVE_NANOSLEEP = @HAVE_NANOSLEEP@
|
||||
HAVE_OPENAT = @HAVE_OPENAT@
|
||||
HAVE_OS_H = @HAVE_OS_H@
|
||||
HAVE_PCLOSE = @HAVE_PCLOSE@
|
||||
HAVE_PIPE = @HAVE_PIPE@
|
||||
|
|
@ -563,6 +572,7 @@ LIBXTR6 = @LIBXTR6@
|
|||
LIBXT_OTHER = @LIBXT_OTHER@
|
||||
LIBX_OTHER = @LIBX_OTHER@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_EACCESS = @LIB_EACCESS@
|
||||
LIB_EXECINFO = @LIB_EXECINFO@
|
||||
LIB_GCC = @LIB_GCC@
|
||||
LIB_MATH = @LIB_MATH@
|
||||
|
|
@ -578,6 +588,7 @@ M17N_FLT_LIBS = @M17N_FLT_LIBS@
|
|||
MAKEINFO = @MAKEINFO@
|
||||
MKDEPDIR = @MKDEPDIR@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@
|
||||
|
|
@ -591,6 +602,7 @@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
|
|||
NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
|
||||
NEXT_FCNTL_H = @NEXT_FCNTL_H@
|
||||
NEXT_GETOPT_H = @NEXT_GETOPT_H@
|
||||
NEXT_INTTYPES_H = @NEXT_INTTYPES_H@
|
||||
NEXT_SIGNAL_H = @NEXT_SIGNAL_H@
|
||||
|
|
@ -641,6 +653,7 @@ REPLACE_DUP = @REPLACE_DUP@
|
|||
REPLACE_DUP2 = @REPLACE_DUP2@
|
||||
REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
|
||||
REPLACE_FCLOSE = @REPLACE_FCLOSE@
|
||||
REPLACE_FCNTL = @REPLACE_FCNTL@
|
||||
REPLACE_FDOPEN = @REPLACE_FDOPEN@
|
||||
REPLACE_FFLUSH = @REPLACE_FFLUSH@
|
||||
REPLACE_FOPEN = @REPLACE_FOPEN@
|
||||
|
|
@ -680,6 +693,8 @@ REPLACE_MKTIME = @REPLACE_MKTIME@
|
|||
REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
|
||||
REPLACE_NULL = @REPLACE_NULL@
|
||||
REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@
|
||||
REPLACE_OPEN = @REPLACE_OPEN@
|
||||
REPLACE_OPENAT = @REPLACE_OPENAT@
|
||||
REPLACE_PERROR = @REPLACE_PERROR@
|
||||
REPLACE_POPEN = @REPLACE_POPEN@
|
||||
REPLACE_PREAD = @REPLACE_PREAD@
|
||||
|
|
@ -859,18 +874,20 @@ x_default_search_path = @x_default_search_path@
|
|||
# statements but through direct file reference. Therefore this snippet must be
|
||||
# present in all Makefile.am that need it. This is ensured by the applicability
|
||||
# 'all' defined above.
|
||||
BUILT_SOURCES = $(ALLOCA_H) $(EXECINFO_H) $(GETOPT_H) inttypes.h \
|
||||
signal.h arg-nonnull.h c++defs.h warn-on-use.h $(STDALIGN_H) \
|
||||
$(STDARG_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \
|
||||
stdlib.h sys/select.h sys/stat.h sys/time.h time.h unistd.h
|
||||
BUILT_SOURCES = $(ALLOCA_H) $(EXECINFO_H) fcntl.h $(GETOPT_H) \
|
||||
inttypes.h signal.h arg-nonnull.h c++defs.h warn-on-use.h \
|
||||
$(STDALIGN_H) $(STDARG_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) \
|
||||
stdio.h stdlib.h sys/select.h sys/stat.h sys/time.h time.h \
|
||||
unistd.h
|
||||
EXTRA_DIST = alloca.in.h allocator.h careadlinkat.h close-stream.h \
|
||||
md5.h sha1.h sha256.h sha512.h dosname.h ftoastr.c ftoastr.h \
|
||||
dup2.c execinfo.c execinfo.in.h filemode.h fpending.c \
|
||||
fpending.h getloadavg.c getopt.c getopt.in.h getopt1.c \
|
||||
getopt_int.h gettimeofday.c ignore-value.h intprops.h \
|
||||
inttypes.in.h lstat.c mktime-internal.h mktime.c pathmax.h \
|
||||
pselect.c pthread_sigmask.c readlink.c signal.in.h \
|
||||
$(top_srcdir)/build-aux/snippet/_Noreturn.h \
|
||||
dup2.c euidaccess.c execinfo.c execinfo.in.h at-func.c \
|
||||
faccessat.c fcntl.in.h filemode.h fpending.c fpending.h \
|
||||
getgroups.c getloadavg.c getopt.c getopt.in.h getopt1.c \
|
||||
getopt_int.h gettimeofday.c group-member.c ignore-value.h \
|
||||
intprops.h inttypes.in.h lstat.c mktime-internal.h mktime.c \
|
||||
pathmax.h pselect.c pthread_sigmask.c readlink.c root-uid.h \
|
||||
signal.in.h $(top_srcdir)/build-aux/snippet/_Noreturn.h \
|
||||
$(top_srcdir)/build-aux/snippet/arg-nonnull.h \
|
||||
$(top_srcdir)/build-aux/snippet/c++defs.h \
|
||||
$(top_srcdir)/build-aux/snippet/warn-on-use.h stat.c \
|
||||
|
|
@ -879,12 +896,12 @@ EXTRA_DIST = alloca.in.h allocator.h careadlinkat.h close-stream.h \
|
|||
strtol.c strtoll.c strtol.c strtoul.c strtoull.c strtoimax.c \
|
||||
strtoumax.c symlink.c sys_select.in.h sys_stat.in.h \
|
||||
sys_time.in.h time.in.h time_r.c timespec.h u64.h unistd.in.h \
|
||||
utimens.h verify.h
|
||||
utimens.h verify.h xalloc-oversized.h
|
||||
MOSTLYCLEANDIRS = sys sys
|
||||
MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t execinfo.h \
|
||||
execinfo.h-t getopt.h getopt.h-t inttypes.h inttypes.h-t \
|
||||
signal.h signal.h-t arg-nonnull.h arg-nonnull.h-t c++defs.h \
|
||||
c++defs.h-t warn-on-use.h warn-on-use.h-t stdalign.h \
|
||||
execinfo.h-t fcntl.h fcntl.h-t getopt.h getopt.h-t inttypes.h \
|
||||
inttypes.h-t signal.h signal.h-t arg-nonnull.h arg-nonnull.h-t \
|
||||
c++defs.h c++defs.h-t warn-on-use.h warn-on-use.h-t stdalign.h \
|
||||
stdalign.h-t stdarg.h stdarg.h-t stdbool.h stdbool.h-t \
|
||||
stddef.h stddef.h-t stdint.h stdint.h-t stdio.h stdio.h-t \
|
||||
stdlib.h stdlib.h-t sys/select.h sys/select.h-t sys/stat.h \
|
||||
|
|
@ -900,8 +917,9 @@ libgnu_a_SOURCES = allocator.c c-ctype.h c-ctype.c c-strcase.h \
|
|||
timespec.c timespec-add.c timespec-sub.c u64.c utimens.c
|
||||
libgnu_a_LIBADD = $(gl_LIBOBJS)
|
||||
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
|
||||
EXTRA_libgnu_a_SOURCES = ftoastr.c dup2.c execinfo.c fpending.c \
|
||||
getloadavg.c getopt.c getopt1.c gettimeofday.c lstat.c \
|
||||
EXTRA_libgnu_a_SOURCES = ftoastr.c dup2.c euidaccess.c execinfo.c \
|
||||
at-func.c faccessat.c fpending.c getgroups.c getloadavg.c \
|
||||
getopt.c getopt1.c gettimeofday.c group-member.c lstat.c \
|
||||
mktime.c pselect.c pthread_sigmask.c readlink.c stat.c \
|
||||
strtoimax.c strtol.c strtoll.c strtol.c strtoul.c strtoull.c \
|
||||
strtoimax.c strtoumax.c symlink.c time_r.c
|
||||
|
|
@ -963,6 +981,7 @@ distclean-compile:
|
|||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocator.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-ctype.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strcasecmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strncasecmp.Po@am__quote@
|
||||
|
|
@ -971,15 +990,19 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtotimespec.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/euidaccess.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/execinfo.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/faccessat.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpending.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getgroups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettime.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group-member.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@
|
||||
|
|
@ -1243,6 +1266,32 @@ uninstall-am:
|
|||
@GL_GENERATE_EXECINFO_H_FALSE@execinfo.h: $(top_builddir)/config.status
|
||||
@GL_GENERATE_EXECINFO_H_FALSE@ rm -f $@
|
||||
|
||||
# We need the following in order to create <fcntl.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
|
||||
-e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \
|
||||
-e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \
|
||||
-e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \
|
||||
-e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \
|
||||
-e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
|
||||
-e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
|
||||
-e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
|
||||
-e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
|
||||
-e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/fcntl.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <getopt.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
|
||||
|
|
|
|||
5
autogen/aclocal.m4
vendored
5
autogen/aclocal.m4
vendored
|
|
@ -991,17 +991,22 @@ m4_include([m4/clock_time.m4])
|
|||
m4_include([m4/close-stream.m4])
|
||||
m4_include([m4/dup2.m4])
|
||||
m4_include([m4/environ.m4])
|
||||
m4_include([m4/euidaccess.m4])
|
||||
m4_include([m4/execinfo.m4])
|
||||
m4_include([m4/extensions.m4])
|
||||
m4_include([m4/extern-inline.m4])
|
||||
m4_include([m4/faccessat.m4])
|
||||
m4_include([m4/fcntl_h.m4])
|
||||
m4_include([m4/filemode.m4])
|
||||
m4_include([m4/fpending.m4])
|
||||
m4_include([m4/getgroups.m4])
|
||||
m4_include([m4/getloadavg.m4])
|
||||
m4_include([m4/getopt.m4])
|
||||
m4_include([m4/gettime.m4])
|
||||
m4_include([m4/gettimeofday.m4])
|
||||
m4_include([m4/gnulib-common.m4])
|
||||
m4_include([m4/gnulib-comp.m4])
|
||||
m4_include([m4/group-member.m4])
|
||||
m4_include([m4/include_next.m4])
|
||||
m4_include([m4/inttypes.m4])
|
||||
m4_include([m4/largefile.m4])
|
||||
|
|
|
|||
|
|
@ -174,6 +174,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
garbage collection in the jmp_buf. */
|
||||
#undef GC_SETJMP_WORKS
|
||||
|
||||
/* Define to the type of elements in the array set by `getgroups'. Usually
|
||||
this is either `int' or `gid_t'. */
|
||||
#undef GETGROUPS_T
|
||||
|
||||
/* Define this to 1 if getgroups(0,NULL) does not return the number of groups.
|
||||
*/
|
||||
#undef GETGROUPS_ZERO_BUG
|
||||
|
||||
/* Define if gettimeofday clobbers the localtime buffer. */
|
||||
#undef GETTIMEOFDAY_CLOBBERS_LOCALTIME
|
||||
|
||||
|
|
@ -188,6 +196,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
whether the gnulib module close-stream shall be considered present. */
|
||||
#undef GNULIB_CLOSE_STREAM
|
||||
|
||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
|
||||
whether the gnulib module faccessat shall be considered present. */
|
||||
#undef GNULIB_FACCESSAT
|
||||
|
||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
|
||||
whether the gnulib module fscanf shall be considered present. */
|
||||
#undef GNULIB_FSCANF
|
||||
|
|
@ -209,6 +221,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
startup, if using GTK. */
|
||||
#undef G_SLICE_ALWAYS_MALLOC
|
||||
|
||||
/* Define to 1 if you have the `access' function. */
|
||||
#undef HAVE_ACCESS
|
||||
|
||||
/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */
|
||||
#undef HAVE_AIX_SMT_EXP
|
||||
|
||||
|
|
@ -333,6 +348,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
/* Define to 1 if you have the 'dup2' function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define to 1 if you have the `eaccess' function. */
|
||||
#undef HAVE_EACCESS
|
||||
|
||||
/* Define to 1 if you have the `endgrent' function. */
|
||||
#undef HAVE_ENDGRENT
|
||||
|
||||
|
|
@ -348,15 +366,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
/* Define to 1 if you have the <execinfo.h> header file. */
|
||||
#undef HAVE_EXECINFO_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
/* Define to 1 if you have the `faccessat' function. */
|
||||
#undef HAVE_FACCESSAT
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `fpathconf' function. */
|
||||
#undef HAVE_FPATHCONF
|
||||
|
||||
/* Define to 1 if you have the `freeifaddrs' function. */
|
||||
#undef HAVE_FREEIFADDRS
|
||||
|
||||
|
|
@ -396,6 +411,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
/* Define to 1 if you have the `getgrent' function. */
|
||||
#undef HAVE_GETGRENT
|
||||
|
||||
/* Define to 1 if your system has a working `getgroups' function. */
|
||||
#undef HAVE_GETGROUPS
|
||||
|
||||
/* Define to 1 if you have the `gethostname' function. */
|
||||
#undef HAVE_GETHOSTNAME
|
||||
|
||||
|
|
@ -562,6 +580,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
/* Define to 1 if you have the `dnet' library (-ldnet). */
|
||||
#undef HAVE_LIBDNET
|
||||
|
||||
/* Define to 1 if you have the <libgen.h> header file. */
|
||||
#undef HAVE_LIBGEN_H
|
||||
|
||||
/* Define to 1 if you have the hesiod library (-lhesiod). */
|
||||
#undef HAVE_LIBHESIOD
|
||||
|
||||
|
|
|
|||
1101
autogen/configure
vendored
1101
autogen/configure
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -574,6 +574,8 @@ else
|
|||
test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
|
||||
fi
|
||||
|
||||
# Avoid gnulib's tests for O_NOATIME and O_NOFOLLOW, as we don't use them.
|
||||
AC_DEFUN([gl_FCNTL_O_FLAGS])
|
||||
# Avoid gnulib's threadlib module, as we do threads our own way.
|
||||
AC_DEFUN([gl_THREADLIB])
|
||||
|
||||
|
|
@ -1268,7 +1270,7 @@ fi
|
|||
dnl checks for header files
|
||||
AC_CHECK_HEADERS_ONCE(
|
||||
linux/version.h sys/systeminfo.h
|
||||
fcntl.h coff.h pty.h
|
||||
coff.h pty.h
|
||||
sys/vlimit.h sys/resource.h
|
||||
sys/utsname.h pwd.h utmp.h dirent.h util.h)
|
||||
|
||||
|
|
@ -2933,7 +2935,7 @@ AC_SUBST(BLESSMAIL_TARGET)
|
|||
AC_CHECK_FUNCS(gethostname \
|
||||
closedir getrusage get_current_dir_name \
|
||||
lrand48 \
|
||||
fpathconf select euidaccess getpagesize setlocale \
|
||||
select getpagesize setlocale \
|
||||
utimes getrlimit setrlimit getcwd shutdown getaddrinfo \
|
||||
strsignal setitimer \
|
||||
sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
2012-11-18 Dani Moncayo <dmoncayo@gmail.com>
|
||||
|
||||
* mark.texi (Disabled Transient Mark): Doc fixes (Bug#12746).
|
||||
|
||||
2012-11-16 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* trouble.texi (Crashing): Add information about MS-Windows and
|
||||
the emacs_backtrace.txt file. (Bug#12908)
|
||||
|
||||
2012-11-13 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* building.texi (Multithreaded Debugging): gdb-stopped-hooks is
|
||||
|
|
|
|||
|
|
@ -429,10 +429,6 @@ soon, before you forget where it is. You can also check where the
|
|||
mark is by using @kbd{C-x C-x}, which exchanges the positions of the
|
||||
point and the mark (@pxref{Setting Mark}).
|
||||
|
||||
@item
|
||||
Many commands that move point long distances, like @kbd{M-<} and
|
||||
@kbd{C-s}, first set the mark where point was.
|
||||
|
||||
@item
|
||||
Some commands, which ordinarily act on the region when the mark is
|
||||
active, no longer do so. For example, normally @kbd{M-%}
|
||||
|
|
@ -455,9 +451,10 @@ command twice.)
|
|||
|
||||
@item C-u C-x C-x
|
||||
@kindex C-u C-x C-x
|
||||
Activate the mark and enable Transient Mark mode temporarily, until
|
||||
the mark is next deactivated. (This is the @kbd{C-x C-x} command,
|
||||
@code{exchange-point-and-mark}, with a prefix argument.)
|
||||
Exchange point and mark, activate the mark and enable Transient Mark
|
||||
mode temporarily, until the mark is next deactivated. (This is the
|
||||
@kbd{C-x C-x} command, @code{exchange-point-and-mark}, with a prefix
|
||||
argument.)
|
||||
@end table
|
||||
|
||||
These commands set or activate the mark, and enable Transient Mark
|
||||
|
|
|
|||
|
|
@ -282,18 +282,23 @@ itself, and the reserve supply may not be enough.
|
|||
@subsection When Emacs Crashes
|
||||
|
||||
@cindex crash report
|
||||
@cindex backtrace
|
||||
@cindex @file{emacs_backtrace.txt} file, MS-Windows
|
||||
Emacs is not supposed to crash, but if it does, it produces a
|
||||
@dfn{crash report} prior to exiting. The crash report is printed to
|
||||
the standard error stream. If Emacs was started from a graphical
|
||||
desktop, the standard error stream is commonly redirected to a file
|
||||
such as @file{~/.xsession-errors}, so you can look for the crash
|
||||
report there.
|
||||
desktop on a GNU or Unix system, the standard error stream is commonly
|
||||
redirected to a file such as @file{~/.xsession-errors}, so you can
|
||||
look for the crash report there. On MS-Windows, the crash report is
|
||||
written to a file named @file{emacs_backtrace.txt} in the current
|
||||
directory of the Emacs process, in addition to the standard error
|
||||
stream.
|
||||
|
||||
The format of the crash report depends on the platform. On some
|
||||
platforms, such as those using the GNU C Library, the crash report
|
||||
includes a @dfn{backtrace} describing the execution state prior to
|
||||
crashing, which can be used to help debug the crash. Here is an
|
||||
example:
|
||||
example for a GNU system:
|
||||
|
||||
@example
|
||||
Fatal error 11: Segmentation fault
|
||||
|
|
@ -320,22 +325,24 @@ backtrace with source-code line numbers:
|
|||
|
||||
@example
|
||||
sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} |
|
||||
addr2line -Cfip -e @var{bindir}/emacs
|
||||
addr2line -Cfip -e @var{bindir}/@var{emacs-binary}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Here, @var{backtrace} is the name of a text file containing a copy of
|
||||
the backtrace, and @var{bindir} is the name of the directory that
|
||||
contains the Emacs executable.
|
||||
the backtrace, @var{bindir} is the name of the directory that
|
||||
contains the Emacs executable, and @var{emacs-binary} is the name of
|
||||
the Emacs executable file, normally @file{emacs} on GNU and Unix
|
||||
systems and @file{emacs.exe} on MS-Windows and MS-DOS.
|
||||
|
||||
@cindex core dump
|
||||
Optionally, Emacs can generate a @dfn{core dump} when it crashes. A
|
||||
core dump is a file containing voluminous data about the state of the
|
||||
program prior to the crash, usually examined by loading it into a
|
||||
debugger such as GDB. On many platforms, core dumps are disabled by
|
||||
default, and you must explicitly enable them by running the shell
|
||||
command @samp{ulimit -c unlimited} (e.g.@: in your shell startup
|
||||
script).
|
||||
Optionally, Emacs can generate a @dfn{core dump} when it crashes, on
|
||||
systems that support core files. A core dump is a file containing
|
||||
voluminous data about the state of the program prior to the crash,
|
||||
usually examined by loading it into a debugger such as GDB. On many
|
||||
platforms, core dumps are disabled by default, and you must explicitly
|
||||
enable them by running the shell command @samp{ulimit -c unlimited}
|
||||
(e.g.@: in your shell startup script).
|
||||
|
||||
@node After a Crash
|
||||
@subsection Recovery After a Crash
|
||||
|
|
|
|||
|
|
@ -1,3 +1,56 @@
|
|||
2012-11-18 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* loading.texi (How Programs Do Loading): Add eager macro expansion.
|
||||
* macros.texi (Expansion): Mention eager macro expansion.
|
||||
|
||||
* minibuf.texi (Basic Completion): Mention misc completion-table funcs.
|
||||
|
||||
2012-11-18 Leo Liu <sdl.web@gmail.com>
|
||||
|
||||
* minibuf.texi (Programmed Completion): Doc fix for metadata
|
||||
request (Bug#12850).
|
||||
|
||||
2012-11-18 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* display.texi (Temporary Displays): Document with-temp-buffer-window.
|
||||
|
||||
* frames.texi (Size and Position): Add fit-frame-to-buffer command.
|
||||
* windows.texi (Resizing Windows): Add fit-frame-to-buffer option.
|
||||
(Window Sizes): Add vindex for window-min-height, window-min-width.
|
||||
(Display Action Functions): Mention pop-up-frame-parameters.
|
||||
|
||||
2012-11-16 Martin Rudalics <rudalics@gmx.at>
|
||||
|
||||
* windows.texi (Choosing Window): Rewrite description of
|
||||
display-buffer-alist (Bug#12167).
|
||||
(Display Action Functions): Mention inhibit-switch-frame. Fix
|
||||
description of display-buffer-below-selected. Reorder actions.
|
||||
Add example (Bug#12848).
|
||||
|
||||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* display.texi (Face Attributes): Fix :underline COLOR description.
|
||||
(Attribute Functions): Update for set-face-underline rename.
|
||||
Tweak descriptions of face-underline-p, face-inverse-video-p.
|
||||
|
||||
* keymaps.texi (Searching Keymaps, Tool Bar): Untabify examples,
|
||||
so they align better in info.
|
||||
(Active Keymaps, Searching Keymaps, Controlling Active Maps):
|
||||
Document set-temporary-overlay-map.
|
||||
|
||||
2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* keymaps.texi (Translation Keymaps): Add a subsection "Interaction
|
||||
with normal keymaps".
|
||||
|
||||
2012-11-15 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* internals.texi (Garbage Collection): Update descriptions
|
||||
of vectorlike_header, garbage-collect and gc-cons-threshold.
|
||||
(Object Internals): Explain Lisp_Object layout and the basics
|
||||
of an internal type system.
|
||||
(Buffer Internals): Update description of struct buffer.
|
||||
|
||||
2012-11-13 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* variables.texi (Adding Generalized Variables):
|
||||
|
|
|
|||
|
|
@ -1078,7 +1078,8 @@ editing. Many help commands use this feature.
|
|||
This function executes @var{forms} while arranging to insert any output
|
||||
they print into the buffer named @var{buffer-name}, which is first
|
||||
created if necessary, and put into Help mode. Finally, the buffer is
|
||||
displayed in some window, but not selected.
|
||||
displayed in some window, but not selected. (See the similar
|
||||
form @code{with-temp-buffer-window} below.)
|
||||
|
||||
If the @var{forms} do not change the major mode in the output buffer,
|
||||
so that it is still Help mode at the end of their execution, then
|
||||
|
|
@ -1152,6 +1153,37 @@ displaying the temporary buffer. When the hook runs, the temporary buffer
|
|||
is current, and the window it was displayed in is selected.
|
||||
@end defvar
|
||||
|
||||
@defmac with-temp-buffer-window buffer-or-name action quit-function forms@dots{}
|
||||
This macro is similar to @code{with-output-to-temp-buffer}.
|
||||
Like that construct, it executes @var{forms} while arranging to insert
|
||||
any output they print into the buffer named @var{buffer-or-name}.
|
||||
Finally, the buffer is displayed in some window, but not selected.
|
||||
Unlike @code{with-output-to-temp-buffer}, this does not switch to Help
|
||||
mode.
|
||||
|
||||
The argument @var{buffer-or-name} specifies the temporary buffer.
|
||||
It can be either a buffer, which must already exist, or a string,
|
||||
in which case a buffer of that name is created if necessary.
|
||||
The buffer is marked as unmodified and read-only when
|
||||
@code{with-temp-buffer-window} exits.
|
||||
|
||||
This macro does not call @code{temp-buffer-show-function}. Rather, it
|
||||
passes the @var{action} argument to @code{display-buffer} in order to
|
||||
display the buffer.
|
||||
|
||||
The value of the last form in @var{forms} is returned, unless the
|
||||
argument @var{quit-function} is specified. In that case,
|
||||
it is called with two arguments: the window showing the buffer
|
||||
and the result of @var{forms}. The final return value is then
|
||||
whatever @var{quit-function} returns.
|
||||
|
||||
@vindex temp-buffer-window-setup-hook
|
||||
@vindex temp-buffer-window-show-hook
|
||||
This macro uses the normal hooks @code{temp-buffer-window-setup-hook}
|
||||
and @code{temp-buffer-window-show-hook} in place of the analogous hooks
|
||||
run by @code{with-output-to-temp-buffer}.
|
||||
@end defmac
|
||||
|
||||
@defun momentary-string-display string position &optional char message
|
||||
This function momentarily displays @var{string} in the current buffer at
|
||||
@var{position}. It has no effect on the undo list or on the buffer's
|
||||
|
|
@ -2009,12 +2041,11 @@ Don't underline.
|
|||
Underline with the foreground color of the face.
|
||||
|
||||
@item @var{color}
|
||||
Underline in color @var{color}; which should be either a string
|
||||
specifying a color, or the symbol @code{foreground-color}, meaning the
|
||||
foreground color of the face.
|
||||
Underline in color @var{color}, a string specifying a color.
|
||||
|
||||
@item @code{(:color @var{color} :style @var{style})}
|
||||
@var{color} is as described above. Omitting the attribute
|
||||
@var{color} is either a string, or the symbol @code{foreground-color},
|
||||
meaning the foreground color of the face. Omitting the attribute
|
||||
@code{:color} means to use the foreground color of the face.
|
||||
@var{style} should be a symbol @code{line} or @code{wave}, meaning to
|
||||
use a straight or wavy line. Omitting the attribute @code{:style}
|
||||
|
|
@ -2404,7 +2435,7 @@ This sets the @code{:slant} attribute of @var{face} to @var{normal} if
|
|||
@var{italic-p} is @code{nil}, and to @var{italic} otherwise.
|
||||
@end defun
|
||||
|
||||
@defun set-face-underline-p face underline &optional frame
|
||||
@defun set-face-underline face underline &optional frame
|
||||
This sets the @code{:underline} attribute of @var{face} to
|
||||
@var{underline}.
|
||||
@end defun
|
||||
|
|
@ -2467,12 +2498,16 @@ attribute of @var{face} is @code{italic} or @code{oblique}, and
|
|||
@code{nil} otherwise.
|
||||
@end defun
|
||||
|
||||
@c Note the weasel words. A face that inherits from an underlined
|
||||
@c face but does not specify :underline will return nil.
|
||||
@defun face-underline-p face &optional frame
|
||||
This function returns the @code{:underline} attribute of face @var{face}.
|
||||
This function returns non-@code{nil} if face @var{face} specifies
|
||||
a non-@code{nil} @code{:underline} attribute.
|
||||
@end defun
|
||||
|
||||
@defun face-inverse-video-p face &optional frame
|
||||
This function returns the @code{:inverse-video} attribute of face @var{face}.
|
||||
This function returns non-@code{nil} if face @var{face} specifies
|
||||
a non-@code{nil} @code{:inverse-video} attribute.
|
||||
@end defun
|
||||
|
||||
@node Displaying Faces
|
||||
|
|
|
|||
|
|
@ -1113,6 +1113,21 @@ The argument @var{pretend} has the same meaning as in
|
|||
@code{set-frame-height}.
|
||||
@end defun
|
||||
|
||||
@c FIXME? Belongs more in Emacs manual than here?
|
||||
@c But eg fit-window-to-buffer is in this manual.
|
||||
@deffn Command fit-frame-to-buffer &optional frame max-height min-height
|
||||
This command adjusts the height of @var{frame} (the default is the
|
||||
selected frame) to fit its contents. The optional arguments
|
||||
@var{max-height} and @var{min-height} specify the maximum and minimum
|
||||
new frame heights, respectively.
|
||||
|
||||
@vindex fit-frame-to-buffer-bottom-margin
|
||||
The default minimum height corresponds to @code{window-min-height}.
|
||||
The default maximum height is the screen height below the current top
|
||||
position of the frame, minus any margin specified by the option
|
||||
@code{fit-frame-to-buffer-bottom-margin}.
|
||||
@end deffn
|
||||
|
||||
@node Geometry
|
||||
@subsection Geometry
|
||||
|
||||
|
|
|
|||
|
|
@ -226,12 +226,11 @@ of 8k bytes, and small vectors are packed into blocks of 4k bytes).
|
|||
Beyond the basic vector, a lot of objects like window, buffer, and
|
||||
frame are managed as if they were vectors. The corresponding C data
|
||||
structures include the @code{struct vectorlike_header} field whose
|
||||
@code{next} field points to the next object in the chain:
|
||||
@code{header.next.buffer} points to the next buffer (which could be
|
||||
a killed buffer), and @code{header.next.vector} points to the next
|
||||
vector in a free list. If a vector is small (smaller than or equal to
|
||||
@code{VBLOCK_BYTES_MAX} bytes, see @file{alloc.c}), then
|
||||
@code{header.next.nbytes} contains the vector size in bytes.
|
||||
@code{size} member contains the subtype enumerated by @code{enum pvec_type}
|
||||
and an information about how many @code{Lisp_Object} fields this structure
|
||||
contains and what the size of the rest data is. This information is
|
||||
needed to calculate the memory footprint of an object, and used
|
||||
by the vector allocation code while iterating over the vector blocks.
|
||||
|
||||
@cindex garbage collection
|
||||
It is quite common to use some storage for a while, then release it
|
||||
|
|
@ -284,88 +283,147 @@ the amount of space in use. (Garbage collection can also occur
|
|||
spontaneously if you use more than @code{gc-cons-threshold} bytes of
|
||||
Lisp data since the previous garbage collection.)
|
||||
|
||||
@code{garbage-collect} returns a list containing the following
|
||||
information:
|
||||
@code{garbage-collect} returns a list with information on amount of space in
|
||||
use, where each entry has the form @samp{(@var{name} @var{size} @var{used})}
|
||||
or @samp{(@var{name} @var{size} @var{used} @var{free})}. In the entry,
|
||||
@var{name} is a symbol describing the kind of objects this entry represents,
|
||||
@var{size} is the number of bytes used by each one, @var{used} is the number
|
||||
of those objects that were found live in the heap, and optional @var{free} is
|
||||
the number of those objects that are not live but that Emacs keeps around for
|
||||
future allocations. So an overall result is:
|
||||
|
||||
@example
|
||||
@group
|
||||
((@var{used-conses} . @var{free-conses})
|
||||
(@var{used-syms} . @var{free-syms})
|
||||
@end group
|
||||
(@var{used-miscs} . @var{free-miscs})
|
||||
@var{used-string-chars}
|
||||
@var{used-vector-slots}
|
||||
(@var{used-floats} . @var{free-floats})
|
||||
(@var{used-intervals} . @var{free-intervals})
|
||||
(@var{used-strings} . @var{free-strings}))
|
||||
((@code{conses} @var{cons-size} @var{used-conse} @var{free-conses})
|
||||
(@code{symbols} @var{symbol-size} @var{used-symbols} @var{free-symbols})
|
||||
(@code{miscs} @var{misc-size} @var{used-miscs} @var{free-miscs})
|
||||
(@code{strings} @var{string-size} @var{used-strings} @var{free-strings})
|
||||
(@code{string-bytes} @var{byte-size} @var{used-bytes})
|
||||
(@code{vectors} @var{vector-size} @var{used-vectors})
|
||||
(@code{vector-slots} @var{slot-size} @var{used-slots} @var{free-slots})
|
||||
(@code{floats} @var{float-size} @var{used-floats} @var{free-floats})
|
||||
(@code{intervals} @var{interval-size} @var{used-intervals} @var{free-intervals})
|
||||
(@code{buffers} @var{buffer-size} @var{used-buffers})
|
||||
(@code{heap} @var{unit-size} @var{total-size} @var{free-size}))
|
||||
@end example
|
||||
|
||||
Here is an example:
|
||||
|
||||
@example
|
||||
@group
|
||||
(garbage-collect)
|
||||
@result{} ((106886 . 13184) (9769 . 0)
|
||||
(7731 . 4651) 347543 121628
|
||||
(31 . 94) (1273 . 168)
|
||||
(25474 . 3569))
|
||||
@end group
|
||||
@result{} ((conses 16 49126 8058) (symbols 48 14607 0)
|
||||
(miscs 40 34 56) (strings 32 2942 2607)
|
||||
(string-bytes 1 78607) (vectors 16 7247)
|
||||
(vector-slots 8 341609 29474) (floats 8 71 102)
|
||||
(intervals 56 27 26) (buffers 944 8)
|
||||
(heap 1024 11715 2678))
|
||||
@end example
|
||||
|
||||
Here is a table explaining each element:
|
||||
Below is a table explaining each element. Note that last @code{heap} entry
|
||||
is optional and present only if an underlying @code{malloc} implementation
|
||||
provides @code{mallinfo} function.
|
||||
|
||||
@table @var
|
||||
@item cons-size
|
||||
Internal size of a cons cell, i.e.@: @code{sizeof (struct Lisp_Cons)}.
|
||||
|
||||
@item used-conses
|
||||
The number of cons cells in use.
|
||||
|
||||
@item free-conses
|
||||
The number of cons cells for which space has been obtained from the
|
||||
operating system, but that are not currently being used.
|
||||
The number of cons cells for which space has been obtained from
|
||||
the operating system, but that are not currently being used.
|
||||
|
||||
@item used-syms
|
||||
@item symbol-size
|
||||
Internal size of a symbol, i.e.@: @code{sizeof (struct Lisp_Symbol)}.
|
||||
|
||||
@item used-symbols
|
||||
The number of symbols in use.
|
||||
|
||||
@item free-syms
|
||||
The number of symbols for which space has been obtained from the
|
||||
operating system, but that are not currently being used.
|
||||
@item free-symbols
|
||||
The number of symbols for which space has been obtained from
|
||||
the operating system, but that are not currently being used.
|
||||
|
||||
@item misc-size
|
||||
Internal size of a miscellaneous entity, i.e.@:
|
||||
@code{sizeof (union Lisp_Misc)}, which is a size of the
|
||||
largest type enumerated in @code{enum Lisp_Misc_Type}.
|
||||
|
||||
@item used-miscs
|
||||
The number of miscellaneous objects in use. These include markers and
|
||||
overlays, plus certain objects not visible to users.
|
||||
The number of miscellaneous objects in use. These include markers
|
||||
and overlays, plus certain objects not visible to users.
|
||||
|
||||
@item free-miscs
|
||||
The number of miscellaneous objects for which space has been obtained
|
||||
from the operating system, but that are not currently being used.
|
||||
|
||||
@item used-string-chars
|
||||
The total size of all strings, in characters.
|
||||
@item string-size
|
||||
Internal size of a string header, i.e.@: @code{sizeof (struct Lisp_String)}.
|
||||
|
||||
@item used-vector-slots
|
||||
The total number of elements of existing vectors.
|
||||
@item used-strings
|
||||
The number of string headers in use.
|
||||
|
||||
@item free-strings
|
||||
The number of string headers for which space has been obtained
|
||||
from the operating system, but that are not currently being used.
|
||||
|
||||
@item byte-size
|
||||
This is used for convenience and equals to @code{sizeof (char)}.
|
||||
|
||||
@item used-bytes
|
||||
The total size of all string data in bytes.
|
||||
|
||||
@item vector-size
|
||||
Internal size of a vector header, i.e.@: @code{sizeof (struct Lisp_Vector)}.
|
||||
|
||||
@item used-vectors
|
||||
The number of vector headers allocated from the vector blocks.
|
||||
|
||||
@item slot-size
|
||||
Internal size of a vector slot, always equal to @code{sizeof (Lisp_Object)}.
|
||||
|
||||
@item used-slots
|
||||
The number of slots in all used vectors.
|
||||
|
||||
@item free-slots
|
||||
The number of free slots in all vector blocks.
|
||||
|
||||
@item float-size
|
||||
Internal size of a float object, i.e.@: @code{sizeof (struct Lisp_Float)}.
|
||||
(Do not confuse it with the native platform @code{float} or @code{double}.)
|
||||
|
||||
@item used-floats
|
||||
The number of floats in use.
|
||||
|
||||
@item free-floats
|
||||
The number of floats for which space has been obtained from the
|
||||
operating system, but that are not currently being used.
|
||||
The number of floats for which space has been obtained from
|
||||
the operating system, but that are not currently being used.
|
||||
|
||||
@item interval-size
|
||||
Internal size of an interval object, i.e.@: @code{sizeof (struct interval)}.
|
||||
|
||||
@item used-intervals
|
||||
The number of intervals in use. Intervals are an internal
|
||||
data structure used for representing text properties.
|
||||
The number of intervals in use.
|
||||
|
||||
@item free-intervals
|
||||
The number of intervals for which space has been obtained
|
||||
from the operating system, but that are not currently being used.
|
||||
The number of intervals for which space has been obtained from
|
||||
the operating system, but that are not currently being used.
|
||||
|
||||
@item used-strings
|
||||
The number of strings in use.
|
||||
@item buffer-size
|
||||
Internal size of a buffer, i.e.@: @code{sizeof (struct buffer)}.
|
||||
(Do not confuse with the value returned by @code{buffer-size} function.)
|
||||
|
||||
@item free-strings
|
||||
The number of string headers for which the space was obtained from the
|
||||
operating system, but which are currently not in use. (A string
|
||||
object consists of a header and the storage for the string text
|
||||
itself; the latter is only allocated when the string is created.)
|
||||
@item used-buffers
|
||||
The number of buffer objects in use. This includes killed buffers
|
||||
invisible to users, i.e.@: all buffers in @code{all_buffers} list.
|
||||
|
||||
@item unit-size
|
||||
The unit of heap space measurement, always equal to 1024 bytes.
|
||||
|
||||
@item total-size
|
||||
Total heap size, in @var{unit-size} units.
|
||||
|
||||
@item free-size
|
||||
Heap space which is not currently used, in @var{unit-size} units.
|
||||
@end table
|
||||
|
||||
If there was overflow in pure space (@pxref{Pure Storage}),
|
||||
|
|
@ -388,23 +446,25 @@ careful writing them.
|
|||
@defopt gc-cons-threshold
|
||||
The value of this variable is the number of bytes of storage that must
|
||||
be allocated for Lisp objects after one garbage collection in order to
|
||||
trigger another garbage collection. A cons cell counts as eight bytes,
|
||||
a string as one byte per character plus a few bytes of overhead, and so
|
||||
on; space allocated to the contents of buffers does not count. Note
|
||||
that the subsequent garbage collection does not happen immediately when
|
||||
the threshold is exhausted, but only the next time the Lisp evaluator is
|
||||
called.
|
||||
trigger another garbage collection. You can use the result returned by
|
||||
@code{garbage-collect} to get an information about size of the particular
|
||||
object type; space allocated to the contents of buffers does not count.
|
||||
Note that the subsequent garbage collection does not happen immediately
|
||||
when the threshold is exhausted, but only the next time the Lisp interpreter
|
||||
is called.
|
||||
|
||||
The initial threshold value is 800,000. If you specify a larger
|
||||
value, garbage collection will happen less often. This reduces the
|
||||
amount of time spent garbage collecting, but increases total memory use.
|
||||
You may want to do this when running a program that creates lots of
|
||||
Lisp data.
|
||||
The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in
|
||||
@file{alloc.c}. Since it's defined in @code{word_size} units, the value
|
||||
is 400,000 for the default 32-bit configuration and 800,000 for the 64-bit
|
||||
one. If you specify a larger value, garbage collection will happen less
|
||||
often. This reduces the amount of time spent garbage collecting, but
|
||||
increases total memory use. You may want to do this when running a program
|
||||
that creates lots of Lisp data.
|
||||
|
||||
You can make collections more frequent by specifying a smaller value,
|
||||
down to 10,000. A value less than 10,000 will remain in effect only
|
||||
until the subsequent garbage collection, at which time
|
||||
@code{garbage-collect} will set the threshold back to 10,000.
|
||||
You can make collections more frequent by specifying a smaller value, down
|
||||
to 1/10th of @code{GC_DEFAULT_THRESHOLD}. A value less than this minimum
|
||||
will remain in effect only until the subsequent garbage collection, at which
|
||||
time @code{garbage-collect} will set the threshold back to the minimum.
|
||||
@end defopt
|
||||
|
||||
@defopt gc-cons-percentage
|
||||
|
|
@ -639,7 +699,12 @@ in the file @file{lisp.h}.) If the primitive has no upper limit on
|
|||
the number of Lisp arguments, it must have exactly two C arguments:
|
||||
the first is the number of Lisp arguments, and the second is the
|
||||
address of a block containing their values. These have types
|
||||
@code{int} and @w{@code{Lisp_Object *}} respectively.
|
||||
@code{int} and @w{@code{Lisp_Object *}} respectively. Since
|
||||
@code{Lisp_Object} can hold any Lisp object of any data type, you
|
||||
can determine the actual data type only at run time; so if you want
|
||||
a primitive to accept only a certain type of argument, you must check
|
||||
the type explicitly using a suitable predicate (@pxref{Type Predicates}).
|
||||
@cindex type checking internals
|
||||
|
||||
@cindex @code{GCPRO} and @code{UNGCPRO}
|
||||
@cindex protect C variables from garbage collection
|
||||
|
|
@ -820,23 +885,70 @@ knows about it.
|
|||
@section Object Internals
|
||||
@cindex object internals
|
||||
|
||||
@c FIXME Is this still true? Does --with-wide-int affect anything?
|
||||
GNU Emacs Lisp manipulates many different types of data. The actual
|
||||
data are stored in a heap and the only access that programs have to it
|
||||
is through pointers. Each pointer is 32 bits wide on 32-bit machines,
|
||||
and 64 bits wide on 64-bit machines; three of these bits are used for
|
||||
the tag that identifies the object's type, and the remainder are used
|
||||
to address the object.
|
||||
Emacs Lisp provides a rich set of the data types. Some of them, like cons
|
||||
cells, integers and stirngs, are common to nearly all Lisp dialects. Some
|
||||
others, like markers and buffers, are quite special and needed to provide
|
||||
the basic support to write editor commands in Lisp. To implement such
|
||||
a variety of object types and provide an efficient way to pass objects between
|
||||
the subsystems of an interpreter, there is a set of C data structures and
|
||||
a special type to represent the pointers to all of them, which is known as
|
||||
@dfn{tagged pointer}.
|
||||
|
||||
Because Lisp objects are represented as tagged pointers, it is always
|
||||
possible to determine the Lisp data type of any object. The C data type
|
||||
@code{Lisp_Object} can hold any Lisp object of any data type. Ordinary
|
||||
variables have type @code{Lisp_Object}, which means they can hold any
|
||||
type of Lisp value; you can determine the actual data type only at run
|
||||
time. The same is true for function arguments; if you want a function
|
||||
to accept only a certain type of argument, you must check the type
|
||||
explicitly using a suitable predicate (@pxref{Type Predicates}).
|
||||
@cindex type checking internals
|
||||
In C, the tagged pointer is an object of type @code{Lisp_Object}. Any
|
||||
initialized variable of such a type always holds the value of one of the
|
||||
following basic data types: integer, symbol, string, cons cell, float,
|
||||
vectorlike or miscellaneous object. Each of these data types has the
|
||||
corresponding tag value. All tags are enumerated by @code{enum Lisp_Type}
|
||||
and placed into a 3-bit bitfield of the @code{Lisp_Object}. The rest of the
|
||||
bits is the value itself. Integer values are immediate, i.e.@: directly
|
||||
represented by those @dfn{value bits}, and all other objects are represented
|
||||
by the C pointers to a corresponding object allocated from the heap. Width
|
||||
of the @code{Lisp_Object} is platform- and configuration-dependent: usually
|
||||
it's equal to the width of an underlying platform pointer (i.e.@: 32-bit on
|
||||
a 32-bit machine and 64-bit on a 64-bit one), but also there is a special
|
||||
configuration where @code{Lisp_Object} is 64-bit but all pointers are 32-bit.
|
||||
The latter trick was designed to overcome the limited range of values for
|
||||
Lisp integers on a 32-bit system by using 64-bit @code{long long} type for
|
||||
@code{Lisp_Object}.
|
||||
|
||||
The following C data structures are defined in @file{lisp.h} to represent
|
||||
the basic data types beyond integers:
|
||||
|
||||
@table @code
|
||||
@item struct Lisp_Cons
|
||||
Cons cell, an object used to construct lists.
|
||||
|
||||
@item struct Lisp_String
|
||||
String, the basic object to represent a sequence of characters.
|
||||
|
||||
@item struct Lisp_Vector
|
||||
Array, a fixed-size set of Lisp objects which may be accessed by an index.
|
||||
|
||||
@item struct Lisp_Symbol
|
||||
Symbol, the unique-named entity commonly used as an identifier.
|
||||
|
||||
@item struct Lisp_Float
|
||||
Floating point value.
|
||||
|
||||
@item union Lisp_Misc
|
||||
Miscellaneous kinds of objects which don't fit into any of the above.
|
||||
@end table
|
||||
|
||||
These types are the first-class citizens of an internal type system.
|
||||
Since the tag space is limited, all other types are the subtypes of either
|
||||
@code{Lisp_Vectorlike} or @code{Lisp_Misc}. Vector subtypes are enumerated
|
||||
by @code{enum pvec_type}, and nearly all complex objects like windows, buffers,
|
||||
frames, and processes fall into this category. The rest of special types,
|
||||
including markers and overlays, are enumerated by @code{enum Lisp_Misc_Type}
|
||||
and form the set of subtypes of @code{Lisp_Misc}.
|
||||
|
||||
Below there is a description of a few subtypes of @code{Lisp_Vectorlike}.
|
||||
Buffer object represents the text to display and edit. Window is the part
|
||||
of display structure which shows the buffer or used as a container to
|
||||
recursively place other windows on the same frame. (Do not confuse Emacs Lisp
|
||||
window object with the window as an entity managed by the user interface
|
||||
system like X; in Emacs terminology, the latter is called frame.) Finally,
|
||||
process object is used to manage the subprocesses.
|
||||
|
||||
@menu
|
||||
* Buffer Internals:: Components of a buffer structure.
|
||||
|
|
@ -912,12 +1024,8 @@ Some of the fields of @code{struct buffer} are:
|
|||
|
||||
@table @code
|
||||
@item header
|
||||
A @code{struct vectorlike_header} structure where @code{header.next}
|
||||
points to the next buffer, in the chain of all buffers (including
|
||||
killed buffers). This chain is used only for garbage collection, in
|
||||
order to collect killed buffers properly. Note that vectors, and most
|
||||
kinds of objects allocated as vectors, are all on one chain, but
|
||||
buffers are on a separate chain of their own.
|
||||
A header of type @code{struct vectorlike_header} is common to all
|
||||
vectorlike objects.
|
||||
|
||||
@item own_text
|
||||
A @code{struct buffer_text} structure that ordinarily holds the buffer
|
||||
|
|
@ -928,6 +1036,11 @@ A pointer to the @code{buffer_text} structure for this buffer. In an
|
|||
ordinary buffer, this is the @code{own_text} field above. In an
|
||||
indirect buffer, this is the @code{own_text} field of the base buffer.
|
||||
|
||||
@item next
|
||||
A pointer to the next buffer, in the chain of all buffers, including
|
||||
killed buffers. This chain is used only for allocation and garbage
|
||||
collection, in order to collect killed buffers properly.
|
||||
|
||||
@item pt
|
||||
@itemx pt_byte
|
||||
The character and byte positions of point in a buffer.
|
||||
|
|
|
|||
|
|
@ -664,7 +664,9 @@ additional active keymaps through the variable
|
|||
|
||||
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.
|
||||
keymap to be processed, in normal circumstances. Next comes
|
||||
any keymap added by the function @code{set-temporary-overlay-map}.
|
||||
@xref{Controlling Active Maps}.
|
||||
|
||||
However, there are also special ways for programs to substitute
|
||||
other keymaps for some of those. The variable
|
||||
|
|
@ -753,12 +755,13 @@ them:
|
|||
(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} @var{temp-map})
|
||||
(@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-global-map)))
|
||||
@end lisp
|
||||
|
||||
|
|
@ -770,7 +773,8 @@ Lookup}.) If the key sequence starts with a mouse event, or a
|
|||
symbolic prefix event followed by 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.
|
||||
instead of the buffer. @var{temp-map} is a pseudo variable that
|
||||
represents the effect of a @code{set-temporary-overlay-map} call.
|
||||
|
||||
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
|
||||
|
|
@ -950,6 +954,21 @@ are used before @code{minor-mode-map-alist} and
|
|||
@code{minor-mode-overriding-map-alist}.
|
||||
@end defvar
|
||||
|
||||
@defun set-temporary-overlay-map keymap &optional keep
|
||||
This function adds @var{keymap} as a temporary keymap that takes
|
||||
precedence over most other keymaps. It does not take precedence over
|
||||
the ``overriding'' maps (see above); and unlike them, if no match for
|
||||
a key is found in @var{keymap}, the search continues.
|
||||
|
||||
Normally, @var{keymap} is used only once. If the optional argument
|
||||
@var{pred} is @code{t}, the map stays active if a key from @var{keymap}
|
||||
is used. @var{pred} can also be a function of no arguments: if it returns
|
||||
non-@code{nil} then @var{keymap} stays active.
|
||||
|
||||
For a pseudo-Lisp description of exactly how and when this keymap applies,
|
||||
@pxref{Searching Keymaps}.
|
||||
@end defun
|
||||
|
||||
@node Key Lookup
|
||||
@section Key Lookup
|
||||
@cindex key lookup
|
||||
|
|
@ -1540,14 +1559,11 @@ sequence, to translate certain event sequences into others.
|
|||
being read, as it is read, against @code{input-decode-map}, then
|
||||
@code{local-function-key-map}, and then against @code{key-translation-map}.
|
||||
|
||||
@defvar input-decode-map
|
||||
This variable holds a keymap that describes the character sequences sent
|
||||
by function keys on an ordinary character terminal. This keymap has the
|
||||
same structure as other keymaps, but is used differently: it specifies
|
||||
translations to make while reading key sequences, rather than bindings
|
||||
for key sequences.
|
||||
These keymaps have the same structure as other keymaps, but they are used
|
||||
differently: they specify translations to make while reading key sequences,
|
||||
rather than bindings for key sequences.
|
||||
|
||||
If @code{input-decode-map} ``binds'' a key sequence @var{k} to a vector
|
||||
If one of these keymaps ``binds'' a key sequence @var{k} to a vector
|
||||
@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
|
||||
key sequence, it is replaced with the events in @var{v}.
|
||||
|
||||
|
|
@ -1562,6 +1578,10 @@ Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c
|
|||
this back into @kbd{C-c @key{PF1}}, which it returns as the vector
|
||||
@code{[?\C-c pf1]}.
|
||||
|
||||
@defvar input-decode-map
|
||||
This variable holds a keymap that describes the character sequences sent
|
||||
by function keys on an ordinary character terminal.
|
||||
|
||||
The value of @code{input-decode-map} is usually set up automatically
|
||||
according to the terminal's Terminfo or Termcap entry, but sometimes
|
||||
those need help from terminal-specific Lisp files. Emacs comes with
|
||||
|
|
@ -1636,8 +1656,6 @@ to turn the character that follows into a Hyper character:
|
|||
(let ((symbol (if (symbolp e) e (car e))))
|
||||
(setq symbol (intern (concat string
|
||||
(symbol-name symbol))))
|
||||
@end group
|
||||
@group
|
||||
(if (symbolp e)
|
||||
symbol
|
||||
(cons symbol (cdr e)))))
|
||||
|
|
@ -1647,10 +1665,30 @@ to turn the character that follows into a Hyper character:
|
|||
@end example
|
||||
|
||||
If you have enabled keyboard character set decoding using
|
||||
@code{set-keyboard-coding-system}, decoding is done after the
|
||||
translations listed above. @xref{Terminal I/O Encoding}. However, in
|
||||
future Emacs versions, character set decoding may be done at an
|
||||
earlier stage.
|
||||
@code{set-keyboard-coding-system}, decoding is done before the
|
||||
translations listed above. @xref{Terminal I/O Encoding}.
|
||||
|
||||
@subsection Interaction with normal keymaps
|
||||
|
||||
The end of a key sequence is detected when that key sequence either is bound
|
||||
to a command, or when Emacs determines that no additional event can lead
|
||||
to a sequence that is bound to a command.
|
||||
|
||||
This means that, while @code{input-decode-map} and @code{key-translation-map}
|
||||
apply regardless of whether the original key sequence would have a binding, the
|
||||
presence of such a binding can still prevent translation from taking place.
|
||||
For example, let us return to our VT100 example above and add a binding for
|
||||
@kbd{C-c @key{ESC}} to the global map; now when the user hits @kbd{C-c
|
||||
@key{PF1}} Emacs will fail to decode @kbd{C-c @key{ESC} O P} into @kbd{C-c
|
||||
@key{PF1}} because it will stop reading keys right after @kbd{C-x @key{ESC}},
|
||||
leaving @kbd{O P} for later. This is in case the user really hit @kbd{C-c
|
||||
@key{ESC}}, in which case Emacs should not sit there waiting for the next key
|
||||
to decide whether the user really pressed @kbd{@key{ESC}} or @kbd{@key{PF1}}.
|
||||
|
||||
For that reason, it is better to avoid binding commands to key sequences where
|
||||
the end of the key sequence is a prefix of a key translation. The main such
|
||||
problematic suffixes/prefixes are @kbd{@key{ESC}}, @kbd{M-O} (which is really
|
||||
@kbd{@key{ESC} O}) and @kbd{M-[} (which is really @kbd{@key{ESC} [}).
|
||||
|
||||
@node Key Binding Commands
|
||||
@section Commands for Binding Keys
|
||||
|
|
@ -2629,8 +2667,8 @@ By default, the global map binds @code{[tool-bar]} as follows:
|
|||
|
||||
@example
|
||||
(global-set-key [tool-bar]
|
||||
`(menu-item ,(purecopy "tool bar") ignore
|
||||
:filter tool-bar-make-keymap))
|
||||
`(menu-item ,(purecopy "tool bar") ignore
|
||||
:filter tool-bar-make-keymap))
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
|
|
|
|||
|
|
@ -113,6 +113,25 @@ When loading a source file (not compiled), @code{load} performs
|
|||
character set translation just as Emacs would do when visiting the file.
|
||||
@xref{Coding Systems}.
|
||||
|
||||
@c This is referred to from the Macros chapter.
|
||||
@c Not sure if it should be the other way round.
|
||||
@cindex eager macro expansion
|
||||
When loading an uncompiled file, Emacs tries to expand any macros
|
||||
that the file contains (@pxref{Macros}). We refer to this as
|
||||
@dfn{eager macro expansion}. Doing this (rather than deferring
|
||||
the expansion until the relevant code runs) can significantly speed
|
||||
up the execution of uncompiled code. Sometimes, this macro expansion
|
||||
cannot be done, owing to a cyclic dependency. In the simplest
|
||||
example of this, the file you are loading refers to a macro defined
|
||||
in another file, and that file in turn requires the file you are
|
||||
loading. This is generally harmless. Emacs prints a warning
|
||||
(@samp{Eager macro-expansion skipped due to cycle@dots{}})
|
||||
giving details of the problem, but it still loads the file, just
|
||||
leaving the macro unexpanded for now. You may wish to restructure
|
||||
your code so that this does not happen. Loading a compiled file does
|
||||
not cause macroexpansion, because this should already have happened
|
||||
during compilation. @xref{Compiling Macros}.
|
||||
|
||||
Messages like @samp{Loading foo...} and @samp{Loading foo...done} appear
|
||||
in the echo area during loading unless @var{nomessage} is
|
||||
non-@code{nil}.
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ macro.
|
|||
calls to other macros. It may even be a call to the same macro, though
|
||||
this is unusual.
|
||||
|
||||
Note that Emacs tries to expand macros when loading an uncompiled
|
||||
Lisp file. This is not always possible, but if it is, it speeds up
|
||||
subsequent execution. @xref{How Programs Do Loading}.
|
||||
|
||||
You can see the expansion of a given macro call by calling
|
||||
@code{macroexpand}.
|
||||
|
||||
|
|
|
|||
|
|
@ -886,6 +886,26 @@ Here is an example:
|
|||
@end smallexample
|
||||
@end defmac
|
||||
|
||||
@c FIXME? completion-table-with-context?
|
||||
@findex completion-table-case-fold
|
||||
@findex completion-table-in-turn
|
||||
@findex completion-table-subvert
|
||||
@findex completion-table-with-quoting
|
||||
@findex completion-table-with-predicate
|
||||
@findex completion-table-with-terminator
|
||||
@cindex completion table, modifying
|
||||
@cindex completion tables, combining
|
||||
There are several functions that take an existing completion table and
|
||||
return a modified version. @code{completion-table-case-fold} returns
|
||||
a case-insensitive table. @code{completion-table-in-turn} combines
|
||||
multiple input tables. @code{completion-table-subvert} alters a table
|
||||
to use a different initial prefix. @code{completion-table-with-quoting}
|
||||
returns a table suitable for operating on quoted text.
|
||||
@code{completion-table-with-predicate} filters a table with a
|
||||
predicate function. @code{completion-table-with-terminator} adds a
|
||||
terminating string.
|
||||
|
||||
|
||||
@node Minibuffer Completion
|
||||
@subsection Completion and the Minibuffer
|
||||
@cindex minibuffer completion
|
||||
|
|
@ -1710,8 +1730,9 @@ string, and @var{end} is the position of the end boundary in
|
|||
|
||||
@item metadata
|
||||
This specifies a request for information about the state of the
|
||||
current completion. The function should return an alist, as described
|
||||
below. The alist may contain any number of elements.
|
||||
current completion. The return value should have the form
|
||||
@code{(metadata . @var{alist})}, where @var{alist} is an alist whose
|
||||
elements are described below.
|
||||
@end table
|
||||
|
||||
@noindent
|
||||
|
|
|
|||
|
|
@ -490,6 +490,8 @@ partially-visible line at the bottom of the text area is not counted.
|
|||
aliases are considered obsolete and will be removed in the future.
|
||||
|
||||
@cindex fixed-size window
|
||||
@vindex window-min-height
|
||||
@vindex window-min-width
|
||||
Commands that change the size of windows (@pxref{Resizing Windows}),
|
||||
or split them (@pxref{Splitting Windows}), obey the variables
|
||||
@code{window-min-height} and @code{window-min-width}, which specify
|
||||
|
|
@ -633,6 +635,10 @@ variable @code{window-min-height}.
|
|||
If the optional argument @var{override} is non-@code{nil}, this
|
||||
function ignores any size restrictions imposed by
|
||||
@code{window-min-height} and @code{window-min-width}.
|
||||
|
||||
@vindex fit-frame-to-buffer
|
||||
If the option @code{fit-frame-to-buffer} is non-@code{nil}, this
|
||||
command may resize the frame to fit its contents.
|
||||
@end deffn
|
||||
|
||||
@deffn Command shrink-window-if-larger-than-buffer &optional window
|
||||
|
|
@ -1055,7 +1061,7 @@ including the space earlier stolen from @code{W3}.
|
|||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This can be counterintutive, in particular if @code{W4} were used for
|
||||
This can be counterintuitive, in particular if @code{W4} were used for
|
||||
displaying a buffer only temporarily (@pxref{Temporary Displays}), and
|
||||
you want to continue working with the initial layout.
|
||||
|
||||
|
|
@ -1766,6 +1772,7 @@ Like @code{switch-to-buffer}, this function updates the buffer list
|
|||
unless @var{norecord} is non-@code{nil}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Choosing Window
|
||||
@section Choosing a Window for Display
|
||||
|
||||
|
|
@ -1851,10 +1858,14 @@ default value is empty, i.e. @code{(nil . nil)}.
|
|||
@end defvar
|
||||
|
||||
@defopt display-buffer-alist
|
||||
The value of this option is an alist mapping regular expressions to
|
||||
display actions. If the name of the buffer passed to
|
||||
@code{display-buffer} matches a regular expression in this alist, then
|
||||
@code{display-buffer} uses the corresponding display action.
|
||||
The value of this option is an alist mapping conditions to display
|
||||
actions. Each condition may be either a regular expression matching a
|
||||
buffer name or a function that takes two arguments - a buffer name and
|
||||
the @var{action} argument passed to @code{display-buffer}. If the name
|
||||
of the buffer passed to @code{display-buffer} either matches a regular
|
||||
expression in this alist or the function specified by a condition
|
||||
returns non-@code{nil}, then @code{display-buffer} uses the
|
||||
corresponding display action to display the buffer.
|
||||
@end defopt
|
||||
|
||||
@defopt display-buffer-base-action
|
||||
|
|
@ -1868,6 +1879,7 @@ This display action specifies the fallback behavior for
|
|||
@code{display-buffer} if no other display actions are given.
|
||||
@end defvr
|
||||
|
||||
|
||||
@node Display Action Functions
|
||||
@section Action Functions for @code{display-buffer}
|
||||
|
||||
|
|
@ -1911,15 +1923,18 @@ normally searches just the selected frame; however, if the variable
|
|||
@code{pop-up-frames} is non-@code{nil}, it searches all frames on the
|
||||
current terminal. @xref{Choosing Window Options}.
|
||||
|
||||
If this function chooses a window on another frame, it makes that
|
||||
frame visible and raises it if necessary.
|
||||
If this function chooses a window on another frame, it makes that frame
|
||||
visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
|
||||
entry (@pxref{Choosing Window Options}), raises that frame if necessary.
|
||||
@end defun
|
||||
|
||||
@defun display-buffer-pop-up-frame buffer alist
|
||||
This function creates a new frame, and displays the buffer in that
|
||||
frame's window. It actually performs the frame creation by calling
|
||||
the function specified in @code{pop-up-frame-function}
|
||||
(@pxref{Choosing Window Options}).
|
||||
(@pxref{Choosing Window Options}). If @var{alist} contains a
|
||||
@code{pop-up-frame-parameters} entry, the associated value
|
||||
is added to the newly created frame's parameters.
|
||||
@end defun
|
||||
|
||||
@defun display-buffer-pop-up-window buffer alist
|
||||
|
|
@ -1976,16 +1991,12 @@ reason (e.g. if there is just one frame and it has an
|
|||
@code{unsplittable} frame parameter; @pxref{Buffer Parameters}).
|
||||
@end defun
|
||||
|
||||
@defun display-buffer-use-some-window buffer alist
|
||||
This function tries to display @var{buffer} by choosing an existing
|
||||
window and displaying the buffer in that window. It can fail if all
|
||||
windows are dedicated to another buffer (@pxref{Dedicated Windows}).
|
||||
@end defun
|
||||
|
||||
@defun display-buffer-below-selected buffer alist
|
||||
This function tries to display @var{buffer} in a window below the
|
||||
selected window. This means to either split the selected window or
|
||||
reuse the window below the selected one.
|
||||
selected window. This means to either split the selected window or use
|
||||
the window below the selected one. If it does create a new window, it
|
||||
will also adjust its size provided @var{alist} contains a suitable
|
||||
@code{window-height} or @code{window-width} entry, see above.
|
||||
@end defun
|
||||
|
||||
@defun display-buffer-in-previous-window buffer alist
|
||||
|
|
@ -2001,6 +2012,83 @@ specified by that entry will override any other window found by the
|
|||
methods above, even if that window never showed @var{buffer} before.
|
||||
@end defun
|
||||
|
||||
@defun display-buffer-use-some-window buffer alist
|
||||
This function tries to display @var{buffer} by choosing an existing
|
||||
window and displaying the buffer in that window. It can fail if all
|
||||
windows are dedicated to another buffer (@pxref{Dedicated Windows}).
|
||||
@end defun
|
||||
|
||||
To illustrate the use of action functions, consider the following
|
||||
example.
|
||||
|
||||
@example
|
||||
@group
|
||||
(display-buffer
|
||||
(get-buffer-create "*foo*")
|
||||
'((display-buffer-reuse-window
|
||||
display-buffer-pop-up-window
|
||||
display-buffer-pop-up-frame)
|
||||
(reusable-frames . 0)
|
||||
(window-height . 10) (window-width . 40)))
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Evaluating the form above will cause @code{display-buffer} to proceed as
|
||||
follows: If `*foo*' already appears on a visible or iconified frame, it
|
||||
will reuse its window. Otherwise, it will try to pop up a new window
|
||||
or, if that is impossible, a new frame. If all these steps fail, it
|
||||
will try to use some existing window.
|
||||
|
||||
Furthermore, @code{display-buffer} will try to adjust a reused window
|
||||
(provided `*foo*' was put by @code{display-buffer} there before) or a
|
||||
popped-up window as follows: If the window is part of a vertical
|
||||
combination, it will set its height to ten lines. Note that if, instead
|
||||
of the number ``10'', we specified the function
|
||||
@code{fit-window-to-buffer}, @code{display-buffer} would come up with a
|
||||
one-line window to fit the empty buffer. If the window is part of a
|
||||
horizontal combination, it sets its width to 40 columns. Whether a new
|
||||
window is vertically or horizontally combined depends on the shape of
|
||||
the window split and the values of
|
||||
@code{split-window-preferred-function}, @code{split-height-threshold}
|
||||
and @code{split-width-threshold} (@pxref{Choosing Window Options}).
|
||||
|
||||
Now suppose we combine this call with a preexisting setup for
|
||||
`display-buffer-alist' as follows.
|
||||
|
||||
@example
|
||||
@group
|
||||
(let ((display-buffer-alist
|
||||
(cons
|
||||
'("\\*foo\\*"
|
||||
(display-buffer-reuse-window display-buffer-below-selected)
|
||||
(reusable-frames)
|
||||
(window-height . 5))
|
||||
display-buffer-alist)))
|
||||
(display-buffer
|
||||
(get-buffer-create "*foo*")
|
||||
'((display-buffer-reuse-window
|
||||
display-buffer-pop-up-window
|
||||
display-buffer-pop-up-frame)
|
||||
(reusable-frames . 0)
|
||||
(window-height . 10) (window-width . 40))))
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Evaluating this form will cause @code{display-buffer} to first try
|
||||
reusing a window showing @code{*foo*} on the selected frame.
|
||||
If no such window exists, it will try to split the selected window or,
|
||||
if that is impossible, use the window below the selected window.
|
||||
|
||||
If there's no window below the selected one, or the window below the
|
||||
selected one is dedicated to its buffer, @code{display-buffer} will
|
||||
proceed as described in the previous example. Note, however, that when
|
||||
it tries to adjust the height of any reused or popped-up window, it will
|
||||
in any case try to set its number of lines to ``5'' since that value
|
||||
overrides the corresponding specification in the @var{action} argument
|
||||
of @code{display-buffer}.
|
||||
|
||||
|
||||
@node Choosing Window Options
|
||||
@section Additional Options for Displaying Buffers
|
||||
|
|
@ -2343,7 +2431,7 @@ buffer previously shown no longer exists, this function calls
|
|||
@code{switch-to-prev-buffer} (@pxref{Window History}) to show some other
|
||||
buffer instead.
|
||||
|
||||
The optional argument @var{bury-or-kill} specifes how to deal with
|
||||
The optional argument @var{bury-or-kill} specifies how to deal with
|
||||
@var{window}'s buffer. The following values are handled:
|
||||
|
||||
@table @code
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Calc now uses the Gregorian calendar for all dates,
|
||||
and uses January 1, 1 AD as its day number 1.
|
||||
* calc.texi (Date Forms): Document this.
|
||||
|
||||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* cl.texi (Function Bindings): Clarify that cl-flet is lexical.
|
||||
(Obsolete Macros): Move example here from Function Bindings.
|
||||
|
||||
* erc.texi: Use @code{nil} rather than just "nil".
|
||||
(Modules): Undocument obsolete "hecomplete".
|
||||
Add "notifications".
|
||||
(Connecting): Add brief section on passwords.
|
||||
(Options): Make a start by adding erc-hide-list, erc-lurker-hide-list.
|
||||
|
||||
2012-11-13 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* flymake.texi (Customizable variables)
|
||||
|
|
|
|||
|
|
@ -11010,35 +11010,41 @@ You can use the @kbd{v p} (@code{calc-pack}) and @kbd{v u}
|
|||
of a date form. @xref{Packing and Unpacking}.
|
||||
|
||||
Date forms can go arbitrarily far into the future or past. Negative
|
||||
year numbers represent years BC. Calc uses a combination of the
|
||||
Gregorian and Julian calendars, following the history of Great
|
||||
Britain and the British colonies. This is the same calendar that
|
||||
is used by the @code{cal} program in most Unix implementations.
|
||||
year numbers represent years BC. There is no ``year 0''; the day
|
||||
before @samp{<Mon Jan 1, +1>} is @samp{<Sun Dec 31, -1>}. These are
|
||||
days 1 and 0 respectively in Calc's internal numbering scheme. The
|
||||
Gregorian calendar is used for all dates, including dates before the
|
||||
Gregorian calendar was invented. Thus Calc's use of the day number
|
||||
@mathit{-10000} to represent August 15, 28 BC should be taken with a
|
||||
grain of salt.
|
||||
|
||||
@cindex Julian calendar
|
||||
@cindex Gregorian calendar
|
||||
Some historical background: The Julian calendar was created by
|
||||
Julius Caesar in the year 46 BC as an attempt to fix the gradual
|
||||
drift caused by the lack of leap years in the calendar used
|
||||
until that time. The Julian calendar introduced an extra day in
|
||||
Julius Caesar in the year 46 BC as an attempt to fix the confusion
|
||||
caused by the irregular Roman calendar that was used before that time.
|
||||
The Julian calendar introduced an extra day in
|
||||
all years divisible by four. After some initial confusion, the
|
||||
calendar was adopted around the year we call 8 AD. Some centuries
|
||||
calendar was adopted around the year we call 8 AD, although the years were
|
||||
numbered differently and did not necessarily begin on January 1. Some centuries
|
||||
later it became apparent that the Julian year of 365.25 days was
|
||||
itself not quite right. In 1582 Pope Gregory XIII introduced the
|
||||
Gregorian calendar, which added the new rule that years divisible
|
||||
by 100, but not by 400, were not to be considered leap years
|
||||
despite being divisible by four. Many countries delayed adoption
|
||||
of the Gregorian calendar because of religious differences;
|
||||
in Britain it was put off until the year 1752, by which time
|
||||
the Julian calendar had fallen eleven days behind the true
|
||||
seasons. So the switch to the Gregorian calendar in early
|
||||
September 1752 introduced a discontinuity: The day after
|
||||
Sep 2, 1752 is Sep 14, 1752. Calc follows this convention.
|
||||
To take another example, Russia waited until 1918 before
|
||||
adopting the new calendar, and thus needed to remove thirteen
|
||||
days (between Feb 1, 1918 and Feb 14, 1918). This means that
|
||||
Calc's reckoning will be inconsistent with Russian history between
|
||||
1752 and 1918, and similarly for various other countries.
|
||||
of the Gregorian calendar because of religious differences, and
|
||||
used differing year numbers and start-of-year for other reasons;
|
||||
for example, in early 1752 England changed the start of its year from
|
||||
March 25 to January 1, and in September it switched to the Gregorian
|
||||
calendar: in England, the day after December 31, 1750 was January 1,
|
||||
1750 and the day after March 24, 1750 was March 25, 1751, but the day
|
||||
after December 31, 1751 was January 1, 1752 and the day after
|
||||
September 2, 1752 was September 14, 1752. To take another example,
|
||||
Russia switched both year numbering and start-of-year in 1700, but did
|
||||
not adopt the Gregorian calendar until 1918. Calc's reckoning
|
||||
therefore matches English practice starting in 1752 and Russian
|
||||
practice starting in 1918, but disagrees with earlier dates in both
|
||||
countries.
|
||||
|
||||
Today's timekeepers introduce an occasional ``leap second'' as
|
||||
well, but Calc does not take these minor effects into account.
|
||||
|
|
@ -11046,15 +11052,6 @@ well, but Calc does not take these minor effects into account.
|
|||
between, say, @samp{<12:00am Mon Jan 1, 1900>} and
|
||||
@samp{<12:00am Sat Jan 1, 2000>}.)
|
||||
|
||||
Calc uses the Julian calendar for all dates before the year 1752,
|
||||
including dates BC when the Julian calendar technically had not
|
||||
yet been invented. Thus the claim that day number @mathit{-10000} is
|
||||
called ``August 16, 28 BC'' should be taken with a grain of salt.
|
||||
|
||||
Please note that there is no ``year 0''; the day before
|
||||
@samp{<Sat Jan 1, +1>} is @samp{<Fri Dec 31, -1>}. These are
|
||||
days 0 and @mathit{-1} respectively in Calc's internal numbering scheme.
|
||||
|
||||
@cindex Julian day counting
|
||||
Another day counting system in common use is, confusingly, also called
|
||||
``Julian.'' The Julian day number is the numbers of days since
|
||||
|
|
|
|||
|
|
@ -1292,28 +1292,14 @@ it were a @code{cl-defun} form. The function @var{name} is defined
|
|||
accordingly for the duration of the body of the @code{cl-flet}; then
|
||||
the old function definition, or lack thereof, is restored.
|
||||
|
||||
You can use @code{cl-flet} to disable or modify the behavior of a
|
||||
function in a temporary fashion. (Compare this with the idea
|
||||
of advising functions.
|
||||
You can use @code{cl-flet} to disable or modify the behavior of
|
||||
functions (including Emacs primitives) in a temporary, localized fashion.
|
||||
(Compare this with the idea of advising functions.
|
||||
@xref{Advising Functions,,,elisp,GNU Emacs Lisp Reference Manual}.)
|
||||
This will even work on Emacs primitives, although note that some calls
|
||||
to primitive functions internal to Emacs are made without going
|
||||
through the symbol's function cell, and so will not be affected by
|
||||
@code{cl-flet}. For example,
|
||||
|
||||
@example
|
||||
(cl-flet ((message (&rest args) (push args saved-msgs)))
|
||||
(do-something))
|
||||
@end example
|
||||
|
||||
This code attempts to replace the built-in function @code{message}
|
||||
with a function that simply saves the messages in a list rather
|
||||
than displaying them. The original definition of @code{message}
|
||||
will be restored after @code{do-something} exits. This code will
|
||||
work fine on messages generated by other Lisp code, but messages
|
||||
generated directly inside Emacs will not be caught since they make
|
||||
direct C-language calls to the message routines rather than going
|
||||
through the Lisp @code{message} function.
|
||||
The bindings are lexical in scope. This means that all references to
|
||||
the named functions must appear physically within the body of the
|
||||
@code{cl-flet} form.
|
||||
|
||||
Functions defined by @code{cl-flet} may use the full Common Lisp
|
||||
argument notation supported by @code{cl-defun}; also, the function
|
||||
|
|
@ -1321,7 +1307,8 @@ body is enclosed in an implicit block as if by @code{cl-defun}.
|
|||
@xref{Program Structure}.
|
||||
|
||||
Note that the @file{cl.el} version of this macro behaves slightly
|
||||
differently. @xref{Obsolete Macros}.
|
||||
differently. In particular, its binding is dynamic rather than
|
||||
lexical. @xref{Obsolete Macros}.
|
||||
@end defmac
|
||||
|
||||
@defmac cl-labels (bindings@dots{}) forms@dots{}
|
||||
|
|
@ -4863,6 +4850,25 @@ time before Emacs had lexical binding). The result is
|
|||
that @code{flet} affects indirect calls to a function as well as calls
|
||||
directly inside the @code{flet} form itself.
|
||||
|
||||
This will even work on Emacs primitives, although note that some calls
|
||||
to primitive functions internal to Emacs are made without going
|
||||
through the symbol's function cell, and so will not be affected by
|
||||
@code{flet}. For example,
|
||||
|
||||
@example
|
||||
(flet ((message (&rest args) (push args saved-msgs)))
|
||||
(do-something))
|
||||
@end example
|
||||
|
||||
This code attempts to replace the built-in function @code{message}
|
||||
with a function that simply saves the messages in a list rather
|
||||
than displaying them. The original definition of @code{message}
|
||||
will be restored after @code{do-something} exits. This code will
|
||||
work fine on messages generated by other Lisp code, but messages
|
||||
generated directly inside Emacs will not be caught since they make
|
||||
direct C-language calls to the message routines rather than going
|
||||
through the Lisp @code{message} function.
|
||||
|
||||
@c Bug#411.
|
||||
Note that many primitives (e.g.@: @code{+}) have special byte-compile
|
||||
handling. Attempts to redefine such functions using @code{flet} will
|
||||
|
|
|
|||
|
|
@ -390,11 +390,6 @@ Complete nicknames and commands (programmable)
|
|||
@item fill
|
||||
Wrap long lines
|
||||
|
||||
@cindex modules, hecomplete
|
||||
@item hecomplete
|
||||
Complete nicknames and commands (old). This is the old module---you
|
||||
might prefer the ``completion'' module instead.
|
||||
|
||||
@cindex modules, identd
|
||||
@item identd
|
||||
Launch an identd server on port 8113
|
||||
|
|
@ -427,6 +422,11 @@ Don't display non-IRC commands after evaluation
|
|||
@item notify
|
||||
Notify when the online status of certain users changes
|
||||
|
||||
@cindex modules, notifications
|
||||
@item notifications
|
||||
Send you a notification when you get a private message,
|
||||
or your nickname is mentioned
|
||||
|
||||
@cindex modules, page
|
||||
@item page
|
||||
Process CTCP PAGE requests from IRC
|
||||
|
|
@ -530,7 +530,7 @@ parameters.
|
|||
@defun erc-compute-server &optional server
|
||||
Return an IRC server name.
|
||||
|
||||
This tries a number of increasingly more default methods until a non-nil
|
||||
This tries a number of increasingly more default methods until a non-@code{nil}
|
||||
value is found.
|
||||
|
||||
@itemize @bullet
|
||||
|
|
@ -542,7 +542,7 @@ value is found.
|
|||
|
||||
@end defun
|
||||
|
||||
@defopt erc-server nil
|
||||
@defopt erc-server
|
||||
IRC server to use if one is not provided.
|
||||
@end defopt
|
||||
|
||||
|
|
@ -551,7 +551,7 @@ IRC server to use if one is not provided.
|
|||
@defun erc-compute-port &optional port
|
||||
Return a port for an IRC server.
|
||||
|
||||
This tries a number of increasingly more default methods until a non-nil
|
||||
This tries a number of increasingly more default methods until a non-@code{nil}
|
||||
value is found.
|
||||
|
||||
@itemize @bullet
|
||||
|
|
@ -574,7 +574,7 @@ This can be either a string or a number.
|
|||
Return user's IRC nick.
|
||||
|
||||
This tries a number of increasingly more default methods until a
|
||||
non-nil value is found.
|
||||
non-@code{nil} value is found.
|
||||
|
||||
@itemize
|
||||
@item @var{nick} (the argument passed to this function)
|
||||
|
|
@ -598,19 +598,43 @@ The string to append to the nick if it is already in use.
|
|||
@end defopt
|
||||
|
||||
@defopt erc-try-new-nick-p
|
||||
If the nickname you chose isn't available, and this option is non-nil,
|
||||
If the nickname you chose isn't available, and this option is non-@code{nil},
|
||||
ERC should automatically attempt to connect with another nickname.
|
||||
|
||||
You can manually set another nickname with the /NICK command.
|
||||
@end defopt
|
||||
|
||||
@subheading Password
|
||||
@cindex password
|
||||
|
||||
@defopt erc-prompt-for-password
|
||||
If non-@code{nil} (the default), @kbd{M-x erc} prompts for a password.
|
||||
@end defopt
|
||||
|
||||
If you prefer, you can set this option to @code{nil} and use the
|
||||
@code{auth-source} mechanism to store your password. For instance, if
|
||||
you use @file{~/.authinfo} as your auth-source backend, then put
|
||||
something like the following in that file:
|
||||
|
||||
@example
|
||||
machine irc.example.net login "#fsf" password sEcReT
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
ERC also consults @code{auth-source} to find any channel keys required
|
||||
for the channels that you wish to autojoin, as specified by the
|
||||
variable @code{erc-autojoin-channels-alist}.
|
||||
|
||||
For more details, @pxref{Top,,auth-source, auth, Emacs auth-source Library}.
|
||||
|
||||
|
||||
@subheading Full name
|
||||
|
||||
@defun erc-compute-full-name &optional full-name
|
||||
Return user's full name.
|
||||
|
||||
This tries a number of increasingly more default methods until a
|
||||
non-nil value is found.
|
||||
non-@code{nil} value is found.
|
||||
|
||||
@itemize @bullet
|
||||
@item @var{full-name} (the argument passed to this function)
|
||||
|
|
@ -713,10 +737,24 @@ stuff, to the current ERC buffer."
|
|||
@c PRE5_4: (Node) Document every ERC option (module options go in
|
||||
@c previous chapter)
|
||||
|
||||
This section has not yet been written. For now, the easiest way to
|
||||
check out the available options for ERC is to do
|
||||
This section is extremely incomplete. For now, the easiest way to
|
||||
check out all the available options for ERC is to do
|
||||
@kbd{M-x customize-group erc RET}.
|
||||
|
||||
@defopt erc-hide-list
|
||||
If non, @code{nil}, this is a list of IRC message types to hide, e.g.
|
||||
|
||||
@example
|
||||
(setq erc-hide-list '("JOIN" "PART" "QUIT"))
|
||||
@end example
|
||||
@end defopt
|
||||
|
||||
@defopt erc-lurker-hide-list
|
||||
Like @code{erc-hide-list}, but only applies to messages sent by
|
||||
lurkers. The function @code{erc-lurker-p} determines whether a given
|
||||
nickname is considerd a lurker.
|
||||
@end defopt
|
||||
|
||||
|
||||
@node Getting Help and Reporting Bugs
|
||||
@chapter Getting Help and Reporting Bugs
|
||||
|
|
|
|||
|
|
@ -482,9 +482,9 @@ show column letters again.
|
|||
Pops up a menu to set the current row as the header, or revert to
|
||||
column letters.
|
||||
@item M-x ses-rename-cell
|
||||
@findex ses-rename-cell
|
||||
Rename a cell from a standard A1-like name to any
|
||||
string.
|
||||
@findex ses-rename-cell
|
||||
Rename a cell from a standard A1-like name to any
|
||||
string.
|
||||
@item M-x ses-repair-cell-reference-all
|
||||
@findex ses-repair-cell-reference-all
|
||||
When you interrupt a cell formula update by clicking @kbd{C-g}, then
|
||||
|
|
@ -606,15 +606,15 @@ instance @code{(ses-range A1 A4 _ "empty")} will do the same as
|
|||
are empty. Similarly, @code{(ses-range A1 A4 _ )} will do the same as
|
||||
@code{(list A1 0 A3 0)}.
|
||||
@item >v
|
||||
When order matters, list cells by reading cells rowwise from top left
|
||||
When order matters, list cells by reading cells row-wise from top left
|
||||
to bottom right. This flag is provided for completeness only as it is
|
||||
the default reading order.
|
||||
@item <v
|
||||
List cells by reading cells rowwise from top right to bottom left.
|
||||
List cells by reading cells row-wise from top right to bottom left.
|
||||
@item v>
|
||||
List cells by reading cells columnwise from top left to bottom right.
|
||||
List cells by reading cells column-wise from top left to bottom right.
|
||||
@item v<
|
||||
List cells by reading cells columnwise from top right to bottom left.
|
||||
List cells by reading cells column-wise from top right to bottom left.
|
||||
@item v
|
||||
A short hand for @code{v>}.
|
||||
@item ^
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ To use this function, you must @code{(require 'url-queue)}.
|
|||
The value of this option is an integer specifying the maximum number
|
||||
of concurrent @code{url-queue-retrieve} network processes. If the
|
||||
number of @code{url-queue-retrieve} calls is larger than this number,
|
||||
later ones are queued until ealier ones are finished.
|
||||
later ones are queued until earlier ones are finished.
|
||||
@end defopt
|
||||
|
||||
@vindex url-queue-timeout
|
||||
|
|
|
|||
69
etc/NEWS
69
etc/NEWS
|
|
@ -25,7 +25,14 @@ so we will look at it and add it to the manual.
|
|||
* Startup Changes in Emacs 24.4
|
||||
* Changes in Emacs 24.4
|
||||
* Editing Changes in Emacs 24.4
|
||||
|
||||
|
||||
* Changes in Specialized Modes and Packages in Emacs 24.4
|
||||
|
||||
+++
|
||||
** New function `ses-rename-cell' to give SES cells arbitrary names.
|
||||
|
||||
|
||||
* New Modes and Packages in Emacs 24.4
|
||||
** New nadvice.el package offering lighter-weight advice facilities.
|
||||
It is layered as:
|
||||
|
|
@ -36,6 +43,9 @@ It is layered as:
|
|||
|
||||
* Incompatible Lisp Changes in Emacs 24.4
|
||||
|
||||
** `defadvice' does not honor the `freeze' flag and cannot advise
|
||||
special-forms any more.
|
||||
|
||||
** `dolist' in lexical-binding mode does not bind VAR in RESULT any more.
|
||||
VAR was bound to nil which was not tremendously useful and just lead to
|
||||
spurious warnings about an unused var.
|
||||
|
|
@ -51,6 +61,11 @@ and redirect them to your own function instead of `fset'.
|
|||
|
||||
* Changes in Emacs 24.4 on non-free operating systems
|
||||
|
||||
+++
|
||||
** The "generate a backtrace on fatal error" feature now works on MS Windows.
|
||||
The backtrace is written to the 'emacs_backtrace.txt' file in the
|
||||
directory where Emacs was running.
|
||||
|
||||
|
||||
* Installation Changes in Emacs 24.3
|
||||
|
||||
|
|
@ -351,6 +366,8 @@ provide the old non-prefixed names. Some exceptions are listed below.
|
|||
+++
|
||||
*** `cl-flet' is not like `flet' (which is deprecated).
|
||||
Instead it obeys the behavior of Common-Lisp's `flet'.
|
||||
In particular, in cl-flet function definitions are lexically scoped,
|
||||
whereas in flet the scoping is dynamic.
|
||||
|
||||
+++
|
||||
*** `cl-labels' is slightly different from `labels'.
|
||||
|
|
@ -465,12 +482,18 @@ The global binding for `M-=', `count-words-region' is in effect.
|
|||
|
||||
** ERC
|
||||
|
||||
*** New package `erc-desktop-notifications.el', which can send a notification
|
||||
when you receive a private message or your nickname is mentioned.
|
||||
+++
|
||||
*** New module "notifications", which can send a notification when you
|
||||
receive a private message or your nickname is mentioned.
|
||||
|
||||
+++
|
||||
*** ERC will look up server/channel names via auth-source and use any
|
||||
channel keys found.
|
||||
|
||||
+++
|
||||
*** New option `erc-lurker-hide-list', similar to `erc-hide-list', but
|
||||
only applies to messages sent by lurkers.
|
||||
|
||||
+++
|
||||
** Flymake uses fringe bitmaps to indicate errors and warnings.
|
||||
See `flymake-fringe-indicator-position', `flymake-error-bitmap' and
|
||||
|
|
@ -658,8 +681,7 @@ enabled, applies to all applicable major modes.
|
|||
** winner-mode-hook now runs when the mode is disabled, as well as when it is
|
||||
enabled.
|
||||
|
||||
** FIXME something happened to ses.el, 2012-04-17.
|
||||
|
||||
+++
|
||||
** Hooks renamed to avoid obsolete "-hooks" suffix:
|
||||
*** semantic-lex-reset-hooks -> semantic-lex-reset-functions
|
||||
*** semantic-change-hooks -> semantic-change-functions
|
||||
|
|
@ -836,6 +858,7 @@ More commands use `read-regexp' now to read their regexp arguments.
|
|||
*** New function `completion-table-with-quoting' to handle completion
|
||||
in the presence of quoting, such as file completion in shell buffers.
|
||||
|
||||
+++
|
||||
*** New function `completion-table-subvert' to use an existing completion
|
||||
table, but with a different prefix.
|
||||
|
||||
|
|
@ -864,24 +887,33 @@ now accept a third argument to avoid choosing the selected window.
|
|||
+++
|
||||
*** Additional values recognized for option `window-combination-limit'.
|
||||
|
||||
*** New macro `with-temp-buffer-window'.
|
||||
+++
|
||||
*** New macro `with-temp-buffer-window', similar to
|
||||
`with-output-to-temp-buffer'.
|
||||
|
||||
---
|
||||
*** `temp-buffer-resize-mode' no longer resizes windows that have been
|
||||
reused.
|
||||
|
||||
*** New function `fit-frame-to-buffer' and new options
|
||||
`fit-frame-to-buffer' and `fit-frame-to-buffer-bottom-margin'.
|
||||
+++
|
||||
*** New command `fit-frame-to-buffer' adjusts the frame height to
|
||||
fit the contents.
|
||||
|
||||
+++
|
||||
*** The command `fit-window-to-buffer' can adjust the frame height
|
||||
if the new option `fit-frame-to-buffer' is non-nil.
|
||||
|
||||
+++
|
||||
*** New option switch-to-buffer-preserve-window-point to restore a
|
||||
window's point when switching buffers.
|
||||
+++
|
||||
*** New display action functions `display-buffer-below-selected',
|
||||
and `display-buffer-in-previous-window'.
|
||||
|
||||
+++
|
||||
*** New display action alist entry `inhibit-switch-frame', if non-nil,
|
||||
tells display action functions to avoid changing which frame is
|
||||
selected.
|
||||
|
||||
+++
|
||||
*** New display action alist entry `pop-up-frame-parameters', if
|
||||
non-nil, specifies frame parameters to give any newly-created frame.
|
||||
+++
|
||||
|
|
@ -937,13 +969,14 @@ Previously, they returned NaNs on some platforms but signaled errors
|
|||
on others. The affected functions are acos, asin, tan, exp, expt,
|
||||
log, log10, sqrt, and mod.
|
||||
|
||||
** Interpreted files are eagerly macro-expanded during load.
|
||||
+++
|
||||
** Emacs tries to macroexpand interpreted (non-compiled) files during load.
|
||||
This can significantly speed up execution of non-byte-compiled code,
|
||||
but can also bump into harmless and previously unnoticed cyclic
|
||||
dependencies. These should not be fatal: they will simply cause the
|
||||
macro-calls to be left for later expansion (as before), but will also
|
||||
result in a warning ("Eager macro-expansion skipped due to cycle")
|
||||
describing the cycle.
|
||||
but can also bump into previously unnoticed cyclic dependencies.
|
||||
These are generally harmless: they will simply cause the macro calls
|
||||
to be left for later expansion (as before), but will result in a
|
||||
warning ("Eager macro-expansion skipped due to cycle") describing the cycle.
|
||||
You may wish to restructure your code so this does not happen.
|
||||
|
||||
** Miscellaneous new functions:
|
||||
+++
|
||||
|
|
@ -958,7 +991,9 @@ describing the cycle.
|
|||
*** `function-get' fetches a function property, following aliases.
|
||||
+++
|
||||
*** `posnp' tests if an object is a `posn'.
|
||||
*** `set-temporary-overlay-map' sets up a temporary overlay map.
|
||||
+++
|
||||
*** `set-temporary-overlay-map' sets up a temporary keymap that
|
||||
takes precedence over most other maps for a short while (normally one key).
|
||||
+++
|
||||
*** `system-users' returns the user names on the system.
|
||||
+++
|
||||
|
|
@ -972,8 +1007,8 @@ describing the cycle.
|
|||
+++
|
||||
** New fringe bitmap `exclamation-mark'.
|
||||
|
||||
+++
|
||||
** Face underlining can now use a wave.
|
||||
See the "Face Attributes" section of the Elisp manual.
|
||||
|
||||
** The following functions and variables are obsolete:
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
2012-11-17 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* makefile.w32-in (SYSWAIT_H): New macro.
|
||||
($(BLD)/movemail.$(O)): Update dependencies.
|
||||
|
||||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* movemail.c, update-game-score.c: Assume <fcntl.h> exists.
|
||||
|
||||
2012-10-26 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* Makefile.in (uninstall): No INSTALLABLES live in archlibdir.
|
||||
|
|
|
|||
|
|
@ -374,6 +374,8 @@ NTLIB_H = $(LIB_SRC)/ntlib.h \
|
|||
SYSTIME_H = $(SRC)/systime.h \
|
||||
$(NT_INC)/sys/time.h \
|
||||
$(GNU_LIB)/timespec.h
|
||||
SYSWAIT_H = $(SRC)/syswait.h \
|
||||
$(NT_INC)/sys/wait.h
|
||||
|
||||
$(BLD)/ctags.$(O) : \
|
||||
$(LIB_SRC)/ctags.c \
|
||||
|
|
@ -419,14 +421,14 @@ $(BLD)/make-docfile.$(O) : \
|
|||
$(BLD)/movemail.$(O) : \
|
||||
$(LIB_SRC)/movemail.c \
|
||||
$(LIB_SRC)/pop.h \
|
||||
$(SRC)/syswait.h \
|
||||
$(NT_INC)/pwd.h \
|
||||
$(NT_INC)/sys/file.h \
|
||||
$(NT_INC)/sys/stat.h \
|
||||
$(NT_INC)/unistd.h \
|
||||
$(GNU_LIB)/getopt.h \
|
||||
$(CONFIG_H) \
|
||||
$(NTLIB_H)
|
||||
$(NTLIB_H) \
|
||||
$(SYSWAIT_H)
|
||||
|
||||
$(BLD)/ntlib.$(O) : \
|
||||
$(LIB_SRC)/ntlib.c \
|
||||
|
|
|
|||
|
|
@ -65,9 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "syswait.h"
|
||||
#ifdef MAIL_USE_POP
|
||||
|
|
|
|||
|
|
@ -42,9 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <time.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <getopt.h>
|
||||
|
||||
|
|
|
|||
146
lib/at-func.c
Normal file
146
lib/at-func.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/* Define at-style functions like fstatat, unlinkat, fchownat, etc.
|
||||
Copyright (C) 2006, 2009-2012 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 of the License, 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 */
|
||||
|
||||
#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
|
||||
|
||||
#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
|
||||
# include <errno.h>
|
||||
# ifndef ENOTSUP
|
||||
# define ENOTSUP EINVAL
|
||||
# endif
|
||||
#else
|
||||
# include "openat.h"
|
||||
# include "openat-priv.h"
|
||||
# include "save-cwd.h"
|
||||
#endif
|
||||
|
||||
#ifdef AT_FUNC_USE_F1_COND
|
||||
# define CALL_FUNC(F) \
|
||||
(flag == AT_FUNC_USE_F1_COND \
|
||||
? AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS) \
|
||||
: AT_FUNC_F2 (F AT_FUNC_POST_FILE_ARGS))
|
||||
# define VALIDATE_FLAG(F) \
|
||||
if (flag & ~AT_FUNC_USE_F1_COND) \
|
||||
{ \
|
||||
errno = EINVAL; \
|
||||
return FUNC_FAIL; \
|
||||
}
|
||||
#else
|
||||
# define CALL_FUNC(F) (AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS))
|
||||
# define VALIDATE_FLAG(F) /* empty */
|
||||
#endif
|
||||
|
||||
#ifdef AT_FUNC_RESULT
|
||||
# define FUNC_RESULT AT_FUNC_RESULT
|
||||
#else
|
||||
# define FUNC_RESULT int
|
||||
#endif
|
||||
|
||||
#ifdef AT_FUNC_FAIL
|
||||
# define FUNC_FAIL AT_FUNC_FAIL
|
||||
#else
|
||||
# define FUNC_FAIL -1
|
||||
#endif
|
||||
|
||||
/* Call AT_FUNC_F1 to operate on FILE, which is in the directory
|
||||
open on descriptor FD. If AT_FUNC_USE_F1_COND is defined to a value,
|
||||
AT_FUNC_POST_FILE_PARAM_DECLS must include a parameter named flag;
|
||||
call AT_FUNC_F2 if FLAG is 0 or fail if FLAG contains more bits than
|
||||
AT_FUNC_USE_F1_COND. Return int and fail with -1 unless AT_FUNC_RESULT
|
||||
or AT_FUNC_FAIL are defined. If possible, do it without changing the
|
||||
working directory. Otherwise, resort to using save_cwd/fchdir,
|
||||
then AT_FUNC_F?/restore_cwd. If either the save_cwd or the restore_cwd
|
||||
fails, then give a diagnostic and exit nonzero. */
|
||||
FUNC_RESULT
|
||||
AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS)
|
||||
{
|
||||
VALIDATE_FLAG (flag);
|
||||
|
||||
if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
|
||||
return CALL_FUNC (file);
|
||||
|
||||
#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
|
||||
errno = ENOTSUP;
|
||||
return FUNC_FAIL;
|
||||
#else
|
||||
{
|
||||
/* Be careful to choose names unlikely to conflict with
|
||||
AT_FUNC_POST_FILE_PARAM_DECLS. */
|
||||
struct saved_cwd saved_cwd;
|
||||
int saved_errno;
|
||||
FUNC_RESULT err;
|
||||
|
||||
{
|
||||
char proc_buf[OPENAT_BUFFER_SIZE];
|
||||
char *proc_file = openat_proc_name (proc_buf, fd, file);
|
||||
if (proc_file)
|
||||
{
|
||||
FUNC_RESULT proc_result = CALL_FUNC (proc_file);
|
||||
int proc_errno = errno;
|
||||
if (proc_file != proc_buf)
|
||||
free (proc_file);
|
||||
/* If the syscall succeeds, or if it fails with an unexpected
|
||||
errno value, then return right away. Otherwise, fall through
|
||||
and resort to using save_cwd/restore_cwd. */
|
||||
if (FUNC_FAIL != proc_result)
|
||||
return proc_result;
|
||||
if (! EXPECTED_ERRNO (proc_errno))
|
||||
{
|
||||
errno = proc_errno;
|
||||
return proc_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (save_cwd (&saved_cwd) != 0)
|
||||
openat_save_fail (errno);
|
||||
if (0 <= fd && fd == saved_cwd.desc)
|
||||
{
|
||||
/* If saving the working directory collides with the user's
|
||||
requested fd, then the user's fd must have been closed to
|
||||
begin with. */
|
||||
free_cwd (&saved_cwd);
|
||||
errno = EBADF;
|
||||
return FUNC_FAIL;
|
||||
}
|
||||
|
||||
if (fchdir (fd) != 0)
|
||||
{
|
||||
saved_errno = errno;
|
||||
free_cwd (&saved_cwd);
|
||||
errno = saved_errno;
|
||||
return FUNC_FAIL;
|
||||
}
|
||||
|
||||
err = CALL_FUNC (file);
|
||||
saved_errno = (err == FUNC_FAIL ? errno : 0);
|
||||
|
||||
if (restore_cwd (&saved_cwd) != 0)
|
||||
openat_restore_fail (errno);
|
||||
|
||||
free_cwd (&saved_cwd);
|
||||
|
||||
if (saved_errno)
|
||||
errno = saved_errno;
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#undef CALL_FUNC
|
||||
#undef FUNC_RESULT
|
||||
#undef FUNC_FAIL
|
||||
221
lib/euidaccess.c
Normal file
221
lib/euidaccess.c
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
/* euidaccess -- check if effective user id can access file
|
||||
|
||||
Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2012 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it 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.
|
||||
|
||||
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 David MacKenzie and Torbjorn Granlund.
|
||||
Adapted for GNU C library by Roland McGrath. */
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "root-uid.h"
|
||||
|
||||
#if HAVE_LIBGEN_H
|
||||
# include <libgen.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef __set_errno
|
||||
# define __set_errno(val) errno = (val)
|
||||
#endif
|
||||
|
||||
#if defined EACCES && !defined EACCESS
|
||||
# define EACCESS EACCES
|
||||
#endif
|
||||
|
||||
#ifndef F_OK
|
||||
# define F_OK 0
|
||||
# define X_OK 1
|
||||
# define W_OK 2
|
||||
# define R_OK 4
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
|
||||
# define access __access
|
||||
# define getuid __getuid
|
||||
# define getgid __getgid
|
||||
# define geteuid __geteuid
|
||||
# define getegid __getegid
|
||||
# define group_member __group_member
|
||||
# define euidaccess __euidaccess
|
||||
# undef stat
|
||||
# define stat stat64
|
||||
|
||||
#endif
|
||||
|
||||
/* Return 0 if the user has permission of type MODE on FILE;
|
||||
otherwise, return -1 and set 'errno'.
|
||||
Like access, except that it uses the effective user and group
|
||||
id's instead of the real ones, and it does not always check for read-only
|
||||
file system, text busy, etc. */
|
||||
|
||||
int
|
||||
euidaccess (const char *file, int mode)
|
||||
{
|
||||
#if HAVE_FACCESSAT /* glibc, AIX 7, Solaris 11, Cygwin 1.7 */
|
||||
return faccessat (AT_FDCWD, file, mode, AT_EACCESS);
|
||||
#elif defined EFF_ONLY_OK /* IRIX, OSF/1, Interix */
|
||||
return access (file, mode | EFF_ONLY_OK);
|
||||
#elif defined ACC_SELF /* AIX */
|
||||
return accessx (file, mode, ACC_SELF);
|
||||
#elif HAVE_EACCESS /* FreeBSD */
|
||||
return eaccess (file, mode);
|
||||
#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */
|
||||
|
||||
uid_t uid = getuid ();
|
||||
gid_t gid = getgid ();
|
||||
uid_t euid = geteuid ();
|
||||
gid_t egid = getegid ();
|
||||
struct stat stats;
|
||||
|
||||
# if HAVE_DECL_SETREGID && PREFER_NONREENTRANT_EUIDACCESS
|
||||
|
||||
/* Define PREFER_NONREENTRANT_EUIDACCESS if you prefer euidaccess to
|
||||
return the correct result even if this would make it
|
||||
nonreentrant. Define this only if your entire application is
|
||||
safe even if the uid or gid might temporarily change. If your
|
||||
application uses signal handlers or threads it is probably not
|
||||
safe. */
|
||||
|
||||
if (mode == F_OK)
|
||||
return stat (file, &stats);
|
||||
else
|
||||
{
|
||||
int result;
|
||||
int saved_errno;
|
||||
|
||||
if (uid != euid)
|
||||
setreuid (euid, uid);
|
||||
if (gid != egid)
|
||||
setregid (egid, gid);
|
||||
|
||||
result = access (file, mode);
|
||||
saved_errno = errno;
|
||||
|
||||
/* Restore them. */
|
||||
if (uid != euid)
|
||||
setreuid (uid, euid);
|
||||
if (gid != egid)
|
||||
setregid (gid, egid);
|
||||
|
||||
errno = saved_errno;
|
||||
return result;
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
/* The following code assumes the traditional Unix model, and is not
|
||||
correct on systems that have ACLs or the like. However, it's
|
||||
better than nothing, and it is reentrant. */
|
||||
|
||||
unsigned int granted;
|
||||
if (uid == euid && gid == egid)
|
||||
/* If we are not set-uid or set-gid, access does the same. */
|
||||
return access (file, mode);
|
||||
|
||||
if (stat (file, &stats) != 0)
|
||||
return -1;
|
||||
|
||||
/* The super-user can read and write any file, and execute any file
|
||||
that anyone can execute. */
|
||||
if (euid == ROOT_UID
|
||||
&& ((mode & X_OK) == 0
|
||||
|| (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
|
||||
return 0;
|
||||
|
||||
/* Convert the mode to traditional form, clearing any bogus bits. */
|
||||
if (R_OK == 4 && W_OK == 2 && X_OK == 1 && F_OK == 0)
|
||||
mode &= 7;
|
||||
else
|
||||
mode = ((mode & R_OK ? 4 : 0)
|
||||
+ (mode & W_OK ? 2 : 0)
|
||||
+ (mode & X_OK ? 1 : 0));
|
||||
|
||||
if (mode == 0)
|
||||
return 0; /* The file exists. */
|
||||
|
||||
/* Convert the file's permission bits to traditional form. */
|
||||
if (S_IRUSR == (4 << 6) && S_IWUSR == (2 << 6) && S_IXUSR == (1 << 6)
|
||||
&& S_IRGRP == (4 << 3) && S_IWGRP == (2 << 3) && S_IXGRP == (1 << 3)
|
||||
&& S_IROTH == (4 << 0) && S_IWOTH == (2 << 0) && S_IXOTH == (1 << 0))
|
||||
granted = stats.st_mode;
|
||||
else
|
||||
granted = ((stats.st_mode & S_IRUSR ? 4 << 6 : 0)
|
||||
+ (stats.st_mode & S_IWUSR ? 2 << 6 : 0)
|
||||
+ (stats.st_mode & S_IXUSR ? 1 << 6 : 0)
|
||||
+ (stats.st_mode & S_IRGRP ? 4 << 3 : 0)
|
||||
+ (stats.st_mode & S_IWGRP ? 2 << 3 : 0)
|
||||
+ (stats.st_mode & S_IXGRP ? 1 << 3 : 0)
|
||||
+ (stats.st_mode & S_IROTH ? 4 << 0 : 0)
|
||||
+ (stats.st_mode & S_IWOTH ? 2 << 0 : 0)
|
||||
+ (stats.st_mode & S_IXOTH ? 1 << 0 : 0));
|
||||
|
||||
if (euid == stats.st_uid)
|
||||
granted >>= 6;
|
||||
else if (egid == stats.st_gid || group_member (stats.st_gid))
|
||||
granted >>= 3;
|
||||
|
||||
if ((mode & ~granted) == 0)
|
||||
return 0;
|
||||
__set_errno (EACCESS);
|
||||
return -1;
|
||||
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
#undef euidaccess
|
||||
#ifdef weak_alias
|
||||
weak_alias (__euidaccess, euidaccess)
|
||||
#endif
|
||||
|
||||
#ifdef TEST
|
||||
# include <error.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
char *program_name;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *file;
|
||||
int mode;
|
||||
int err;
|
||||
|
||||
program_name = argv[0];
|
||||
if (argc < 3)
|
||||
abort ();
|
||||
file = argv[1];
|
||||
mode = atoi (argv[2]);
|
||||
|
||||
err = euidaccess (file, mode);
|
||||
printf ("%d\n", err);
|
||||
if (err != 0)
|
||||
error (0, errno, "%s", file);
|
||||
exit (0);
|
||||
}
|
||||
#endif
|
||||
45
lib/faccessat.c
Normal file
45
lib/faccessat.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Check the access rights of a file relative to an open directory.
|
||||
Copyright (C) 2009-2012 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 of the License, 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 Eric Blake */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef HAVE_ACCESS
|
||||
/* Mingw lacks access, but it also lacks real vs. effective ids, so
|
||||
the gnulib euidaccess module is good enough. */
|
||||
# undef access
|
||||
# define access euidaccess
|
||||
#endif
|
||||
|
||||
/* Invoke access or euidaccess on file, FILE, using mode MODE, in the directory
|
||||
open on descriptor FD. If possible, do it without changing the
|
||||
working directory. Otherwise, resort to using save_cwd/fchdir, then
|
||||
(access|euidaccess)/restore_cwd. If either the save_cwd or the
|
||||
restore_cwd fails, then give a diagnostic and exit nonzero.
|
||||
Note that this implementation only supports AT_EACCESS, although some
|
||||
native versions also support AT_SYMLINK_NOFOLLOW. */
|
||||
|
||||
#define AT_FUNC_NAME faccessat
|
||||
#define AT_FUNC_F1 euidaccess
|
||||
#define AT_FUNC_F2 access
|
||||
#define AT_FUNC_USE_F1_COND AT_EACCESS
|
||||
#define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag
|
||||
#define AT_FUNC_POST_FILE_ARGS , mode
|
||||
#include "at-func.c"
|
||||
347
lib/fcntl.in.h
Normal file
347
lib/fcntl.in.h
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
/* Like <fcntl.h>, but with non-working flags defined to 0.
|
||||
|
||||
Copyright (C) 2006-2012 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 of the License, 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 Paul Eggert */
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#if defined __need_system_fcntl_h
|
||||
/* Special invocation convention. */
|
||||
|
||||
/* Needed before <sys/stat.h>.
|
||||
May also define off_t to a 64-bit type on native Windows. */
|
||||
#include <sys/types.h>
|
||||
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
|
||||
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
|
||||
But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
|
||||
extern "C" { ... } block, which leads to errors in C++ mode with the
|
||||
overridden <sys/stat.h> from gnulib. These errors are known to be gone
|
||||
with g++ version >= 4.3. */
|
||||
#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_FCNTL_H
|
||||
|
||||
/* Needed before <sys/stat.h>.
|
||||
May also define off_t to a 64-bit type on native Windows. */
|
||||
#include <sys/types.h>
|
||||
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
|
||||
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
|
||||
But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
|
||||
extern "C" { ... } block, which leads to errors in C++ mode with the
|
||||
overridden <sys/stat.h> from gnulib. These errors are known to be gone
|
||||
with g++ version >= 4.3. */
|
||||
#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_FCNTL_H
|
||||
#define _@GUARD_PREFIX@_FCNTL_H
|
||||
|
||||
#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Native Windows platforms declare open(), creat() in <io.h>. */
|
||||
#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
|
||||
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||
|
||||
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||
|
||||
|
||||
/* Declare overridden functions. */
|
||||
|
||||
#if @GNULIB_FCNTL@
|
||||
# if @REPLACE_FCNTL@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef fcntl
|
||||
# define fcntl rpl_fcntl
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
|
||||
_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
|
||||
# else
|
||||
# if !@HAVE_FCNTL@
|
||||
_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (fcntl);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fcntl
|
||||
# if HAVE_RAW_DECL_FCNTL
|
||||
_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
|
||||
"use gnulib module fcntl for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_OPEN@
|
||||
# if @REPLACE_OPEN@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef open
|
||||
# define open rpl_open
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
|
||||
# endif
|
||||
/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a
|
||||
default argument. _GL_CXXALIASWARN does not work in this case. */
|
||||
# if !defined __hpux
|
||||
_GL_CXXALIASWARN (open);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef open
|
||||
/* Assume open is always declared. */
|
||||
_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
|
||||
"use gnulib module open for portability");
|
||||
#endif
|
||||
|
||||
#if @GNULIB_OPENAT@
|
||||
# if @REPLACE_OPENAT@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef openat
|
||||
# define openat rpl_openat
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (openat, int,
|
||||
(int fd, char const *file, int flags, /* mode_t mode */ ...)
|
||||
_GL_ARG_NONNULL ((2)));
|
||||
_GL_CXXALIAS_RPL (openat, int,
|
||||
(int fd, char const *file, int flags, /* mode_t mode */ ...));
|
||||
# else
|
||||
# if !@HAVE_OPENAT@
|
||||
_GL_FUNCDECL_SYS (openat, int,
|
||||
(int fd, char const *file, int flags, /* mode_t mode */ ...)
|
||||
_GL_ARG_NONNULL ((2)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (openat, int,
|
||||
(int fd, char const *file, int flags, /* mode_t mode */ ...));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (openat);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef openat
|
||||
# if HAVE_RAW_DECL_OPENAT
|
||||
_GL_WARN_ON_USE (openat, "openat is not portable - "
|
||||
"use gnulib module openat for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Fix up the FD_* macros, only known to be missing on mingw. */
|
||||
|
||||
#ifndef FD_CLOEXEC
|
||||
# define FD_CLOEXEC 1
|
||||
#endif
|
||||
|
||||
/* Fix up the supported F_* macros. Intentionally leave other F_*
|
||||
macros undefined. Only known to be missing on mingw. */
|
||||
|
||||
#ifndef F_DUPFD_CLOEXEC
|
||||
# define F_DUPFD_CLOEXEC 0x40000000
|
||||
/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */
|
||||
# define GNULIB_defined_F_DUPFD_CLOEXEC 1
|
||||
#else
|
||||
# define GNULIB_defined_F_DUPFD_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#ifndef F_DUPFD
|
||||
# define F_DUPFD 1
|
||||
#endif
|
||||
|
||||
#ifndef F_GETFD
|
||||
# define F_GETFD 2
|
||||
#endif
|
||||
|
||||
/* Fix up the O_* macros. */
|
||||
|
||||
#if !defined O_DIRECT && defined O_DIRECTIO
|
||||
/* Tru64 spells it 'O_DIRECTIO'. */
|
||||
# define O_DIRECT O_DIRECTIO
|
||||
#endif
|
||||
|
||||
#if !defined O_CLOEXEC && defined O_NOINHERIT
|
||||
/* Mingw spells it 'O_NOINHERIT'. */
|
||||
# define O_CLOEXEC O_NOINHERIT
|
||||
#endif
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
# define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#ifndef O_DIRECT
|
||||
# define O_DIRECT 0
|
||||
#endif
|
||||
|
||||
#ifndef O_DIRECTORY
|
||||
# define O_DIRECTORY 0
|
||||
#endif
|
||||
|
||||
#ifndef O_DSYNC
|
||||
# define O_DSYNC 0
|
||||
#endif
|
||||
|
||||
#ifndef O_EXEC
|
||||
# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
|
||||
#endif
|
||||
|
||||
#ifndef O_IGNORE_CTTY
|
||||
# define O_IGNORE_CTTY 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NDELAY
|
||||
# define O_NDELAY 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NOATIME
|
||||
# define O_NOATIME 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NONBLOCK
|
||||
# define O_NONBLOCK O_NDELAY
|
||||
#endif
|
||||
|
||||
/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
|
||||
value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
|
||||
or to 0 as fallback. */
|
||||
#if @GNULIB_NONBLOCKING@
|
||||
# if O_NONBLOCK
|
||||
# define GNULIB_defined_O_NONBLOCK 0
|
||||
# else
|
||||
# define GNULIB_defined_O_NONBLOCK 1
|
||||
# undef O_NONBLOCK
|
||||
# define O_NONBLOCK 0x40000000
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef O_NOCTTY
|
||||
# define O_NOCTTY 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NOFOLLOW
|
||||
# define O_NOFOLLOW 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NOLINK
|
||||
# define O_NOLINK 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NOLINKS
|
||||
# define O_NOLINKS 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NOTRANS
|
||||
# define O_NOTRANS 0
|
||||
#endif
|
||||
|
||||
#ifndef O_RSYNC
|
||||
# define O_RSYNC 0
|
||||
#endif
|
||||
|
||||
#ifndef O_SEARCH
|
||||
# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
|
||||
#endif
|
||||
|
||||
#ifndef O_SYNC
|
||||
# define O_SYNC 0
|
||||
#endif
|
||||
|
||||
#ifndef O_TTY_INIT
|
||||
# define O_TTY_INIT 0
|
||||
#endif
|
||||
|
||||
#if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
|
||||
# undef O_ACCMODE
|
||||
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
|
||||
#endif
|
||||
|
||||
/* For systems that distinguish between text and binary I/O.
|
||||
O_BINARY is usually declared in fcntl.h */
|
||||
#if !defined O_BINARY && defined _O_BINARY
|
||||
/* For MSC-compatible compilers. */
|
||||
# define O_BINARY _O_BINARY
|
||||
# define O_TEXT _O_TEXT
|
||||
#endif
|
||||
|
||||
#if defined __BEOS__ || defined __HAIKU__
|
||||
/* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
|
||||
# undef O_BINARY
|
||||
# undef O_TEXT
|
||||
#endif
|
||||
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
# define O_TEXT 0
|
||||
#endif
|
||||
|
||||
/* Fix up the AT_* macros. */
|
||||
|
||||
/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
|
||||
value exceeds INT_MAX, so its use as an int doesn't conform to the
|
||||
C standard, and GCC and Sun C complain in some cases. If the bug
|
||||
is present, undef AT_FDCWD here, so it can be redefined below. */
|
||||
#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
|
||||
# undef AT_FDCWD
|
||||
#endif
|
||||
|
||||
/* Use the same bit pattern as Solaris 9, but with the proper
|
||||
signedness. The bit pattern is important, in case this actually is
|
||||
Solaris with the above workaround. */
|
||||
#ifndef AT_FDCWD
|
||||
# define AT_FDCWD (-3041965)
|
||||
#endif
|
||||
|
||||
/* Use the same values as Solaris 9. This shouldn't matter, but
|
||||
there's no real reason to differ. */
|
||||
#ifndef AT_SYMLINK_NOFOLLOW
|
||||
# define AT_SYMLINK_NOFOLLOW 4096
|
||||
#endif
|
||||
|
||||
#ifndef AT_REMOVEDIR
|
||||
# define AT_REMOVEDIR 1
|
||||
#endif
|
||||
|
||||
/* Solaris 9 lacks these two, so just pick unique values. */
|
||||
#ifndef AT_SYMLINK_FOLLOW
|
||||
# define AT_SYMLINK_FOLLOW 2
|
||||
#endif
|
||||
|
||||
#ifndef AT_EACCESS
|
||||
# define AT_EACCESS 4
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_FCNTL_H */
|
||||
#endif /* _@GUARD_PREFIX@_FCNTL_H */
|
||||
#endif
|
||||
116
lib/getgroups.c
Normal file
116
lib/getgroups.c
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/* provide consistent interface to getgroups for systems that don't allow N==0
|
||||
|
||||
Copyright (C) 1996, 1999, 2003, 2006-2012 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 of the License, 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 */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if !HAVE_GETGROUPS
|
||||
|
||||
/* Provide a stub that fails with ENOSYS, since there is no group
|
||||
information available on mingw. */
|
||||
int
|
||||
getgroups (int n _GL_UNUSED, GETGROUPS_T *groups _GL_UNUSED)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else /* HAVE_GETGROUPS */
|
||||
|
||||
# undef getgroups
|
||||
# ifndef GETGROUPS_ZERO_BUG
|
||||
# define GETGROUPS_ZERO_BUG 0
|
||||
# endif
|
||||
|
||||
/* On at least Ultrix 4.3 and NextStep 3.2, getgroups (0, NULL) always
|
||||
fails. On other systems, it returns the number of supplemental
|
||||
groups for the process. This function handles that special case
|
||||
and lets the system-provided function handle all others. However,
|
||||
it can fail with ENOMEM if memory is tight. It is unspecified
|
||||
whether the effective group id is included in the list. */
|
||||
|
||||
int
|
||||
rpl_getgroups (int n, gid_t *group)
|
||||
{
|
||||
int n_groups;
|
||||
GETGROUPS_T *gbuf;
|
||||
int saved_errno;
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (n != 0 || !GETGROUPS_ZERO_BUG)
|
||||
{
|
||||
int result;
|
||||
if (sizeof *group == sizeof *gbuf)
|
||||
return getgroups (n, (GETGROUPS_T *) group);
|
||||
|
||||
if (SIZE_MAX / sizeof *gbuf <= n)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
gbuf = malloc (n * sizeof *gbuf);
|
||||
if (!gbuf)
|
||||
return -1;
|
||||
result = getgroups (n, gbuf);
|
||||
if (0 <= result)
|
||||
{
|
||||
n = result;
|
||||
while (n--)
|
||||
group[n] = gbuf[n];
|
||||
}
|
||||
saved_errno = errno;
|
||||
free (gbuf);
|
||||
errno == saved_errno;
|
||||
return result;
|
||||
}
|
||||
|
||||
n = 20;
|
||||
while (1)
|
||||
{
|
||||
/* No need to worry about address arithmetic overflow here,
|
||||
since the ancient systems that we're running on have low
|
||||
limits on the number of secondary groups. */
|
||||
gbuf = malloc (n * sizeof *gbuf);
|
||||
if (!gbuf)
|
||||
return -1;
|
||||
n_groups = getgroups (n, gbuf);
|
||||
if (n_groups == -1 ? errno != EINVAL : n_groups < n)
|
||||
break;
|
||||
free (gbuf);
|
||||
n *= 2;
|
||||
}
|
||||
|
||||
saved_errno = errno;
|
||||
free (gbuf);
|
||||
errno = saved_errno;
|
||||
|
||||
return n_groups;
|
||||
}
|
||||
|
||||
#endif /* HAVE_GETGROUPS */
|
||||
|
|
@ -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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --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 c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub 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=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --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 c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
|
||||
|
||||
|
||||
MOSTLYCLEANFILES += core *.stackdump
|
||||
|
|
@ -158,6 +158,17 @@ EXTRA_libgnu_a_SOURCES += dup2.c
|
|||
|
||||
## end gnulib module dup2
|
||||
|
||||
## begin gnulib module euidaccess
|
||||
|
||||
if gl_GNULIB_ENABLED_euidaccess
|
||||
|
||||
endif
|
||||
EXTRA_DIST += euidaccess.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += euidaccess.c
|
||||
|
||||
## end gnulib module euidaccess
|
||||
|
||||
## begin gnulib module execinfo
|
||||
|
||||
BUILT_SOURCES += $(EXECINFO_H)
|
||||
|
|
@ -183,6 +194,50 @@ EXTRA_libgnu_a_SOURCES += execinfo.c
|
|||
|
||||
## end gnulib module execinfo
|
||||
|
||||
## begin gnulib module faccessat
|
||||
|
||||
|
||||
EXTRA_DIST += at-func.c faccessat.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += at-func.c faccessat.c
|
||||
|
||||
## end gnulib module faccessat
|
||||
|
||||
## begin gnulib module fcntl-h
|
||||
|
||||
BUILT_SOURCES += fcntl.h
|
||||
|
||||
# We need the following in order to create <fcntl.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
|
||||
-e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \
|
||||
-e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \
|
||||
-e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \
|
||||
-e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \
|
||||
-e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
|
||||
-e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
|
||||
-e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
|
||||
-e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
|
||||
-e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/fcntl.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += fcntl.h fcntl.h-t
|
||||
|
||||
EXTRA_DIST += fcntl.in.h
|
||||
|
||||
## end gnulib module fcntl-h
|
||||
|
||||
## begin gnulib module filemode
|
||||
|
||||
libgnu_a_SOURCES += filemode.c
|
||||
|
|
@ -200,6 +255,17 @@ EXTRA_libgnu_a_SOURCES += fpending.c
|
|||
|
||||
## end gnulib module fpending
|
||||
|
||||
## begin gnulib module getgroups
|
||||
|
||||
if gl_GNULIB_ENABLED_getgroups
|
||||
|
||||
endif
|
||||
EXTRA_DIST += getgroups.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += getgroups.c
|
||||
|
||||
## end gnulib module getgroups
|
||||
|
||||
## begin gnulib module getloadavg
|
||||
|
||||
|
||||
|
|
@ -259,6 +325,17 @@ EXTRA_libgnu_a_SOURCES += gettimeofday.c
|
|||
|
||||
## end gnulib module gettimeofday
|
||||
|
||||
## begin gnulib module group-member
|
||||
|
||||
if gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1
|
||||
|
||||
endif
|
||||
EXTRA_DIST += group-member.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += group-member.c
|
||||
|
||||
## end gnulib module group-member
|
||||
|
||||
## begin gnulib module ignore-value
|
||||
|
||||
|
||||
|
|
@ -371,6 +448,15 @@ EXTRA_libgnu_a_SOURCES += readlink.c
|
|||
|
||||
## end gnulib module readlink
|
||||
|
||||
## begin gnulib module root-uid
|
||||
|
||||
if gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c
|
||||
|
||||
endif
|
||||
EXTRA_DIST += root-uid.h
|
||||
|
||||
## end gnulib module root-uid
|
||||
|
||||
## begin gnulib module signal-h
|
||||
|
||||
BUILT_SOURCES += signal.h
|
||||
|
|
@ -1329,6 +1415,15 @@ EXTRA_DIST += verify.h
|
|||
|
||||
## end gnulib module verify
|
||||
|
||||
## begin gnulib module xalloc-oversized
|
||||
|
||||
if gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec
|
||||
|
||||
endif
|
||||
EXTRA_DIST += xalloc-oversized.h
|
||||
|
||||
## end gnulib module xalloc-oversized
|
||||
|
||||
|
||||
mostlyclean-local: mostlyclean-generic
|
||||
@for dir in '' $(MOSTLYCLEANDIRS); do \
|
||||
|
|
|
|||
119
lib/group-member.c
Normal file
119
lib/group-member.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/* group-member.c -- determine whether group id is in calling user's group list
|
||||
|
||||
Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2012 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 of the License, 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/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xalloc-oversized.h"
|
||||
|
||||
/* Most processes have no more than this many groups, and for these
|
||||
processes we can avoid using malloc. */
|
||||
enum { GROUPBUF_SIZE = 100 };
|
||||
|
||||
struct group_info
|
||||
{
|
||||
gid_t *group;
|
||||
gid_t groupbuf[GROUPBUF_SIZE];
|
||||
};
|
||||
|
||||
static void
|
||||
free_group_info (struct group_info const *g)
|
||||
{
|
||||
if (g->group != g->groupbuf)
|
||||
free (g->group);
|
||||
}
|
||||
|
||||
static int
|
||||
get_group_info (struct group_info *gi)
|
||||
{
|
||||
int n_groups = getgroups (GROUPBUF_SIZE, gi->groupbuf);
|
||||
gi->group = gi->groupbuf;
|
||||
|
||||
if (n_groups < 0)
|
||||
{
|
||||
int n_group_slots = getgroups (0, NULL);
|
||||
if (0 <= n_group_slots
|
||||
&& ! xalloc_oversized (n_group_slots, sizeof *gi->group))
|
||||
{
|
||||
gi->group = malloc (n_group_slots * sizeof *gi->group);
|
||||
if (gi->group)
|
||||
n_groups = getgroups (n_group_slots, gi->group);
|
||||
}
|
||||
}
|
||||
|
||||
/* In case of error, the user loses. */
|
||||
return n_groups;
|
||||
}
|
||||
|
||||
/* Return non-zero if GID is one that we have in our groups list.
|
||||
Note that the groups list is not guaranteed to contain the current
|
||||
or effective group ID, so they should generally be checked
|
||||
separately. */
|
||||
|
||||
int
|
||||
group_member (gid_t gid)
|
||||
{
|
||||
int i;
|
||||
int found;
|
||||
struct group_info gi;
|
||||
int n_groups = get_group_info (&gi);
|
||||
|
||||
/* Search through the list looking for GID. */
|
||||
found = 0;
|
||||
for (i = 0; i < n_groups; i++)
|
||||
{
|
||||
if (gid == gi.group[i])
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free_group_info (&gi);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
char *program_name;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
program_name = argv[0];
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
gid_t gid;
|
||||
|
||||
gid = atoi (argv[i]);
|
||||
printf ("%d: %s\n", gid, group_member (gid) ? "yes" : "no");
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
30
lib/root-uid.h
Normal file
30
lib/root-uid.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* The user ID that always has appropriate privileges in the POSIX sense.
|
||||
|
||||
Copyright 2012 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 of the License, 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 Paul Eggert. */
|
||||
|
||||
#ifndef ROOT_UID_H_
|
||||
#define ROOT_UID_H_
|
||||
|
||||
/* The user ID that always has appropriate privileges in the POSIX sense. */
|
||||
#ifdef __TANDEM
|
||||
# define ROOT_UID 65535
|
||||
#else
|
||||
# define ROOT_UID 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
38
lib/xalloc-oversized.h
Normal file
38
lib/xalloc-oversized.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* xalloc-oversized.h -- memory allocation size checking
|
||||
|
||||
Copyright (C) 1990-2000, 2003-2004, 2006-2012 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef XALLOC_OVERSIZED_H_
|
||||
# define XALLOC_OVERSIZED_H_
|
||||
|
||||
# include <stddef.h>
|
||||
|
||||
/* Return 1 if an array of N objects, each of size S, cannot exist due
|
||||
to size arithmetic overflow. S must be positive and N must be
|
||||
nonnegative. This is a macro, not a function, so that it
|
||||
works correctly even when SIZE_MAX < N.
|
||||
|
||||
By gnulib convention, SIZE_MAX represents overflow in size
|
||||
calculations, so the conservative dividend to use here is
|
||||
SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
|
||||
However, malloc (SIZE_MAX) fails on all known hosts where
|
||||
sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
|
||||
exactly-SIZE_MAX allocations on such hosts; this avoids a test and
|
||||
branch when S is known to be 1. */
|
||||
# define xalloc_oversized(n, s) \
|
||||
((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
|
||||
|
||||
#endif /* !XALLOC_OVERSIZED_H_ */
|
||||
319
lisp/ChangeLog
319
lisp/ChangeLog
|
|
@ -1,3 +1,322 @@
|
|||
2012-11-18 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* filecache.el (file-cache--read-list): New function.
|
||||
(file-cache-add-directory-list, file-cache-add-file-list)
|
||||
(file-cache-delete-file-list, file-cache-delete-directory-list):
|
||||
Use it to read a list of files or directories (Bug#12846).
|
||||
(file-cache-add-file, file-cache-add-directory)
|
||||
(file-cache-delete-file-list, file-cache-delete-file-regexp)
|
||||
(file-cache-delete-directory): Print an message.
|
||||
|
||||
2012-11-18 Jay Belanger <jay.p.belanger@gmail.com>
|
||||
|
||||
* calc/calc-forms.el (math-date-to-dt): Use integer date when
|
||||
calling `math-date-to-julian-dt' and 'math-date-to-gregorian-dt'.
|
||||
|
||||
2012-11-18 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* image.el (insert-image, insert-sliced-image): Doc fix.
|
||||
|
||||
2012-11-18 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* emacs-lisp/syntax.el (syntax-propertize-function): Doc fix
|
||||
(Bug#12810).
|
||||
|
||||
2012-11-18 OKAZAKI Tetsurou <okazaki.tetsurou@gmail.com> (tiny change)
|
||||
|
||||
* vc/vc-svn.el (vc-svn-merge-news): Properly parse the merge
|
||||
response when the target file is in a subdirectory (Bug#12757).
|
||||
|
||||
2012-11-18 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* filecache.el (file-cache-add-file-list): Doc fix (Bug#12694).
|
||||
|
||||
2012-11-18 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* emacs-lisp/cl-lib.el (face-underline-p):
|
||||
Use set-face-underline rather than the alias set-face-underline-p.
|
||||
|
||||
* window.el (with-temp-buffer-window): Doc fix.
|
||||
* subr.el (with-output-to-temp-buffer):
|
||||
Add doc xref to with-temp-buffer-window.
|
||||
|
||||
2012-11-18 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* woman.el (woman-non-underline-faces): Use `set-face-underline'.
|
||||
* calc/calc.el (math-format-date-cache): Declare.
|
||||
|
||||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* calc/calc-forms.el (math-julian-date-beginning)
|
||||
(math-julian-date-beginning-int): Implement [new date numbering].
|
||||
|
||||
2012-11-17 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* descr-text.el (quail-find-key):
|
||||
* dired.el (desktop-file-name):
|
||||
* dirtrack.el (shell-prefixed-directory-name, shell-process-cd):
|
||||
* generic-x.el (comint-mode, comint-exec):
|
||||
* image-dired.el (widget-forward):
|
||||
* info.el (speedbar-add-expansion-list, speedbar-center-buffer-smartly)
|
||||
(speedbar-change-expand-button-char)
|
||||
(speedbar-change-initial-expansion-list, speedbar-delete-subblock)
|
||||
(speedbar-make-specialized-keymap, speedbar-make-tag-line):
|
||||
* printing.el (easy-menu-add-item, easy-menu-remove-item)
|
||||
(widget-field-action, widget-value-set):
|
||||
* speedbar.el (imenu--make-index-alist):
|
||||
* term.el (ring-empty-p, ring-ref, ring-insert-at-beginning)
|
||||
(ring-length, ring-insert):
|
||||
* vcursor.el (compare-windows-skip-whitespace):
|
||||
* woman.el (dired-get-filename):
|
||||
Declare functions.
|
||||
|
||||
* term/w32-win.el (cygwin-convert-path-from-windows): Fix declaration.
|
||||
|
||||
2012-11-17 Jay Belanger <jay.p.belanger@gmail.com>
|
||||
|
||||
* calc/calc.el (calc-gregorian-switch): New variable.
|
||||
|
||||
* calc/calc-forms.el (math-day-in-year, math-dt-before-p)
|
||||
(math-absolute-from-gregorian-dt, math-absolute-from-julian-dt)
|
||||
(math-date-to-julian-dt, math-date-to-gregorian-dt): New functions.
|
||||
(math-leap-year-p): Add option to distinguish between Julian
|
||||
and Gregorian calendars.
|
||||
(math-day-number): Use `math-day-in-year' to do the computations.
|
||||
(math-absolute-from-dt): Rename from `math-absolute-from-date'.
|
||||
Use `math-absolute-from-gregorian' and `math-absolute-from-julian'
|
||||
to do the computations.
|
||||
(math-date-to-dt): Use `math-date-to-julian-dt' and
|
||||
`math-date-to-gregorian-dt' to do the computations.
|
||||
(calcFunc-weekday, math-format-date-part): Use the new version of
|
||||
the DATE to determine the weekday.
|
||||
(calcFunc-newmonth, calcFunc-newyear): Use `calc-gregorian-switch'
|
||||
when necessary.
|
||||
|
||||
2012-11-17 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* term/w32-win.el (w32-handle-dropped-file): Use 'file://' only on
|
||||
Cygwin; otherwise use 'file:'. (Bug#12914)
|
||||
(cygwin-convert-path-from-windows): Declare, to avoid
|
||||
byte-compiler warnings.
|
||||
|
||||
2012-11-17 Andreas Politz <politza@fh-trier.de>
|
||||
|
||||
* ibuffer.el (ibuffer-mark-forward, ibuffer-unmark-forward)
|
||||
(ibuffer-unmark-backward, ibuffer-mark-interactive): Support plain
|
||||
prefix and negative numeric prefix args (Bug#12795).
|
||||
|
||||
2012-11-17 Stephen Berman <stephen.berman@gmx.net>
|
||||
|
||||
* play/gamegrid.el (gamegrid-add-score-with-update-game-score-1):
|
||||
Don't signal an error with a score that is too low to add to the
|
||||
list of top scores. (Bug#12779)
|
||||
|
||||
2012-11-17 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* help-mode.el (help-xref-interned): End on point-min (Bug#12737).
|
||||
|
||||
* filecache.el (file-cache-add-file): Handle relative file name in
|
||||
the argument (Bug#12694).
|
||||
|
||||
2012-11-16 Jürgen Hötzel <juergen@archlinux.org> (tiny change)
|
||||
|
||||
* eshell/em-unix.el (eshell/mkdir): Handle "--parents" (bug#12897).
|
||||
|
||||
2012-11-16 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/advice.el (ad-make-advised-definition): Improve last fix.
|
||||
|
||||
* emacs-lisp/cl-lib.el: Set more meaningful version number.
|
||||
|
||||
2012-11-16 Martin Rudalics <rudalics@gmx.at>
|
||||
|
||||
* window.el (enlarge-window, shrink-window): Don't mention return
|
||||
value in doc-string (Bug#12896).
|
||||
(window--display-buffer): Don't resize frames - it won't work
|
||||
with all window managers and defeat pop-up-frame-alist.
|
||||
(display-buffer-alist): In doc-string explain that CONDITION can
|
||||
be a function and which arguments are passed to it (Bug#12854).
|
||||
(display-buffer-assq-regexp): New argument ACTION. Handle lambda
|
||||
expressions (Bug#12854).
|
||||
(display-buffer): Pass ACTION argument to
|
||||
display-buffer-assq-regexp.
|
||||
|
||||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* window.el (fit-frame-to-buffer-bottom-margin)
|
||||
(fit-frame-to-buffer, fit-window-to-buffer): Doc fixes.
|
||||
|
||||
* faces.el (face-underline-p): Use face-attribute-specified-or.
|
||||
|
||||
2012-11-16 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* emacs-lisp/cl-macs.el (cl-loop, cl-do, cl-do*): Doc fixes.
|
||||
|
||||
2012-11-16 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/cl-macs.el (cl-flet, cl-flet*): Fix docstring (bug#12895).
|
||||
|
||||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* eshell/em-cmpl.el (eshell-pcomplete): New command. (Bug#12838)
|
||||
(eshell-cmpl-initialize): Bind eshell-pcomplete to TAB, C-i.
|
||||
|
||||
* faces.el (face-underline-p): Doc fix. Handle :underline being
|
||||
things other than `t' (a string, a list).
|
||||
(face-inverse-video-p): Doc fix.
|
||||
(set-face-underline): Rename it back from set-face-underline-p.
|
||||
Doc fix. Allow interactive input of values other than t.
|
||||
(read-face-attribute): Apply formatting to :underline,
|
||||
since like :box and :stipple it can take list values.
|
||||
|
||||
* term.el (ansi-term): Don't let C-x escape-char binding
|
||||
clobber the more standard C-c binding. (Bug#12842)
|
||||
|
||||
* subr.el (set-temporary-overlay-map): Doc fix.
|
||||
|
||||
2012-11-16 Martin Rudalics <rudalics@gmx.at>
|
||||
|
||||
* window.el (record-window-buffer)
|
||||
(display-buffer-record-window): When copying the markers to
|
||||
window-point preserve window-point-insertion-type. (Bug#12588)
|
||||
|
||||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* emacs-lisp/eieio-datadebug.el (eieio-debug-methodinvoke):
|
||||
* net/tramp-gvfs.el (tramp-gvfs-dbus-event-error):
|
||||
Use new names for hooks rather than obsolete aliases.
|
||||
|
||||
2012-11-15 Daniel Colascione <dancol@dancol.org>
|
||||
|
||||
* term/w32-win.el (w32-handle-dropped-file): Use a "file://"
|
||||
prefix instead of "file:" so that when FILE-NAME begins with "//",
|
||||
as it does when the target file is on a network share, url-handler
|
||||
isn't confused.
|
||||
|
||||
2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/advice.el (ad-definition-type): Make sure we don't use
|
||||
a preactivated advice from an old advice.el; they're not compatible!
|
||||
|
||||
2012-11-15 Katsumi Yamaoka <yamaoka@jpl.org>
|
||||
|
||||
* emacs-lisp/nadvice.el (advice--make-interactive-form):
|
||||
Fix string-spec case.
|
||||
|
||||
* emacs-lisp/advice.el (ad-make-advised-definition): Fix undefined case.
|
||||
|
||||
2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/nadvice.el: Add buffer-local support to add-function.
|
||||
(advice--buffer-local-function-sample): New var.
|
||||
(advice--set-buffer-local, advice--buffer-local): New functions.
|
||||
(add-function, remove-function): Use them.
|
||||
|
||||
2012-11-15 Drew Adams <drew.adams@oracle.com>
|
||||
|
||||
* imenu.el (imenu--split-submenus): Use imenu--subalist-p (bug#12717).
|
||||
|
||||
2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/cl-macs.el (cl--transform-lambda): Defend against
|
||||
potential binding of print-gensym to t, and prettify (back)quotes in
|
||||
case they appear in args's default values (bug#12884).
|
||||
|
||||
2012-11-14 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/nadvice.el: Add around advice for interactive specs.
|
||||
(advice-eval-interactive-spec): New function.
|
||||
(advice--make-interactive-form): Support around advice (bug#12844).
|
||||
|
||||
2012-11-14 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* progmodes/ruby-mode.el (ruby-expr-beg): Make heredoc detection
|
||||
more strict. Add docstring.
|
||||
(ruby-expression-expansion-re): Extract from
|
||||
`ruby-match-expression-expansion'.
|
||||
(ruby-syntax-propertize-function): After everything else, search
|
||||
for expansions in string literals, mark their insides as
|
||||
whitespace syntax and save match data for font-lock.
|
||||
(ruby-font-lock-keywords): Use the 2nd group from expression
|
||||
expansion matches.
|
||||
(ruby-match-expression-expansion): Use the match data saved to the
|
||||
text property in ruby-syntax-propertize-function.
|
||||
|
||||
2012-11-14 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/gv.el (setf): Fix debug spec for multiple assignments
|
||||
(bug#12879).
|
||||
|
||||
2012-11-13 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* progmodes/ruby-mode.el (ruby-move-to-block): Looks for a block
|
||||
start/end keyword a bit harder. Works with different values of N.
|
||||
Add more comments.
|
||||
(ruby-end-of-block): Update accordingly.
|
||||
|
||||
2012-11-13 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* woman.el (woman-file-name): Don't mess with unread-command-events
|
||||
(bug#12861).
|
||||
|
||||
* emacs-lisp/advice.el: Layer on top of nadvice.el.
|
||||
Remove out of date self-require hack.
|
||||
(ad-do-advised-functions): Use simple `dolist'.
|
||||
(ad-advice-name, ad-advice-protected, ad-advice-enabled)
|
||||
(ad-advice-definition): Redefine as functions.
|
||||
(ad-advice-classes): Move before first use.
|
||||
(ad-make-origname, ad-set-orig-definition, ad-clear-orig-definition)
|
||||
(ad-make-mapped-call, ad-make-advised-docstring,ad-make-plain-docstring)
|
||||
(ad--defalias-fset): Remove functions.
|
||||
(ad-make-advicefunname, ad-clear-advicefunname-definition): New funs.
|
||||
(ad-get-orig-definition): Rewrite.
|
||||
(ad-make-advised-definition-docstring): Change base docstring.
|
||||
(ad-real-orig-definition): Rewrite.
|
||||
(ad-map-arglists): Change name of called function.
|
||||
(ad--make-advised-docstring): Redirect `function' from ad-Advice-...
|
||||
(ad-make-advised-definition): Simplify.
|
||||
(ad-assemble-advised-definition): Tweak for new calling context.
|
||||
(ad-activate-advised-definition): Setup ad-Advice-* i.s.o ad-Orig-*.
|
||||
(ad--defalias-fset): Rename from ad-handle-definition. Make it set the
|
||||
function and call ad-activate if needed.
|
||||
(ad-activate, ad-deactivate): Don't call ad-handle-definition any more.
|
||||
(ad-recover): Clear ad-Advice-* instead of ad-Orig-*.
|
||||
(ad-compile-function): Compile ad-Advice-*.
|
||||
(ad-activate-on-top-level, ad-with-auto-activation-disabled): Remove.
|
||||
(ad-start-advice, ad-stop-advice): Remove.
|
||||
|
||||
2012-11-13 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* progmodes/ruby-mode.el (ruby-add-log-current-method): Print the
|
||||
period before class method names, not after. Remove handling of
|
||||
one impossible case. Add comments.
|
||||
|
||||
2012-11-13 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/advice.el: Remove support for freezing.
|
||||
(ad-make-freeze-docstring, ad-make-freeze-definition): Remove functions.
|
||||
(ad-make-single-advice-docstring, ad-defadvice-flags, defadvice):
|
||||
Remove support for `freeze'.
|
||||
|
||||
* emacs-lisp/cl.el (dolist, dotimes, declare): Use advice-add to
|
||||
override the default.
|
||||
* emacs-lisp/cl-macs.el (cl-dolist, cl-dotimes): Rewrite without using
|
||||
cl--dotimes/dolist.
|
||||
* subr.el (dolist, dotimes, declare): Redefine them normally, even when
|
||||
`cl' is loaded.
|
||||
|
||||
* emacs-lisp/nadvice.el (advice--normalize): New function, extracted
|
||||
from add-advice.
|
||||
(advice--strip-macro): New function.
|
||||
(advice--defalias-fset): Use them to handle macros.
|
||||
(advice-add): Use them.
|
||||
(advice-member-p): Correctly handle macros.
|
||||
|
||||
2012-11-13 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* progmodes/ruby-mode.el (ruby-font-lock-keywords):
|
||||
Never font-lock the beginning of singleton class as heredoc.
|
||||
|
||||
2012-11-13 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/gv.el (gv-define-simple-setter): One more fix (bug#12871).
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
;;
|
||||
;; archive-mode-hook
|
||||
;; archive-foo-mode-hook
|
||||
;; archive-extract-hooks
|
||||
;; archive-extract-hook
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
|
|
|||
|
|
@ -369,17 +369,67 @@
|
|||
|
||||
;;; Some of these functions are adapted from Edward Reingold's "calendar.el".
|
||||
;;; These versions are rewritten to use arbitrary-size integers.
|
||||
;;; The Julian calendar is used up to 9/2/1752, after which the Gregorian
|
||||
;;; calendar is used; the first day after 9/2/1752 is 9/14/1752.
|
||||
|
||||
;;; A numerical date is the number of days since midnight on
|
||||
;;; the morning of January 1, 1 A.D. If the date is a non-integer,
|
||||
;;; it represents a specific date and time.
|
||||
;;; the morning of December 31, 1 B.C. Emacs's calendar refers to such
|
||||
;;; a date as an absolute date, some function names also use that
|
||||
;;; terminology. If the date is a non-integer, it represents a specific date and time.
|
||||
;;; A "dt" is a list of the form, (year month day), corresponding to
|
||||
;;; an integer code, or (year month day hour minute second), corresponding
|
||||
;;; to a non-integer code.
|
||||
|
||||
(defun math-date-to-gregorian-dt (date)
|
||||
"Return the day (YEAR MONTH DAY) in the Gregorian calendar.
|
||||
DATE is the number of days since December 31, -1 in the Gregorian calendar."
|
||||
(let* ((month 1)
|
||||
day
|
||||
(year (math-quotient (math-add date (if (Math-lessp date 711859)
|
||||
365 ; for speed, we take
|
||||
-108)) ; >1950 as a special case
|
||||
(if (math-negp date) 366 365)))
|
||||
; this result may be an overestimate
|
||||
temp)
|
||||
(while (Math-lessp date (setq temp (math-absolute-from-gregorian-dt year 1 1)))
|
||||
(setq year (math-add year -1)))
|
||||
(if (eq year 0) (setq year -1))
|
||||
(setq date (1+ (math-sub date temp)))
|
||||
(setq temp
|
||||
(if (math-leap-year-p year)
|
||||
[1 32 61 92 122 153 183 214 245 275 306 336 999]
|
||||
[1 32 60 91 121 152 182 213 244 274 305 335 999]))
|
||||
(while (>= date (aref temp month))
|
||||
(setq month (1+ month)))
|
||||
(setq day (1+ (- date (aref temp (1- month)))))
|
||||
(list year month day)))
|
||||
|
||||
(defun math-date-to-julian-dt (date)
|
||||
"Return the day (YEAR MONTH DAY) in the Julian calendar.
|
||||
DATE is the number of days since December 31, -1 in the Gregorian calendar."
|
||||
(let* ((month 1)
|
||||
day
|
||||
(year (math-quotient (math-add date (if (Math-lessp date 711859)
|
||||
365 ; for speed, we take
|
||||
-108)) ; >1950 as a special case
|
||||
(if (math-negp date) 366 365)))
|
||||
; this result may be an overestimate
|
||||
temp)
|
||||
(while (Math-lessp date (setq temp (math-absolute-from-julian-dt year 1 1)))
|
||||
(setq year (math-add year -1)))
|
||||
(if (eq year 0) (setq year -1))
|
||||
(setq date (1+ (math-sub date temp)))
|
||||
(setq temp
|
||||
(if (math-leap-year-p year t)
|
||||
[1 32 61 92 122 153 183 214 245 275 306 336 999]
|
||||
[1 32 60 91 121 152 182 213 244 274 305 335 999]))
|
||||
(while (>= date (aref temp month))
|
||||
(setq month (1+ month)))
|
||||
(setq day (1+ (- date (aref temp (1- month)))))
|
||||
(list year month day)))
|
||||
|
||||
(defun math-date-to-dt (value)
|
||||
"Return the day and time of VALUE.
|
||||
The integer part of VALUE is the number of days since Dec 31, -1
|
||||
in the Gregorian calendar and the remaining part determines the time."
|
||||
(if (eq (car-safe value) 'date)
|
||||
(setq value (nth 1 value)))
|
||||
(or (math-realp value)
|
||||
|
|
@ -387,32 +437,21 @@
|
|||
(let* ((parts (math-date-parts value))
|
||||
(date (car parts))
|
||||
(time (nth 1 parts))
|
||||
(month 1)
|
||||
day
|
||||
(year (math-quotient (math-add date (if (Math-lessp date 711859)
|
||||
365 ; for speed, we take
|
||||
-108)) ; >1950 as a special case
|
||||
(if (math-negp value) 366 365)))
|
||||
; this result may be an overestimate
|
||||
temp)
|
||||
(while (Math-lessp date (setq temp (math-absolute-from-date year 1 1)))
|
||||
(setq year (math-add year -1)))
|
||||
(if (eq year 0) (setq year -1))
|
||||
(setq date (1+ (math-sub date temp)))
|
||||
(and (eq year 1752) (>= date 247)
|
||||
(setq date (+ date 11)))
|
||||
(setq temp (if (math-leap-year-p year)
|
||||
[1 32 61 92 122 153 183 214 245 275 306 336 999]
|
||||
[1 32 60 91 121 152 182 213 244 274 305 335 999]))
|
||||
(while (>= date (aref temp month))
|
||||
(setq month (1+ month)))
|
||||
(setq day (1+ (- date (aref temp (1- month)))))
|
||||
(dt (if (and calc-gregorian-switch
|
||||
(Math-lessp value
|
||||
(or
|
||||
(nth 3 calc-gregorian-switch)
|
||||
(apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))
|
||||
))
|
||||
(math-date-to-julian-dt date)
|
||||
(math-date-to-gregorian-dt date))))
|
||||
(if (math-integerp value)
|
||||
(list year month day)
|
||||
(list year month day
|
||||
(/ time 3600)
|
||||
(% (/ time 60) 60)
|
||||
(math-add (% time 60) (nth 2 parts))))))
|
||||
dt
|
||||
(append dt
|
||||
(list
|
||||
(/ time 3600)
|
||||
(% (/ time 60) 60)
|
||||
(math-add (% time 60) (nth 2 parts)))))))
|
||||
|
||||
(defun math-dt-to-date (dt)
|
||||
(or (integerp (nth 1 dt))
|
||||
|
|
@ -423,7 +462,7 @@
|
|||
(math-reject-arg (nth 2 dt) 'fixnump))
|
||||
(if (or (< (nth 2 dt) 1) (> (nth 2 dt) 31))
|
||||
(math-reject-arg (nth 2 dt) "Day value is out of range"))
|
||||
(let ((date (math-absolute-from-date (car dt) (nth 1 dt) (nth 2 dt))))
|
||||
(let ((date (math-absolute-from-dt (car dt) (nth 1 dt) (nth 2 dt))))
|
||||
(if (nth 3 dt)
|
||||
(math-add (math-float date)
|
||||
(math-div (math-add (+ (* (nth 3 dt) 3600)
|
||||
|
|
@ -446,8 +485,12 @@
|
|||
(defun math-this-year ()
|
||||
(nth 5 (decode-time)))
|
||||
|
||||
(defun math-leap-year-p (year)
|
||||
(if (Math-lessp year 1752)
|
||||
(defun math-leap-year-p (year &optional julian)
|
||||
"Non-nil if YEAR is a leap year.
|
||||
If JULIAN is non-nil, then use the criterion for leap years
|
||||
in the Julian calendar, otherwise use the criterion in the
|
||||
Gregorian calendar."
|
||||
(if julian
|
||||
(if (math-negp year)
|
||||
(= (math-imod (math-neg year) 4) 1)
|
||||
(= (math-imod year 4) 0))
|
||||
|
|
@ -460,39 +503,104 @@
|
|||
29
|
||||
(aref [31 28 31 30 31 30 31 31 30 31 30 31] (1- month))))
|
||||
|
||||
(defun math-day-number (year month day)
|
||||
(defun math-day-in-year (year month day &optional julian)
|
||||
"Return the number of days of the year up to YEAR MONTH DAY.
|
||||
The count includes the given date.
|
||||
If JULIAN is non-nil, use the Julian calendar, otherwise
|
||||
use the Gregorian calendar."
|
||||
(let ((day-of-year (+ day (* 31 (1- month)))))
|
||||
(if (> month 2)
|
||||
(progn
|
||||
(setq day-of-year (- day-of-year (/ (+ 23 (* 4 month)) 10)))
|
||||
(if (math-leap-year-p year)
|
||||
(if (math-leap-year-p year julian)
|
||||
(setq day-of-year (1+ day-of-year)))))
|
||||
(and (eq year 1752)
|
||||
(or (> month 9)
|
||||
(and (= month 9) (>= day 14)))
|
||||
(setq day-of-year (- day-of-year 11)))
|
||||
day-of-year))
|
||||
|
||||
(defun math-absolute-from-date (year month day)
|
||||
(defun math-day-number (year month day)
|
||||
"Return the number of days of the year up to YEAR MONTH DAY.
|
||||
The count includes the given date."
|
||||
(if calc-gregorian-switch
|
||||
(cond ((eq year (nth 0 calc-gregorian-switch))
|
||||
(1+
|
||||
(- (math-absolute-from-dt year month day)
|
||||
(math-absolute-from-dt year 1 1))))
|
||||
((Math-lessp year (nth 0 calc-gregorian-switch))
|
||||
(math-day-in-year year month day t))
|
||||
(t
|
||||
(math-day-in-year year month day)))
|
||||
(math-day-in-year year month day)))
|
||||
|
||||
(defun math-dt-before-p (dt1 dt2)
|
||||
"Non-nil if DT1 occurs before DT2.
|
||||
A DT is a list of the form (YEAR MONTH DAY)."
|
||||
(or (Math-lessp (nth 0 dt1) (nth 0 dt2))
|
||||
(and (equal (nth 0 dt1) (nth 0 dt2))
|
||||
(or (< (nth 1 dt1) (nth 1 dt2))
|
||||
(and (= (nth 1 dt1) (nth 1 dt2))
|
||||
(< (nth 2 dt1) (nth 2 dt2)))))))
|
||||
|
||||
(defun math-absolute-from-gregorian-dt (year month day)
|
||||
"Return the DATE of the day given by the Gregorian day YEAR MONTH DAY.
|
||||
Recall that DATE is the number of days since December 31, -1
|
||||
in the Gregorian calendar."
|
||||
(if (eq year 0) (setq year -1))
|
||||
(let ((yearm1 (math-sub year 1)))
|
||||
(math-sub (math-add (math-day-number year month day)
|
||||
(math-add (math-mul 365 yearm1)
|
||||
(if (math-posp year)
|
||||
(math-quotient yearm1 4)
|
||||
(math-sub 365
|
||||
(math-quotient (math-sub 3 year)
|
||||
4)))))
|
||||
(if (or (Math-lessp year 1753)
|
||||
(and (eq year 1752) (<= month 9)))
|
||||
1
|
||||
(let ((correction (math-mul (math-quotient yearm1 100) 3)))
|
||||
(let ((res (math-idivmod correction 4)))
|
||||
(math-add (if (= (cdr res) 0)
|
||||
-1
|
||||
0)
|
||||
(car res))))))))
|
||||
(math-sub
|
||||
;; Add the number of days of the year and the numbers of days
|
||||
;; in the previous years (leap year days to be added separately)
|
||||
(math-add (math-day-in-year year month day)
|
||||
(math-add (math-mul 365 yearm1)
|
||||
;; Add the number of Julian leap years
|
||||
(if (math-posp year)
|
||||
(math-quotient yearm1 4)
|
||||
(math-sub 365
|
||||
(math-quotient (math-sub 3 year)
|
||||
4)))))
|
||||
;; Subtract the number of Julian leap years which are not
|
||||
;; Gregorian leap years. In C=4N+r centuries, there will
|
||||
;; be 3N+r of these days. The following will compute
|
||||
;; 3N+r.
|
||||
(let* ((correction (math-mul (math-quotient yearm1 100) 3))
|
||||
(res (math-idivmod correction 4)))
|
||||
(math-add (if (= (cdr res) 0)
|
||||
0
|
||||
1)
|
||||
(car res))))))
|
||||
|
||||
(defun math-absolute-from-julian-dt (year month day)
|
||||
"Return the DATE of the day given by the Julian day YEAR MONTH DAY.
|
||||
Recall that DATE is the number of days since December 31, -1
|
||||
in the Gregorian calendar."
|
||||
(if (eq year 0) (setq year -1))
|
||||
(let ((yearm1 (math-sub year 1)))
|
||||
(math-sub
|
||||
;; Add the number of days of the year and the numbers of days
|
||||
;; in the previous years (leap year days to be added separately)
|
||||
(math-add (math-day-in-year year month day)
|
||||
(math-add (math-mul 365 yearm1)
|
||||
;; Add the number of Julian leap years
|
||||
(if (math-posp year)
|
||||
(math-quotient yearm1 4)
|
||||
(math-sub 365
|
||||
(math-quotient (math-sub 3 year)
|
||||
4)))))
|
||||
;; Adjustment, since January 1, 1 (Julian) is absolute day -1
|
||||
2)))
|
||||
|
||||
;; calc-gregorian-switch is a customizable variable defined in calc.el
|
||||
(defvar calc-gregorian-switch)
|
||||
|
||||
|
||||
(defun math-absolute-from-dt (year month day)
|
||||
"Return the DATE of the day given by the day YEAR MONTH DAY.
|
||||
Recall that DATE is the number of days since December 31, -1
|
||||
in the Gregorian calendar."
|
||||
(if (and calc-gregorian-switch
|
||||
;; The next few lines determine if the given date
|
||||
;; occurs before the switch to the Gregorian calendar.
|
||||
(math-dt-before-p (list year month day) calc-gregorian-switch))
|
||||
(math-absolute-from-julian-dt year month day)
|
||||
(math-absolute-from-gregorian-dt year month day)))
|
||||
|
||||
;;; It is safe to redefine these in your init file to use a different
|
||||
;;; language.
|
||||
|
|
@ -548,13 +656,13 @@
|
|||
(setcdr math-fd-dt nil))
|
||||
fmt))))
|
||||
|
||||
(defconst math-julian-date-beginning '(float 17214235 -1)
|
||||
"The beginning of the Julian calendar,
|
||||
as measured in the number of days before January 1 of the year 1AD.")
|
||||
(defconst math-julian-date-beginning '(float 17214225 -1)
|
||||
"The beginning of the Julian date calendar,
|
||||
as measured in the number of days before December 31, 1 BC (Gregorian).")
|
||||
|
||||
(defconst math-julian-date-beginning-int 1721424
|
||||
"The beginning of the Julian calendar,
|
||||
as measured in the integer number of days before January 1 of the year 1AD.")
|
||||
(defconst math-julian-date-beginning-int 1721423
|
||||
"The beginning of the Julian date calendar,
|
||||
as measured in the integer number of days before December 31, 1 BC (Gregorian).")
|
||||
|
||||
(defun math-format-date-part (x)
|
||||
(cond ((stringp x)
|
||||
|
|
@ -585,8 +693,7 @@ as measured in the integer number of days before January 1 of the year 1AD.")
|
|||
math-fd-year (car math-fd-dt)
|
||||
math-fd-month (nth 1 math-fd-dt)
|
||||
math-fd-day (nth 2 math-fd-dt)
|
||||
math-fd-weekday (math-mod
|
||||
(math-add (math-floor math-fd-date) 6) 7)
|
||||
math-fd-weekday (math-mod (math-floor math-fd-date) 7)
|
||||
math-fd-hour (nth 3 math-fd-dt)
|
||||
math-fd-minute (nth 4 math-fd-dt)
|
||||
math-fd-second (nth 5 math-fd-dt))
|
||||
|
|
@ -1098,7 +1205,7 @@ as measured in the integer number of days before January 1 of the year 1AD.")
|
|||
(setq date (nth 1 date)))
|
||||
(or (math-realp date)
|
||||
(math-reject-arg date 'datep))
|
||||
(math-mod (math-add (math-floor date) 6) 7))
|
||||
(math-mod (math-floor date) 7))
|
||||
|
||||
(defun calcFunc-yearday (date)
|
||||
(let ((dt (math-date-to-dt date)))
|
||||
|
|
@ -1298,7 +1405,7 @@ second, the number of seconds offset for daylight savings."
|
|||
0)))
|
||||
(rounded-abs-date
|
||||
(+
|
||||
(calendar-absolute-from-gregorian
|
||||
(calendar-absolute-from-gregorian
|
||||
(list (nth 1 dt) (nth 2 dt) (nth 0 dt)))
|
||||
(/ (round (* 60 time)) 60.0 24.0))))
|
||||
(if (dst-in-effect rounded-abs-date)
|
||||
|
|
@ -1434,28 +1541,100 @@ and ends on the last Sunday of October at 2 a.m."
|
|||
(and (math-messy-integerp day) (setq day (math-trunc day)))
|
||||
(or (integerp day) (math-reject-arg day 'fixnump))
|
||||
(and (or (< day 0) (> day 31)) (math-reject-arg day 'range))
|
||||
(let ((dt (math-date-to-dt date)))
|
||||
(if (or (= day 0) (> day (math-days-in-month (car dt) (nth 1 dt))))
|
||||
(setq day (math-days-in-month (car dt) (nth 1 dt))))
|
||||
(and (eq (car dt) 1752) (= (nth 1 dt) 9)
|
||||
(if (>= day 14) (setq day (- day 11))))
|
||||
(list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1))
|
||||
(1- day)))))
|
||||
(let* ((dt (math-date-to-dt date))
|
||||
(dim (math-days-in-month (car dt) (nth 1 dt)))
|
||||
(julian (if calc-gregorian-switch
|
||||
(math-date-to-dt (math-sub
|
||||
(or (nth 3 calc-gregorian-switch)
|
||||
(apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))
|
||||
1)))))
|
||||
(if (or (= day 0) (> day dim))
|
||||
(setq day (1- dim))
|
||||
(setq day (1- day)))
|
||||
;; Adjust if this occurs near the switch to the Gregorian calendar
|
||||
(if calc-gregorian-switch
|
||||
(cond
|
||||
((and (math-dt-before-p (list (car dt) (nth 1 dt) 1) calc-gregorian-switch)
|
||||
(math-dt-before-p julian (list (car dt) (nth 1 dt) 1)))
|
||||
;; In this case, CALC-GREGORIAN-SWITCH is the first day of the month
|
||||
(list 'date
|
||||
(math-dt-to-date (list (car calc-gregorian-switch)
|
||||
(nth 1 calc-gregorian-switch)
|
||||
(if (> (+ (nth 2 calc-gregorian-switch) day) dim)
|
||||
dim
|
||||
(+ (nth 2 calc-gregorian-switch) day))))))
|
||||
((and (eq (car dt) (car calc-gregorian-switch))
|
||||
(= (nth 1 dt) (nth 1 calc-gregorian-switch)))
|
||||
;; In this case, the switch to the Gregorian calendar occurs in the given month
|
||||
(if (< (+ (nth 2 julian) day) (nth 2 calc-gregorian-switch))
|
||||
;; If the DAYth day occurs before the switch, use it
|
||||
(list 'date (math-dt-to-date (list (car dt) (nth 1 dt) (1+ day))))
|
||||
;; Otherwise do some computations
|
||||
(let ((tm (+ day (- (nth 2 calc-gregorian-switch) (nth 2 julian)))))
|
||||
(list 'date (math-dt-to-date
|
||||
(list (car dt)
|
||||
(nth 1 dt)
|
||||
;;
|
||||
(if (> tm dim) dim tm)))))))
|
||||
((and (eq (car dt) (car julian))
|
||||
(= (nth 1 dt) (nth 1 julian)))
|
||||
;; In this case, the current month is truncated because of the switch
|
||||
;; to the Gregorian calendar
|
||||
(list 'date (math-dt-to-date
|
||||
(list (car dt)
|
||||
(nth 1 dt)
|
||||
(if (>= day (nth 2 julian))
|
||||
(nth 2 julian)
|
||||
(1+ day))))))
|
||||
(t
|
||||
;; The default
|
||||
(list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day))))
|
||||
(list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day)))))
|
||||
|
||||
(defun calcFunc-newyear (date &optional day)
|
||||
(if (eq (car-safe date) 'date) (setq date (nth 1 date)))
|
||||
(or day (setq day 1))
|
||||
(and (math-messy-integerp day) (setq day (math-trunc day)))
|
||||
(or (integerp day) (math-reject-arg day 'fixnump))
|
||||
(let ((dt (math-date-to-dt date)))
|
||||
(let* ((dt (math-date-to-dt date))
|
||||
(gregbeg (if calc-gregorian-switch
|
||||
(or (nth 3 calc-gregorian-switch)
|
||||
(apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))))
|
||||
(julianend (if calc-gregorian-switch (math-sub gregbeg 1)))
|
||||
(julian (if calc-gregorian-switch
|
||||
(math-date-to-dt julianend))))
|
||||
(if (and (>= day 0) (<= day 366))
|
||||
(let ((max (if (eq (car dt) 1752) 355
|
||||
(if (math-leap-year-p (car dt)) 366 365))))
|
||||
(let ((max (if (math-leap-year-p (car dt)) 366 365)))
|
||||
(if (or (= day 0) (> day max)) (setq day max))
|
||||
(list 'date (math-add (math-dt-to-date (list (car dt) 1 1))
|
||||
(1- day))))
|
||||
(if calc-gregorian-switch
|
||||
;; Now to break this down into cases
|
||||
(cond
|
||||
((and (math-dt-before-p (list (car dt) 1 1) calc-gregorian-switch)
|
||||
(math-dt-before-p julian (list (car dt) 1 1)))
|
||||
;; In this case, CALC-GREGORIAN-SWITCH is the first day of the year
|
||||
(list 'date (math-min (math-add gregbeg (1- day))
|
||||
(math-dt-to-date (list (car calc-gregorian-switch) 12 31)))))
|
||||
((eq (car dt) (car julian))
|
||||
;; In this case, the switch to the Gregorian calendar occurs in the given year
|
||||
(if (Math-lessp (car julian) (car calc-gregorian-switch))
|
||||
;; Here, the last Julian day is the last day of the year.
|
||||
(list 'date (math-min (math-add (math-dt-to-date (list (car dt) 1 1)) (1- day))
|
||||
julianend))
|
||||
;; Otherwise, just make sure the date doesn't go past the end of the year
|
||||
(list 'date (math-min (math-add (math-dt-to-date (list (car dt) 1 1)) (1- day))
|
||||
(math-dt-to-date (list (car dt) 12 31))))))
|
||||
(t
|
||||
(list 'date (math-add (math-dt-to-date (list (car dt) 1 1))
|
||||
(1- day)))))
|
||||
(list 'date (math-add (math-dt-to-date (list (car dt) 1 1))
|
||||
(1- day)))))
|
||||
(if (and (>= day -12) (<= day -1))
|
||||
(list 'date (math-dt-to-date (list (car dt) (- day) 1)))
|
||||
(math-reject-arg day 'range)))))
|
||||
(if (and calc-gregorian-switch
|
||||
(math-dt-before-p (list (car dt) (- day) 1) calc-gregorian-switch)
|
||||
(math-dt-before-p julian (list (car dt) (- day) 1)))
|
||||
(list 'date gregbeg)
|
||||
(list 'date (math-dt-to-date (list (car dt) (- day) 1))))
|
||||
(math-reject-arg day 'range)))))
|
||||
|
||||
(defun calcFunc-incmonth (date &optional step)
|
||||
(or step (setq step 1))
|
||||
|
|
|
|||
|
|
@ -464,6 +464,52 @@ to be identified as that note."
|
|||
:type 'string
|
||||
:group 'calc)
|
||||
|
||||
(defvar math-format-date-cache) ; calc-forms.el
|
||||
|
||||
;; Dates that are built-in options for `calc-gregorian-switch' should be
|
||||
;; (YEAR MONTH DAY math-date-from-gregorian-dt(YEAR MONTH DAY)) for speed.
|
||||
(defcustom calc-gregorian-switch nil
|
||||
"The first day the Gregorian calendar is used by Calc's date forms.
|
||||
This is `nil' (the default) if the Gregorian calendar is the only one used.
|
||||
Otherwise, it should be a list `(YEAR MONTH DAY)' when Calc begins to use
|
||||
the Gregorian calendar; Calc will use the Julian calendar for earlier dates.
|
||||
The dates in which different regions of the world began to use the
|
||||
Gregorian calendar vary quite a bit, even within a single country.
|
||||
If you want Calc's date forms to switch between the Julian and
|
||||
Gregorian calendar, you can specify the date or choose from several
|
||||
common choices. Some of these choices should be taken with a grain
|
||||
of salt; for example different parts of France changed calendars at
|
||||
different times, and Sweden's change to the Gregorian calendar was
|
||||
complicated. Also, the boundaries of the countries were different at
|
||||
the times of the calendar changes than they are now.
|
||||
The Vatican decided that the Gregorian calendar should take effect
|
||||
on 15 October 1582 (Gregorian), and many Catholic countries made
|
||||
the change then. Great Britian and its colonies had the Gregorian
|
||||
calendar take effect on 14 September 1752 (Gregorian); this includes
|
||||
the United States."
|
||||
:group 'calc
|
||||
:version "24.4"
|
||||
:type '(choice (const :tag "Always use the Gregorian calendar" nil)
|
||||
(const :tag "Great Britian and the US (1752 9 14)" (1752 9 14 639797))
|
||||
(const :tag "Vatican (1582 10 15)" (1582 10 15 577736))
|
||||
(const :tag "Czechoslovakia (1584 1 17)" (1584 1 17 578195))
|
||||
(const :tag "Denmark (1700 3 1)" (1700 3 1 620607))
|
||||
(const :tag "France (1582 12 20)" (1582 12 20 577802))
|
||||
(const :tag "Hungary (1587 11 1)" (1587 11 1 579579))
|
||||
(const :tag "Luxemburg (1582 12 25)" (1582 12 25 577807))
|
||||
(const :tag "Romania (1919 4 14)" (1919 4 14 700638))
|
||||
(const :tag "Russia (1918 2 14)" (1918 2 14 700214))
|
||||
(const :tag "Sweden (1753 3 1)" (1753 3 1 639965))
|
||||
(const :tag "Switzerland (Catholic) (1584 1 22)" (1584 1 22 578200))
|
||||
(const :tag "Switzerland (Protestant) (1701 1 12)" (1701 1 12 620924))
|
||||
(list :tag "(YEAR MONTH DAY)"
|
||||
(integer :tag "Year")
|
||||
(integer :tag "Month (integer)")
|
||||
(integer :tag "Day")))
|
||||
:set (lambda (symbol value)
|
||||
(set-default symbol value)
|
||||
(setq math-format-date-cache nil)))
|
||||
|
||||
(defface calc-nonselected-face
|
||||
'((t :inherit shadow
|
||||
:slant italic))
|
||||
|
|
|
|||
|
|
@ -1,3 +1,24 @@
|
|||
2012-11-16 David Engster <deng@randomsample.de>
|
||||
|
||||
* semantic/symref/list.el (semantic-symref-symbol): Use
|
||||
`semantic-complete-read-tag-project' instead of
|
||||
`semantic-complete-read-tag-buffer-deep', since the latter is not
|
||||
working correctly.
|
||||
|
||||
* semantic/symref.el (semantic-symref-result-get-tags): Use
|
||||
`find-buffer-visiting' to follow symbolic links.
|
||||
|
||||
* semantic/fw.el (semantic-find-file-noselect): Always set
|
||||
`enable-local-variables' to `:safe' when loading files.
|
||||
|
||||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
|
||||
* semantic/util.el (semantic-describe-buffer):
|
||||
* semantic/bovine/c.el (semantic-c-parse-lexical-token)
|
||||
(semantic-default-c-setup):
|
||||
Use new names for hooks rather than obsolete aliases.
|
||||
|
||||
2012-11-13 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* semantic/mru-bookmark.el (semantic-mru-bookmark-mode):
|
||||
|
|
|
|||
|
|
@ -931,8 +931,8 @@ the regular parser."
|
|||
(setq semantic-new-buffer-fcn-was-run t)
|
||||
(semantic-lex-init)
|
||||
(semantic-clear-toplevel-cache)
|
||||
(remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook
|
||||
t)
|
||||
(remove-hook 'semantic-lex-reset-functions
|
||||
'semantic-lex-spp-reset-hook t)
|
||||
)
|
||||
;; Get the macro symbol table right.
|
||||
(setq semantic-lex-spp-dynamic-macro-symbol-obarray spp-syms)
|
||||
|
|
@ -2073,7 +2073,7 @@ actually in their parent which is not accessible.")
|
|||
)
|
||||
|
||||
(setq semantic-lex-analyzer #'semantic-c-lexer)
|
||||
(add-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook nil t)
|
||||
(add-hook 'semantic-lex-reset-functions 'semantic-lex-spp-reset-hook nil t)
|
||||
(when (eq major-mode 'c++-mode)
|
||||
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("__cplusplus" . "")))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -421,14 +421,7 @@ into `mode-local-init-hook'." file filename)
|
|||
;; Don't prompt to insert a template if we visit an empty file
|
||||
(auto-insert nil)
|
||||
;; We don't want emacs to query about unsafe local variables
|
||||
(enable-local-variables
|
||||
(if (featurep 'xemacs)
|
||||
;; XEmacs only has nil as an option?
|
||||
nil
|
||||
;; Emacs 23 has the spiffy :safe option, nil otherwise.
|
||||
(if (>= emacs-major-version 22)
|
||||
nil
|
||||
:safe)))
|
||||
(enable-local-variables :safe)
|
||||
;; ... or eval variables
|
||||
(enable-local-eval nil)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
;; If you use SPP in your language, be sure to specify this in your
|
||||
;; semantic language setup function:
|
||||
;;
|
||||
;; (add-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook nil t)
|
||||
;; (add-hook 'semantic-lex-reset-functions 'semantic-lex-spp-reset-hook nil t)
|
||||
;;
|
||||
;;
|
||||
;; Special Lexical Tokens:
|
||||
|
|
@ -947,8 +947,8 @@ and variable state from the current buffer."
|
|||
(setq semantic-new-buffer-fcn-was-run t)
|
||||
(semantic-lex-init)
|
||||
(semantic-clear-toplevel-cache)
|
||||
(remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook
|
||||
t)
|
||||
(remove-hook 'semantic-lex-reset-functions
|
||||
'semantic-lex-spp-reset-hook t)
|
||||
))
|
||||
|
||||
;; Second Cheat: copy key variables regarding macro state from the
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ already."
|
|||
(lambda (hit)
|
||||
(let* ((line (car hit))
|
||||
(file (cdr hit))
|
||||
(buff (get-file-buffer file))
|
||||
(buff (find-buffer-visiting file))
|
||||
(tag nil)
|
||||
)
|
||||
(cond
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ current project to find references to the input SYM. The
|
|||
references are organized by file and the name of the function
|
||||
they are used in.
|
||||
Display the references in `semantic-symref-results-mode'."
|
||||
(interactive (list (semantic-tag-name (semantic-complete-read-tag-buffer-deep
|
||||
(interactive (list (semantic-tag-name (semantic-complete-read-tag-project
|
||||
"Symrefs for: "))))
|
||||
(semantic-fetch-tags)
|
||||
(let ((res nil)
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ If TAG is not specified, use the tag at point."
|
|||
semantic-parser-name
|
||||
semantic-parse-tree-state
|
||||
semantic-lex-analyzer
|
||||
semantic-lex-reset-hooks
|
||||
semantic-lex-reset-functions
|
||||
semantic-lex-syntax-modifications
|
||||
)))
|
||||
(dolist (V vars)
|
||||
|
|
|
|||
|
|
@ -374,6 +374,8 @@ This function is semi-obsolete. Use `get-char-code-property'."
|
|||
(format "%c:%s" x doc)))
|
||||
mnemonics ", ")))))
|
||||
|
||||
(declare-function quail-find-key "quail" (char))
|
||||
|
||||
;;;###autoload
|
||||
(defun describe-char (pos &optional buffer)
|
||||
"Describe position POS (interactively, point) and the char after POS.
|
||||
|
|
|
|||
|
|
@ -3732,6 +3732,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
|
|||
;;;; Desktop support
|
||||
|
||||
(eval-when-compile (require 'desktop))
|
||||
(declare-function desktop-file-name "desktop" (filename dirname))
|
||||
|
||||
(defun dired-desktop-buffer-misc-data (dirname)
|
||||
"Auxiliary information to be saved in desktop file."
|
||||
|
|
|
|||
|
|
@ -220,6 +220,9 @@ the mode if ARG is omitted or nil."
|
|||
(goto-char (point-max))
|
||||
(insert msg1 msg2 "\n"))))
|
||||
|
||||
(declare-function shell-prefixed-directory-name "shell" (dir))
|
||||
(declare-function shell-process-cd "shell" (arg))
|
||||
|
||||
;;;###autoload
|
||||
(defun dirtrack (input)
|
||||
"Determine the current directory from the process output for a prompt.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -124,7 +124,7 @@
|
|||
;; Adding your own checks:
|
||||
;;
|
||||
;; You can experiment with adding your own checks by setting the
|
||||
;; hooks `checkdoc-style-functions' and `checkdoc-comment-style-hooks'.
|
||||
;; hooks `checkdoc-style-functions' and `checkdoc-comment-style-functions'.
|
||||
;; Return a string which is the error you wish to report. The cursor
|
||||
;; position should be preserved.
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 1993, 2001-2012 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Dave Gillespie <daveg@synaptics.com>
|
||||
;; Version: 2.02
|
||||
;; Version: 1.0
|
||||
;; Keywords: extensions
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
@ -661,7 +661,7 @@ If ALIST is non-nil, the new pairs are prepended to it."
|
|||
(gv-define-setter face-foreground (x f &optional s)
|
||||
`(set-face-foreground ,f ,x ,s))
|
||||
(gv-define-setter face-underline-p (x f &optional s)
|
||||
`(set-face-underline-p ,f ,x ,s))
|
||||
`(set-face-underline ,f ,x ,s))
|
||||
(gv-define-simple-setter file-modes set-file-modes t)
|
||||
(gv-define-simple-setter frame-height set-screen-height t)
|
||||
(gv-define-simple-setter frame-parameters modify-frame-parameters t)
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ including `cl-block' and `cl-eval-when'.
|
|||
;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when
|
||||
;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp
|
||||
;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*)
|
||||
;;;;;; "cl-macs" "cl-macs.el" "747d3cde8ebe1b8f8eab86642a4eb739")
|
||||
;;;;;; "cl-macs" "cl-macs.el" "a7d9b56ea588b869813de8ed7ec1fbcd")
|
||||
;;; Generated autoloads from cl-macs.el
|
||||
|
||||
(autoload 'cl--compiler-macro-list* "cl-macs" "\
|
||||
|
|
@ -416,7 +416,7 @@ This is compatible with Common Lisp, but note that `defun' and
|
|||
(put 'cl-return-from 'lisp-indent-function '1)
|
||||
|
||||
(autoload 'cl-loop "cl-macs" "\
|
||||
The Common Lisp `cl-loop' macro.
|
||||
The Common Lisp `loop' macro.
|
||||
Valid clauses are:
|
||||
for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
|
||||
for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR,
|
||||
|
|
@ -432,14 +432,14 @@ Valid clauses are:
|
|||
\(fn CLAUSE...)" nil t)
|
||||
|
||||
(autoload 'cl-do "cl-macs" "\
|
||||
The Common Lisp `cl-do' loop.
|
||||
The Common Lisp `do' loop.
|
||||
|
||||
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t)
|
||||
|
||||
(put 'cl-do 'lisp-indent-function '2)
|
||||
|
||||
(autoload 'cl-do* "cl-macs" "\
|
||||
The Common Lisp `cl-do*' loop.
|
||||
The Common Lisp `do*' loop.
|
||||
|
||||
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t)
|
||||
|
||||
|
|
@ -501,7 +501,7 @@ a `let' form, except that the list of symbols can be computed at run-time.
|
|||
(put 'cl-progv 'lisp-indent-function '2)
|
||||
|
||||
(autoload 'cl-flet "cl-macs" "\
|
||||
Make temporary function definitions.
|
||||
Make local function definitions.
|
||||
Like `cl-labels' but the definitions are not recursive.
|
||||
|
||||
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t)
|
||||
|
|
@ -509,7 +509,7 @@ Like `cl-labels' but the definitions are not recursive.
|
|||
(put 'cl-flet 'lisp-indent-function '1)
|
||||
|
||||
(autoload 'cl-flet* "cl-macs" "\
|
||||
Make temporary function definitions.
|
||||
Make local function definitions.
|
||||
Like `cl-flet' but the definitions can refer to previous ones.
|
||||
|
||||
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t)
|
||||
|
|
|
|||
|
|
@ -260,9 +260,11 @@ The name is made by appending a number to PREFIX, default \"G\"."
|
|||
(require 'help-fns)
|
||||
(cons (help-add-fundoc-usage
|
||||
(if (stringp (car hdr)) (pop hdr))
|
||||
(format "%S"
|
||||
(cons 'fn
|
||||
(cl--make-usage-args orig-args))))
|
||||
;; Be careful with make-symbol and (back)quote,
|
||||
;; see bug#12884.
|
||||
(let ((print-gensym nil) (print-quoted t))
|
||||
(format "%S" (cons 'fn (cl--make-usage-args
|
||||
orig-args)))))
|
||||
hdr)))
|
||||
(list `(let* ,cl--bind-lets
|
||||
,@(nreverse cl--bind-forms)
|
||||
|
|
@ -756,7 +758,7 @@ This is compatible with Common Lisp, but note that `defun' and
|
|||
|
||||
;;;###autoload
|
||||
(defmacro cl-loop (&rest loop-args)
|
||||
"The Common Lisp `cl-loop' macro.
|
||||
"The Common Lisp `loop' macro.
|
||||
Valid clauses are:
|
||||
for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
|
||||
for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR,
|
||||
|
|
@ -1501,7 +1503,7 @@ such that COMBO is equivalent to (and . CLAUSES)."
|
|||
|
||||
;;;###autoload
|
||||
(defmacro cl-do (steps endtest &rest body)
|
||||
"The Common Lisp `cl-do' loop.
|
||||
"The Common Lisp `do' loop.
|
||||
|
||||
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
|
||||
(declare (indent 2)
|
||||
|
|
@ -1513,7 +1515,7 @@ such that COMBO is equivalent to (and . CLAUSES)."
|
|||
|
||||
;;;###autoload
|
||||
(defmacro cl-do* (steps endtest &rest body)
|
||||
"The Common Lisp `cl-do*' loop.
|
||||
"The Common Lisp `do*' loop.
|
||||
|
||||
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
|
||||
(declare (indent 2) (debug cl-do))
|
||||
|
|
@ -1547,9 +1549,9 @@ An implicit nil block is established around the loop.
|
|||
\(fn (VAR LIST [RESULT]) BODY...)"
|
||||
(declare (debug ((symbolp form &optional form) cl-declarations body))
|
||||
(indent 1))
|
||||
`(cl-block nil
|
||||
(,(if (eq 'cl-dolist (symbol-function 'dolist)) 'cl--dolist 'dolist)
|
||||
,spec ,@body)))
|
||||
(let ((loop `(dolist ,spec ,@body)))
|
||||
(if (advice-member-p #'cl--wrap-in-nil-block 'dolist)
|
||||
loop `(cl-block nil ,loop))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro cl-dotimes (spec &rest body)
|
||||
|
|
@ -1560,9 +1562,9 @@ nil.
|
|||
|
||||
\(fn (VAR COUNT [RESULT]) BODY...)"
|
||||
(declare (debug cl-dolist) (indent 1))
|
||||
`(cl-block nil
|
||||
(,(if (eq 'cl-dotimes (symbol-function 'dotimes)) 'cl--dotimes 'dotimes)
|
||||
,spec ,@body)))
|
||||
(let ((loop `(dotimes ,spec ,@body)))
|
||||
(if (advice-member-p #'cl--wrap-in-nil-block 'dotimes)
|
||||
loop `(cl-block nil ,loop))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro cl-do-symbols (spec &rest body)
|
||||
|
|
@ -1648,7 +1650,7 @@ a `let' form, except that the list of symbols can be computed at run-time."
|
|||
|
||||
;;;###autoload
|
||||
(defmacro cl-flet (bindings &rest body)
|
||||
"Make temporary function definitions.
|
||||
"Make local function definitions.
|
||||
Like `cl-labels' but the definitions are not recursive.
|
||||
|
||||
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
||||
|
|
@ -1672,7 +1674,7 @@ Like `cl-labels' but the definitions are not recursive.
|
|||
|
||||
;;;###autoload
|
||||
(defmacro cl-flet* (bindings &rest body)
|
||||
"Make temporary function definitions.
|
||||
"Make local function definitions.
|
||||
Like `cl-flet' but the definitions can refer to previous ones.
|
||||
|
||||
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
||||
|
|
|
|||
|
|
@ -107,14 +107,6 @@
|
|||
))
|
||||
(defvaralias var (intern (format "cl-%s" var))))
|
||||
|
||||
;; Before overwriting subr.el's `dotimes' and `dolist', let's remember
|
||||
;; them under a different name, so we can use them in our implementation
|
||||
;; of `dotimes' and `dolist'.
|
||||
(unless (fboundp 'cl--dotimes)
|
||||
(defalias 'cl--dotimes (symbol-function 'dotimes) "The non-CL `dotimes'."))
|
||||
(unless (fboundp 'cl--dolist)
|
||||
(defalias 'cl--dolist (symbol-function 'dolist) "The non-CL `dolist'."))
|
||||
|
||||
(dolist (fun '(
|
||||
(get* . cl-get)
|
||||
(random* . cl-random)
|
||||
|
|
@ -228,7 +220,6 @@
|
|||
remf
|
||||
psetf
|
||||
(define-setf-method . define-setf-expander)
|
||||
declare
|
||||
the
|
||||
locally
|
||||
multiple-value-setq
|
||||
|
|
@ -239,8 +230,6 @@
|
|||
psetq
|
||||
do-all-symbols
|
||||
do-symbols
|
||||
dotimes
|
||||
dolist
|
||||
do*
|
||||
do
|
||||
loop
|
||||
|
|
@ -322,6 +311,15 @@
|
|||
(intern (format "cl-%s" fun)))))
|
||||
(defalias fun new)))
|
||||
|
||||
(defun cl--wrap-in-nil-block (fun &rest args)
|
||||
`(cl-block nil ,(apply fun args)))
|
||||
(advice-add 'dolist :around #'cl--wrap-in-nil-block)
|
||||
(advice-add 'dotimes :around #'cl--wrap-in-nil-block)
|
||||
|
||||
(defun cl--pass-args-to-cl-declare (&rest specs)
|
||||
(macroexpand `(cl-declare ,@specs)))
|
||||
(advice-add 'declare :after #'cl--pass-args-to-cl-declare)
|
||||
|
||||
;;; Features provided a bit differently in Elisp.
|
||||
|
||||
;; First, the old lexical-let is now better served by `lexical-binding', tho
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ PREBUTTONTEXT is some text between PREFIX and the object button."
|
|||
(defun eieio-debug-methodinvoke (method class)
|
||||
"Show the method invocation order for METHOD with CLASS object."
|
||||
(interactive "aMethod: \nXClass Expression: ")
|
||||
(let* ((eieio-pre-method-execution-hooks
|
||||
(let* ((eieio-pre-method-execution-functions
|
||||
(lambda (l) (throw 'moose l) ))
|
||||
(data
|
||||
(catch 'moose (eieio-generic-call
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ For example, (setf (cadr x) y) is equivalent to (setcar (cdr x) y).
|
|||
The return value is the last VAL in the list.
|
||||
|
||||
\(fn PLACE VAL PLACE VAL ...)"
|
||||
(declare (debug (gv-place form)))
|
||||
(declare (debug (&rest [gv-place form])))
|
||||
(if (and args (null (cddr args)))
|
||||
(let ((place (pop args))
|
||||
(val (car args)))
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
;; holds a function.
|
||||
;; This part provides mainly 2 macros: `add-function' and `remove-function'.
|
||||
;;
|
||||
;; - The second part provides `add-advice' and `remove-advice' which are
|
||||
;; - The second part provides `advice-add' and `advice-remove' which are
|
||||
;; refined version of the previous macros specially tailored for the case
|
||||
;; where the place that we want to modify is a `symbol-function'.
|
||||
|
||||
|
|
@ -109,18 +109,33 @@ Each element has the form (WHERE BYTECODE STACK) where:
|
|||
(propertize "Advised function"
|
||||
'dynamic-docstring-function #'advice--make-docstring)) ;; )
|
||||
|
||||
(defun advice-eval-interactive-spec (spec)
|
||||
"Evaluate the interactive spec SPEC."
|
||||
(cond
|
||||
((stringp spec)
|
||||
;; There's no direct access to the C code (in call-interactively) that
|
||||
;; processes those specs, but that shouldn't stop us, should it?
|
||||
;; FIXME: Despite appearances, this is not faithful: SPEC and
|
||||
;; (advice-eval-interactive-spec SPEC) will behave subtly differently w.r.t
|
||||
;; command-history (and maybe a few other details).
|
||||
(call-interactively `(lambda (&rest args) (interactive ,spec) args)))
|
||||
;; ((functionp spec) (funcall spec))
|
||||
(t (eval spec))))
|
||||
|
||||
(defun advice--make-interactive-form (function main)
|
||||
;; TODO: Make it possible to do around-like advising on the
|
||||
;; interactive forms (bug#12844).
|
||||
;; TODO: make it so that interactive spec can be a constant which
|
||||
;; dynamically checks the advice--car/cdr to do its job.
|
||||
;; TODO: Implement interactive-read-args:
|
||||
;;(when (or (commandp function) (commandp main))
|
||||
;; `(interactive-read-args
|
||||
;; (cadr (or (interactive-form function) (interactive-form main)))))
|
||||
;; FIXME: This loads autoloaded functions too eagerly.
|
||||
;; For that, advice-eval-interactive-spec needs to be more faithful.
|
||||
;; FIXME: The calls to interactive-form below load autoloaded functions
|
||||
;; too eagerly.
|
||||
(let ((fspec (cadr (interactive-form function))))
|
||||
(when (eq 'function (car-safe fspec)) ;; Macroexpanded lambda?
|
||||
(setq fspec (nth 1 fspec)))
|
||||
(if (functionp fspec)
|
||||
`(funcall ',fspec
|
||||
',(cadr (interactive-form main)))
|
||||
(cadr (or (interactive-form function)
|
||||
(interactive-form main))))
|
||||
(interactive-form main))))))
|
||||
|
||||
(defsubst advice--make-1 (byte-code stack-depth function main props)
|
||||
"Build a function value that adds FUNCTION to MAIN."
|
||||
|
|
@ -167,17 +182,31 @@ WHERE is a symbol to select an entry in `advice--where-alist'."
|
|||
(advice--make-1 (aref flist 1) (aref flist 3)
|
||||
first nrest props)))))))
|
||||
|
||||
(defvar advice--buffer-local-function-sample nil)
|
||||
|
||||
(defun advice--set-buffer-local (var val)
|
||||
(if (function-equal val advice--buffer-local-function-sample)
|
||||
(kill-local-variable var)
|
||||
(set (make-local-variable var) val)))
|
||||
|
||||
;;;###autoload
|
||||
(defun advice--buffer-local (var)
|
||||
"Buffer-local value of VAR, presumed to contain a function."
|
||||
(declare (gv-setter advice--set-buffer-local))
|
||||
(if (local-variable-p var) (symbol-value var)
|
||||
(setq advice--buffer-local-function-sample
|
||||
(lambda (&rest args) (apply (default-value var) args)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro add-function (where place function &optional props)
|
||||
;; TODO:
|
||||
;; - provide something like `around' for interactive forms.
|
||||
;; - provide some kind of buffer-local functionality at least when `place'
|
||||
;; is a variable.
|
||||
;; - obsolete with-wrapper-hook (mostly requires buffer-local support).
|
||||
;; - provide some kind of control over ordering. E.g. debug-on-entry, ELP
|
||||
;; and tracing want to stay first.
|
||||
;; - maybe also let `where' specify some kind of predicate and use it
|
||||
;; - maybe let `where' specify some kind of predicate and use it
|
||||
;; to implement things like mode-local or eieio-defmethod.
|
||||
;; Of course, that only makes sense if the predicates of all advices can
|
||||
;; be combined and made more efficient.
|
||||
;; :before is like a normal add-hook on a normal hook.
|
||||
;; :before-while is like add-hook on run-hook-with-args-until-failure.
|
||||
;; :before-until is like add-hook on run-hook-with-args-until-success.
|
||||
|
|
@ -197,8 +226,24 @@ call OLDFUN here:
|
|||
If FUNCTION was already added, do nothing.
|
||||
PROPS is an alist of additional properties, among which the following have
|
||||
a special meaning:
|
||||
- `name': a string or symbol. It can be used to refer to this piece of advice."
|
||||
- `name': a string or symbol. It can be used to refer to this piece of advice.
|
||||
|
||||
PLACE cannot be a simple variable. Instead it should either be
|
||||
\(default-value 'VAR) or (local 'VAR) depending on whether FUNCTION
|
||||
should be applied to VAR buffer-locally or globally.
|
||||
|
||||
If one of FUNCTION or OLDFUN is interactive, then the resulting function
|
||||
is also interactive. There are 3 cases:
|
||||
- FUNCTION is not interactive: the interactive spec of OLDFUN is used.
|
||||
- The interactive spec of FUNCTION is itself a function: it should take one
|
||||
argument (the interactive spec of OLDFUN, which it can pass to
|
||||
`advice-eval-interactive-spec') and return the list of arguments to use.
|
||||
- Else, use the interactive spec of FUNCTION and ignore the one of OLDFUN."
|
||||
(declare (debug t)) ;;(indent 2)
|
||||
(cond ((eq 'local (car-safe place))
|
||||
(setq place `(advice--buffer-local ,@(cdr place))))
|
||||
((symbolp place)
|
||||
(error "Use (default-value '%S) or (local '%S)" place place)))
|
||||
`(advice--add-function ,where (gv-ref ,place) ,function ,props))
|
||||
|
||||
;;;###autoload
|
||||
|
|
@ -213,6 +258,10 @@ If FUNCTION was not added to PLACE, do nothing.
|
|||
Instead of FUNCTION being the actual function, it can also be the `name'
|
||||
of the piece of advice."
|
||||
(declare (debug t))
|
||||
(cond ((eq 'local (car-safe place))
|
||||
(setq place `(advice--buffer-local ,@(cdr place))))
|
||||
((symbolp place)
|
||||
(error "Use (default-value '%S) or (local '%S)" place place)))
|
||||
(gv-letplace (getter setter) place
|
||||
(macroexp-let2 nil new `(advice--remove-function ,getter ,function)
|
||||
`(unless (eq ,new ,getter) ,(funcall setter new)))))
|
||||
|
|
@ -230,23 +279,49 @@ of the piece of advice."
|
|||
(advice--make-1 (aref old 1) (aref old 3)
|
||||
first nrest props)))))
|
||||
|
||||
(defun advice--normalize (symbol def)
|
||||
(cond
|
||||
((special-form-p def)
|
||||
;; Not worth the trouble trying to handle this, I think.
|
||||
(error "advice-add failure: %S is a special form" symbol))
|
||||
((and (symbolp def)
|
||||
(eq 'macro (car-safe (ignore-errors (indirect-function def)))))
|
||||
(let ((newval (cons 'macro (cdr (indirect-function def)))))
|
||||
(put symbol 'advice--saved-rewrite (cons def newval))
|
||||
newval))
|
||||
;; `f' might be a pure (hence read-only) cons!
|
||||
((and (eq 'macro (car-safe def))
|
||||
(not (ignore-errors (setcdr def (cdr def)) t)))
|
||||
(cons 'macro (cdr def)))
|
||||
(t def)))
|
||||
|
||||
(defsubst advice--strip-macro (x)
|
||||
(if (eq 'macro (car-safe x)) (cdr x) x))
|
||||
|
||||
(defun advice--defalias-fset (fsetfun symbol newdef)
|
||||
(let* ((olddef (if (fboundp symbol) (symbol-function symbol)))
|
||||
(when (get symbol 'advice--saved-rewrite)
|
||||
(put symbol 'advice--saved-rewrite nil))
|
||||
(setq newdef (advice--normalize symbol newdef))
|
||||
(let* ((olddef (advice--strip-macro
|
||||
(if (fboundp symbol) (symbol-function symbol))))
|
||||
(oldadv
|
||||
(cond
|
||||
((null (get symbol 'advice--pending))
|
||||
(or olddef
|
||||
(progn
|
||||
(message "Delayed advice activation failed for %s: no data"
|
||||
symbol)
|
||||
nil)))
|
||||
((or (not olddef) (autoloadp olddef))
|
||||
(prog1 (get symbol 'advice--pending)
|
||||
(put symbol 'advice--pending nil)))
|
||||
((null (get symbol 'advice--pending))
|
||||
(or olddef
|
||||
(progn
|
||||
(message "Delayed advice activation failed for %s: no data"
|
||||
symbol)
|
||||
nil)))
|
||||
((or (not olddef) (autoloadp olddef))
|
||||
(prog1 (get symbol 'advice--pending)
|
||||
(put symbol 'advice--pending nil)))
|
||||
(t (message "Dropping left-over advice--pending for %s" symbol)
|
||||
(put symbol 'advice--pending nil)
|
||||
olddef))))
|
||||
(funcall (or fsetfun #'fset) symbol (advice--subst-main oldadv newdef))))
|
||||
(let* ((snewdef (advice--strip-macro newdef))
|
||||
(snewadv (advice--subst-main oldadv snewdef)))
|
||||
(funcall (or fsetfun #'fset) symbol
|
||||
(if (eq snewdef newdef) snewadv (cons 'macro snewadv))))))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
|
|
@ -259,39 +334,21 @@ is defined as a macro, alias, command, ..."
|
|||
;; - change all defadvice in lisp/**/*.el.
|
||||
;; - rewrite advice.el on top of this.
|
||||
;; - obsolete advice.el.
|
||||
;; To make advice.el and nadvice.el interoperate properly I see 2 different
|
||||
;; ways:
|
||||
;; - keep them separate: complete the defalias-fset-function setter with
|
||||
;; a matching accessor which both nadvice.el and advice.el will have to use
|
||||
;; in place of symbol-function. This can probably be made to work, but
|
||||
;; they have to agree on a "protocol".
|
||||
;; - layer advice.el on top of nadvice.el. I prefer this approach. the
|
||||
;; simplest way is to make advice.el build one ad-Advice-foo function for
|
||||
;; each advised function which is advice-added/removed whenever ad-activate
|
||||
;; ad-deactivate is called.
|
||||
(let ((f (and (fboundp symbol) (symbol-function symbol))))
|
||||
(cond
|
||||
((special-form-p f)
|
||||
;; Not worth the trouble trying to handle this, I think.
|
||||
(error "add-advice failure: %S is a special form" symbol))
|
||||
((and (symbolp f)
|
||||
(eq 'macro (car-safe (ignore-errors (indirect-function f)))))
|
||||
(let ((newval (cons 'macro (cdr (indirect-function f)))))
|
||||
(put symbol 'advice--saved-rewrite (cons f newval))
|
||||
(fset symbol newval)))
|
||||
;; `f' might be a pure (hence read-only) cons!
|
||||
((and (eq 'macro (car-safe f)) (not (ignore-errors (setcdr f (cdr f)) t)))
|
||||
(fset symbol (cons 'macro (cdr f))))
|
||||
))
|
||||
(let ((f (and (fboundp symbol) (symbol-function symbol))))
|
||||
(let* ((f (and (fboundp symbol) (symbol-function symbol)))
|
||||
(nf (advice--normalize symbol f)))
|
||||
(unless (eq f nf) ;; Most importantly, if nf == nil!
|
||||
(fset symbol nf))
|
||||
(add-function where (cond
|
||||
((eq (car-safe f) 'macro) (cdr f))
|
||||
;; If the function is not yet defined, we can't yet
|
||||
;; install the advice.
|
||||
;; FIXME: If it's an autoloaded command, we also
|
||||
;; have a problem because we need to load the
|
||||
;; command to build the interactive-form.
|
||||
((or (not f) (and (autoloadp f))) ;; (commandp f)
|
||||
((eq (car-safe nf) 'macro) (cdr nf))
|
||||
;; Reasons to delay installation of the advice:
|
||||
;; - If the function is not yet defined, installing
|
||||
;; the advice would affect `fboundp'ness.
|
||||
;; - If it's an autoloaded command,
|
||||
;; advice--make-interactive-form would end up
|
||||
;; loading the command eagerly.
|
||||
;; - `autoload' does nothing if the function is
|
||||
;; not an autoload or undefined.
|
||||
((or (not nf) (autoloadp nf))
|
||||
(get symbol 'advice--pending))
|
||||
(t (symbol-function symbol)))
|
||||
function props)
|
||||
|
|
@ -316,7 +373,7 @@ of the piece of advice."
|
|||
function)
|
||||
(unless (advice--p
|
||||
(if (eq (car-safe f) 'macro) (cdr f) (symbol-function symbol)))
|
||||
;; Not adviced any more.
|
||||
;; Not advised any more.
|
||||
(remove-function (get symbol 'defalias-fset-function)
|
||||
#'advice--defalias-fset)
|
||||
(if (eq (symbol-function symbol)
|
||||
|
|
@ -335,13 +392,15 @@ of the piece of advice."
|
|||
;; (setq def (advice--cdr def)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun advice-member-p (function symbol)
|
||||
"Return non-nil if advice FUNCTION has been added to function SYMBOL.
|
||||
Instead of FUNCTION being the actual function, it can also be the `name'
|
||||
(defun advice-member-p (advice function-name)
|
||||
"Return non-nil if ADVICE has been added to FUNCTION-NAME.
|
||||
Instead of ADVICE being the actual function, it can also be the `name'
|
||||
of the piece of advice."
|
||||
(advice--member-p function
|
||||
(or (get symbol 'advice--pending)
|
||||
(if (fboundp symbol) (symbol-function symbol)))))
|
||||
(advice--member-p advice
|
||||
(or (get function-name 'advice--pending)
|
||||
(advice--strip-macro
|
||||
(if (fboundp function-name)
|
||||
(symbol-function function-name))))))
|
||||
|
||||
|
||||
(provide 'nadvice)
|
||||
|
|
|
|||
|
|
@ -55,12 +55,18 @@
|
|||
;; have to flush that cache between each function, and we couldn't use
|
||||
;; syntax-ppss-flush-cache since that would not only flush the cache but also
|
||||
;; reset syntax-propertize--done which should not be done in this case).
|
||||
"Mode-specific function to apply the syntax-table properties.
|
||||
Called with two arguments: START and END.
|
||||
This function can call `syntax-ppss' on any position before END, but it
|
||||
should not call `syntax-ppss-flush-cache', which means that it should not
|
||||
call `syntax-ppss' on some position and later modify the buffer on some
|
||||
earlier position.")
|
||||
"Mode-specific function to apply `syntax-table' text properties.
|
||||
The value of this variable is a function to be called by Font
|
||||
Lock mode, prior to performing syntactic fontification on a
|
||||
stretch of text. It is given two arguments, START and END: the
|
||||
start and end of the text to be fontified. Major modes can
|
||||
specify a custom function to apply `syntax-table' properties to
|
||||
override the default syntax table in special cases.
|
||||
|
||||
The specified function may call `syntax-ppss' on any position
|
||||
before END, but it should not call `syntax-ppss-flush-cache',
|
||||
which means that it should not call `syntax-ppss' on some
|
||||
position and later modify the buffer on some earlier position.")
|
||||
|
||||
(defvar syntax-propertize-chunk-size 500)
|
||||
|
||||
|
|
@ -118,7 +124,7 @@ The arg RULES can be of the same form as in `syntax-propertize-rules'.
|
|||
The return value is an object that can be passed as a rule to
|
||||
`syntax-propertize-rules'.
|
||||
I.e. this is useful only when you want to share rules among several
|
||||
syntax-propertize-functions."
|
||||
`syntax-propertize-function's."
|
||||
(declare (debug syntax-propertize-rules))
|
||||
;; Precompile? Yeah, right!
|
||||
;; Seriously, tho, this is a macro for 2 reasons:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* erc.el (erc-modules): Add "notifications". Tweak "hecomplete" doc.
|
||||
|
||||
2012-10-28 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* erc-backend.el: Only require `erc' during compilation (bug#12740).
|
||||
|
|
|
|||
|
|
@ -1843,7 +1843,7 @@ removed from the list will be disabled."
|
|||
capab-identify)
|
||||
(const :tag "completion: Complete nicknames and commands (programmable)"
|
||||
completion)
|
||||
(const :tag "hecomplete: Complete nicknames and commands (old)" hecomplete)
|
||||
(const :tag "hecomplete: Complete nicknames and commands (obsolete, use \"completion\")" hecomplete)
|
||||
(const :tag "dcc: Provide Direct Client-to-Client support" dcc)
|
||||
(const :tag "fill: Wrap long lines" fill)
|
||||
(const :tag "identd: Launch an identd server on port 8113" identd)
|
||||
|
|
@ -1863,6 +1863,8 @@ removed from the list will be disabled."
|
|||
(const :tag
|
||||
"notify: Notify when the online status of certain users changes"
|
||||
notify)
|
||||
(const :tag "notifications: Send notifications on PRIVMSG or nickname mentions"
|
||||
notifications)
|
||||
(const :tag "page: Process CTCP PAGE requests from IRC" page)
|
||||
(const :tag "readonly: Make displayed lines read-only" readonly)
|
||||
(const :tag "replace: Replace text in messages" replace)
|
||||
|
|
|
|||
|
|
@ -295,8 +295,8 @@ to writing a completion function."
|
|||
'pcomplete-expand-and-complete)
|
||||
(define-key eshell-command-map [space] 'pcomplete-expand)
|
||||
(define-key eshell-command-map [? ] 'pcomplete-expand)
|
||||
(define-key eshell-mode-map [tab] 'pcomplete)
|
||||
(define-key eshell-mode-map [(control ?i)] 'pcomplete)
|
||||
(define-key eshell-mode-map [tab] 'eshell-pcomplete)
|
||||
(define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete)
|
||||
;; jww (1999-10-19): Will this work on anything but X?
|
||||
(if (featurep 'xemacs)
|
||||
(define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse)
|
||||
|
|
@ -449,6 +449,13 @@ to writing a completion function."
|
|||
(all-completions filename obarray 'functionp))
|
||||
completions)))))))
|
||||
|
||||
(defun eshell-pcomplete ()
|
||||
"Eshell wrapper for `pcomplete'."
|
||||
(interactive)
|
||||
(if eshell-cmpl-ignore-case
|
||||
(pcomplete-expand-and-complete) ; hack workaround for bug#12838
|
||||
(pcomplete)))
|
||||
|
||||
(provide 'em-cmpl)
|
||||
|
||||
;; Local Variables:
|
||||
|
|
|
|||
|
|
@ -306,12 +306,13 @@ Remove (unlink) the FILE(s).")
|
|||
(eshell-eval-using-options
|
||||
"mkdir" args
|
||||
'((?h "help" nil nil "show this usage screen")
|
||||
(?p "parents" nil em-parents "make parent directories as needed")
|
||||
:external "mkdir"
|
||||
:show-usage
|
||||
:usage "[OPTION] DIRECTORY...
|
||||
Create the DIRECTORY(ies), if they do not already exist.")
|
||||
(while args
|
||||
(eshell-funcalln 'make-directory (car args))
|
||||
(eshell-funcalln 'make-directory (car args) em-parents)
|
||||
(setq args (cdr args)))
|
||||
nil))
|
||||
|
||||
|
|
|
|||
|
|
@ -487,16 +487,21 @@ with the `default' face (which is always completely specified)."
|
|||
(defalias 'face-background-pixmap 'face-stipple)
|
||||
|
||||
|
||||
;; FIXME all of these -p functions ignore inheritance (cf face-stipple).
|
||||
;; Ie, a face that inherits from an underlined face but does not
|
||||
;; specify :underline will return nil.
|
||||
;; So these functions don't actually tell you anything about how the
|
||||
;; face will _appear_. So not very useful IMO.
|
||||
(defun face-underline-p (face &optional frame)
|
||||
"Return non-nil if FACE is underlined.
|
||||
"Return non-nil if FACE specifies a non-nil underlining.
|
||||
If the optional argument FRAME is given, report on face FACE in that frame.
|
||||
If FRAME is t, report on the defaults for face FACE (for new frames).
|
||||
If FRAME is omitted or nil, use the selected frame."
|
||||
(eq (face-attribute face :underline frame) t))
|
||||
(face-attribute-specified-or (face-attribute face :underline frame) nil))
|
||||
|
||||
|
||||
(defun face-inverse-video-p (face &optional frame)
|
||||
"Return non-nil if FACE is in inverse video on FRAME.
|
||||
"Return non-nil if FACE specifies a non-nil inverse-video.
|
||||
If the optional argument FRAME is given, report on face FACE in that frame.
|
||||
If FRAME is t, report on the defaults for face FACE (for new frames).
|
||||
If FRAME is omitted or nil, use the selected frame."
|
||||
|
|
@ -837,21 +842,24 @@ and DATA is a string, containing the raw bits of the bitmap."
|
|||
(set-face-attribute face frame :stipple (or stipple 'unspecified)))
|
||||
|
||||
|
||||
(defun set-face-underline-p (face underline &optional frame)
|
||||
(defun set-face-underline (face underline &optional frame)
|
||||
"Specify whether face FACE is underlined.
|
||||
UNDERLINE nil means FACE explicitly doesn't underline.
|
||||
UNDERLINE non-nil means FACE explicitly does underlining
|
||||
with the same of the foreground color.
|
||||
If UNDERLINE is a string, underline with the color named UNDERLINE.
|
||||
UNDERLINE t means FACE underlines with its foreground color.
|
||||
If UNDERLINE is a string, underline with that color.
|
||||
|
||||
UNDERLINE may also be a list of the form (:color COLOR :style STYLE),
|
||||
where COLOR is a string or `foreground-color', and STYLE is either
|
||||
`line' or `wave'. :color may be omitted, which means to use the
|
||||
foreground color. :style may be omitted, which means to use a line.
|
||||
|
||||
FRAME nil or not specified means change face on all frames.
|
||||
Use `set-face-attribute' to ``unspecify'' underlining."
|
||||
(interactive
|
||||
(let ((list (read-face-and-attribute :underline)))
|
||||
(list (car list) (eq (car (cdr list)) t))))
|
||||
(interactive (read-face-and-attribute :underline))
|
||||
(set-face-attribute face frame :underline underline))
|
||||
|
||||
(define-obsolete-function-alias 'set-face-underline
|
||||
'set-face-underline-p "22.1")
|
||||
(define-obsolete-function-alias 'set-face-underline-p
|
||||
'set-face-underline "24.3")
|
||||
|
||||
|
||||
(defun set-face-inverse-video-p (face inverse-video-p &optional frame)
|
||||
|
|
@ -866,6 +874,9 @@ Use `set-face-attribute' to ``unspecify'' the inverse video attribute."
|
|||
(set-face-attribute face frame :inverse-video inverse-video-p))
|
||||
|
||||
|
||||
;; The -p suffix is a hostage to fortune. What if we want to extend
|
||||
;; this to allow more than boolean options? Exactly this happened
|
||||
;; to set-face-underline-p.
|
||||
(defun set-face-bold-p (face bold-p &optional frame)
|
||||
"Specify whether face FACE is bold.
|
||||
BOLD-P non-nil means FACE should explicitly display bold.
|
||||
|
|
@ -1114,6 +1125,9 @@ name of the attribute for prompting. Value is the new attribute value."
|
|||
(string-to-number new-value)))))
|
||||
|
||||
|
||||
;; FIXME this does allow you to enter the list forms of :box,
|
||||
;; :stipple, or :underline, because face-valid-attribute-values does
|
||||
;; not return those forms.
|
||||
(defun read-face-attribute (face attribute &optional frame)
|
||||
"Interactively read a new value for FACE's ATTRIBUTE.
|
||||
Optional argument FRAME nil or unspecified means read an attribute value
|
||||
|
|
@ -1125,12 +1139,11 @@ of a global face. Value is the new attribute value."
|
|||
;; Represent complex attribute values as strings by printing them
|
||||
;; out. Stipple can be a vector; (WIDTH HEIGHT DATA). Box can be
|
||||
;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow
|
||||
;; SHADOW)'.
|
||||
(when (and (or (eq attribute :stipple)
|
||||
(eq attribute :box))
|
||||
(or (consp old-value)
|
||||
(vectorp old-value)))
|
||||
(setq old-value (prin1-to-string old-value)))
|
||||
;; SHADOW)'. Underline can be `(:color COLOR :style STYLE)'.
|
||||
(and (memq attribute '(:box :stipple :underline))
|
||||
(or (consp old-value)
|
||||
(vectorp old-value))
|
||||
(setq old-value (prin1-to-string old-value)))
|
||||
(cond ((listp valid)
|
||||
(let ((default
|
||||
(or (car (rassoc old-value valid))
|
||||
|
|
@ -1160,11 +1173,10 @@ of a global face. Value is the new attribute value."
|
|||
;; Convert stipple and box value text we read back to a list or
|
||||
;; vector if it looks like one. This makes the assumption that a
|
||||
;; pixmap file name won't start with an open-paren.
|
||||
(when (and (or (eq attribute :stipple)
|
||||
(eq attribute :box))
|
||||
(stringp new-value)
|
||||
(string-match "^[[(]" new-value))
|
||||
(setq new-value (read new-value)))
|
||||
(and (memq attribute '(:stipple :box :underline))
|
||||
(stringp new-value)
|
||||
(string-match "^[[(]" new-value)
|
||||
(setq new-value (read new-value)))
|
||||
new-value))
|
||||
|
||||
(declare-function fontset-list "fontset.c" ())
|
||||
|
|
|
|||
|
|
@ -267,42 +267,63 @@ files of names DIRNAME1/FILENAME, DIRNAME2/FILENAME, ...")
|
|||
;; Functions to add files to the cache
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun file-cache--read-list (file op-prompt)
|
||||
(let* ((fun (if file 'read-file-name 'read-directory-name))
|
||||
(type (if file "file" "directory"))
|
||||
(prompt-1 (concat op-prompt " " type ": "))
|
||||
(prompt-2 (concat op-prompt " another " type "?"))
|
||||
(continue t)
|
||||
result)
|
||||
(while continue
|
||||
(push (funcall fun prompt-1 nil nil t) result)
|
||||
(setq continue (y-or-n-p prompt-2)))
|
||||
(nreverse result)))
|
||||
|
||||
;;;###autoload
|
||||
(defun file-cache-add-directory (directory &optional regexp)
|
||||
"Add DIRECTORY to the file cache.
|
||||
If the optional REGEXP argument is non-nil, only files which match it will
|
||||
be added to the cache."
|
||||
(interactive "DAdd files from directory: ")
|
||||
"Add all files in DIRECTORY to the file cache.
|
||||
If called from Lisp with a non-nil REGEXP argument is non-nil,
|
||||
only add files whose names match REGEXP."
|
||||
(interactive (list (read-directory-name "Add files from directory: "
|
||||
nil nil t)
|
||||
nil))
|
||||
;; Not an error, because otherwise we can't use load-paths that
|
||||
;; contain non-existent directories.
|
||||
(if (not (file-accessible-directory-p directory))
|
||||
(message "Directory %s does not exist" directory)
|
||||
(when (file-accessible-directory-p directory)
|
||||
(let* ((dir (expand-file-name directory))
|
||||
(dir-files (directory-files dir t regexp)))
|
||||
;; Filter out files we don't want to see
|
||||
(dolist (file dir-files)
|
||||
(if (file-directory-p file)
|
||||
(setq dir-files (delq file dir-files))
|
||||
(dolist (regexp file-cache-filter-regexps)
|
||||
(if (string-match regexp file)
|
||||
(setq dir-files (delq file dir-files))))))
|
||||
(if (file-directory-p file)
|
||||
(setq dir-files (delq file dir-files))
|
||||
(dolist (regexp file-cache-filter-regexps)
|
||||
(if (string-match regexp file)
|
||||
(setq dir-files (delq file dir-files))))))
|
||||
(file-cache-add-file-list dir-files))))
|
||||
|
||||
;;;###autoload
|
||||
(defun file-cache-add-directory-list (directory-list &optional regexp)
|
||||
"Add DIRECTORY-LIST (a list of directory names) to the file cache.
|
||||
(defun file-cache-add-directory-list (directories &optional regexp)
|
||||
"Add DIRECTORIES (a list of directory names) to the file cache.
|
||||
If called interactively, read the directory names one by one.
|
||||
If the optional REGEXP argument is non-nil, only files which match it
|
||||
will be added to the cache. Note that the REGEXP is applied to the
|
||||
files in each directory, not to the directory list itself."
|
||||
(interactive "XAdd files from directory list: ")
|
||||
(mapcar
|
||||
(lambda (dir) (file-cache-add-directory dir regexp))
|
||||
directory-list))
|
||||
(interactive (list (file-cache--read-list nil "Add")))
|
||||
(dolist (dir directories)
|
||||
(file-cache-add-directory dir regexp))
|
||||
(let ((n (length directories)))
|
||||
(message "Filecache: cached file names from %d director%s."
|
||||
n (if (= n 1) "y" "ies"))))
|
||||
|
||||
(defun file-cache-add-file-list (file-list)
|
||||
"Add FILE-LIST (a list of files names) to the file cache."
|
||||
(interactive "XFile List: ")
|
||||
(mapcar 'file-cache-add-file file-list))
|
||||
(defun file-cache-add-file-list (files)
|
||||
"Add FILES (a list of file names) to the file cache.
|
||||
If called interactively, read the file names one by one."
|
||||
(interactive (list (file-cache--read-list t "Add")))
|
||||
(dolist (f files)
|
||||
(file-cache-add-file f))
|
||||
(let ((n (length files)))
|
||||
(message "Filecache: cached %d file name%s."
|
||||
n (if (= n 1) "" "s"))))
|
||||
|
||||
;; Workhorse function
|
||||
|
||||
|
|
@ -310,23 +331,25 @@ files in each directory, not to the directory list itself."
|
|||
(defun file-cache-add-file (file)
|
||||
"Add FILE to the file cache."
|
||||
(interactive "fAdd File: ")
|
||||
(if (not (file-exists-p file))
|
||||
(message "Filecache: file %s does not exist" file)
|
||||
(let* ((file-name (file-name-nondirectory file))
|
||||
(dir-name (file-name-directory file))
|
||||
(the-entry (assoc-string
|
||||
file-name file-cache-alist
|
||||
file-cache-ignore-case)))
|
||||
;; Does the entry exist already?
|
||||
(if the-entry
|
||||
(if (or (and (stringp (cdr the-entry))
|
||||
(string= dir-name (cdr the-entry)))
|
||||
(and (listp (cdr the-entry))
|
||||
(member dir-name (cdr the-entry))))
|
||||
nil
|
||||
(setcdr the-entry (cons dir-name (cdr the-entry))))
|
||||
;; If not, add it to the cache
|
||||
(push (list file-name dir-name) file-cache-alist)))))
|
||||
(setq file (file-truename file))
|
||||
(unless (file-exists-p file)
|
||||
(error "Filecache: file %s does not exist" file))
|
||||
(let* ((file-name (file-name-nondirectory file))
|
||||
(dir-name (file-name-directory file))
|
||||
(the-entry (assoc-string file-name file-cache-alist
|
||||
file-cache-ignore-case)))
|
||||
(cond ((null the-entry)
|
||||
;; If the entry wasn't in the cache, add it.
|
||||
(push (list file-name dir-name) file-cache-alist)
|
||||
(if (called-interactively-p 'interactive)
|
||||
(message "Filecache: cached file name %s." file)))
|
||||
((not (member dir-name (cdr the-entry)))
|
||||
(setcdr the-entry (cons dir-name (cdr the-entry)))
|
||||
(if (called-interactively-p 'interactive)
|
||||
(message "Filecache: cached file name %s." file)))
|
||||
(t
|
||||
(if (called-interactively-p 'interactive)
|
||||
(message "Filecache: %s is already cached." file))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun file-cache-add-directory-using-find (directory)
|
||||
|
|
@ -412,17 +435,26 @@ or the optional REGEXP argument."
|
|||
|
||||
;; This clears *all* files with the given name
|
||||
(defun file-cache-delete-file (file)
|
||||
"Delete FILE from the file cache."
|
||||
"Delete FILE (a relative file name) from the file cache.
|
||||
Return nil if FILE was not in the file cache, non-nil otherwise."
|
||||
(interactive
|
||||
(list (completing-read "Delete file from cache: " file-cache-alist)))
|
||||
(setq file-cache-alist
|
||||
(delq (assoc-string file file-cache-alist file-cache-ignore-case)
|
||||
file-cache-alist)))
|
||||
(let ((elt (assoc-string file file-cache-alist file-cache-ignore-case)))
|
||||
(setq file-cache-alist (delq elt file-cache-alist))
|
||||
elt))
|
||||
|
||||
(defun file-cache-delete-file-list (file-list)
|
||||
"Delete FILE-LIST (a list of files) from the file cache."
|
||||
(interactive "XFile List: ")
|
||||
(mapcar 'file-cache-delete-file file-list))
|
||||
(defun file-cache-delete-file-list (files &optional message)
|
||||
"Delete FILES (a list of files) from the file cache.
|
||||
If called interactively, read the file names one by one.
|
||||
If MESSAGE is non-nil, or if called interactively, print a
|
||||
message reporting the number of file names deleted."
|
||||
(interactive (list (file-cache--read-list t "Uncache") t))
|
||||
(let ((n 0))
|
||||
(dolist (f files)
|
||||
(if (file-cache-delete-file f)
|
||||
(setq n (1+ n))))
|
||||
(message "Filecache: uncached %d file name%s."
|
||||
n (if (= n 1) "" "s"))))
|
||||
|
||||
(defun file-cache-delete-file-regexp (regexp)
|
||||
"Delete files matching REGEXP from the file cache."
|
||||
|
|
@ -431,21 +463,18 @@ or the optional REGEXP argument."
|
|||
(dolist (elt file-cache-alist)
|
||||
(and (string-match regexp (car elt))
|
||||
(push (car elt) delete-list)))
|
||||
(file-cache-delete-file-list delete-list)
|
||||
(message "Filecache: deleted %d files from file cache"
|
||||
(length delete-list))))
|
||||
(file-cache-delete-file-list delete-list)))
|
||||
|
||||
(defun file-cache-delete-directory (directory)
|
||||
"Delete DIRECTORY from the file cache."
|
||||
(interactive "DDelete directory from file cache: ")
|
||||
(let ((dir (expand-file-name directory))
|
||||
(result 0))
|
||||
(n 0))
|
||||
(dolist (entry file-cache-alist)
|
||||
(if (file-cache-do-delete-directory dir entry)
|
||||
(setq result (1+ result))))
|
||||
(if (zerop result)
|
||||
(error "Filecache: no entries containing %s found in cache" directory)
|
||||
(message "Filecache: deleted %d entries" result))))
|
||||
(setq n (1+ n))))
|
||||
(message "Filecache: uncached %d file name%s."
|
||||
n (if (= n 1) "" "s"))))
|
||||
|
||||
(defun file-cache-do-delete-directory (dir entry)
|
||||
(let ((directory-list (cdr entry))
|
||||
|
|
@ -456,10 +485,12 @@ or the optional REGEXP argument."
|
|||
(delq entry file-cache-alist))
|
||||
(setcdr entry (delete directory directory-list))))))
|
||||
|
||||
(defun file-cache-delete-directory-list (directory-list)
|
||||
"Delete DIRECTORY-LIST (a list of directories) from the file cache."
|
||||
(interactive "XDirectory List: ")
|
||||
(mapcar 'file-cache-delete-directory directory-list))
|
||||
(defun file-cache-delete-directory-list (directories)
|
||||
"Delete DIRECTORIES (a list of directory names) from the file cache.
|
||||
If called interactively, read the directory names one by one."
|
||||
(interactive (list (file-cache--read-list nil "Uncache")))
|
||||
(dolist (d directories)
|
||||
(file-cache-delete-directory d)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Utility functions
|
||||
|
|
|
|||
|
|
@ -549,6 +549,9 @@ like an INI file. You can add this hook to `find-file-hook'."
|
|||
(concat (w32-shell-name) " -c " (buffer-file-name)))))
|
||||
|
||||
(eval-when-compile (require 'comint))
|
||||
(declare-function comint-mode "comint" ())
|
||||
(declare-function comint-exec "comint" (buffer name command startfile switches))
|
||||
|
||||
(defun bat-generic-mode-run-as-comint ()
|
||||
"Run the current BAT file in a comint buffer."
|
||||
(interactive)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
2012-11-16 Jan Tatarik <jan.tatarik@gmail.com>
|
||||
|
||||
* gnus-score.el (gnus-score-body):
|
||||
* gnus-logic.el (gnus-advanced-body): Don't score by headers when
|
||||
scoring by body.
|
||||
|
||||
2012-11-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* gnus-diary.el (nndiary-request-create-group-functions)
|
||||
(nndiary-request-update-info-functions)
|
||||
(gnus-subscribe-newsgroup-functions)
|
||||
(nndiary-request-accept-article-functions):
|
||||
Use new names for hooks rather than obsolete aliases.
|
||||
|
||||
2012-11-08 Katsumi Yamaoka <yamaoka@jpl.org>
|
||||
|
||||
* gnus-art.el (gnus-article-browse-html-parts): Always replace charset
|
||||
|
|
|
|||
|
|
@ -277,18 +277,18 @@ Optional prefix (or REVERSE argument) means sort in reverse order."
|
|||
|
||||
;; Called when a group is subscribed. This is needed because groups created
|
||||
;; because of mail splitting are *not* created with the back end function.
|
||||
;; Thus, `nndiary-request-create-group-hooks' is inoperative.
|
||||
;; Thus, `nndiary-request-create-group-functions' is inoperative.
|
||||
(defun gnus-diary-maybe-update-group-parameters (group)
|
||||
(when (eq (car (gnus-find-method-for-group group)) 'nndiary)
|
||||
(gnus-diary-update-group-parameters group)))
|
||||
|
||||
(add-hook 'nndiary-request-create-group-hooks
|
||||
(add-hook 'nndiary-request-create-group-functions
|
||||
'gnus-diary-update-group-parameters)
|
||||
;; Now that we have `gnus-subscribe-newsgroup-hooks', this is not needed
|
||||
;; Now that we have `gnus-subscribe-newsgroup-functions', this is not needed
|
||||
;; anymore. Maybe I should remove this completely.
|
||||
(add-hook 'nndiary-request-update-info-hooks
|
||||
(add-hook 'nndiary-request-update-info-functions
|
||||
'gnus-diary-update-group-parameters)
|
||||
(add-hook 'gnus-subscribe-newsgroup-hooks
|
||||
(add-hook 'gnus-subscribe-newsgroup-functions
|
||||
'gnus-diary-maybe-update-group-parameters)
|
||||
|
||||
|
||||
|
|
@ -384,7 +384,7 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
|
|||
nndiary-headers)
|
||||
))
|
||||
|
||||
(add-hook 'nndiary-request-accept-article-hooks
|
||||
(add-hook 'nndiary-request-accept-article-functions
|
||||
(lambda () (gnus-diary-check-message nil)))
|
||||
|
||||
(define-key message-mode-map "\C-c\C-fd" 'gnus-diary-check-message)
|
||||
|
|
|
|||
|
|
@ -181,17 +181,18 @@
|
|||
(with-current-buffer nntp-server-buffer
|
||||
(let* ((request-func (cond ((string= "head" header)
|
||||
'gnus-request-head)
|
||||
;; We need to peek at the headers to detect the
|
||||
;; content encoding
|
||||
((string= "body" header)
|
||||
'gnus-request-article)
|
||||
'gnus-request-body)
|
||||
(t 'gnus-request-article)))
|
||||
ofunc article handles)
|
||||
;; Not all backends support partial fetching. In that case, we
|
||||
;; just fetch the entire article.
|
||||
(unless (gnus-check-backend-function
|
||||
(intern (concat "request-" header))
|
||||
gnus-newsgroup-name)
|
||||
;; When scoring by body, we need to peek at the headers to detect the
|
||||
;; content encoding
|
||||
(unless (or (gnus-check-backend-function
|
||||
(intern (concat "request-" header))
|
||||
gnus-newsgroup-name)
|
||||
(string= "body" header))
|
||||
(setq ofunc request-func)
|
||||
(setq request-func 'gnus-request-article))
|
||||
(setq article (mail-header-number gnus-advanced-headers))
|
||||
|
|
|
|||
|
|
@ -1762,21 +1762,22 @@ score in `gnus-newsgroup-scored' by SCORE."
|
|||
(all-scores scores)
|
||||
(request-func (cond ((string= "head" header)
|
||||
'gnus-request-head)
|
||||
;; We need to peek at the headers to detect
|
||||
;; the content encoding
|
||||
((string= "body" header)
|
||||
'gnus-request-article)
|
||||
'gnus-request-body)
|
||||
(t 'gnus-request-article)))
|
||||
entries alist ofunc article last)
|
||||
(when articles
|
||||
(setq last (mail-header-number (caar (last articles))))
|
||||
;; Not all backends support partial fetching. In that case,
|
||||
;; we just fetch the entire article.
|
||||
(unless (gnus-check-backend-function
|
||||
(and (string-match "^gnus-" (symbol-name request-func))
|
||||
(intern (substring (symbol-name request-func)
|
||||
(match-end 0))))
|
||||
gnus-newsgroup-name)
|
||||
;; When scoring by body, we need to peek at the headers to detect
|
||||
;; the content encoding
|
||||
(unless (or (gnus-check-backend-function
|
||||
(and (string-match "^gnus-" (symbol-name request-func))
|
||||
(intern (substring (symbol-name request-func)
|
||||
(match-end 0))))
|
||||
gnus-newsgroup-name)
|
||||
(string= "body" header))
|
||||
(setq ofunc request-func)
|
||||
(setq request-func 'gnus-request-article))
|
||||
(while articles
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ Shorter values mean quicker response, but are more CPU intensive.")
|
|||
1000))))))
|
||||
|
||||
(defvar pop3-uidl)
|
||||
;; List of UIDLs of existing messages at pesent in the server:
|
||||
;; List of UIDLs of existing messages at present in the server:
|
||||
;; ("UIDL1" "UIDL2" "UIDL3"...)
|
||||
|
||||
(defvar pop3-uidl-saved)
|
||||
|
|
|
|||
|
|
@ -677,7 +677,8 @@ help buffer."
|
|||
" is also a " "face." "\n\n" facedoc))
|
||||
;; Don't record the `describe-function' item in the stack.
|
||||
(setq help-xref-stack-item nil)
|
||||
(help-setup-xref (list #'help-xref-interned symbol) nil)))))))
|
||||
(help-setup-xref (list #'help-xref-interned symbol) nil))))
|
||||
(goto-char (point-min)))))
|
||||
|
||||
|
||||
;; Navigation/hyperlinking with xrefs
|
||||
|
|
|
|||
|
|
@ -1362,24 +1362,27 @@ group."
|
|||
(defun ibuffer-mark-forward (arg)
|
||||
"Mark the buffer on this line, and move forward ARG lines.
|
||||
If point is on a group name, this function operates on that group."
|
||||
(interactive "P")
|
||||
(ibuffer-mark-interactive arg ibuffer-marked-char 1))
|
||||
(interactive "p")
|
||||
(ibuffer-mark-interactive arg ibuffer-marked-char))
|
||||
|
||||
(defun ibuffer-unmark-forward (arg)
|
||||
"Unmark the buffer on this line, and move forward ARG lines.
|
||||
If point is on a group name, this function operates on that group."
|
||||
(interactive "P")
|
||||
(ibuffer-mark-interactive arg ?\s 1))
|
||||
(interactive "p")
|
||||
(ibuffer-mark-interactive arg ?\s))
|
||||
|
||||
(defun ibuffer-unmark-backward (arg)
|
||||
"Unmark the buffer on this line, and move backward ARG lines.
|
||||
If point is on a group name, this function operates on that group."
|
||||
(interactive "P")
|
||||
(ibuffer-mark-interactive arg ?\s -1))
|
||||
(interactive "p")
|
||||
(ibuffer-unmark-forward (- arg)))
|
||||
|
||||
(defun ibuffer-mark-interactive (arg mark movement)
|
||||
(defun ibuffer-mark-interactive (arg mark &optional movement)
|
||||
(ibuffer-assert-ibuffer-mode)
|
||||
(or arg (setq arg 1))
|
||||
;; deprecated movement argument
|
||||
(when (and movement (< movement 0))
|
||||
(setq arg (- arg)))
|
||||
(ibuffer-forward-line 0)
|
||||
(ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name)
|
||||
(progn
|
||||
|
|
@ -1389,8 +1392,12 @@ If point is on a group name, this function operates on that group."
|
|||
(let ((inhibit-read-only t))
|
||||
(while (> arg 0)
|
||||
(ibuffer-set-mark mark)
|
||||
(ibuffer-forward-line movement t)
|
||||
(setq arg (1- arg))))))
|
||||
(ibuffer-forward-line 1 t)
|
||||
(setq arg (1- arg)))
|
||||
(while (< arg 0)
|
||||
(ibuffer-forward-line -1 t)
|
||||
(ibuffer-set-mark mark)
|
||||
(setq arg (1+ arg))))))
|
||||
|
||||
(defun ibuffer-set-mark (mark)
|
||||
(ibuffer-assert-ibuffer-mode)
|
||||
|
|
|
|||
|
|
@ -2454,6 +2454,8 @@ when using per-directory thumbnail file storage"))
|
|||
(defvar image-dired-widget-list nil
|
||||
"List to keep track of meta data in edit buffer.")
|
||||
|
||||
(declare-function widget-forward "wid-edit" (arg))
|
||||
|
||||
;;;###autoload
|
||||
(defun image-dired-dired-edit-comment-and-tags ()
|
||||
"Edit comment and tags of current or marked image files.
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ means display it in the right marginal area."
|
|||
"Insert IMAGE into current buffer at point.
|
||||
IMAGE is displayed by inserting STRING into the current buffer
|
||||
with a `display' property whose value is the image. STRING
|
||||
defaults to the empty string if you omit it.
|
||||
defaults to a single space if you omit it.
|
||||
AREA is where to display the image. AREA nil or omitted means
|
||||
display it in the text area, a value of `left-margin' means
|
||||
display it in the left marginal area, a value of `right-margin'
|
||||
|
|
@ -467,8 +467,8 @@ height of the image; integer values are taken as pixel values."
|
|||
(defun insert-sliced-image (image &optional string area rows cols)
|
||||
"Insert IMAGE into current buffer at point.
|
||||
IMAGE is displayed by inserting STRING into the current buffer
|
||||
with a `display' property whose value is the image. STRING is
|
||||
defaulted if you omit it.
|
||||
with a `display' property whose value is the image. The default
|
||||
STRING is a single space.
|
||||
AREA is where to display the image. AREA nil or omitted means
|
||||
display it in the text area, a value of `left-margin' means
|
||||
display it in the left marginal area, a value of `right-margin'
|
||||
|
|
|
|||
|
|
@ -546,9 +546,7 @@ The returned alist DOES NOT share structure with MENULIST."
|
|||
Return a split and sorted copy of ALIST. The returned alist DOES
|
||||
NOT share structure with ALIST."
|
||||
(mapcar (lambda (elt)
|
||||
(if (and (consp elt)
|
||||
(stringp (car elt))
|
||||
(listp (cdr elt)))
|
||||
(if (imenu--subalist-p elt)
|
||||
(imenu--split-menu (cdr elt) (car elt))
|
||||
elt))
|
||||
alist))
|
||||
|
|
|
|||
11
lisp/info.el
11
lisp/info.el
|
|
@ -4836,6 +4836,17 @@ first line or header line, and for breadcrumb links.")
|
|||
;; current Info node.
|
||||
(eval-when-compile (require 'speedbar))
|
||||
|
||||
(declare-function speedbar-add-expansion-list "speedbar" (new-list))
|
||||
(declare-function speedbar-center-buffer-smartly "speedbar" ())
|
||||
(declare-function speedbar-change-expand-button-char "speedbar" (char))
|
||||
(declare-function speedbar-change-initial-expansion-list "speedbar" (new-default))
|
||||
(declare-function speedbar-delete-subblock "speedbar" (indent))
|
||||
(declare-function speedbar-make-specialized-keymap "speedbar" ())
|
||||
(declare-function speedbar-make-tag-line "speedbar"
|
||||
(exp-button-type exp-button-char exp-button-function
|
||||
exp-button-data tag-button tag-button-function
|
||||
tag-button-data tag-button-face depth))
|
||||
|
||||
(defvar Info-speedbar-key-map nil
|
||||
"Keymap used when in the Info display mode.")
|
||||
|
||||
|
|
|
|||
|
|
@ -521,12 +521,12 @@ It is needed when D-Bus signals or errors arrive, because there
|
|||
is no information where to trace the message.")
|
||||
|
||||
(defun tramp-gvfs-dbus-event-error (event err)
|
||||
"Called when a D-Bus error message arrives, see `dbus-event-error-hooks'."
|
||||
"Called when a D-Bus error message arrives, see `dbus-event-error-functions'."
|
||||
(when tramp-gvfs-dbus-event-vector
|
||||
(tramp-message tramp-gvfs-dbus-event-vector 10 "%S" event)
|
||||
(tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err))))
|
||||
|
||||
(add-hook 'dbus-event-error-hooks 'tramp-gvfs-dbus-event-error)
|
||||
(add-hook 'dbus-event-error-functions 'tramp-gvfs-dbus-event-error)
|
||||
|
||||
|
||||
;; File name primitives.
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ FILE is created there."
|
|||
(goto-char (point-min))
|
||||
(search-forward (concat (int-to-string score)
|
||||
" " (user-login-name) " "
|
||||
marker-string))
|
||||
marker-string) nil t)
|
||||
(beginning-of-line)))))
|
||||
|
||||
(defun gamegrid-add-score-insecure (file score &optional directory)
|
||||
|
|
|
|||
|
|
@ -1383,6 +1383,10 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
|
|||
(eval-when-compile
|
||||
(require 'easymenu)) ; to avoid compilation gripes
|
||||
|
||||
(declare-function easy-menu-add-item "easymenu"
|
||||
(map path item &optional before))
|
||||
(declare-function easy-menu-remove-item "easymenu" (map path name))
|
||||
|
||||
(eval-and-compile
|
||||
(defun pr-global-menubar (pr-menu-spec)
|
||||
(require 'easymenu)
|
||||
|
|
@ -6079,6 +6083,8 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
|
|||
(and pr-i-region ; let region activated
|
||||
(pr-keep-region-active)))
|
||||
|
||||
(declare-function widget-field-action "wid-edit" (widget &optional _event))
|
||||
(declare-function widget-value-set "wid-edit" (widget value))
|
||||
|
||||
(defun pr-insert-section-1 ()
|
||||
;; 1. Print:
|
||||
|
|
|
|||
|
|
@ -105,7 +105,10 @@
|
|||
(eval-and-compile
|
||||
(defconst ruby-here-doc-beg-re
|
||||
"\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)"
|
||||
"Regexp to match the beginning of a heredoc."))
|
||||
"Regexp to match the beginning of a heredoc.")
|
||||
|
||||
(defconst ruby-expression-expansion-re
|
||||
"[^\\]\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)\\)"))
|
||||
|
||||
(defun ruby-here-doc-end-match ()
|
||||
"Return a regexp to find the end of a heredoc.
|
||||
|
|
@ -384,7 +387,9 @@ and `\\' when preceded by `?'."
|
|||
(looking-at "class\\s *<<"))))
|
||||
|
||||
(defun ruby-expr-beg (&optional option)
|
||||
"TODO: document."
|
||||
"Check if point is possibly at the beginning of an expression.
|
||||
OPTION specifies the type of the expression.
|
||||
Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'."
|
||||
(save-excursion
|
||||
(store-match-data nil)
|
||||
(let ((space (skip-chars-backward " \t"))
|
||||
|
|
@ -397,10 +402,10 @@ and `\\' when preceded by `?'."
|
|||
(or (eq (char-syntax (char-before (point))) ?w)
|
||||
(ruby-special-char-p))))
|
||||
nil)
|
||||
((and (eq option 'heredoc) (< space 0))
|
||||
(not (progn (goto-char start) (ruby-singleton-class-p))))
|
||||
((or (looking-at ruby-operator-re)
|
||||
(looking-at "[\\[({,;]")
|
||||
((looking-at ruby-operator-re))
|
||||
((eq option 'heredoc)
|
||||
(and (< space 0) (not (ruby-singleton-class-p start))))
|
||||
((or (looking-at "[\\[({,;]")
|
||||
(and (looking-at "[!?]")
|
||||
(or (not (eq option 'modifier))
|
||||
(bolp)
|
||||
|
|
@ -865,39 +870,54 @@ calculating indentation on the lines after it."
|
|||
(beginning-of-line)))))
|
||||
|
||||
(defun ruby-move-to-block (n)
|
||||
"Move to the beginning (N < 0) or the end (N > 0) of the current block
|
||||
or blocks containing the current block."
|
||||
;; TODO: Make this work for n > 1,
|
||||
;; make it not loop for n = 0,
|
||||
;; document body
|
||||
"Move to the beginning (N < 0) or the end (N > 0) of the
|
||||
current block, a sibling block, or an outer block. Do that (abs N) times."
|
||||
(let ((orig (point))
|
||||
(start (ruby-calculate-indent))
|
||||
(down (looking-at (if (< n 0) ruby-block-end-re
|
||||
(concat "\\<\\(" ruby-block-beg-re "\\)\\>"))))
|
||||
pos done)
|
||||
(while (and (not done) (not (if (< n 0) (bobp) (eobp))))
|
||||
(forward-line n)
|
||||
(cond
|
||||
((looking-at "^\\s *$"))
|
||||
((looking-at "^\\s *#"))
|
||||
((and (> n 0) (looking-at "^=begin\\>"))
|
||||
(re-search-forward "^=end\\>"))
|
||||
((and (< n 0) (looking-at "^=end\\>"))
|
||||
(re-search-backward "^=begin\\>"))
|
||||
(t
|
||||
(setq pos (current-indentation))
|
||||
(signum (if (> n 0) 1 -1))
|
||||
(backward (< n 0))
|
||||
down pos done)
|
||||
(dotimes (_ (abs n))
|
||||
(setq done nil)
|
||||
(setq down (save-excursion
|
||||
(back-to-indentation)
|
||||
;; There is a block start or block end keyword on this
|
||||
;; line, don't need to look for another block.
|
||||
(and (re-search-forward
|
||||
(if backward ruby-block-end-re
|
||||
(concat "\\_<\\(" ruby-block-beg-re "\\)\\_>"))
|
||||
(line-end-position) t)
|
||||
(not (nth 8 (syntax-ppss))))))
|
||||
(while (and (not done) (not (if backward (bobp) (eobp))))
|
||||
(forward-line signum)
|
||||
(cond
|
||||
((< start pos)
|
||||
(setq down t))
|
||||
((and down (= pos start))
|
||||
(setq done t))
|
||||
((> start pos)
|
||||
(setq done t)))))
|
||||
(if done
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(if (looking-at (concat "\\<\\(" ruby-block-mid-re "\\)\\>"))
|
||||
(setq done nil)))))
|
||||
;; Skip empty and commented out lines.
|
||||
((looking-at "^\\s *$"))
|
||||
((looking-at "^\\s *#"))
|
||||
;; Skip block comments;
|
||||
((and (not backward) (looking-at "^=begin\\>"))
|
||||
(re-search-forward "^=end\\>"))
|
||||
((and backward (looking-at "^=end\\>"))
|
||||
(re-search-backward "^=begin\\>"))
|
||||
(t
|
||||
(setq pos (current-indentation))
|
||||
(cond
|
||||
;; Deeper indentation, we found a block.
|
||||
;; FIXME: We can't recognize empty blocks this way.
|
||||
((< start pos)
|
||||
(setq down t))
|
||||
;; Block found, and same indentation as when started, stop.
|
||||
((and down (= pos start))
|
||||
(setq done t))
|
||||
;; Shallower indentation, means outer block, can stop now.
|
||||
((> start pos)
|
||||
(setq done t)))))
|
||||
(if done
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
;; Not really at the first or last line of the block, move on.
|
||||
(if (looking-at (concat "\\<\\(" ruby-block-mid-re "\\)\\>"))
|
||||
(setq done nil))))))
|
||||
(back-to-indentation)))
|
||||
|
||||
(defun ruby-beginning-of-block (&optional arg)
|
||||
|
|
@ -909,8 +929,7 @@ With ARG, move up multiple blocks."
|
|||
(defun ruby-end-of-block (&optional arg)
|
||||
"Move forward to the end of the current block.
|
||||
With ARG, move out of multiple blocks."
|
||||
;; Passing a value > 1 to ruby-move-to-block currently doesn't work.
|
||||
(interactive)
|
||||
(interactive "p")
|
||||
(ruby-move-to-block (or arg 1)))
|
||||
|
||||
(defun ruby-forward-sexp (&optional arg)
|
||||
|
|
@ -1033,21 +1052,19 @@ For example:
|
|||
#exit
|
||||
String#gsub
|
||||
Net::HTTP#active?
|
||||
File::open.
|
||||
File.open
|
||||
|
||||
See `add-log-current-defun-function'."
|
||||
;; TODO: Document body
|
||||
;; Why does this append a period to class methods?
|
||||
(condition-case nil
|
||||
(save-excursion
|
||||
(let (mname mlist (indent 0))
|
||||
;; get current method (or class/module)
|
||||
;; Get the current method definition (or class/module).
|
||||
(if (re-search-backward
|
||||
(concat "^[ \t]*" ruby-defun-beg-re "[ \t]+"
|
||||
"\\("
|
||||
;; \\. and :: for class method
|
||||
"\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)"
|
||||
"+\\)")
|
||||
;; \\. and :: for class methods
|
||||
"\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)"
|
||||
"+\\)")
|
||||
nil t)
|
||||
(progn
|
||||
(setq mname (match-string 2))
|
||||
|
|
@ -1056,7 +1073,7 @@ See `add-log-current-defun-function'."
|
|||
(goto-char (match-beginning 1))
|
||||
(setq indent (current-column))
|
||||
(beginning-of-line)))
|
||||
;; nest class/module
|
||||
;; Walk up the class/module nesting.
|
||||
(while (and (> indent 0)
|
||||
(re-search-backward
|
||||
(concat
|
||||
|
|
@ -1069,28 +1086,26 @@ See `add-log-current-defun-function'."
|
|||
(setq mlist (cons (match-string 2) mlist))
|
||||
(setq indent (current-column))
|
||||
(beginning-of-line))))
|
||||
;; Process the method name.
|
||||
(when mname
|
||||
(let ((mn (split-string mname "\\.\\|::")))
|
||||
(if (cdr mn)
|
||||
(progn
|
||||
(cond
|
||||
((string-equal "" (car mn))
|
||||
(setq mn (cdr mn) mlist nil))
|
||||
((string-equal "self" (car mn))
|
||||
(setq mn (cdr mn)))
|
||||
((let ((ml (nreverse mlist)))
|
||||
(unless (string-equal "self" (car mn)) ; def self.foo
|
||||
;; def C.foo
|
||||
(let ((ml (nreverse mlist)))
|
||||
;; If the method name references one of the
|
||||
;; containing modules, drop the more nested ones.
|
||||
(while ml
|
||||
(if (string-equal (car ml) (car mn))
|
||||
(setq mlist (nreverse (cdr ml)) ml nil))
|
||||
(or (setq ml (cdr ml)) (nreverse mlist))))))
|
||||
(if mlist
|
||||
(setcdr (last mlist) mn)
|
||||
(setq mlist mn))
|
||||
(setq mn (last mn 2))
|
||||
(setq mname (concat "." (cadr mn)))
|
||||
(setcdr mn nil))
|
||||
(or (setq ml (cdr ml)) (nreverse mlist))))
|
||||
(if mlist
|
||||
(setcdr (last mlist) (butlast mn))
|
||||
(setq mlist (butlast mn))))
|
||||
(setq mname (concat "." (car (last mn)))))
|
||||
(setq mname (concat "#" mname)))))
|
||||
;; generate string
|
||||
;; Generate the string.
|
||||
(if (consp mlist)
|
||||
(setq mlist (mapconcat (function identity) mlist "::")))
|
||||
(if mname
|
||||
|
|
@ -1237,7 +1252,19 @@ It will be properly highlighted even when the call omits parens."))
|
|||
;; Handle percent literals: %w(), %q{}, etc.
|
||||
((concat "\\(?:^\\|[[ \t\n<+(,=]\\)" ruby-percent-literal-beg-re)
|
||||
(1 (prog1 "|" (ruby-syntax-propertize-percent-literal end)))))
|
||||
(point) end))
|
||||
(point) end)
|
||||
(remove-text-properties start end '(ruby-expansion-match-data))
|
||||
(goto-char start)
|
||||
;; Find all expression expansions and
|
||||
;; - set the syntax of all text inside to whitespace,
|
||||
;; - save the match data to a text property, for font-locking later.
|
||||
(while (re-search-forward ruby-expression-expansion-re end 'move)
|
||||
(when (ruby-in-ppss-context-p 'string)
|
||||
(put-text-property (match-beginning 2) (match-end 2)
|
||||
'syntax-table (string-to-syntax "-"))
|
||||
(put-text-property (match-beginning 2) (1+ (match-beginning 2))
|
||||
'ruby-expansion-match-data
|
||||
(match-data)))))
|
||||
|
||||
(defun ruby-syntax-propertize-heredoc (limit)
|
||||
(let ((ppss (syntax-ppss))
|
||||
|
|
@ -1551,7 +1578,8 @@ See `font-lock-syntax-table'.")
|
|||
ruby-keyword-end-re)
|
||||
2)
|
||||
;; here-doc beginnings
|
||||
(list ruby-here-doc-beg-re 0 'font-lock-string-face)
|
||||
`(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0))
|
||||
'font-lock-string-face))
|
||||
;; variables
|
||||
'("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>"
|
||||
2 font-lock-variable-name-face)
|
||||
|
|
@ -1569,7 +1597,7 @@ See `font-lock-syntax-table'.")
|
|||
'("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-constant-face)
|
||||
;; expression expansion
|
||||
'(ruby-match-expression-expansion
|
||||
0 font-lock-variable-name-face t)
|
||||
2 font-lock-variable-name-face t)
|
||||
;; warn lower camel case
|
||||
;'("\\<[a-z]+[a-z0-9]*[A-Z][A-Za-z0-9]*\\([!?]?\\|\\>\\)"
|
||||
; 0 font-lock-warning-face)
|
||||
|
|
@ -1577,9 +1605,14 @@ See `font-lock-syntax-table'.")
|
|||
"Additional expressions to highlight in Ruby mode.")
|
||||
|
||||
(defun ruby-match-expression-expansion (limit)
|
||||
(when (re-search-forward "[^\\]\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)\\)" limit 'move)
|
||||
(or (ruby-in-ppss-context-p 'string)
|
||||
(ruby-match-expression-expansion limit))))
|
||||
(let ((prop 'ruby-expansion-match-data) pos value)
|
||||
(when (and (setq pos (next-single-char-property-change (point) prop
|
||||
nil limit))
|
||||
(> pos (point)))
|
||||
(goto-char pos)
|
||||
(or (and (setq value (get-text-property pos prop))
|
||||
(progn (set-match-data value) t))
|
||||
(ruby-match-expression-expansion limit)))))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode ruby-mode prog-mode "Ruby"
|
||||
|
|
|
|||
|
|
@ -3608,6 +3608,7 @@ functions to do caching and flushing if appropriate."
|
|||
nil
|
||||
|
||||
(eval-when-compile (condition-case nil (require 'imenu) (error nil)))
|
||||
(declare-function imenu--make-index-alist "imenu" (&optional no-error))
|
||||
|
||||
(defun speedbar-fetch-dynamic-imenu (file)
|
||||
"Load FILE into a buffer, and generate tags using Imenu.
|
||||
|
|
|
|||
26
lisp/subr.el
26
lisp/subr.el
|
|
@ -195,11 +195,6 @@ value of last one, or nil if there are none.
|
|||
(declare (indent 1) (debug t))
|
||||
(cons 'if (cons cond (cons nil body))))
|
||||
|
||||
(if (null (featurep 'cl))
|
||||
(progn
|
||||
;; If we reload subr.el after having loaded CL, be careful not to
|
||||
;; overwrite CL's extended definition of `dolist', `dotimes', `declare'.
|
||||
|
||||
(defmacro dolist (spec &rest body)
|
||||
"Loop over a list.
|
||||
Evaluate BODY with VAR bound to each car from LIST, in turn.
|
||||
|
|
@ -279,7 +274,6 @@ The possible values of SPECS are specified by
|
|||
`defun-declarations-alist' and `macro-declarations-alist'."
|
||||
;; FIXME: edebug spec should pay attention to defun-declarations-alist.
|
||||
nil)
|
||||
))
|
||||
|
||||
(defmacro ignore-errors (&rest body)
|
||||
"Execute BODY; if an error occurs, return nil.
|
||||
|
|
@ -3195,6 +3189,7 @@ in which case `save-window-excursion' cannot help."
|
|||
;; Return nil.
|
||||
nil)
|
||||
|
||||
;; Doc is very similar to with-temp-buffer-window.
|
||||
(defmacro with-output-to-temp-buffer (bufname &rest body)
|
||||
"Bind `standard-output' to buffer BUFNAME, eval BODY, then show that buffer.
|
||||
|
||||
|
|
@ -3220,7 +3215,9 @@ with the buffer BUFNAME temporarily current. It runs the hook
|
|||
`temp-buffer-show-hook' after displaying buffer BUFNAME, with that
|
||||
buffer temporarily current, and the window that was used to display it
|
||||
temporarily selected. But it doesn't run `temp-buffer-show-hook'
|
||||
if it uses `temp-buffer-show-function'."
|
||||
if it uses `temp-buffer-show-function'.
|
||||
|
||||
See the related form `with-temp-buffer-window'."
|
||||
(declare (debug t))
|
||||
(let ((old-dir (make-symbol "old-dir"))
|
||||
(buf (make-symbol "buf")))
|
||||
|
|
@ -3967,11 +3964,16 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
|
|||
(put symbol 'hookvar (or hookvar 'mail-send-hook)))
|
||||
|
||||
(defun set-temporary-overlay-map (map &optional keep-pred)
|
||||
"Set MAP as a temporary overlay map.
|
||||
When KEEP-PRED is `t', using a key from the temporary keymap
|
||||
leaves this keymap activated. KEEP-PRED can also be a function,
|
||||
which will have the same effect when it returns `t'.
|
||||
When KEEP-PRED is nil, the temporary keymap is used only once."
|
||||
"Set MAP as a temporary keymap taking precedence over most other keymaps.
|
||||
Note that this does NOT take precedence over the \"overriding\" maps
|
||||
`overriding-terminal-local-map' and `overriding-local-map' (or the
|
||||
`keymap' text property). Unlike those maps, if no match for a key is
|
||||
found in MAP, the normal key lookup sequence then continues.
|
||||
|
||||
Normally, MAP is used only once. If the optional argument
|
||||
KEEP-PRED is t, MAP stays active if a key from MAP is used.
|
||||
KEEP-PRED can also be a function of no arguments: if it returns
|
||||
non-nil then MAP stays active."
|
||||
(let* ((clearfunsym (make-symbol "clear-temporary-overlay-map"))
|
||||
(overlaysym (make-symbol "t"))
|
||||
(alist (list (cons overlaysym map)))
|
||||
|
|
|
|||
21
lisp/term.el
21
lisp/term.el
|
|
@ -397,6 +397,12 @@
|
|||
(require 'ring)
|
||||
(require 'ehelp)
|
||||
|
||||
(declare-function ring-empty-p "ring" (ring))
|
||||
(declare-function ring-ref "ring" (ring index))
|
||||
(declare-function ring-insert-at-beginning "ring" (ring item))
|
||||
(declare-function ring-length "ring" (ring))
|
||||
(declare-function ring-insert "ring" (ring item))
|
||||
|
||||
(defgroup term nil
|
||||
"General command interpreter in a window."
|
||||
:group 'processes)
|
||||
|
|
@ -4178,11 +4184,16 @@ the process. Any more args are arguments to PROGRAM."
|
|||
(term-mode)
|
||||
(term-char-mode)
|
||||
|
||||
;; I wanna have find-file on C-x C-f -mm
|
||||
;; your mileage may definitely vary, maybe it's better to put this in your
|
||||
;; .emacs ...
|
||||
|
||||
(term-set-escape-char ?\C-x)
|
||||
;; Historical baggage. A call to term-set-escape-char used to not
|
||||
;; undo any previous call to t-s-e-c. Because of this, ansi-term
|
||||
;; ended up with both C-x and C-c as escape chars. Who knows what
|
||||
;; the original intention was, but people could have become used to
|
||||
;; either. (Bug#12842)
|
||||
(let (term-escape-char)
|
||||
;; I wanna have find-file on C-x C-f -mm
|
||||
;; your mileage may definitely vary, maybe it's better to put this in your
|
||||
;; .emacs ...
|
||||
(term-set-escape-char ?\C-x))
|
||||
|
||||
(switch-to-buffer term-ansi-buffer-name))
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@
|
|||
(declare-function w32-send-sys-command "w32fns.c")
|
||||
(declare-function set-message-beep "w32fns.c")
|
||||
|
||||
(declare-function cygwin-convert-path-from-windows "cygw32.c"
|
||||
(path &optional absolute_p))
|
||||
|
||||
;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
|
||||
(if (fboundp 'new-fontset)
|
||||
(require 'fontset))
|
||||
|
|
@ -116,7 +119,11 @@
|
|||
"/")
|
||||
"/")))
|
||||
(dnd-handle-one-url window 'private
|
||||
(concat "file:" file-name)))
|
||||
(concat
|
||||
(if (eq system-type 'cygwin)
|
||||
"file://"
|
||||
"file:")
|
||||
file-name)))
|
||||
|
||||
(defun w32-drag-n-drop (event &optional new-frame)
|
||||
"Edit the files listed in the drag-n-drop EVENT.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
(defun url-path-and-query (urlobj)
|
||||
"Return the path and query components of URLOBJ.
|
||||
These two components are store together in the FILENAME slot of
|
||||
These two components are stored together in the FILENAME slot of
|
||||
the object. The return value of this function is (PATH . QUERY),
|
||||
where each of PATH and QUERY are strings or nil."
|
||||
(let ((name (url-filename urlobj))
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
|
|||
;; We also used to match the filename in column 0 without any
|
||||
;; meta-info before it, but I believe this can never happen.
|
||||
(concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)? \\)"
|
||||
(regexp-quote (file-name-nondirectory file)))
|
||||
(regexp-quote (file-relative-name file)))
|
||||
nil t)
|
||||
(cond
|
||||
;; Merge successful, we are in sync with repository now
|
||||
|
|
|
|||
|
|
@ -881,6 +881,8 @@ ALL-FRAMES is also used to decide whether to split the window."
|
|||
(vcursor-disable -1))))
|
||||
)
|
||||
|
||||
(declare-function compare-windows-skip-whitespace "compare-w" (start))
|
||||
|
||||
;; vcursor-compare-windows is copied from compare-w.el with only
|
||||
;; minor modifications; these are too bound up with the function
|
||||
;; to make it really useful to call compare-windows itself.
|
||||
|
|
|
|||
174
lisp/window.el
174
lisp/window.el
|
|
@ -142,41 +142,46 @@ to `display-buffer'."
|
|||
;; Return the window.
|
||||
window))))
|
||||
|
||||
;; Doc is very similar to with-output-to-temp-buffer.
|
||||
(defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body)
|
||||
"Evaluate BODY and display the buffer specified by BUFFER-OR-NAME.
|
||||
"Bind `standard-output' to BUFFER-OR-NAME, eval BODY, show the buffer.
|
||||
BUFFER-OR-NAME must specify either a live buffer, or the name of a
|
||||
buffer (if it does not exist, this macro creates it).
|
||||
|
||||
Make sure the specified buffer is empty before evaluating BODY.
|
||||
Do not make that buffer current for BODY. Instead, bind
|
||||
`standard-output' to that buffer, so that output generated with
|
||||
`prin1' and similar functions in BODY goes into that buffer.
|
||||
This construct makes buffer BUFFER-OR-NAME empty before running BODY.
|
||||
It does not make the buffer current for BODY.
|
||||
Instead it binds `standard-output' to that buffer, so that output
|
||||
generated with `prin1' and similar functions in BODY goes into
|
||||
the buffer.
|
||||
|
||||
After evaluating BODY, this marks the specified buffer unmodified and
|
||||
read-only, and displays it in a window via `display-buffer', passing
|
||||
ACTION as the action argument to `display-buffer'. It automatically
|
||||
shrinks the relevant window if `temp-buffer-resize-mode' is enabled.
|
||||
At the end of BODY, this marks the specified buffer unmodified and
|
||||
read-only, and displays it in a window (but does not select it, or make
|
||||
the buffer current). The display happens by calling `display-buffer'
|
||||
with the ACTION argument. If `temp-buffer-resize-mode' is enabled,
|
||||
the relevant window shrinks automatically.
|
||||
|
||||
Returns the value returned by BODY, unless QUIT-FUNCTION specifies
|
||||
a function. In that case, runs the function with two arguments -
|
||||
This returns the value returned by BODY, unless QUIT-FUNCTION specifies
|
||||
a function. In that case, it runs the function with two arguments -
|
||||
the window showing the specified buffer and the value returned by
|
||||
BODY - and returns the value returned by that function.
|
||||
|
||||
If the buffer is displayed on a new frame, the window manager may
|
||||
decide to select that frame. In that case, it's usually a good
|
||||
strategy if the function specified by QUIT-FUNCTION selects the
|
||||
window showing the buffer before reading a value from the
|
||||
minibuffer; for example, when asking a `yes-or-no-p' question.
|
||||
strategy if QUIT-FUNCTION selects the window showing the buffer
|
||||
before reading any value from the minibuffer; for example, when
|
||||
asking a `yes-or-no-p' question.
|
||||
|
||||
This construct is similar to `with-output-to-temp-buffer', but does
|
||||
not put the buffer in help mode, or call `temp-buffer-show-function'.
|
||||
It also runs different hooks, namely `temp-buffer-window-setup-hook'
|
||||
\(with the specified buffer current) and `temp-buffer-window-show-hook'
|
||||
\(with the specified buffer current and the window showing it selected).
|
||||
This runs the hook `temp-buffer-window-setup-hook' before BODY,
|
||||
with the specified buffer temporarily current. It runs the
|
||||
hook `temp-buffer-window-show-hook' after displaying the buffer,
|
||||
with that buffer temporarily current, and the window that was used to
|
||||
display it temporarily selected.
|
||||
|
||||
Since this macro calls `display-buffer', the window displaying
|
||||
the buffer is usually not selected and the specified buffer
|
||||
usually not made current. QUIT-FUNCTION can override that."
|
||||
This construct is similar to `with-output-to-temp-buffer', but
|
||||
runs different hooks. In particular, it does not run
|
||||
`temp-buffer-setup-hook', which usually puts the buffer in Help mode.
|
||||
Also, it does not call `temp-buffer-show-function' (the ACTION
|
||||
argument replaces this)."
|
||||
(declare (debug t))
|
||||
(let ((buffer (make-symbol "buffer"))
|
||||
(window (make-symbol "window"))
|
||||
|
|
@ -2571,8 +2576,7 @@ move it as far as possible in the desired direction."
|
|||
Interactively, if no argument is given, make the selected window
|
||||
one line taller. If optional argument HORIZONTAL is non-nil,
|
||||
make selected window wider by DELTA columns. If DELTA is
|
||||
negative, shrink selected window by -DELTA lines or columns.
|
||||
Return nil."
|
||||
negative, shrink selected window by -DELTA lines or columns."
|
||||
(interactive "p")
|
||||
(let ((minibuffer-window (minibuffer-window)))
|
||||
(cond
|
||||
|
|
@ -2605,8 +2609,7 @@ Interactively, if no argument is given, make the selected window
|
|||
one line smaller. If optional argument HORIZONTAL is non-nil,
|
||||
make selected window narrower by DELTA columns. If DELTA is
|
||||
negative, enlarge selected window by -DELTA lines or columns.
|
||||
Also see the `window-min-height' variable.
|
||||
Return nil."
|
||||
Also see the `window-min-height' variable."
|
||||
(interactive "p")
|
||||
(let ((minibuffer-window (minibuffer-window)))
|
||||
(cond
|
||||
|
|
@ -3049,8 +3052,10 @@ WINDOW must be a live window and defaults to the selected one."
|
|||
(set-marker (nth 2 entry) point))
|
||||
;; Make new markers.
|
||||
(list (copy-marker start)
|
||||
(copy-marker point)))))
|
||||
|
||||
(copy-marker
|
||||
;; Preserve window-point-insertion-type
|
||||
;; (Bug#12588).
|
||||
point window-point-insertion-type)))))
|
||||
(set-window-prev-buffers
|
||||
window (cons entry (window-prev-buffers window))))))))
|
||||
|
||||
|
|
@ -4555,13 +4560,17 @@ element is BUFFER."
|
|||
;; If WINDOW has a quit-restore parameter, reset its car.
|
||||
(setcar (window-parameter window 'quit-restore) 'same))
|
||||
;; WINDOW shows another buffer.
|
||||
(set-window-parameter
|
||||
window 'quit-restore
|
||||
(list 'other
|
||||
;; A quadruple of WINDOW's buffer, start, point and height.
|
||||
(list (window-buffer window) (window-start window)
|
||||
(window-point window) (window-total-size window))
|
||||
(selected-window) buffer))))
|
||||
(with-current-buffer (window-buffer window)
|
||||
(set-window-parameter
|
||||
window 'quit-restore
|
||||
(list 'other
|
||||
;; A quadruple of WINDOW's buffer, start, point and height.
|
||||
(list (current-buffer) (window-start window)
|
||||
;; Preserve window-point-insertion-type (Bug#12588).
|
||||
(copy-marker
|
||||
(window-point window) window-point-insertion-type)
|
||||
(window-total-size window))
|
||||
(selected-window) buffer)))))
|
||||
((eq type 'window)
|
||||
;; WINDOW has been created on an existing frame.
|
||||
(set-window-parameter
|
||||
|
|
@ -5170,11 +5179,12 @@ is higher than WINDOW."
|
|||
(error nil))))
|
||||
|
||||
(defun window--display-buffer (buffer window type &optional alist dedicated)
|
||||
"Display BUFFER in WINDOW and make its frame visible.
|
||||
"Display BUFFER in WINDOW.
|
||||
TYPE must be one of the symbols `reuse', `window' or `frame' and
|
||||
is passed unaltered to `display-buffer-record-window'. Set
|
||||
`window-dedicated-p' to DEDICATED if non-nil. Return WINDOW if
|
||||
BUFFER and WINDOW are live."
|
||||
is passed unaltered to `display-buffer-record-window'. ALIST is
|
||||
the alist argument of `display-buffer'. Set `window-dedicated-p'
|
||||
to DEDICATED if non-nil. Return WINDOW if BUFFER and WINDOW are
|
||||
live."
|
||||
(when (and (buffer-live-p buffer) (window-live-p window))
|
||||
(display-buffer-record-window type window buffer)
|
||||
(unless (eq buffer (window-buffer window))
|
||||
|
|
@ -5187,10 +5197,10 @@ BUFFER and WINDOW are live."
|
|||
(let ((parameter (window-parameter window 'quit-restore))
|
||||
(height (cdr (assq 'window-height alist)))
|
||||
(width (cdr (assq 'window-width alist))))
|
||||
(when (or (memq type '(window frame))
|
||||
(when (or (eq type 'window)
|
||||
(and (eq (car parameter) 'same)
|
||||
(memq (nth 1 parameter) '(window frame))))
|
||||
;; Adjust height of new window or frame.
|
||||
(eq (nth 1 parameter) 'window)))
|
||||
;; Adjust height of window if asked for.
|
||||
(cond
|
||||
((not height))
|
||||
((numberp height)
|
||||
|
|
@ -5201,19 +5211,12 @@ BUFFER and WINDOW are live."
|
|||
(* (window-total-size (frame-root-window window))
|
||||
height))))
|
||||
(delta (- new-height (window-total-size window))))
|
||||
(cond
|
||||
((and (window--resizable-p window delta nil 'safe)
|
||||
(window-combined-p window))
|
||||
(window-resize window delta nil 'safe))
|
||||
((or (eq type 'frame)
|
||||
(and (eq (car parameter) 'same)
|
||||
(eq (nth 1 parameter) 'frame)))
|
||||
(set-frame-height
|
||||
(window-frame window)
|
||||
(+ (frame-height (window-frame window)) delta))))))
|
||||
(when (and (window--resizable-p window delta nil 'safe)
|
||||
(window-combined-p window))
|
||||
(window-resize window delta nil 'safe))))
|
||||
((functionp height)
|
||||
(ignore-errors (funcall height window))))
|
||||
;; Adjust width of a window or frame.
|
||||
;; Adjust width of window if asked for.
|
||||
(cond
|
||||
((not width))
|
||||
((numberp width)
|
||||
|
|
@ -5224,18 +5227,12 @@ BUFFER and WINDOW are live."
|
|||
(* (window-total-size (frame-root-window window) t)
|
||||
width))))
|
||||
(delta (- new-width (window-total-size window t))))
|
||||
(cond
|
||||
((and (window--resizable-p window delta t 'safe)
|
||||
(window-combined-p window t))
|
||||
(window-resize window delta t 'safe))
|
||||
((or (eq type 'frame)
|
||||
(and (eq (car parameter) 'same)
|
||||
(eq (nth 1 parameter) 'frame)))
|
||||
(set-frame-width
|
||||
(window-frame window)
|
||||
(+ (frame-width (window-frame window)) delta))))))
|
||||
(when (and (window--resizable-p window delta t 'safe)
|
||||
(window-combined-p window t))
|
||||
(window-resize window delta t 'safe))))
|
||||
((functionp width)
|
||||
(ignore-errors (funcall width window))))))
|
||||
|
||||
window))
|
||||
|
||||
(defun window--maybe-raise-frame (frame)
|
||||
|
|
@ -5295,13 +5292,19 @@ See `display-buffer' for details.")
|
|||
"Alist of conditional actions for `display-buffer'.
|
||||
This is a list of elements (CONDITION . ACTION), where:
|
||||
|
||||
CONDITION is either a regexp matching buffer names, or a function
|
||||
that takes a buffer and returns a boolean.
|
||||
CONDITION is either a regexp matching buffer names, or a
|
||||
function that takes two arguments - a buffer name and the
|
||||
ACTION argument of `display-buffer' - and returns a boolean.
|
||||
|
||||
ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a
|
||||
function or a list of functions. Each such function should
|
||||
accept two arguments: a buffer to display and an alist of the
|
||||
same form as ALIST. See `display-buffer' for details."
|
||||
same form as ALIST. See `display-buffer' for details.
|
||||
|
||||
`display-buffer' scans this alist until it either finds a
|
||||
matching regular expression or the function specified by a
|
||||
condition returns non-nil. In any of these cases, it adds the
|
||||
associated action to the list of actions it will try."
|
||||
:type `(alist :key-type
|
||||
(choice :tag "Condition"
|
||||
regexp
|
||||
|
|
@ -5335,15 +5338,16 @@ specified, e.g. by the user options `display-buffer-alist' or
|
|||
`display-buffer-base-action'. See `display-buffer'.")
|
||||
(put 'display-buffer-fallback-action 'risky-local-variable t)
|
||||
|
||||
(defun display-buffer-assq-regexp (buffer-name alist)
|
||||
"Retrieve ALIST entry corresponding to BUFFER-NAME."
|
||||
(defun display-buffer-assq-regexp (buffer-name alist action)
|
||||
"Retrieve ALIST entry corresponding to BUFFER-NAME.
|
||||
ACTION is the action argument passed to `display-buffer'."
|
||||
(catch 'match
|
||||
(dolist (entry alist)
|
||||
(let ((key (car entry)))
|
||||
(when (or (and (stringp key)
|
||||
(string-match-p key buffer-name))
|
||||
(and (symbolp key) (functionp key)
|
||||
(funcall key buffer-name alist)))
|
||||
(and (functionp key)
|
||||
(funcall key buffer-name action)))
|
||||
(throw 'match (cdr entry)))))))
|
||||
|
||||
(defvar display-buffer--same-window-action
|
||||
|
|
@ -5453,8 +5457,8 @@ argument, ACTION is t."
|
|||
(funcall display-buffer-function buffer inhibit-same-window)
|
||||
;; Otherwise, use the defined actions.
|
||||
(let* ((user-action
|
||||
(display-buffer-assq-regexp (buffer-name buffer)
|
||||
display-buffer-alist))
|
||||
(display-buffer-assq-regexp
|
||||
(buffer-name buffer) display-buffer-alist action))
|
||||
(special-action (display-buffer--special-action buffer))
|
||||
;; Extra actions from the arguments to this function:
|
||||
(extra-action
|
||||
|
|
@ -6068,22 +6072,26 @@ of `fit-frame-to-buffer-max-height' and `window-min-height'."
|
|||
:group 'help)
|
||||
|
||||
(defcustom fit-frame-to-buffer-bottom-margin 4
|
||||
"Bottom margin for `fit-frame-to-buffer'.
|
||||
This is the number of lines `fit-frame-to-buffer' leaves free at the
|
||||
bottom of the display in order to not obscure the system task bar."
|
||||
"Bottom margin for the command `fit-frame-to-buffer'.
|
||||
This is the number of lines that function leaves free at the bottom of
|
||||
the display, in order to not obscure any system task bar or panel.
|
||||
If you do not have one (or if it is vertical) you might want to
|
||||
reduce this. If it is thicker, you might want to increase this."
|
||||
;; If you set this too small, fit-frame-to-buffer can shift the
|
||||
;; frame up to avoid the panel.
|
||||
:type 'integer
|
||||
:version "24.3"
|
||||
:group 'windows)
|
||||
|
||||
(defun fit-frame-to-buffer (&optional frame max-height min-height)
|
||||
"Adjust height of FRAME to display its buffer's contents exactly.
|
||||
"Adjust height of FRAME to display its buffer contents exactly.
|
||||
FRAME can be any live frame and defaults to the selected one.
|
||||
|
||||
Optional argument MAX-HEIGHT specifies the maximum height of
|
||||
FRAME and defaults to the height of the display below the current
|
||||
top line of FRAME minus FIT-FRAME-TO-BUFFER-BOTTOM-MARGIN.
|
||||
Optional argument MIN-HEIGHT specifies the minimum height of
|
||||
FRAME."
|
||||
Optional argument MAX-HEIGHT specifies the maximum height of FRAME.
|
||||
It defaults to the height of the display below the current
|
||||
top line of FRAME, minus `fit-frame-to-buffer-bottom-margin'.
|
||||
Optional argument MIN-HEIGHT specifies the minimum height of FRAME.
|
||||
The default corresponds to `window-min-height'."
|
||||
(interactive)
|
||||
(setq frame (window-normalize-frame frame))
|
||||
(let* ((root (frame-root-window frame))
|
||||
|
|
@ -6160,6 +6168,10 @@ defaults to `window-min-height'. Both MAX-HEIGHT and MIN-HEIGHT
|
|||
are specified in lines and include the mode line and header line,
|
||||
if any.
|
||||
|
||||
If WINDOW is a full height window, then if the option
|
||||
`fit-frame-to-buffer' is non-nil, this calls the function
|
||||
`fit-frame-to-buffer' to adjust the frame height.
|
||||
|
||||
Return the number of lines by which WINDOW was enlarged or
|
||||
shrunk. If an error occurs during resizing, return nil but don't
|
||||
signal an error.
|
||||
|
|
|
|||
|
|
@ -1303,12 +1303,12 @@ cache to be re-read."
|
|||
((null (cdr files)) (car (car files))) ; only 1 file for topic.
|
||||
(t
|
||||
;; Multiple files for topic, so must select 1.
|
||||
;; Unread the command event (TAB = ?\t = 9) that runs the command
|
||||
;; `minibuffer-complete' in order to automatically complete the
|
||||
;; minibuffer contents as far as possible.
|
||||
(setq unread-command-events '(9)) ; and delete any type-ahead!
|
||||
(completing-read "Manual file: " files nil 1
|
||||
(try-completion "" files) 'woman-file-history))))))
|
||||
;; Run the command `minibuffer-complete' in order to automatically
|
||||
;; complete the minibuffer contents as far as possible.
|
||||
(minibuffer-with-setup-hook
|
||||
(lambda () (let ((this-command this-command)) (minibuffer-complete)))
|
||||
(completing-read "Manual file: " files nil 1
|
||||
(try-completion "" files) 'woman-file-history)))))))
|
||||
|
||||
(defun woman-select (predicate list)
|
||||
"Select unique elements for which PREDICATE is true in LIST.
|
||||
|
|
@ -1550,11 +1550,13 @@ Also make each path-info component into a list.
|
|||
(woman-dired-define-keys)
|
||||
(add-hook 'dired-mode-hook 'woman-dired-define-keys))
|
||||
|
||||
(declare-function dired-get-filename "dired"
|
||||
(&optional localp no-error-if-not-filep))
|
||||
|
||||
;;;###autoload
|
||||
(defun woman-dired-find-file ()
|
||||
"In dired, run the WoMan man-page browser on this file."
|
||||
(interactive)
|
||||
;; dired-get-filename is defined in dired.el
|
||||
(woman-find-file (dired-get-filename)))
|
||||
|
||||
|
||||
|
|
@ -1947,6 +1949,9 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
|
|||
(message "Woman fill column set to %s."
|
||||
(if woman-fill-frame "frame width" woman-fill-column)))
|
||||
|
||||
(declare-function apropos-print "apropos"
|
||||
(do-keys spacing &optional text nosubst))
|
||||
|
||||
(defun woman-mini-help ()
|
||||
"Display WoMan commands and user options in an `apropos' buffer."
|
||||
;; Based on apropos-command in apropos.el
|
||||
|
|
@ -2191,7 +2196,7 @@ To be called on original buffer and any .so insertions."
|
|||
(face-underline-p face))
|
||||
(let ((face-no-ul (intern (concat face-name "-no-ul"))))
|
||||
(copy-face face face-no-ul)
|
||||
(set-face-underline-p face-no-ul nil)))))))
|
||||
(set-face-underline face-no-ul nil)))))))
|
||||
|
||||
;; Preprocessors
|
||||
;; =============
|
||||
|
|
|
|||
52
m4/euidaccess.m4
Normal file
52
m4/euidaccess.m4
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# euidaccess.m4 serial 15
|
||||
dnl Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_NONREENTRANT_EUIDACCESS],
|
||||
[
|
||||
AC_REQUIRE([gl_FUNC_EUIDACCESS])
|
||||
AC_CHECK_DECLS([setregid])
|
||||
AC_DEFINE([PREFER_NONREENTRANT_EUIDACCESS], [1],
|
||||
[Define this if you prefer euidaccess to return the correct result
|
||||
even if this would make it nonreentrant. Define this only if your
|
||||
entire application is safe even if the uid or gid might temporarily
|
||||
change. If your application uses signal handlers or threads it
|
||||
is probably not safe.])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_EUIDACCESS],
|
||||
[
|
||||
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
|
||||
|
||||
dnl Persuade glibc <unistd.h> to declare euidaccess().
|
||||
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
AC_CHECK_FUNCS([euidaccess])
|
||||
if test $ac_cv_func_euidaccess = no; then
|
||||
HAVE_EUIDACCESS=0
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/euidaccess.c.
|
||||
AC_DEFUN([gl_PREREQ_EUIDACCESS], [
|
||||
dnl Prefer POSIX faccessat over non-standard euidaccess.
|
||||
AC_CHECK_FUNCS_ONCE([faccessat])
|
||||
dnl Try various other non-standard fallbacks.
|
||||
AC_CHECK_HEADERS([libgen.h])
|
||||
AC_FUNC_GETGROUPS
|
||||
|
||||
# Solaris 9 and 10 need -lgen to get the eaccess function.
|
||||
# Save and restore LIBS so -lgen isn't added to it. Otherwise, *all*
|
||||
# programs in the package would end up linked with that potentially-shared
|
||||
# library, inducing unnecessary run-time overhead.
|
||||
LIB_EACCESS=
|
||||
AC_SUBST([LIB_EACCESS])
|
||||
gl_saved_libs=$LIBS
|
||||
AC_SEARCH_LIBS([eaccess], [gen],
|
||||
[test "$ac_cv_search_eaccess" = "none required" ||
|
||||
LIB_EACCESS=$ac_cv_search_eaccess])
|
||||
AC_CHECK_FUNCS([eaccess])
|
||||
LIBS=$gl_saved_libs
|
||||
])
|
||||
28
m4/faccessat.m4
Normal file
28
m4/faccessat.m4
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# serial 6
|
||||
# See if we need to provide faccessat replacement.
|
||||
|
||||
dnl Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Written by Eric Blake.
|
||||
|
||||
AC_DEFUN([gl_FUNC_FACCESSAT],
|
||||
[
|
||||
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
|
||||
|
||||
dnl Persuade glibc <unistd.h> to declare faccessat().
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
AC_CHECK_FUNCS_ONCE([faccessat])
|
||||
if test $ac_cv_func_faccessat = no; then
|
||||
HAVE_FACCESSAT=0
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/faccessat.m4.
|
||||
AC_DEFUN([gl_PREREQ_FACCESSAT],
|
||||
[
|
||||
AC_CHECK_FUNCS([access])
|
||||
])
|
||||
50
m4/fcntl_h.m4
Normal file
50
m4/fcntl_h.m4
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# serial 15
|
||||
# Configure fcntl.h.
|
||||
dnl Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Written by Paul Eggert.
|
||||
|
||||
AC_DEFUN([gl_FCNTL_H],
|
||||
[
|
||||
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_FCNTL_O_FLAGS])
|
||||
gl_NEXT_HEADERS([fcntl.h])
|
||||
|
||||
dnl Ensure the type pid_t gets defined.
|
||||
AC_REQUIRE([AC_TYPE_PID_T])
|
||||
|
||||
dnl Ensure the type mode_t gets defined.
|
||||
AC_REQUIRE([AC_TYPE_MODE_T])
|
||||
|
||||
dnl Check for declarations of anything we want to poison if the
|
||||
dnl corresponding gnulib module is not in use, if it is not common
|
||||
dnl enough to be declared everywhere.
|
||||
gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
|
||||
]], [fcntl openat])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
||||
dnl Define it also as a C macro, for the benefit of the unit tests.
|
||||
gl_MODULE_INDICATOR_FOR_TESTS([$1])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FCNTL_H_DEFAULTS],
|
||||
[
|
||||
GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL])
|
||||
GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING])
|
||||
GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN])
|
||||
GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT])
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
|
||||
HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
|
||||
REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL])
|
||||
REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
|
||||
REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])
|
||||
])
|
||||
107
m4/getgroups.m4
Normal file
107
m4/getgroups.m4
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# serial 18
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl A wrapper around AC_FUNC_GETGROUPS.
|
||||
|
||||
# Copyright (C) 1996-1997, 1999-2004, 2008-2012 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
m4_version_prereq([2.70], [] ,[
|
||||
|
||||
# This is taken from the following Autoconf patch:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
|
||||
AC_DEFUN([AC_FUNC_GETGROUPS],
|
||||
[
|
||||
AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
|
||||
AC_CHECK_FUNC([getgroups])
|
||||
|
||||
# If we don't yet have getgroups, see if it's in -lbsd.
|
||||
# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
|
||||
ac_save_LIBS=$LIBS
|
||||
if test $ac_cv_func_getgroups = no; then
|
||||
AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
|
||||
fi
|
||||
|
||||
# Run the program to test the functionality of the system-supplied
|
||||
# getgroups function only if there is such a function.
|
||||
if test $ac_cv_func_getgroups = yes; then
|
||||
AC_CACHE_CHECK([for working getgroups], [ac_cv_func_getgroups_works],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[AC_INCLUDES_DEFAULT],
|
||||
[[/* On Ultrix 4.3, getgroups (0, 0) always fails. */
|
||||
return getgroups (0, 0) == -1;]])
|
||||
],
|
||||
[ac_cv_func_getgroups_works=yes],
|
||||
[ac_cv_func_getgroups_works=no],
|
||||
[case "$host_os" in # ((
|
||||
# Guess yes on glibc systems.
|
||||
*-gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) ac_cv_func_getgroups_works="guessing no" ;;
|
||||
esac
|
||||
])
|
||||
])
|
||||
else
|
||||
ac_cv_func_getgroups_works=no
|
||||
fi
|
||||
case "$ac_cv_func_getgroups_works" in
|
||||
*yes)
|
||||
AC_DEFINE([HAVE_GETGROUPS], [1],
|
||||
[Define to 1 if your system has a working `getgroups' function.])
|
||||
;;
|
||||
esac
|
||||
LIBS=$ac_save_LIBS
|
||||
])# AC_FUNC_GETGROUPS
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_GETGROUPS],
|
||||
[
|
||||
AC_REQUIRE([AC_TYPE_GETGROUPS])
|
||||
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
||||
|
||||
AC_FUNC_GETGROUPS
|
||||
if test $ac_cv_func_getgroups != yes; then
|
||||
HAVE_GETGROUPS=0
|
||||
else
|
||||
if test "$ac_cv_type_getgroups" != gid_t \
|
||||
|| { case "$ac_cv_func_getgroups_works" in
|
||||
*yes) false;;
|
||||
*) true;;
|
||||
esac
|
||||
}; then
|
||||
REPLACE_GETGROUPS=1
|
||||
AC_DEFINE([GETGROUPS_ZERO_BUG], [1], [Define this to 1 if
|
||||
getgroups(0,NULL) does not return the number of groups.])
|
||||
else
|
||||
dnl Detect FreeBSD bug; POSIX requires getgroups(-1,ptr) to fail.
|
||||
AC_CACHE_CHECK([whether getgroups handles negative values],
|
||||
[gl_cv_func_getgroups_works],
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
|
||||
[[int size = getgroups (0, 0);
|
||||
gid_t *list = malloc (size * sizeof *list);
|
||||
return getgroups (-1, list) != -1;]])],
|
||||
[gl_cv_func_getgroups_works=yes],
|
||||
[gl_cv_func_getgroups_works=no],
|
||||
[case "$host_os" in
|
||||
# Guess yes on glibc systems.
|
||||
*-gnu*) gl_cv_func_getgroups_works="guessing yes" ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) gl_cv_func_getgroups_works="guessing no" ;;
|
||||
esac
|
||||
])])
|
||||
case "$gl_cv_func_getgroups_works" in
|
||||
*yes) ;;
|
||||
*) REPLACE_GETGROUPS=1 ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
|
||||
])
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue