From 3de25479216a2ecec509df8933047873d084f708 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Fri, 2 Apr 2010 23:09:13 +0200 Subject: [PATCH 001/101] imagemagick patch5 + minor mods --- configure | 986 +++++++++++++++++++++++++++--------------------- configure.in | 20 + lisp/image.el | 25 ++ src/Makefile.in | 10 +- src/image.c | 478 ++++++++++++++++++++++- 5 files changed, 1095 insertions(+), 424 deletions(-) diff --git a/configure b/configure index 7d0662ce346..bd8007cc712 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for emacs 24.0.50. +# Generated by GNU Autoconf 2.63 for emacs 24.0.50. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -638,150 +638,152 @@ ac_includes_default="\ ac_config_libobj_dir=src ac_header_list= ac_func_list= -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -MAINT -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -CPP -GREP -EGREP -LN_S -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -RANLIB -INSTALL_INFO -GZIP_PROG -MAKEINFO -LIBSOUND -PKG_CONFIG -ALSA_CFLAGS -ALSA_LIBS -CFLAGS_SOUND -SET_MAKE -XMKMF -HAVE_XSERVER -RSVG_CFLAGS -RSVG_LIBS -GTK_CFLAGS -GTK_LIBS -DBUS_CFLAGS -DBUS_LIBS -GCONF_CFLAGS -GCONF_LIBS -FONTCONFIG_CFLAGS -FONTCONFIG_LIBS -XFT_CFLAGS -XFT_LIBS -LIBOTF_CFLAGS -LIBOTF_LIBS -M17N_FLT_CFLAGS -M17N_FLT_LIBS -FREETYPE_CFLAGS -FREETYPE_LIBS -LIBXPM -LIBJPEG -LIBPNG -LIBTIFF -LIBGIF -LIBGPM -ALLOCA -liblockfile -LIBS_MAIL -LIBOBJS -NEED_SETGID -KMEM_GROUP -GETLOADAVG_LIBS -GETOPT_H -GETOPTOBJS -LIBHESIOD -LIBRESOLV -COM_ERRLIB -CRYPTOLIB -KRB5LIB -DESLIB -KRB4LIB -version -configuration -canonical -srcdir -lispdir -locallisppath -lisppath -x_default_search_path -etcdir -archlibdir -bitmapdir -gamedir -gameuser -c_switch_system -c_switch_machine -LD_SWITCH_X_SITE -LD_SWITCH_X_SITE_AUX -C_SWITCH_X_SITE -X_TOOLKIT_TYPE -machfile -opsysfile -ns_appdir -ns_appbindir -ns_appresdir -ns_appsrc -GNUSTEP_MAKEFILES -GNUSTEP_SYSTEM_HEADERS -GNUSTEP_SYSTEM_LIBRARIES -GNU_OBJC_CFLAGS -LIB_SRC_EXTRA_INSTALLABLES +ac_subst_vars='LTLIBOBJS OTHER_FILES -LTLIBOBJS' +LIB_SRC_EXTRA_INSTALLABLES +GNU_OBJC_CFLAGS +GNUSTEP_SYSTEM_LIBRARIES +GNUSTEP_SYSTEM_HEADERS +GNUSTEP_MAKEFILES +ns_appsrc +ns_appresdir +ns_appbindir +ns_appdir +opsysfile +machfile +X_TOOLKIT_TYPE +C_SWITCH_X_SITE +LD_SWITCH_X_SITE_AUX +LD_SWITCH_X_SITE +c_switch_machine +c_switch_system +gameuser +gamedir +bitmapdir +archlibdir +etcdir +x_default_search_path +lisppath +locallisppath +lispdir +srcdir +canonical +configuration +version +KRB4LIB +DESLIB +KRB5LIB +CRYPTOLIB +COM_ERRLIB +LIBRESOLV +LIBHESIOD +GETOPTOBJS +GETOPT_H +GETLOADAVG_LIBS +KMEM_GROUP +NEED_SETGID +LIBOBJS +LIBS_MAIL +liblockfile +ALLOCA +LIBGPM +LIBGIF +LIBTIFF +LIBPNG +LIBJPEG +LIBXPM +FREETYPE_LIBS +FREETYPE_CFLAGS +M17N_FLT_LIBS +M17N_FLT_CFLAGS +LIBOTF_LIBS +LIBOTF_CFLAGS +XFT_LIBS +XFT_CFLAGS +FONTCONFIG_LIBS +FONTCONFIG_CFLAGS +GCONF_LIBS +GCONF_CFLAGS +DBUS_LIBS +DBUS_CFLAGS +GTK_LIBS +GTK_CFLAGS +IMAGEMAGICK_LIBS +IMAGEMAGICK_CFLAGS +RSVG_LIBS +RSVG_CFLAGS +HAVE_XSERVER +XMKMF +SET_MAKE +CFLAGS_SOUND +ALSA_LIBS +ALSA_CFLAGS +PKG_CONFIG +LIBSOUND +MAKEINFO +GZIP_PROG +INSTALL_INFO +RANLIB +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +LN_S +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +MAINT +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -801,6 +803,7 @@ with_tiff with_gif with_png with_rsvg +with_imagemagick with_xft with_libotf with_m17n_flt @@ -1258,9 +1261,9 @@ fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2 + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; - *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1313,7 +1316,7 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: Working directory cannot be determined" >&2 + { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 @@ -1512,6 +1515,7 @@ Optional Packages: --without-gif don't compile with GIF image support --without-png don't compile with PNG image support --without-rsvg don't compile with SVG image support + --with-imagemagick compile with ImageMagick image support --without-xft don't use XFT for anti aliased fonts --without-libotf don't use libotf for OpenType font support --without-m17n-flt don't use m17n-flt for text shaping @@ -1610,7 +1614,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF emacs configure 24.0.50 -generated by GNU Autoconf 2.62 +generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -1624,7 +1628,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by emacs $as_me 24.0.50, which was -generated by GNU Autoconf 2.62. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -1747,8 +1751,8 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1954,6 +1958,8 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 @@ -2233,6 +2239,14 @@ else fi +# Check whether --with-imagemagick was given. +if test "${with_imagemagick+set}" = set; then + withval=$with_imagemagick; +else + with_imagemagick=no +fi + + # Check whether --with-xft was given. if test "${with_xft+set}" = set; then @@ -2773,15 +2787,6 @@ _ACEOF esac ;; - ## LynxOS ports - *-*-lynxos* ) - opsys=lynxos - case "${canonical}" in - i[3456]86-*-lynxos*) machine=intel386 ;; - powerpc-*-lynxos*) machine=powerpc ;; - esac - ;; - alpha*-*-linux-gnu* ) machine=alpha opsys=gnu-linux ;; @@ -2865,30 +2870,14 @@ _ACEOF *-sun-solaris* \ | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \ - | x86_64-*-solaris2* | x86_64-*-sunos5* \ - | powerpc*-*-solaris2* | rs6000-*-solaris2*) + | x86_64-*-solaris2* | x86_64-*-sunos5*) case "${canonical}" in i[3456]86-*-* ) machine=intel386 ;; amd64-*-*|x86_64-*-*) machine=amdx86-64 ;; - powerpc* | rs6000* ) machine=ibmrs6000 ;; sparc* ) machine=sparc ;; * ) unported=yes ;; esac case "${canonical}" in - *-sunos5.3* | *-solaris2.3* ) - opsys=sol2-3 - NON_GNU_CPP=/usr/ccs/lib/cpp - ;; - *-sunos5.4* | *-solaris2.4* ) - opsys=sol2-4 - NON_GNU_CPP=/usr/ccs/lib/cpp - RANLIB="ar -ts" - ;; - *-sunos5.5* | *-solaris2.5* ) - opsys=sol2-5 - NON_GNU_CPP=/usr/ccs/lib/cpp - RANLIB="ar -ts" - ;; *-sunos5.6* | *-solaris2.6* ) opsys=sol2-6 NON_GNU_CPP=/usr/ccs/lib/cpp @@ -2979,22 +2968,6 @@ esac if test x"${opsys}" = x; then case "${canonical}" in *-gnu* ) opsys=gnu ;; - *-sysv4.2uw* ) opsys=unixware ;; - *-sysv5uw* ) opsys=unixware ;; - *-sysv5OpenUNIX* ) opsys=unixware ;; - *-sysv4.1* | *-sysvr4.1* ) - NON_GNU_CPP=/usr/lib/cpp - opsys=usg5-4 ;; - *-sysv4.[2-9]* | *-sysvr4.[2-9]* ) - if [ x$NON_GNU_CPP = x ]; then - if [ -f /usr/ccs/lib/cpp ]; then - NON_GNU_CPP=/usr/ccs/lib/cpp - else - NON_GNU_CPP=/lib/cpp - fi - fi - opsys=usg5-4-2 ;; - *-sysv4* | *-sysvr4* ) opsys=usg5-4 ;; * ) unported=yes ;; @@ -3108,12 +3081,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3312,12 +3281,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3327,11 +3292,13 @@ fi fi -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 @@ -3461,11 +3428,13 @@ if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } + { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext @@ -3493,13 +3462,15 @@ $as_echo "$ac_try_echo") >&5 if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi fi fi @@ -3542,11 +3513,13 @@ for ac_file in conftest.exe conftest conftest.*; do esac done else - { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext @@ -3600,11 +3573,13 @@ else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext @@ -4276,11 +4251,13 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi ac_ext=c @@ -4663,8 +4640,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -4802,7 +4780,7 @@ fi $as_echo "$ac_cv_header_minix_config_h" >&6; } fi -if test $ac_cv_header_minix_config_h = yes; then +if test "x$ac_cv_header_minix_config_h" = x""yes; then MINIX=yes else MINIX= @@ -5250,11 +5228,13 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi ac_ext=c @@ -5439,12 +5419,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -5819,10 +5795,6 @@ configure___ use_mmap_for_buffers=yes configure___ use_mmap_for_buffers=no #endif -#ifndef C_DEBUG_SWITCH -#define C_DEBUG_SWITCH -g -#endif - #ifndef C_OPTIMIZE_SWITCH #ifdef __GNUC__ #define C_OPTIMIZE_SWITCH -O2 @@ -5854,18 +5826,18 @@ configure___ ld_switch_machine=LD_SWITCH_MACHINE /* Get the CFLAGS for tests in configure. */ #ifdef __GNUC__ -configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' +configure___ CFLAGS=C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' #else -configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}' +configure___ CFLAGS='${SPECIFIED_CFLAGS}' #endif #else /* not THIS_IS_CONFIGURE */ /* Get the CFLAGS for real compilation. */ #ifdef __GNUC__ -configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' +configure___ REAL_CFLAGS=C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' #else -configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}' +configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}' #endif #endif /* not THIS_IS_CONFIGURE */ @@ -6413,8 +6385,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -6489,7 +6462,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ossaudio__oss_ioctl" >&5 $as_echo "$ac_cv_lib_ossaudio__oss_ioctl" >&6; } -if test $ac_cv_lib_ossaudio__oss_ioctl = yes; then +if test "x$ac_cv_lib_ossaudio__oss_ioctl" = x""yes; then LIBSOUND=-lossaudio else LIBSOUND= @@ -6867,8 +6840,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -6981,8 +6955,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7284,7 +7259,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_siglist" >&5 $as_echo "$ac_cv_have_decl_sys_siglist" >&6; } -if test $ac_cv_have_decl_sys_siglist = yes; then +if test "x$ac_cv_have_decl_sys_siglist" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_SYS_SIGLIST 1 @@ -7355,7 +7330,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___sys_siglist" >&5 $as_echo "$ac_cv_have_decl___sys_siglist" >&6; } -if test $ac_cv_have_decl___sys_siglist = yes; then +if test "x$ac_cv_have_decl___sys_siglist" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL___SYS_SIGLIST 1 @@ -7897,8 +7872,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7961,8 +7937,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -8135,7 +8112,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 $as_echo "$ac_cv_member_struct_tm_tm_zone" >&6; } -if test $ac_cv_member_struct_tm_tm_zone = yes; then +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -8205,7 +8182,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 $as_echo "$ac_cv_have_decl_tzname" >&6; } -if test $ac_cv_have_decl_tzname = yes; then +if test "x$ac_cv_have_decl_tzname" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_TZNAME 1 @@ -8386,7 +8363,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_gmtoff" >&5 $as_echo "$ac_cv_member_struct_tm_tm_gmtoff" >&6; } -if test $ac_cv_member_struct_tm_tm_gmtoff = yes; then +if test "x$ac_cv_member_struct_tm_tm_gmtoff" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_TM_GMTOFF 1 @@ -8503,7 +8480,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_flags" >&5 $as_echo "$ac_cv_member_struct_ifreq_ifr_flags" >&6; } -if test $ac_cv_member_struct_ifreq_ifr_flags = yes; then +if test "x$ac_cv_member_struct_ifreq_ifr_flags" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_IFREQ_IFR_FLAGS 1 @@ -8620,7 +8597,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_hwaddr" >&5 $as_echo "$ac_cv_member_struct_ifreq_ifr_hwaddr" >&6; } -if test $ac_cv_member_struct_ifreq_ifr_hwaddr = yes; then +if test "x$ac_cv_member_struct_ifreq_ifr_hwaddr" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_IFREQ_IFR_HWADDR 1 @@ -8737,7 +8714,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_netmask" >&5 $as_echo "$ac_cv_member_struct_ifreq_ifr_netmask" >&6; } -if test $ac_cv_member_struct_ifreq_ifr_netmask = yes; then +if test "x$ac_cv_member_struct_ifreq_ifr_netmask" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_IFREQ_IFR_NETMASK 1 @@ -8854,7 +8831,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_broadaddr" >&5 $as_echo "$ac_cv_member_struct_ifreq_ifr_broadaddr" >&6; } -if test $ac_cv_member_struct_ifreq_ifr_broadaddr = yes; then +if test "x$ac_cv_member_struct_ifreq_ifr_broadaddr" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_IFREQ_IFR_BROADADDR 1 @@ -8971,7 +8948,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_addr" >&5 $as_echo "$ac_cv_member_struct_ifreq_ifr_addr" >&6; } -if test $ac_cv_member_struct_ifreq_ifr_addr = yes; then +if test "x$ac_cv_member_struct_ifreq_ifr_addr" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_IFREQ_IFR_ADDR 1 @@ -9402,8 +9379,8 @@ if test "x$with_x" = xno; then have_x=disabled else case $x_includes,$x_libraries in #( - *\'*) { { $as_echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 -$as_echo "$as_me: error: Cannot use X directory names containing '" >&2;} + *\'*) { { $as_echo "$as_me:$LINENO: error: cannot use X directory names containing '" >&5 +$as_echo "$as_me: error: cannot use X directory names containing '" >&2;} { (exit 1); exit 1; }; };; #( *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then $as_echo_n "(cached) " >&6 @@ -9441,7 +9418,7 @@ _ACEOF *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in - /usr/lib | /lib) ;; + /usr/lib | /usr/lib64 | /lib | /lib64) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi @@ -9850,7 +9827,7 @@ fi $as_echo "$ac_cv_header_AppKit_AppKit_h" >&6; } fi -if test $ac_cv_header_AppKit_AppKit_h = yes; then +if test "x$ac_cv_header_AppKit_AppKit_h" = x""yes; then HAVE_NS=yes else { { $as_echo "$as_me:$LINENO: error: \`--with-ns' was specified, but the include @@ -10098,7 +10075,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_get_state" >&5 $as_echo "$ac_cv_func_malloc_get_state" >&6; } -if test $ac_cv_func_malloc_get_state = yes; then +if test "x$ac_cv_func_malloc_get_state" = x""yes; then : else doug_lea_malloc=no @@ -10189,7 +10166,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_set_state" >&5 $as_echo "$ac_cv_func_malloc_set_state" >&6; } -if test $ac_cv_func_malloc_set_state = yes; then +if test "x$ac_cv_func_malloc_set_state" = x""yes; then : else doug_lea_malloc=no @@ -10411,8 +10388,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -10512,8 +10490,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -10782,7 +10761,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } -if test $ac_cv_lib_dnet_dnet_ntoa = yes; then +if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDNET 1 _ACEOF @@ -10851,7 +10830,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xbsd_main" >&5 $as_echo "$ac_cv_lib_Xbsd_main" >&6; } -if test $ac_cv_lib_Xbsd_main = yes; then +if test "x$ac_cv_lib_Xbsd_main" = x""yes; then LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd" fi @@ -10922,7 +10901,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_cma_open" >&5 $as_echo "$ac_cv_lib_pthreads_cma_open" >&6; } -if test $ac_cv_lib_pthreads_cma_open = yes; then +if test "x$ac_cv_lib_pthreads_cma_open" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREADS 1 _ACEOF @@ -11305,8 +11284,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -11506,6 +11486,121 @@ _ACEOF fi fi +HAVE_IMAGEMAGICK=no +if test "${HAVE_X11}" = "yes" ; then + if test "${with_imagemagick}" != "no"; then + IMAGEMAGICK_REQUIRED=1 + IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" + + + succeeded=no + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + if test "$PKG_CONFIG" = "no" ; then + : + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + { $as_echo "$as_me:$LINENO: checking for $IMAGEMAGICK_MODULE" >&5 +$as_echo_n "checking for $IMAGEMAGICK_MODULE... " >&6; } + + if $PKG_CONFIG --exists "$IMAGEMAGICK_MODULE" 2>&5; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + succeeded=yes + + { $as_echo "$as_me:$LINENO: checking IMAGEMAGICK_CFLAGS" >&5 +$as_echo_n "checking IMAGEMAGICK_CFLAGS... " >&6; } + IMAGEMAGICK_CFLAGS=`$PKG_CONFIG --cflags "$IMAGEMAGICK_MODULE"|sed -e 's,///*,/,g'` + { $as_echo "$as_me:$LINENO: result: $IMAGEMAGICK_CFLAGS" >&5 +$as_echo "$IMAGEMAGICK_CFLAGS" >&6; } + + { $as_echo "$as_me:$LINENO: checking IMAGEMAGICK_LIBS" >&5 +$as_echo_n "checking IMAGEMAGICK_LIBS... " >&6; } + IMAGEMAGICK_LIBS=`$PKG_CONFIG --libs "$IMAGEMAGICK_MODULE"|sed -e 's,///*,/,g'` + { $as_echo "$as_me:$LINENO: result: $IMAGEMAGICK_LIBS" >&5 +$as_echo "$IMAGEMAGICK_LIBS" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + IMAGEMAGICK_CFLAGS="" + IMAGEMAGICK_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + IMAGEMAGICK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$IMAGEMAGICK_MODULE"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + : + else + : + fi + + + + + if test ".${IMAGEMAGICK_CFLAGS}" != "."; then + HAVE_IMAGEMAGICK=yes + +cat >>confdefs.h <<\_ACEOF +#define HAVE_IMAGEMAGICK 1 +_ACEOF + + CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" + LIBS="$IMAGEMAGICK_LIBS $LIBS" + fi + fi +fi HAVE_GTK=no if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then @@ -11714,8 +11809,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -11853,8 +11949,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -11926,7 +12023,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" >&5 $as_echo "$ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" >&6; } -if test $ac_cv_have_decl_GTK_TYPE_FILE_SELECTION = yes; then +if test "x$ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" = x""yes; then HAVE_GTK_FILE_SELECTION=yes else HAVE_GTK_FILE_SELECTION=no @@ -12024,8 +12121,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -12093,7 +12191,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" >&5 $as_echo "$ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" >&6; } -if test $ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER = yes; then +if test "x$ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" = x""yes; then HAVE_GTK_FILE_CHOOSER=yes else HAVE_GTK_FILE_CHOOSER=no @@ -12191,8 +12289,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -12350,8 +12449,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -12426,7 +12526,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_self" >&5 $as_echo "$ac_cv_lib_pthread_pthread_self" >&6; } -if test $ac_cv_lib_pthread_pthread_self = yes; then +if test "x$ac_cv_lib_pthread_pthread_self" = x""yes; then HAVE_GTK_AND_PTHREAD=yes fi @@ -12639,8 +12739,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -13049,7 +13150,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xmu_XmuConvertStandardSelection" >&5 $as_echo "$ac_cv_lib_Xmu_XmuConvertStandardSelection" >&6; } -if test $ac_cv_lib_Xmu_XmuConvertStandardSelection = yes; then +if test "x$ac_cv_lib_Xmu_XmuConvertStandardSelection" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBXMU 1 _ACEOF @@ -13130,7 +13231,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XShapeQueryExtension" >&5 $as_echo "$ac_cv_lib_Xext_XShapeQueryExtension" >&6; } -if test $ac_cv_lib_Xext_XShapeQueryExtension = yes; then +if test "x$ac_cv_lib_Xext_XShapeQueryExtension" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBXEXT 1 _ACEOF @@ -13270,7 +13371,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xp_XpCreateContext" >&5 $as_echo "$ac_cv_lib_Xp_XpCreateContext" >&6; } -if test $ac_cv_lib_Xp_XpCreateContext = yes; then +if test "x$ac_cv_lib_Xp_XpCreateContext" = x""yes; then HAVE_LIBXP=yes fi @@ -13795,7 +13896,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xrender_XRenderQueryExtension" >&5 $as_echo "$ac_cv_lib_Xrender_XRenderQueryExtension" >&6; } -if test $ac_cv_lib_Xrender_XRenderQueryExtension = yes; then +if test "x$ac_cv_lib_Xrender_XRenderQueryExtension" = x""yes; then HAVE_XRENDER=yes fi @@ -13934,7 +14035,7 @@ fi $as_echo "$ac_cv_header_X11_Xft_Xft_h" >&6; } fi -if test $ac_cv_header_X11_Xft_Xft_h = yes; then +if test "x$ac_cv_header_X11_Xft_Xft_h" = x""yes; then { $as_echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5 $as_echo_n "checking for XftFontOpen in -lXft... " >&6; } if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then @@ -14000,7 +14101,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5 $as_echo "$ac_cv_lib_Xft_XftFontOpen" >&6; } -if test $ac_cv_lib_Xft_XftFontOpen = yes; then +if test "x$ac_cv_lib_Xft_XftFontOpen" = x""yes; then HAVE_XFT=yes fi @@ -14211,7 +14312,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_otf_OTF_get_variation_glyphs" >&5 $as_echo "$ac_cv_lib_otf_OTF_get_variation_glyphs" >&6; } -if test $ac_cv_lib_otf_OTF_get_variation_glyphs = yes; then +if test "x$ac_cv_lib_otf_OTF_get_variation_glyphs" = x""yes; then HAVE_OTF_GET_VARIATION_GLYPHS=yes else HAVE_OTF_GET_VARIATION_GLYPHS=no @@ -14483,7 +14584,7 @@ fi $as_echo "$ac_cv_header_X11_xpm_h" >&6; } fi -if test $ac_cv_header_X11_xpm_h = yes; then +if test "x$ac_cv_header_X11_xpm_h" = x""yes; then { $as_echo "$as_me:$LINENO: checking for XpmReadFileToPixmap in -lXpm" >&5 $as_echo_n "checking for XpmReadFileToPixmap in -lXpm... " >&6; } if test "${ac_cv_lib_Xpm_XpmReadFileToPixmap+set}" = set; then @@ -14549,7 +14650,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xpm_XpmReadFileToPixmap" >&5 $as_echo "$ac_cv_lib_Xpm_XpmReadFileToPixmap" >&6; } -if test $ac_cv_lib_Xpm_XpmReadFileToPixmap = yes; then +if test "x$ac_cv_lib_Xpm_XpmReadFileToPixmap" = x""yes; then HAVE_XPM=yes fi @@ -14733,7 +14834,7 @@ fi $as_echo "$ac_cv_header_jerror_h" >&6; } fi -if test $ac_cv_header_jerror_h = yes; then +if test "x$ac_cv_header_jerror_h" = x""yes; then { $as_echo "$as_me:$LINENO: checking for jpeg_destroy_compress in -ljpeg" >&5 $as_echo_n "checking for jpeg_destroy_compress in -ljpeg... " >&6; } if test "${ac_cv_lib_jpeg_jpeg_destroy_compress+set}" = set; then @@ -14799,7 +14900,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_destroy_compress" >&5 $as_echo "$ac_cv_lib_jpeg_jpeg_destroy_compress" >&6; } -if test $ac_cv_lib_jpeg_jpeg_destroy_compress = yes; then +if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = x""yes; then HAVE_JPEG=yes fi @@ -14987,8 +15088,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -15063,7 +15165,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_get_channels" >&5 $as_echo "$ac_cv_lib_png_png_get_channels" >&6; } -if test $ac_cv_lib_png_png_get_channels = yes; then +if test "x$ac_cv_lib_png_png_get_channels" = x""yes; then HAVE_PNG=yes fi @@ -15213,7 +15315,7 @@ fi $as_echo "$ac_cv_header_tiffio_h" >&6; } fi -if test $ac_cv_header_tiffio_h = yes; then +if test "x$ac_cv_header_tiffio_h" = x""yes; then tifflibs="-lz -lm" # At least one tiff package requires the jpeg library. if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi @@ -15282,7 +15384,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFGetVersion" >&5 $as_echo "$ac_cv_lib_tiff_TIFFGetVersion" >&6; } -if test $ac_cv_lib_tiff_TIFFGetVersion = yes; then +if test "x$ac_cv_lib_tiff_TIFFGetVersion" = x""yes; then HAVE_TIFF=yes fi @@ -15433,7 +15535,7 @@ fi $as_echo "$ac_cv_header_gif_lib_h" >&6; } fi -if test $ac_cv_header_gif_lib_h = yes; then +if test "x$ac_cv_header_gif_lib_h" = x""yes; then # EGifPutExtensionLast only exists from version libungif-4.1.0b1. # Earlier versions can crash Emacs. { $as_echo "$as_me:$LINENO: checking for EGifPutExtensionLast in -lgif" >&5 @@ -15501,7 +15603,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_gif_EGifPutExtensionLast" >&5 $as_echo "$ac_cv_lib_gif_EGifPutExtensionLast" >&6; } -if test $ac_cv_lib_gif_EGifPutExtensionLast = yes; then +if test "x$ac_cv_lib_gif_EGifPutExtensionLast" = x""yes; then HAVE_GIF=yes else HAVE_GIF=maybe @@ -15580,7 +15682,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ungif_EGifPutExtensionLast" >&5 $as_echo "$ac_cv_lib_ungif_EGifPutExtensionLast" >&6; } -if test $ac_cv_lib_ungif_EGifPutExtensionLast = yes; then +if test "x$ac_cv_lib_ungif_EGifPutExtensionLast" = x""yes; then HAVE_GIF=yes else HAVE_GIF=no @@ -15761,7 +15863,7 @@ fi $as_echo "$ac_cv_header_gpm_h" >&6; } fi -if test $ac_cv_header_gpm_h = yes; then +if test "x$ac_cv_header_gpm_h" = x""yes; then { $as_echo "$as_me:$LINENO: checking for Gpm_Open in -lgpm" >&5 $as_echo_n "checking for Gpm_Open in -lgpm... " >&6; } if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then @@ -15827,7 +15929,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_gpm_Gpm_Open" >&5 $as_echo "$ac_cv_lib_gpm_Gpm_Open" >&6; } -if test $ac_cv_lib_gpm_Gpm_Open = yes; then +if test "x$ac_cv_lib_gpm_Gpm_Open" = x""yes; then HAVE_GPM=yes fi @@ -15973,7 +16075,7 @@ fi $as_echo "$ac_cv_header_malloc_malloc_h" >&6; } fi -if test $ac_cv_header_malloc_malloc_h = yes; then +if test "x$ac_cv_header_malloc_malloc_h" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MALLOC_MALLOC_H 1 @@ -16149,7 +16251,7 @@ fi $as_echo "$ac_cv_header_X11_SM_SMlib_h" >&6; } fi -if test $ac_cv_header_X11_SM_SMlib_h = yes; then +if test "x$ac_cv_header_X11_SM_SMlib_h" = x""yes; then { $as_echo "$as_me:$LINENO: checking for SmcOpenConnection in -lSM" >&5 $as_echo_n "checking for SmcOpenConnection in -lSM... " >&6; } if test "${ac_cv_lib_SM_SmcOpenConnection+set}" = set; then @@ -16215,7 +16317,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_SM_SmcOpenConnection" >&5 $as_echo "$ac_cv_lib_SM_SmcOpenConnection" >&6; } -if test $ac_cv_lib_SM_SmcOpenConnection = yes; then +if test "x$ac_cv_lib_SM_SmcOpenConnection" = x""yes; then HAVE_X_SM=yes fi @@ -16581,8 +16683,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func @@ -16751,7 +16854,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5 $as_echo "$ac_cv_lib_m_sqrt" >&6; } -if test $ac_cv_lib_m_sqrt = yes; then +if test "x$ac_cv_lib_m_sqrt" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF @@ -16828,7 +16931,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mail_maillock" >&5 $as_echo "$ac_cv_lib_mail_maillock" >&6; } -if test $ac_cv_lib_mail_maillock = yes; then +if test "x$ac_cv_lib_mail_maillock" = x""yes; then have_mail=yes else have_mail=no @@ -16910,7 +17013,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lockfile_maillock" >&5 $as_echo "$ac_cv_lib_lockfile_maillock" >&6; } -if test $ac_cv_lib_lockfile_maillock = yes; then +if test "x$ac_cv_lib_lockfile_maillock" = x""yes; then have_lockfile=yes else have_lockfile=no @@ -17068,8 +17171,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -17212,8 +17316,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -17394,8 +17499,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -17539,8 +17645,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -17688,8 +17795,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -17796,8 +17904,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -18182,7 +18291,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_getloadavg" >&5 $as_echo "$ac_cv_func_getloadavg" >&6; } -if test $ac_cv_func_getloadavg = yes; then +if test "x$ac_cv_func_getloadavg" = x""yes; then exit 0 else exit 1 @@ -18281,8 +18390,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -18358,7 +18468,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_kstat_kstat_open" >&5 $as_echo "$ac_cv_lib_kstat_kstat_open" >&6; } -if test $ac_cv_lib_kstat_kstat_open = yes; then +if test "x$ac_cv_lib_kstat_kstat_open" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBKSTAT 1 _ACEOF @@ -18439,7 +18549,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_elf_elf_begin" >&5 $as_echo "$ac_cv_lib_elf_elf_begin" >&6; } -if test $ac_cv_lib_elf_elf_begin = yes; then +if test "x$ac_cv_lib_elf_elf_begin" = x""yes; then LIBS="-lelf $LIBS" fi @@ -18510,7 +18620,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_kvm_kvm_open" >&5 $as_echo "$ac_cv_lib_kvm_kvm_open" >&6; } -if test $ac_cv_lib_kvm_kvm_open = yes; then +if test "x$ac_cv_lib_kvm_kvm_open" = x""yes; then LIBS="-lkvm $LIBS" fi @@ -18580,7 +18690,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_getloadavg" >&5 $as_echo "$ac_cv_lib_util_getloadavg" >&6; } -if test $ac_cv_lib_util_getloadavg = yes; then +if test "x$ac_cv_lib_util_getloadavg" = x""yes; then LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes fi @@ -18656,7 +18766,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_getloadavg_getloadavg" >&5 $as_echo "$ac_cv_lib_getloadavg_getloadavg" >&6; } -if test $ac_cv_lib_getloadavg_getloadavg = yes; then +if test "x$ac_cv_lib_getloadavg_getloadavg" = x""yes; then LIBS="-lgetloadavg $LIBS" else LIBS=$ac_getloadavg_LIBS @@ -18757,8 +18867,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -18904,7 +19015,7 @@ fi $as_echo "$ac_cv_header_sys_dg_sys_info_h" >&6; } fi -if test $ac_cv_header_sys_dg_sys_info_h = yes; then +if test "x$ac_cv_header_sys_dg_sys_info_h" = x""yes; then ac_have_func=yes cat >>confdefs.h <<\_ACEOF @@ -18977,7 +19088,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dgc_dg_sys_info" >&5 $as_echo "$ac_cv_lib_dgc_dg_sys_info" >&6; } -if test $ac_cv_lib_dgc_dg_sys_info = yes; then +if test "x$ac_cv_lib_dgc_dg_sys_info" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDGC 1 _ACEOF @@ -19210,8 +19321,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -19360,7 +19472,7 @@ fi $as_echo "$ac_cv_header_inq_stats_cpustats_h" >&6; } fi -if test $ac_cv_header_inq_stats_cpustats_h = yes; then +if test "x$ac_cv_header_inq_stats_cpustats_h" = x""yes; then ac_have_func=yes cat >>confdefs.h <<\_ACEOF @@ -19505,7 +19617,7 @@ fi $as_echo "$ac_cv_header_sys_cpustats_h" >&6; } fi -if test $ac_cv_header_sys_cpustats_h = yes; then +if test "x$ac_cv_header_sys_cpustats_h" = x""yes; then ac_have_func=yes; cat >>confdefs.h <<\_ACEOF #define UMAX 1 _ACEOF @@ -19651,8 +19763,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -19798,8 +19911,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -19900,7 +20014,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_nlist_n_un_n_name" >&5 $as_echo "$ac_cv_member_struct_nlist_n_un_n_name" >&6; } -if test $ac_cv_member_struct_nlist_n_un_n_name = yes; then +if test "x$ac_cv_member_struct_nlist_n_un_n_name" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_NLIST_N_UN_N_NAME 1 @@ -20281,8 +20395,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -20385,8 +20500,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -20453,7 +20569,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5 $as_echo "$ac_cv_have_decl_optreset" >&6; } -if test $ac_cv_have_decl_optreset = yes; then +if test "x$ac_cv_have_decl_optreset" = x""yes; then GETOPT_H=getopt.h fi @@ -20520,7 +20636,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5 $as_echo "$ac_cv_have_decl_getopt_clip" >&6; } -if test $ac_cv_have_decl_getopt_clip = yes; then +if test "x$ac_cv_have_decl_getopt_clip" = x""yes; then gl_cv_func_gnu_getopt=no else gl_cv_func_gnu_getopt=yes @@ -20765,8 +20881,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -20838,7 +20955,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } -if test $ac_cv_lib_intl_strftime = yes; then +if test "x$ac_cv_lib_intl_strftime" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRFTIME 1 _ACEOF @@ -20942,8 +21059,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -21044,8 +21162,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -21159,6 +21278,7 @@ libncurses-dev(el), libterminfo-dev(el) or similar." >&2;} { (exit 1); exit 1; }; } fi # Must define this when any termcap library is found. + cat >>confdefs.h <<\_ACEOF #define HAVE_LIBNCURSES 1 _ACEOF @@ -21375,7 +21495,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_res_send" >&5 $as_echo "$ac_cv_func_res_send" >&6; } -if test $ac_cv_func_res_send = yes; then +if test "x$ac_cv_func_res_send" = x""yes; then : else { $as_echo "$as_me:$LINENO: checking for __res_send" >&5 @@ -21463,7 +21583,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func___res_send" >&5 $as_echo "$ac_cv_func___res_send" >&6; } -if test $ac_cv_func___res_send = yes; then +if test "x$ac_cv_func___res_send" = x""yes; then : else { $as_echo "$as_me:$LINENO: checking for res_send in -lresolv" >&5 @@ -21531,7 +21651,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_send" >&5 $as_echo "$ac_cv_lib_resolv_res_send" >&6; } -if test $ac_cv_lib_resolv_res_send = yes; then +if test "x$ac_cv_lib_resolv_res_send" = x""yes; then resolv=yes else { $as_echo "$as_me:$LINENO: checking for __res_send in -lresolv" >&5 @@ -21599,7 +21719,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_resolv___res_send" >&5 $as_echo "$ac_cv_lib_resolv___res_send" >&6; } -if test $ac_cv_lib_resolv___res_send = yes; then +if test "x$ac_cv_lib_resolv___res_send" = x""yes; then resolv=yes fi @@ -21699,7 +21819,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_hes_getmailhost" >&5 $as_echo "$ac_cv_func_hes_getmailhost" >&6; } -if test $ac_cv_func_hes_getmailhost = yes; then +if test "x$ac_cv_func_hes_getmailhost" = x""yes; then : else { $as_echo "$as_me:$LINENO: checking for hes_getmailhost in -lhesiod" >&5 @@ -21767,7 +21887,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_hesiod_hes_getmailhost" >&5 $as_echo "$ac_cv_lib_hesiod_hes_getmailhost" >&6; } -if test $ac_cv_lib_hesiod_hes_getmailhost = yes; then +if test "x$ac_cv_lib_hesiod_hes_getmailhost" = x""yes; then hesiod=yes else : @@ -21873,7 +21993,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_com_err_com_err" >&5 $as_echo "$ac_cv_lib_com_err_com_err" >&6; } -if test $ac_cv_lib_com_err_com_err = yes; then +if test "x$ac_cv_lib_com_err_com_err" = x""yes; then have_com_err=yes else have_com_err=no @@ -21953,7 +22073,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_mit_des_cbc_encrypt" >&5 $as_echo "$ac_cv_lib_crypto_mit_des_cbc_encrypt" >&6; } -if test $ac_cv_lib_crypto_mit_des_cbc_encrypt = yes; then +if test "x$ac_cv_lib_crypto_mit_des_cbc_encrypt" = x""yes; then have_crypto=yes else have_crypto=no @@ -22033,7 +22153,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&5 $as_echo "$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&6; } -if test $ac_cv_lib_k5crypto_mit_des_cbc_encrypt = yes; then +if test "x$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" = x""yes; then have_k5crypto=yes else have_k5crypto=no @@ -22113,7 +22233,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_krb5_krb5_init_context" >&5 $as_echo "$ac_cv_lib_krb5_krb5_init_context" >&6; } -if test $ac_cv_lib_krb5_krb5_init_context = yes; then +if test "x$ac_cv_lib_krb5_krb5_init_context" = x""yes; then have_krb5=yes else have_krb5=no @@ -22194,7 +22314,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_des425_des_cbc_encrypt" >&5 $as_echo "$ac_cv_lib_des425_des_cbc_encrypt" >&6; } -if test $ac_cv_lib_des425_des_cbc_encrypt = yes; then +if test "x$ac_cv_lib_des425_des_cbc_encrypt" = x""yes; then have_des425=yes else have_des425=no @@ -22274,7 +22394,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_des_des_cbc_encrypt" >&5 $as_echo "$ac_cv_lib_des_des_cbc_encrypt" >&6; } -if test $ac_cv_lib_des_des_cbc_encrypt = yes; then +if test "x$ac_cv_lib_des_des_cbc_encrypt" = x""yes; then have_des=yes else have_des=no @@ -22355,7 +22475,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_krb4_krb_get_cred" >&5 $as_echo "$ac_cv_lib_krb4_krb_get_cred" >&6; } -if test $ac_cv_lib_krb4_krb_get_cred = yes; then +if test "x$ac_cv_lib_krb4_krb_get_cred" = x""yes; then have_krb4=yes else have_krb4=no @@ -22435,7 +22555,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_krb_krb_get_cred" >&5 $as_echo "$ac_cv_lib_krb_krb_get_cred" >&6; } -if test $ac_cv_lib_krb_krb_get_cred = yes; then +if test "x$ac_cv_lib_krb_krb_get_cred" = x""yes; then have_krb=yes else have_krb=no @@ -22589,8 +22709,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -22691,7 +22812,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_krb5_error_text" >&5 $as_echo "$ac_cv_member_krb5_error_text" >&6; } -if test $ac_cv_member_krb5_error_text = yes; then +if test "x$ac_cv_member_krb5_error_text" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_KRB5_ERROR_TEXT 1 @@ -22796,7 +22917,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_krb5_error_e_text" >&5 $as_echo "$ac_cv_member_krb5_error_e_text" >&6; } -if test $ac_cv_member_krb5_error_e_text = yes; then +if test "x$ac_cv_member_krb5_error_e_text" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_KRB5_ERROR_E_TEXT 1 @@ -22945,8 +23066,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -23087,8 +23209,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -23229,8 +23352,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -23382,8 +23506,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -23524,8 +23649,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -23666,8 +23792,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -23820,8 +23947,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -23906,7 +24034,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_dgettext" >&5 $as_echo "$ac_cv_lib_intl_dgettext" >&6; } -if test $ac_cv_lib_intl_dgettext = yes; then +if test "x$ac_cv_lib_intl_dgettext" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBINTL 1 _ACEOF @@ -24106,8 +24234,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -24273,7 +24402,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_socket" >&5 $as_echo "$ac_cv_func_socket" >&6; } -if test $ac_cv_func_socket = yes; then +if test "x$ac_cv_func_socket" = x""yes; then : else ok_so_far=no @@ -24407,7 +24536,7 @@ fi $as_echo "$ac_cv_header_netinet_in_h" >&6; } fi -if test $ac_cv_header_netinet_in_h = yes; then +if test "x$ac_cv_header_netinet_in_h" = x""yes; then : else ok_so_far=no @@ -24543,7 +24672,7 @@ fi $as_echo "$ac_cv_header_arpa_inet_h" >&6; } fi -if test $ac_cv_header_arpa_inet_h = yes; then +if test "x$ac_cv_header_arpa_inet_h" = x""yes; then : else ok_so_far=no @@ -24694,8 +24823,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -24822,7 +24952,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 $as_echo "$ac_cv_type_pid_t" >&6; } -if test $ac_cv_type_pid_t = yes; then +if test "x$ac_cv_type_pid_t" = x""yes; then : else @@ -24967,8 +25097,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$ac_res" >&6; } fi -if test `eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -25069,8 +25200,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test `eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` = yes; then +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -25494,7 +25626,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 $as_echo "$ac_cv_type_size_t" >&6; } -if test $ac_cv_type_size_t = yes; then +if test "x$ac_cv_type_size_t" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_SIZE_T 1 @@ -25936,6 +26068,7 @@ echo " Does Emacs use -ltiff? ${HAVE_TIFF}" echo " Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF" echo " Does Emacs use -lpng? ${HAVE_PNG}" echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}" +echo " Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}" echo " Does Emacs use -lgpm? ${HAVE_GPM}" echo " Does Emacs use -ldbus? ${HAVE_DBUS}" echo " Does Emacs use -lgconf? ${HAVE_GCONF}" @@ -26045,8 +26178,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -26438,7 +26571,7 @@ exec 6>&1 # values after options handling. ac_log=" This file was extended by emacs $as_me 24.0.50, which was -generated by GNU Autoconf 2.62. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -26451,6 +26584,15 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" @@ -26464,16 +26606,17 @@ ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] + --file=FILE[:TEMPLATE] instantiate the configuration file FILE - --header=FILE[:TEMPLATE] + --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: @@ -26491,7 +26634,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ emacs config.status 24.0.50 -configured by $0, generated by GNU Autoconf 2.62, +configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. @@ -26705,7 +26848,8 @@ for ac_last_try in false false false false false :; do $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -26910,9 +27054,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 } split(mac1, mac2, "(") #) macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". - prefix = substr(line, 1, index(line, defundef) - 1) print prefix "define", macro P[macro] D[macro] next } else { @@ -26920,7 +27064,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { - print "/*", line, "*/" + print "/*", prefix defundef, macro, "*/" next } } @@ -26944,8 +27088,8 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;} + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; @@ -27333,8 +27477,8 @@ if test "$no_create" != yes; then $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/configure.in b/configure.in index fc7c0a93235..eced710c1a7 100644 --- a/configure.in +++ b/configure.in @@ -148,6 +148,7 @@ OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support]) OPTION_DEFAULT_ON([gif],[don't compile with GIF image support]) OPTION_DEFAULT_ON([png],[don't compile with PNG image support]) OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support]) +OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support]) OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts]) OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support]) @@ -1599,6 +1600,24 @@ if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then fi fi +HAVE_IMAGEMAGICK=no +if test "${HAVE_X11}" = "yes" ; then + if test "${with_imagemagick}" != "no"; then + IMAGEMAGICK_REQUIRED=1 + IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" + + PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, :, :) + AC_SUBST(IMAGEMAGICK_CFLAGS) + AC_SUBST(IMAGEMAGICK_LIBS) + + if test ".${IMAGEMAGICK_CFLAGS}" != "."; then + HAVE_IMAGEMAGICK=yes + AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) + CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" + LIBS="$IMAGEMAGICK_LIBS $LIBS" + fi + fi +fi HAVE_GTK=no if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then @@ -3083,6 +3102,7 @@ echo " Does Emacs use -ltiff? ${HAVE_TIFF}" echo " Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF" echo " Does Emacs use -lpng? ${HAVE_PNG}" echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}" +echo " Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}" echo " Does Emacs use -lgpm? ${HAVE_GPM}" echo " Does Emacs use -ldbus? ${HAVE_DBUS}" echo " Does Emacs use -lgconf? ${HAVE_GCONF}" diff --git a/lisp/image.el b/lisp/image.el index 67c1ad946b1..963093c6149 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -690,6 +690,31 @@ shall be displayed." (cons images (+ (aref anim 1) (* (aref anim 2) 256)))))))) +(defconst imagemagick-types-inhibit + '(C HTML HTM TXT) + "Types the imagemagic loader should not try to handle.") + +;;;###autoload +(defun imagemagic-register-types () + "Register file types that imagemagick is able to handle." + (let ((im-types (imagemagick-types)) + (im-inhibit imagemagick-types-inhibit)) + (while im-inhibit + (setq im-types (remove (car im-inhibit) im-types)) + (setq im-inhibit (cdr im-inhibit))) + (while im-types + (let + ((extension (downcase (symbol-name (car im-types))))) + (push + (cons (concat "\\." extension "\\'") 'image-mode) + auto-mode-alist) + (push + (cons (concat "\\." extension "\\'") 'imagemagick) + image-type-file-name-regexps) + (setq im-types (cdr im-types)))))) + + + (provide 'image) ;; arch-tag: 8e76a07b-eb48-4f3e-a7a0-1a7ba9f096b3 diff --git a/src/Makefile.in b/src/Makefile.in index 53904a3992a..a71292e14f7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,3 +1,4 @@ + # Makefile for GNU Emacs. # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 @@ -269,7 +270,9 @@ GCONF_LIBS = @GCONF_LIBS@ /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM since it may have -I options that should override those two. */ -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS} + +ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS} + ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@ .SUFFIXES: .m @@ -388,6 +391,9 @@ CFLAGS_SOUND= @CFLAGS_SOUND@ RSVG_LIBS= @RSVG_LIBS@ RSVG_CFLAGS= @RSVG_CFLAGS@ +IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@ +IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@ + #ifndef ORDINARY_LINK /* Fix linking if compiled with GCC. */ #ifdef __GNUC__ @@ -850,7 +856,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \ duplicated symbols. If the standard libraries were compiled with GCC, we might need gnulib again after them. */ -LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) $(DBUS_LIBS) \ +LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) \ @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ $(GETLOADAVG_LIBS) ${GCONF_LIBS} \ @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \ diff --git a/src/image.c b/src/image.c index 030e06ad77a..8159575e640 100644 --- a/src/image.c +++ b/src/image.c @@ -606,7 +606,7 @@ extern Lisp_Object QCdata, QCtype; extern Lisp_Object Qcenter; Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; -Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; +Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask, QCgeometry, QCcrop, QCrotation; /* Other symbols. */ @@ -7538,6 +7538,449 @@ gif_load (struct frame *f, struct image *img) #endif /* HAVE_GIF */ +/*********************************************************************** + imagemagick + ***********************************************************************/ +#if defined (HAVE_IMAGEMAGICK) +Lisp_Object Vimagemagick_render_type; +/* Function prototypes. */ + +static int imagemagick_image_p (Lisp_Object object); +static int imagemagick_load (struct frame *f, struct image *img); + +static int imagemagick_load_image (struct frame *, struct image *, + unsigned char *, unsigned int, unsigned char *); + +/* The symbol `imagemagick' identifying images of this type. */ + +Lisp_Object Qimagemagick; +Lisp_Object Vimagemagick_render_type; + +/* Indices of image specification fields in imagemagick_format, below. */ + +enum imagemagick_keyword_index +{ + IMAGEMAGICK_TYPE, + IMAGEMAGICK_DATA, + IMAGEMAGICK_FILE, + IMAGEMAGICK_ASCENT, + IMAGEMAGICK_MARGIN, + IMAGEMAGICK_RELIEF, + IMAGEMAGICK_ALGORITHM, + IMAGEMAGICK_HEURISTIC_MASK, + IMAGEMAGICK_MASK, + IMAGEMAGICK_BACKGROUND, + IMAGEMAGICK_LAST +}; + +/* Vector of image_keyword structures describing the format + of valid user-defined image specifications. */ + +static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] = +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; +/* Free X resources of imagemagick image IMG which is used on frame F. */ + +static void +imagemagick_clear_image (f, img) + struct frame *f; + struct image *img; +{ + printf("clearing imagemagick image\n"); + x_clear_image (f, img); +} + +/* Structure describing the image type `imagemagick'. Its the same type of + structure defined for all image formats, handled by Emacs image + functions. See struct image_type in dispextern.h. */ + +static struct image_type imagemagick_type = +{ + /* An identifier showing that this is an image structure for the IMAGEMAGICK format. */ + &Qimagemagick, + /* Handle to a function that can be used to identify a IMAGEMAGICK file. */ + imagemagick_image_p, + /* Handle to function used to load a IMAGEMAGICK file. */ + imagemagick_load, + /* Handle to function to free resources for IMAGEMAGICK. */ + imagemagick_clear_image, + /* An internal field to link to the next image type in a list of + image types, will be filled in when registering the format. */ + NULL +}; + + +/* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification. Do + this by calling parse_image_spec and supplying the keywords that + identify the IMAGEMAGICK format. */ + +static int +imagemagick_image_p (object) + Lisp_Object object; +{ + struct image_keyword fmt[IMAGEMAGICK_LAST]; + bcopy (imagemagick_format, fmt, sizeof fmt); + + if (!parse_image_spec (object, fmt, IMAGEMAGICK_LAST, Qimagemagick)) + return 0; + + /* Must specify either the :data or :file keyword. */ + return fmt[IMAGEMAGICK_FILE].count + fmt[IMAGEMAGICK_DATA].count == 1; +} + +/* The GIF library also defines DrawRectangle, but its never used in Emacs. + Therefore rename the function so it doesnt collide with ImageMagick. */ +#define DrawRectangle DrawRectangleGif +#include + +/* Load IMAGEMAGICK image IMG for use on frame F. Value is non-zero if + successful. this function will go into the imagemagick_type structure, and + the prototype thus needs to be compatible with that structure. */ + +static int +imagemagick_load (f, img) + struct frame *f; + struct image *img; +{ + int success_p = 0; + Lisp_Object file_name; + + /* If IMG->spec specifies a file name, create a non-file spec from it. */ + file_name = image_spec_value (img->spec, QCfile, NULL); + if (STRINGP (file_name)) + { + Lisp_Object file; + unsigned char *contents; + int size; + struct gcpro gcpro1; + + file = x_find_image_file (file_name); + GCPRO1 (file); + if (!STRINGP (file)) + { + image_error ("Cannot find image file `%s'", file_name, Qnil); + UNGCPRO; + return 0; + } + + /* Read the entire file into memory. */ + /* contents = slurp_file (SDATA (file), &size); */ + /* if (contents == NULL) */ + /* { */ + /* image_error ("Error loading IMAGEMAGICK image `%s'", img->spec, Qnil); */ + /* UNGCPRO; */ + /* return 0; */ + /* } */ + /* If the file was slurped into memory properly, parse it. */ + success_p = imagemagick_load_image (f, img, 0, 0, SDATA(file_name)); + UNGCPRO; + } + /* Else its not a file, its a lisp object. Load the image from a + lisp object rather than a file. */ + else + { + Lisp_Object data; + + data = image_spec_value (img->spec, QCdata, NULL); + success_p = imagemagick_load_image (f, img, SDATA (data), SBYTES (data),NULL); + } + + return success_p; +} + +/* imagemagick_load_image is a helper function for imagemagick_load, which does the + actual loading given contents and size, apart from frame and image + structures, passed from imagemagick_load. + + Uses librimagemagick to do most of the image processing. + + Returns non-zero when successful. +*/ + +static int +imagemagick_load_image (f, img, contents, size, filename) + /* Pointer to emacs frame structure. */ + struct frame *f; + /* Pointer to emacs image structure. */ + struct image *img; + /* String containing the IMAGEMAGICK data to be parsed. */ + unsigned char *contents; + /* Size of data in bytes. */ + unsigned int size; + /* Filename, either pass filename or contents/size. */ + unsigned char *filename; +{ + long unsigned int width; + long unsigned int height; + + MagickBooleanType + status; + + XImagePtr ximg; + Lisp_Object specified_bg; + XColor background; + int x; + int y; + + MagickWand *image_wand; + PixelIterator *iterator; + PixelWand **pixels; + MagickPixelPacket pixel; + + + /* image_wand will contain the image. */ + image_wand = NewMagickWand(); + + /* Parse the contents argument and initialize image_wand. */ + if(filename!=NULL) + status=MagickReadImage(image_wand, filename); + else + status=MagickReadImageBlob(image_wand, contents, size); + image_error ("im read failed", Qnil, Qnil); + if (status == MagickFalse) goto imagemagick_error; + + /* Handle image index for image types who can contain more than one image. + Interface :index is same as for GIF. */ + Lisp_Object image; + long ino; + image = image_spec_value (img->spec, QCindex, NULL); + ino = INTEGERP (image) ? XFASTINT (image) : 0; + + /* if (ino >= ) */ + /* { */ + /* image_error ("Invalid image number `%s' in image `%s'", */ + /* image, img->spec); */ + /* UNGCPRO; */ + /* return 0; */ + /* } */ + + if(ino==0) + MagickSetFirstIterator(image_wand); + else + MagickSetIteratorIndex(image_wand, ino); + + /* + If width and/or height is set in the display spec + assume we want to scale to those. */ + + int desired_width, desired_height; + Lisp_Object value; + value = image_spec_value (img->spec, QCwidth, NULL); + desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); + value = image_spec_value (img->spec, QCheight, NULL); + desired_height = (INTEGERP (value) ? XFASTINT (value) : -1); + if(desired_width != -1 && desired_height != -1){ + printf("MagickScaleImage %d %d\n",desired_width, desired_height); + status=MagickScaleImage(image_wand, desired_width, desired_height); + if (status == MagickFalse) { + image_error ("Imagemagick scale failed", Qnil, Qnil); + goto imagemagick_error; + } + + } + + /* Also support :geometry and :crop which are imagemagick specific descriptors. */ + + Lisp_Object crop, geometry; + crop = image_spec_value (img->spec, QCcrop, NULL); + geometry = image_spec_value (img->spec, QCgeometry, NULL); + if (STRINGP (crop) && STRINGP (geometry)){ + printf("MagickTransformImage %s %s\n",SDATA(crop), SDATA(geometry)); + image_wand = MagickTransformImage (image_wand, SDATA (crop), SDATA (geometry)); + /* TODO differ between image_wand and transform_wand. */ + } + + /* Furthermore :rotation. we need background color and angle for rotation. */ + /* + TODO background handling for rotation + specified_bg = image_spec_value (img->spec, QCbackground, NULL); + if (!STRINGP (specified_bg) + */ + double rotation; + value = image_spec_value (img->spec, QCrotation, NULL); + if (FLOATP (value)){ + PixelWand* background = NewPixelWand(); + PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/ + + rotation = extract_float (value); + printf ("MagickRotateImage %f\n",rotation); + + status=MagickRotateImage (image_wand, background,rotation); + DestroyPixelWand (background); + if (status == MagickFalse) { + image_error ("Imagemagick image rotate failed", Qnil, Qnil); + goto imagemagick_error; + } + } + + /* Finaly we are done manipulating the image, + figure out resulting width, height, and then transfer ownerwship to Emacs. + */ + height=MagickGetImageHeight (image_wand); + width=MagickGetImageWidth (image_wand); + if (status == MagickFalse) { + image_error ("Imagemagick image get size failed", Qnil, Qnil); + goto imagemagick_error; + } + + if (! check_image_size (f, width, height)) + { + image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); + goto imagemagick_error; + } + + /* We can now get a valid pixel buffer from the imagemagick file, if all + went ok. */ + + + init_color_table (); + int imagemagick_rendermethod=(INTEGERP (Vimagemagick_render_type) ? XFASTINT (Vimagemagick_render_type) : 0); + if (imagemagick_rendermethod==0){ + /* Try to create a x pixmap to hold the imagemagick pixmap. */ + if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)){ + image_error("Imagemagick X bitmap allocation failure",Qnil,Qnil); + goto imagemagick_error; + } + + /* Copy imagegmagick image to x with primitive yet robust pixel + pusher loop. This has been tested a lot with many different + images, it doesnt work too well with image archive formats though! + + Also seems slow. + */ + + /* Copy pixels from the imagemagick image structure to the x image map. */ + iterator = NewPixelIterator (image_wand); + if ((iterator == (PixelIterator *) NULL)) { + image_error ("Imagemagick pixel iterator creation failed", Qnil, Qnil); + goto imagemagick_error; + } + + for (y=0; y < (long) MagickGetImageHeight(image_wand); y++) + { + pixels = PixelGetNextIteratorRow (iterator, &width); + if ((pixels == (PixelWand **) NULL)) + break; + for (x=0; x < (long) width; x++) + { + PixelGetMagickColor (pixels[x], &pixel); + XPutPixel (ximg, x, y, lookup_rgb_color (f, pixel.red, pixel.green, pixel.blue)); + } + } + DestroyPixelIterator (iterator); + } + + if (imagemagick_rendermethod==1){ + /* Try if magicexportimage is any faster than pixelpushing. */ + /* printf("ximg: bitmap_unit:%d format:%d byte_order:%d depth:%d bits_per_pixel:%d\n", */ + /* ximg->bitmap_unit,ximg->format,ximg->byte_order,ximg->depth,ximg->bits_per_pixel); */ + int imagedepth=24;/*MagickGetImageDepth(image_wand);*/ + char* exportdepth= imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ + /* Try to create a x pixmap to hold the imagemagick pixmap. */ + printf("imagedepth:%d exportdepth:%s\n", imagedepth, exportdepth); + if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, &ximg, &img->pixmap)){ + image_error("Imagemagick X bitmap allocation failure",Qnil,Qnil); + goto imagemagick_error; + } + + + /* Oddly, the below code doesnt seem to work:*/ + int pixelwidth; + /* switch(ximg->bitmap_unit){ */ + /* case 8: */ + /* pixelwidth=CharPixel; */ + /* break; */ + /* case 16: */ + /* pixelwidth=ShortPixel; */ + /* break; */ + /* case 32: */ + /* pixelwidth=LongPixel; */ + /* break; */ + /* } */ + /* + Here im just guessing the format of the bitmap. + happens to work fine for: + - bw djvu images + on rgb display. + seems about 3 times as fast as pixel pushing(not carefully measured) + with color djvu, the bitplanes are mapped to wrong color(seems fixed). + + */ + pixelwidth=CharPixel;/*??? TODO figure out*/ + MagickExportImagePixels(image_wand, + 0,0, + width,height, + exportdepth, + pixelwidth, + /*&(img->pixmap));*/ + ximg->data); + } + +#ifdef COLOR_TABLE_SUPPORT + /* Remember colors allocated for this image. */ + img->colors = colors_in_color_table (&img->ncolors); + free_color_table (); +#endif /* COLOR_TABLE_SUPPORT */ + + + img->width = width; + img->height = height; + + /* Maybe fill in the background field while we have ximg handy. + Casting avoids a GCC warning. */ + /* IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);*/ + + /* Put the image into the pixmap, then free the X image and its + buffer. */ + x_put_x_image (f, ximg, img->pixmap, width, height); + + x_destroy_x_image (ximg); + + + /* JAVE TODO more cleanup. */ + DestroyMagickWand (image_wand); + + return 1; + + imagemagick_error: + /* TODO more cleanup. */ + image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); + printf("Imagemagick error, see *Messages*\n"); + return 0; +} + +DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0,0,0, + doc: /* Return image file types supported by ImageMagick. + Since ImageMagic recognizes a lot of file-types that clash with Emacs, + such as .c, we want to be able to alter the list at the lisp level. */) + () +{ + Lisp_Object typelist = Qnil; + unsigned long numf; + ExceptionInfo ex; + char** imtypes = GetMagickList ("*", &numf, &ex); + int i; + Lisp_Object Qimagemagicktype; + for (i = 0; i < numf; i++) { + Qimagemagicktype = intern (*( imtypes + i)); + typelist = Fcons (Qimagemagicktype, typelist); + } + return typelist; +} + +#endif /* defined (HAVE_IMAGEMAGICK) */ + + /*********************************************************************** SVG @@ -8335,6 +8778,14 @@ of `image-library-alist', which see). */) return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries); #endif +#if defined (HAVE_IMAGEMAGICK) + if (EQ (type, Qimagemagick)){ + /* MagickWandGenesis() initalizes the imagemagick library. */ + MagickWandGenesis(); + return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions, libraries); + } +#endif + #ifdef HAVE_GHOSTSCRIPT if (EQ (type, Qpostscript)) return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries); @@ -8345,6 +8796,7 @@ of `image-library-alist', which see). */) return Qnil; } + void syms_of_image () { @@ -8422,7 +8874,14 @@ non-numeric, there is no explicit limit on the size of images. */); staticpro (&QCheuristic_mask); QCindex = intern_c_string (":index"); staticpro (&QCindex); + QCgeometry = intern (":geometry"); + staticpro (&QCgeometry); + QCcrop = intern (":crop"); + staticpro (&QCcrop); + QCrotation = intern (":rotation"); + staticpro (&QCrotation); QCmatrix = intern_c_string (":matrix"); + staticpro (&QCmatrix); QCcolor_adjustment = intern_c_string (":color-adjustment"); staticpro (&QCcolor_adjustment); @@ -8482,6 +8941,12 @@ non-numeric, there is no explicit limit on the size of images. */); ADD_IMAGE_TYPE (Qpng); #endif +#if defined (HAVE_IMAGEMAGICK) + Qimagemagick = intern ("imagemagick"); + staticpro (&Qimagemagick); + ADD_IMAGE_TYPE (Qimagemagick); +#endif + #if defined (HAVE_RSVG) Qsvg = intern_c_string ("svg"); staticpro (&Qsvg); @@ -8498,6 +8963,9 @@ non-numeric, there is no explicit limit on the size of images. */); #endif /* HAVE_RSVG */ defsubr (&Sinit_image_library); +#ifdef HAVE_IMAGEMAGICK + defsubr (&Simagemagick_types); +#endif defsubr (&Sclear_image_cache); defsubr (&Simage_refresh); defsubr (&Simage_size); @@ -8525,12 +8993,20 @@ When an image has not been displayed this many seconds, remove it from the image cache. Value must be an integer or nil with nil meaning don't clear the cache. */); Vimage_cache_eviction_delay = make_number (30 * 60); + +#ifdef HAVE_IMAGEMAGICK + DEFVAR_LISP ("imagemagick-render-type", &Vimagemagick_render_type, + doc: /* */); +#endif } void init_image () { + } + + /* arch-tag: 123c2a5e-14a8-4c53-ab95-af47d7db49b9 (do not change this comment) */ From 86fa4cb5094901384f680e2ba4d6424e53fa820c Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Wed, 12 May 2010 14:32:06 +0200 Subject: [PATCH 002/101] initial imagemagick readme --- README.imagemagick | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 README.imagemagick diff --git a/README.imagemagick b/README.imagemagick new file mode 100644 index 00000000000..3c760dd75ea --- /dev/null +++ b/README.imagemagick @@ -0,0 +1,51 @@ +This is the imagemagick branch of Emacs. Imagemagick can now be used +to load many new image formats, and also do useful transforms like +scaling and rotation. + +This file will attempt to contain draft NEWS, Changelog and manual +entries for the new functionality. + +TODO +- complete documentation drafts below +- test with more systems, only tested on Fedora 12 so far, and the +libmagick that ships it. +- fix inconsistencys with spelling of imagemagick in the src +- report number of images in image bundle types somehow +- probably add pdf to inhibited types +- inhibit types is defconst should probably be defcustom +- decide what to do with some uncommitted imagemagick support + functions for image size etc. + + +* NEWS entry +** ImageMagick support +It is now possible to use the Imagemagick library to load many new +image formats in Emacs. + +To enable, use the following configure option: +--with-imagemagick + +The new function (imagemagick-types) returns a list of image file +extensions that your installation of imagemagick supports. + +The function (imagemagic-register-types) will enable the imagemagick +support for the extensions in imagemagick-types minus the types listed +in imagemagick-types-inhibit. + +imagemagick-types-inhibit has the value '(C HTML HTM TXT) by default. +This means imagemagick will be used also to load jpeg files, if you +have both jpeg and imagemagick libraries linked. Add 'JPG to +imagemagick-types-inhibit if you do not want this. + +Images loaded with imagemagick will support a couple of new display +specifications: + +- scale +- rotation +- index + +* Changelog entry +nothing yet + +* Manual entry +nothing yet \ No newline at end of file From ef30d1ad3e9abe32001d8d863ae7314ca2a636f2 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Thu, 13 May 2010 16:04:53 +0200 Subject: [PATCH 003/101] make configure.in less particular about themagickwand version --- configure | 3 +-- configure.in | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure b/configure index ae6f8266211..8c4dc2df865 100755 --- a/configure +++ b/configure @@ -11785,8 +11785,7 @@ fi HAVE_IMAGEMAGICK=no if test "${with_imagemagick}" != "no"; then - IMAGEMAGICK_REQUIRED=1 - IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" + IMAGEMAGICK_MODULE="Wand" succeeded=no diff --git a/configure.in b/configure.in index cd6500b51e1..58cace5895f 100644 --- a/configure.in +++ b/configure.in @@ -1755,8 +1755,7 @@ fi HAVE_IMAGEMAGICK=no if test "${with_imagemagick}" != "no"; then - IMAGEMAGICK_REQUIRED=1 - IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" + IMAGEMAGICK_MODULE="Wand" PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, :, :) AC_SUBST(IMAGEMAGICK_CFLAGS) AC_SUBST(IMAGEMAGICK_LIBS) From 3ed42149b94870108d6cc7de759e1435a4730848 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Fri, 14 May 2010 10:19:30 +0200 Subject: [PATCH 004/101] initial support for supplying image count property for image bundles by imagemagick. --- src/image.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/image.c b/src/image.c index 5865d7be00a..1bc58db57b8 100644 --- a/src/image.c +++ b/src/image.c @@ -7926,6 +7926,14 @@ imagemagick_load_image (f, img, contents, size, filename) ximg->data); } + + //TODO figure out imagecount here! + if (MagickGetNumberImages(image_wand) > 1) + img->data.lisp_val = Fcons (Qcount, + Fcons (make_number (MagickGetNumberImages(image_wand)), + img->data.lisp_val)); + + #ifdef COLOR_TABLE_SUPPORT /* Remember colors allocated for this image. */ img->colors = colors_in_color_table (&img->ncolors); From 3b8916b60a47fae40b9833c2abb2ff3695ca5f81 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Fri, 14 May 2010 10:20:36 +0200 Subject: [PATCH 005/101] image count --- README.imagemagick | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index 9096fe2b2f8..fb957d690ed 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -14,17 +14,22 @@ autoconf -TODO -- complete documentation drafts below -- test with more systems, only tested on Fedora 12 so far, and the -libmagick that ships it. -- fix inconsistencys with spelling of imagemagick in the src -- report number of images in image bundle types somehow -- probably add pdf to inhibited types -- inhibit types is defconst should probably be defcustom -- decide what to do with some uncommitted imagemagick support +* TODO +** complete documentation drafts below + +** fix inconsistencys with spelling of imagemagick in the src +** report number of images in image bundle types somehow +** probably add pdf to inhibited types +** inhibit types is defconst should probably be defcustom +** decide what to do with some uncommitted imagemagick support functions for image size etc. - +** Test with more systems +Tested on Fedora 12 so far, and the libmagick that ships with it. +Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. +Also need some way to handle render methods that only work on newer ImageMagicks + +** suport "count" property in image-metadata + * NEWS entry ** ImageMagick support From 431dab046cf9d7360d393a6dc2f1cac369cebe8f Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Fri, 14 May 2010 12:07:01 +0200 Subject: [PATCH 006/101] configure support for MagickExportImagePixels and README --- README.imagemagick | 12 ++- configure | 226 ++++++++++++++++++++++++--------------------- configure.in | 6 +- src/config.in | 3 + src/image.c | 34 ++++--- 5 files changed, 158 insertions(+), 123 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index fb957d690ed..52214a23b25 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -28,8 +28,6 @@ Tested on Fedora 12 so far, and the libmagick that ships with it. Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. Also need some way to handle render methods that only work on newer ImageMagicks -** suport "count" property in image-metadata - * NEWS entry ** ImageMagick support @@ -58,6 +56,16 @@ specifications: - rotation - index +See the ImageMagick manual for information on how these specifications +work. + +The image-metadata function can be used to retrieve the total number +of images in an image bundle, and the :index property can be used to +show a particular image within the bundle. This is simmilar to how GIF +files work. + + + * Changelog entry nothing yet diff --git a/configure b/configure index 8c4dc2df865..d06764e2601 100755 --- a/configure +++ b/configure @@ -636,8 +636,8 @@ ac_includes_default="\ #endif" ac_config_libobj_dir=src -ac_header_list= ac_func_list= +ac_header_list= ac_subst_vars='LTLIBOBJS LIB_GCC LD_SWITCH_SYSTEM_EXTRA @@ -1943,6 +1943,7 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +ac_func_list="$ac_func_list MagickExportImagePixels" ac_header_list="$ac_header_list sys/time.h" ac_header_list="$ac_header_list unistd.h" ac_func_list="$ac_func_list alarm" @@ -11893,6 +11894,125 @@ _ACEOF CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MAGICKEXPORTIMAGEPIXELS 1 +_ACEOF + + + + + +for ac_func in $ac_func_list +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + + + fi @@ -18276,110 +18396,6 @@ done -for ac_func in $ac_func_list -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - - diff --git a/configure.in b/configure.in index 58cace5895f..4d65f779670 100644 --- a/configure.in +++ b/configure.in @@ -1765,7 +1765,11 @@ if test "${with_imagemagick}" != "no"; then AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" - fi + fi + + AC_DEFINE(HAVE_MAGICKEXPORTIMAGEPIXELS, 1, [Define to 1 if MagickExportImagePixels is defined.]) + AC_CHECK_FUNCS_ONCE(MagickExportImagePixels) + fi diff --git a/src/config.in b/src/config.in index 9020d976342..29b2a0b967f 100644 --- a/src/config.in +++ b/src/config.in @@ -438,6 +438,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the header file. */ #undef HAVE_MACH_MACH_H +/* Define to 1 if you have the `MagickExportImagePixels' function. */ +#undef HAVE_MAGICKEXPORTIMAGEPIXELS + /* Define to 1 if you have the header file. */ #undef HAVE_MAILLOCK_H diff --git a/src/image.c b/src/image.c index 1bc58db57b8..3ba36559839 100644 --- a/src/image.c +++ b/src/image.c @@ -7755,15 +7755,22 @@ imagemagick_load_image (f, img, contents, size, filename) long ino; image = image_spec_value (img->spec, QCindex, NULL); ino = INTEGERP (image) ? XFASTINT (image) : 0; - - /* if (ino >= ) */ - /* { */ - /* image_error ("Invalid image number `%s' in image `%s'", */ - /* image, img->spec); */ - /* UNGCPRO; */ - /* return 0; */ - /* } */ + + + if (ino >= MagickGetNumberImages(image_wand)) + { + image_error ("Invalid image number `%s' in image `%s'", + image, img->spec); + UNGCPRO; + return 0; + } + + + if (MagickGetNumberImages(image_wand) > 1) + img->data.lisp_val = Fcons (Qcount, + Fcons (make_number (MagickGetNumberImages(image_wand)), + img->data.lisp_val)); if(ino==0) MagickSetFirstIterator(image_wand); else @@ -7917,6 +7924,7 @@ imagemagick_load_image (f, img, contents, size, filename) */ pixelwidth=CharPixel;/*??? TODO figure out*/ +#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS MagickExportImagePixels(image_wand, 0,0, width,height, @@ -7924,16 +7932,12 @@ imagemagick_load_image (f, img, contents, size, filename) pixelwidth, /*&(img->pixmap));*/ ximg->data); +#else + image_error("You dont have MagickExportImagePixels, upgrade ImageMagick if you want to try it!",Qnil,Qnil); +#endif } - //TODO figure out imagecount here! - if (MagickGetNumberImages(image_wand) > 1) - img->data.lisp_val = Fcons (Qcount, - Fcons (make_number (MagickGetNumberImages(image_wand)), - img->data.lisp_val)); - - #ifdef COLOR_TABLE_SUPPORT /* Remember colors allocated for this image. */ img->colors = colors_in_color_table (&img->ncolors); From 69fd80388b70ccb8ea04dd3ff046c56672243ffa Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Mon, 14 Jun 2010 11:16:39 +0200 Subject: [PATCH 007/101] changed looping according to feedback from stefan monnier --- lisp/image.el | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lisp/image.el b/lisp/image.el index 57e980c0afd..b9cb2067245 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -697,21 +697,17 @@ shall be displayed." ;;;###autoload (defun imagemagick-register-types () "Register file types that imagemagick is able to handle." - (let ((im-types (imagemagick-types)) - (im-inhibit imagemagick-types-inhibit)) - (while im-inhibit - (setq im-types (remove (car im-inhibit) im-types)) - (setq im-inhibit (cdr im-inhibit))) - (while im-types - (let - ((extension (downcase (symbol-name (car im-types))))) + (let ((im-types (imagemagick-types))) + (dolist im-inhibit + (setq im-types (remove im-inhibit im-types))) + (dolist im-type im-types + (let ((extension (downcase (symbol-name im-type)))) (push (cons (concat "\\." extension "\\'") 'image-mode) auto-mode-alist) (push (cons (concat "\\." extension "\\'") 'imagemagick) - image-type-file-name-regexps) - (setq im-types (cdr im-types)))))) + image-type-file-name-regexps))))) From 4917006be4c461d6dfedc205ababadd5e15d5279 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Mon, 14 Jun 2010 15:57:48 +0200 Subject: [PATCH 008/101] mostly cosmetic, moving { instances, changing indentation accordingly. --- lisp/image.el | 4 +- src/image.c | 680 +++++++++++++++++++++++++------------------------- 2 files changed, 343 insertions(+), 341 deletions(-) diff --git a/lisp/image.el b/lisp/image.el index 96694d11363..fe6af0cefda 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -702,9 +702,9 @@ shall be displayed." (defun imagemagick-register-types () "Register file types that imagemagick is able to handle." (let ((im-types (imagemagick-types))) - (dolist im-inhibit + (dolist (im-inhibit imagemagick-types-inhibit) (setq im-types (remove im-inhibit im-types))) - (dolist im-type im-types + (dolist (im-type im-types) (let ((extension (downcase (symbol-name im-type)))) (push (cons (concat "\\." extension "\\'") 'image-mode) diff --git a/src/image.c b/src/image.c index 1ed2fc84af3..9de83fa05e2 100644 --- a/src/image.c +++ b/src/image.c @@ -7569,16 +7569,9 @@ gif_load (struct frame *f, struct image *img) /*********************************************************************** imagemagick - ***********************************************************************/ +***********************************************************************/ #if defined (HAVE_IMAGEMAGICK) Lisp_Object Vimagemagick_render_type; -/* Function prototypes. */ - -static int imagemagick_image_p (Lisp_Object object); -static int imagemagick_load (struct frame *f, struct image *img); - -static int imagemagick_load_image (struct frame *, struct image *, - unsigned char *, unsigned int, unsigned char *); /* The symbol `imagemagick' identifying images of this type. */ @@ -7588,65 +7581,46 @@ Lisp_Object Vimagemagick_render_type; /* Indices of image specification fields in imagemagick_format, below. */ enum imagemagick_keyword_index -{ - IMAGEMAGICK_TYPE, - IMAGEMAGICK_DATA, - IMAGEMAGICK_FILE, - IMAGEMAGICK_ASCENT, - IMAGEMAGICK_MARGIN, - IMAGEMAGICK_RELIEF, - IMAGEMAGICK_ALGORITHM, - IMAGEMAGICK_HEURISTIC_MASK, - IMAGEMAGICK_MASK, - IMAGEMAGICK_BACKGROUND, - IMAGEMAGICK_LAST -}; + { + IMAGEMAGICK_TYPE, + IMAGEMAGICK_DATA, + IMAGEMAGICK_FILE, + IMAGEMAGICK_ASCENT, + IMAGEMAGICK_MARGIN, + IMAGEMAGICK_RELIEF, + IMAGEMAGICK_ALGORITHM, + IMAGEMAGICK_HEURISTIC_MASK, + IMAGEMAGICK_MASK, + IMAGEMAGICK_BACKGROUND, + IMAGEMAGICK_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Free X resources of imagemagick image IMG which is used on frame F. */ static void -imagemagick_clear_image (f, img) - struct frame *f; - struct image *img; +imagemagick_clear_image (struct frame *f, + struct image *img) { printf("clearing imagemagick image\n"); x_clear_image (f, img); } -/* Structure describing the image type `imagemagick'. Its the same type of - structure defined for all image formats, handled by Emacs image - functions. See struct image_type in dispextern.h. */ - -static struct image_type imagemagick_type = -{ - /* An identifier showing that this is an image structure for the IMAGEMAGICK format. */ - &Qimagemagick, - /* Handle to a function that can be used to identify a IMAGEMAGICK file. */ - imagemagick_image_p, - /* Handle to function used to load a IMAGEMAGICK file. */ - imagemagick_load, - /* Handle to function to free resources for IMAGEMAGICK. */ - imagemagick_clear_image, - /* An internal field to link to the next image type in a list of - image types, will be filled in when registering the format. */ - NULL -}; /* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification. Do @@ -7654,8 +7628,7 @@ static struct image_type imagemagick_type = identify the IMAGEMAGICK format. */ static int -imagemagick_image_p (object) - Lisp_Object object; +imagemagick_image_p (Lisp_Object object) { struct image_keyword fmt[IMAGEMAGICK_LAST]; bcopy (imagemagick_format, fmt, sizeof fmt); @@ -7672,14 +7645,292 @@ imagemagick_image_p (object) #define DrawRectangle DrawRectangleGif #include +/* imagemagick_load_image is a helper function for imagemagick_load, which does the + actual loading given contents and size, apart from frame and image + structures, passed from imagemagick_load. + + Uses librimagemagick to do most of the image processing. + + Returns non-zero when successful. +*/ + +static int +imagemagick_load_image (struct frame *f, /* Pointer to emacs frame structure. */ + struct image *img, /* Pointer to emacs image structure. */ + unsigned char *contents,/* String containing the IMAGEMAGICK data to be parsed. */ + unsigned int size, /* Size of data in bytes. */ + unsigned char *filename)/* Filename, either pass filename or contents/size. */ +{ + long unsigned int width; + long unsigned int height; + + MagickBooleanType + status; + + XImagePtr ximg; + Lisp_Object specified_bg; + XColor background; + int x; + int y; + + MagickWand *image_wand; + PixelIterator *iterator; + PixelWand **pixels; + MagickPixelPacket pixel; + Lisp_Object image; + Lisp_Object value; + Lisp_Object crop, geometry; + long ino; + int desired_width, desired_height; + double rotation; + int imagemagick_rendermethod; + int pixelwidth; + + + /* image_wand will contain the image. */ + image_wand = NewMagickWand(); + + /* Parse the contents argument and initialize image_wand. */ + if(filename != NULL) + status = MagickReadImage(image_wand, filename); + else + status = MagickReadImageBlob(image_wand, contents, size); + image_error ("im read failed", Qnil, Qnil); + if (status == MagickFalse) goto imagemagick_error; + + /* Handle image index for image types who can contain more than one image. + Interface :index is same as for GIF. */ + + image = image_spec_value (img->spec, QCindex, NULL); + ino = INTEGERP (image) ? XFASTINT (image) : 0; + + + + if (ino >= MagickGetNumberImages(image_wand)) + { + image_error ("Invalid image number `%s' in image `%s'", + image, img->spec); + UNGCPRO; + return 0; + } + + + if (MagickGetNumberImages(image_wand) > 1) + img->data.lisp_val = Fcons (Qcount, + Fcons (make_number (MagickGetNumberImages(image_wand)), + img->data.lisp_val)); + if(ino == 0) + MagickSetFirstIterator(image_wand); + else + MagickSetIteratorIndex(image_wand, ino); + + /* + If width and/or height is set in the display spec + assume we want to scale to those. */ + + value = image_spec_value (img->spec, QCwidth, NULL); + desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); + value = image_spec_value (img->spec, QCheight, NULL); + desired_height = (INTEGERP (value) ? XFASTINT (value) : -1); + if(desired_width != -1 && desired_height != -1) + { + printf("MagickScaleImage %d %d\n", desired_width, desired_height); + status = MagickScaleImage(image_wand, desired_width, desired_height); + if (status == MagickFalse) { + image_error ("Imagemagick scale failed", Qnil, Qnil); + goto imagemagick_error; + } + } + + /* Also support :geometry and :crop which are imagemagick specific descriptors. */ + + crop = image_spec_value (img->spec, QCcrop, NULL); + geometry = image_spec_value (img->spec, QCgeometry, NULL); + if (STRINGP (crop) && STRINGP (geometry)) + { + printf("MagickTransformImage %s %s\n", SDATA(crop), SDATA(geometry)); + image_wand = MagickTransformImage (image_wand, SDATA (crop), SDATA (geometry)); + /* TODO differ between image_wand and transform_wand. */ + } + + /* Furthermore :rotation. we need background color and angle for rotation. */ + /* + TODO background handling for rotation + specified_bg = image_spec_value (img->spec, QCbackground, NULL); + if (!STRINGP (specified_bg) + */ + value = image_spec_value (img->spec, QCrotation, NULL); + if (FLOATP (value)) + { + PixelWand* background = NewPixelWand(); + PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/ + + rotation = extract_float (value); + printf ("MagickRotateImage %f\n", rotation); + + status = MagickRotateImage (image_wand, background, rotation); + DestroyPixelWand (background); + if (status == MagickFalse) + { + image_error ("Imagemagick image rotate failed", Qnil, Qnil); + goto imagemagick_error; + } + } + + /* Finaly we are done manipulating the image, + figure out resulting width, height, and then transfer ownerwship to Emacs. + */ + height = MagickGetImageHeight (image_wand); + width = MagickGetImageWidth (image_wand); + if (status == MagickFalse) + { + image_error ("Imagemagick image get size failed", Qnil, Qnil); + goto imagemagick_error; + } + + if (! check_image_size (f, width, height)) + { + image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); + goto imagemagick_error; + } + + /* We can now get a valid pixel buffer from the imagemagick file, if all + went ok. */ + + + init_color_table (); + imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type) ? XFASTINT (Vimagemagick_render_type) : 0); + if (imagemagick_rendermethod == 0) + { + /* Try to create a x pixmap to hold the imagemagick pixmap. */ + if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) + { + image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); + goto imagemagick_error; + } + + /* Copy imagegmagick image to x with primitive yet robust pixel + pusher loop. This has been tested a lot with many different + images, it doesnt work too well with image archive formats though! + + Also seems slow. + */ + + /* Copy pixels from the imagemagick image structure to the x image map. */ + iterator = NewPixelIterator (image_wand); + if ((iterator == (PixelIterator *) NULL)) + { + image_error ("Imagemagick pixel iterator creation failed", Qnil, Qnil); + goto imagemagick_error; + } + + for (y = 0; y < (long) MagickGetImageHeight(image_wand); y++) + { + pixels = PixelGetNextIteratorRow (iterator, &width); + if ((pixels == (PixelWand **) NULL)) + break; + for (x = 0; x < (long) width; x++) + { + PixelGetMagickColor (pixels[x], &pixel); + XPutPixel (ximg, x, y, lookup_rgb_color (f, pixel.red, pixel.green, pixel.blue)); + } + } + DestroyPixelIterator (iterator); + } + + if (imagemagick_rendermethod == 1) + { + /* Try if magicexportimage is any faster than pixelpushing. */ + /* printf("ximg: bitmap_unit:%d format:%d byte_order:%d depth:%d bits_per_pixel:%d\n", */ + /* ximg->bitmap_unit,ximg->format,ximg->byte_order,ximg->depth,ximg->bits_per_pixel); */ + int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ + char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ + /* Try to create a x pixmap to hold the imagemagick pixmap. */ + printf("imagedepth:%d exportdepth:%s\n", imagedepth, exportdepth); + if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, &ximg, &img->pixmap)){ + image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); + goto imagemagick_error; + } + + + /* Oddly, the below code doesnt seem to work:*/ + /* switch(ximg->bitmap_unit){ */ + /* case 8: */ + /* pixelwidth=CharPixel; */ + /* break; */ + /* case 16: */ + /* pixelwidth=ShortPixel; */ + /* break; */ + /* case 32: */ + /* pixelwidth=LongPixel; */ + /* break; */ + /* } */ + /* + Here im just guessing the format of the bitmap. + happens to work fine for: + - bw djvu images + on rgb display. + seems about 3 times as fast as pixel pushing(not carefully measured) + with color djvu, the bitplanes are mapped to wrong color(seems fixed). + + */ + pixelwidth = CharPixel;/*??? TODO figure out*/ +#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS + MagickExportImagePixels(image_wand, + 0, 0, + width, height, + exportdepth, + pixelwidth, + /*&(img->pixmap));*/ + ximg->data); +#else + image_error("You dont have MagickExportImagePixels, upgrade ImageMagick if you want to try it!", + Qnil, Qnil); +#endif + } + + +#ifdef COLOR_TABLE_SUPPORT + /* Remember colors allocated for this image. */ + img->colors = colors_in_color_table (&img->ncolors); + free_color_table (); +#endif /* COLOR_TABLE_SUPPORT */ + + + img->width = width; + img->height = height; + + /* Maybe fill in the background field while we have ximg handy. + Casting avoids a GCC warning. */ + /* IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);*/ + + /* Put the image into the pixmap, then free the X image and its + buffer. */ + x_put_x_image (f, ximg, img->pixmap, width, height); + + x_destroy_x_image (ximg); + + + /* JAVE TODO more cleanup. */ + DestroyMagickWand (image_wand); + + return 1; + + imagemagick_error: + /* TODO more cleanup. */ + image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); + printf("Imagemagick error, see *Messages*\n"); + return 0; +} + + /* Load IMAGEMAGICK image IMG for use on frame F. Value is non-zero if successful. this function will go into the imagemagick_type structure, and the prototype thus needs to be compatible with that structure. */ static int -imagemagick_load (f, img) - struct frame *f; - struct image *img; +imagemagick_load (struct frame *f, + struct image *img) { int success_p = 0; Lisp_Object file_name; @@ -7721,289 +7972,38 @@ imagemagick_load (f, img) Lisp_Object data; data = image_spec_value (img->spec, QCdata, NULL); - success_p = imagemagick_load_image (f, img, SDATA (data), SBYTES (data),NULL); + success_p = imagemagick_load_image (f, img, SDATA (data), SBYTES (data), NULL); } return success_p; } -/* imagemagick_load_image is a helper function for imagemagick_load, which does the - actual loading given contents and size, apart from frame and image - structures, passed from imagemagick_load. +/* Structure describing the image type `imagemagick'. Its the same type of + structure defined for all image formats, handled by Emacs image + functions. See struct image_type in dispextern.h. */ - Uses librimagemagick to do most of the image processing. - - Returns non-zero when successful. -*/ - -static int -imagemagick_load_image (f, img, contents, size, filename) - /* Pointer to emacs frame structure. */ - struct frame *f; - /* Pointer to emacs image structure. */ - struct image *img; - /* String containing the IMAGEMAGICK data to be parsed. */ - unsigned char *contents; - /* Size of data in bytes. */ - unsigned int size; - /* Filename, either pass filename or contents/size. */ - unsigned char *filename; -{ - long unsigned int width; - long unsigned int height; - - MagickBooleanType - status; - - XImagePtr ximg; - Lisp_Object specified_bg; - XColor background; - int x; - int y; - - MagickWand *image_wand; - PixelIterator *iterator; - PixelWand **pixels; - MagickPixelPacket pixel; - - - /* image_wand will contain the image. */ - image_wand = NewMagickWand(); - - /* Parse the contents argument and initialize image_wand. */ - if(filename!=NULL) - status=MagickReadImage(image_wand, filename); - else - status=MagickReadImageBlob(image_wand, contents, size); - image_error ("im read failed", Qnil, Qnil); - if (status == MagickFalse) goto imagemagick_error; - - /* Handle image index for image types who can contain more than one image. - Interface :index is same as for GIF. */ - Lisp_Object image; - long ino; - image = image_spec_value (img->spec, QCindex, NULL); - ino = INTEGERP (image) ? XFASTINT (image) : 0; +static struct image_type imagemagick_type = + { + /* An identifier showing that this is an image structure for the IMAGEMAGICK format. */ + &Qimagemagick, + /* Handle to a function that can be used to identify a IMAGEMAGICK file. */ + imagemagick_image_p, + /* Handle to function used to load a IMAGEMAGICK file. */ + imagemagick_load, + /* Handle to function to free resources for IMAGEMAGICK. */ + imagemagick_clear_image, + /* An internal field to link to the next image type in a list of + image types, will be filled in when registering the format. */ + NULL + }; - if (ino >= MagickGetNumberImages(image_wand)) - { - image_error ("Invalid image number `%s' in image `%s'", - image, img->spec); - UNGCPRO; - return 0; - } - - if (MagickGetNumberImages(image_wand) > 1) - img->data.lisp_val = Fcons (Qcount, - Fcons (make_number (MagickGetNumberImages(image_wand)), - img->data.lisp_val)); - if(ino==0) - MagickSetFirstIterator(image_wand); - else - MagickSetIteratorIndex(image_wand, ino); - - /* - If width and/or height is set in the display spec - assume we want to scale to those. */ - - int desired_width, desired_height; - Lisp_Object value; - value = image_spec_value (img->spec, QCwidth, NULL); - desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); - value = image_spec_value (img->spec, QCheight, NULL); - desired_height = (INTEGERP (value) ? XFASTINT (value) : -1); - if(desired_width != -1 && desired_height != -1){ - printf("MagickScaleImage %d %d\n",desired_width, desired_height); - status=MagickScaleImage(image_wand, desired_width, desired_height); - if (status == MagickFalse) { - image_error ("Imagemagick scale failed", Qnil, Qnil); - goto imagemagick_error; - } - - } - - /* Also support :geometry and :crop which are imagemagick specific descriptors. */ - - Lisp_Object crop, geometry; - crop = image_spec_value (img->spec, QCcrop, NULL); - geometry = image_spec_value (img->spec, QCgeometry, NULL); - if (STRINGP (crop) && STRINGP (geometry)){ - printf("MagickTransformImage %s %s\n",SDATA(crop), SDATA(geometry)); - image_wand = MagickTransformImage (image_wand, SDATA (crop), SDATA (geometry)); - /* TODO differ between image_wand and transform_wand. */ - } - - /* Furthermore :rotation. we need background color and angle for rotation. */ - /* - TODO background handling for rotation - specified_bg = image_spec_value (img->spec, QCbackground, NULL); - if (!STRINGP (specified_bg) - */ - double rotation; - value = image_spec_value (img->spec, QCrotation, NULL); - if (FLOATP (value)){ - PixelWand* background = NewPixelWand(); - PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/ - - rotation = extract_float (value); - printf ("MagickRotateImage %f\n",rotation); - - status=MagickRotateImage (image_wand, background,rotation); - DestroyPixelWand (background); - if (status == MagickFalse) { - image_error ("Imagemagick image rotate failed", Qnil, Qnil); - goto imagemagick_error; - } - } - - /* Finaly we are done manipulating the image, - figure out resulting width, height, and then transfer ownerwship to Emacs. - */ - height=MagickGetImageHeight (image_wand); - width=MagickGetImageWidth (image_wand); - if (status == MagickFalse) { - image_error ("Imagemagick image get size failed", Qnil, Qnil); - goto imagemagick_error; - } - - if (! check_image_size (f, width, height)) - { - image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); - goto imagemagick_error; - } - - /* We can now get a valid pixel buffer from the imagemagick file, if all - went ok. */ - - - init_color_table (); - int imagemagick_rendermethod=(INTEGERP (Vimagemagick_render_type) ? XFASTINT (Vimagemagick_render_type) : 0); - if (imagemagick_rendermethod==0){ - /* Try to create a x pixmap to hold the imagemagick pixmap. */ - if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)){ - image_error("Imagemagick X bitmap allocation failure",Qnil,Qnil); - goto imagemagick_error; - } - - /* Copy imagegmagick image to x with primitive yet robust pixel - pusher loop. This has been tested a lot with many different - images, it doesnt work too well with image archive formats though! - - Also seems slow. - */ - - /* Copy pixels from the imagemagick image structure to the x image map. */ - iterator = NewPixelIterator (image_wand); - if ((iterator == (PixelIterator *) NULL)) { - image_error ("Imagemagick pixel iterator creation failed", Qnil, Qnil); - goto imagemagick_error; - } - - for (y=0; y < (long) MagickGetImageHeight(image_wand); y++) - { - pixels = PixelGetNextIteratorRow (iterator, &width); - if ((pixels == (PixelWand **) NULL)) - break; - for (x=0; x < (long) width; x++) - { - PixelGetMagickColor (pixels[x], &pixel); - XPutPixel (ximg, x, y, lookup_rgb_color (f, pixel.red, pixel.green, pixel.blue)); - } - } - DestroyPixelIterator (iterator); - } - - if (imagemagick_rendermethod==1){ - /* Try if magicexportimage is any faster than pixelpushing. */ - /* printf("ximg: bitmap_unit:%d format:%d byte_order:%d depth:%d bits_per_pixel:%d\n", */ - /* ximg->bitmap_unit,ximg->format,ximg->byte_order,ximg->depth,ximg->bits_per_pixel); */ - int imagedepth=24;/*MagickGetImageDepth(image_wand);*/ - char* exportdepth= imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ - /* Try to create a x pixmap to hold the imagemagick pixmap. */ - printf("imagedepth:%d exportdepth:%s\n", imagedepth, exportdepth); - if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, &ximg, &img->pixmap)){ - image_error("Imagemagick X bitmap allocation failure",Qnil,Qnil); - goto imagemagick_error; - } - - - /* Oddly, the below code doesnt seem to work:*/ - int pixelwidth; - /* switch(ximg->bitmap_unit){ */ - /* case 8: */ - /* pixelwidth=CharPixel; */ - /* break; */ - /* case 16: */ - /* pixelwidth=ShortPixel; */ - /* break; */ - /* case 32: */ - /* pixelwidth=LongPixel; */ - /* break; */ - /* } */ - /* - Here im just guessing the format of the bitmap. - happens to work fine for: - - bw djvu images - on rgb display. - seems about 3 times as fast as pixel pushing(not carefully measured) - with color djvu, the bitplanes are mapped to wrong color(seems fixed). - - */ - pixelwidth=CharPixel;/*??? TODO figure out*/ -#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS - MagickExportImagePixels(image_wand, - 0,0, - width,height, - exportdepth, - pixelwidth, - /*&(img->pixmap));*/ - ximg->data); -#else - image_error("You dont have MagickExportImagePixels, upgrade ImageMagick if you want to try it!",Qnil,Qnil); -#endif - } - - -#ifdef COLOR_TABLE_SUPPORT - /* Remember colors allocated for this image. */ - img->colors = colors_in_color_table (&img->ncolors); - free_color_table (); -#endif /* COLOR_TABLE_SUPPORT */ - - - img->width = width; - img->height = height; - - /* Maybe fill in the background field while we have ximg handy. - Casting avoids a GCC warning. */ - /* IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);*/ - - /* Put the image into the pixmap, then free the X image and its - buffer. */ - x_put_x_image (f, ximg, img->pixmap, width, height); - - x_destroy_x_image (ximg); - - - /* JAVE TODO more cleanup. */ - DestroyMagickWand (image_wand); - - return 1; - - imagemagick_error: - /* TODO more cleanup. */ - image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); - printf("Imagemagick error, see *Messages*\n"); - return 0; -} - -DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0,0,0, +DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0, doc: /* Return image file types supported by ImageMagick. - Since ImageMagick recognizes a lot of file-types that clash with Emacs, - such as .c, we want to be able to alter the list at the lisp level. */) + Since ImageMagick recognizes a lot of file-types that clash with Emacs, + such as .c, we want to be able to alter the list at the lisp level. */) () { Lisp_Object typelist = Qnil; @@ -8012,11 +8012,12 @@ DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0,0,0, char** imtypes = GetMagickList ("*", &numf, &ex); int i; Lisp_Object Qimagemagicktype; - for (i = 0; i < numf; i++) { - Qimagemagicktype = intern (*( imtypes + i)); - typelist = Fcons (Qimagemagicktype, typelist); - } - return typelist; + for (i = 0; i < numf; i++) + { + Qimagemagicktype = intern (imtypes[i]); + typelist = Fcons (Qimagemagicktype, typelist); +} +return typelist; } #endif /* defined (HAVE_IMAGEMAGICK) */ @@ -9036,13 +9037,14 @@ a large number of images, the actual eviction time may be shorter. The value can also be nil, meaning the cache is never cleared. The function `clear-image-cache' disregards this variable. */); Vimage_cache_eviction_delay = make_number (300); -} - #ifdef HAVE_IMAGEMAGICK DEFVAR_LISP ("imagemagick-render-type", &Vimagemagick_render_type, - doc: /* */); + doc: /* Choose between ImageMagick render methods. */); #endif +} + + void init_image () { From d2a2d277369b8340851f294761c96b8198665532 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Mon, 14 Jun 2010 23:27:03 +0200 Subject: [PATCH 009/101] cosmetics, and changing of defconst to defcustom --- README.imagemagick | 81 ++++++++++++++++++++++++++--------- lisp/image.el | 4 +- src/image.c | 103 ++++++++++++++++++++++++++++----------------- 3 files changed, 127 insertions(+), 61 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index 52214a23b25..22be443baa8 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -15,18 +15,45 @@ autoconf * TODO -** complete documentation drafts below +#B _ complete documentation drafts below -** fix inconsistencys with spelling of imagemagick in the src -** report number of images in image bundle types somehow -** probably add pdf to inhibited types -** inhibit types is defconst should probably be defcustom -** decide what to do with some uncommitted imagemagick support +#B X fix inconsistencys with spelling of imagemagick in the src +#B X report number of images in image bundle types somehow +Works like for "gif" support. Thanks to Juri Linkov. +#B X probably add pdf to inhibited types +#B X inhibit types is defconst should probably be defcustom +#B _ decide what to do with some uncommitted imagemagick support functions for image size etc. -** Test with more systems +#B _ Test with more systems Tested on Fedora 12 so far, and the libmagick that ships with it. Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. -Also need some way to handle render methods that only work on newer ImageMagicks +#B X Also need some way to handle render methods that only work on newer ImageMagicks +Is handled by configure now + +* Some nits from Stefan Monnier +I just took a quick look at the code and I see the following nits to fix: +#B _ obviously a merge will have to come with a good ChangeLog. +#B X also the merge will need to come with documentation. Maybe not in the + Texinfo form yet, but at least in the etc/NEWS with enough info that + describes the `scale' and other such arguments that someone can start + using them. +#B X the README talks about naming inconsistencies, I think these should be + fixed before a first commit (should be straightforward). + +#B X the "let" in image.el should not be followed by a line break and the while + should be replaced by a dolist. + +#B X the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]]) + its args, not sure what happened. +#B X a few lines in the C code break the 80columns limit. +#B X please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]]) +#B X you can get rid of the prototypes by reordering the code. ([[2010.06.14]]) +#B X the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]]) + weirdly otherwise in C-h f). +#B X Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]]) +#B X why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]]) +#B X some "," lack a space after them. ([[2010.06.14]]) +#B X several "=" and "==" lack spaces around them. ([[2010.06.14]]) * NEWS entry @@ -44,7 +71,7 @@ The function (imagemagick-register-types) will enable the imagemagick support for the extensions in imagemagick-types minus the types listed in imagemagick-types-inhibit. -imagemagick-types-inhibit has the value '(C HTML HTM TXT) by default. +imagemagick-types-inhibit has the value '(C HTML HTM TXT PDF) by default. This means imagemagick will be used also to load jpeg files, if you have both jpeg and imagemagick libraries linked. Add 'JPG to imagemagick-types-inhibit if you do not want this. @@ -52,22 +79,36 @@ imagemagick-types-inhibit if you do not want this. Images loaded with imagemagick will support a couple of new display specifications: -- scale -- rotation -- index +- :scale takes a geometry string as defined by ImageMagick: -See the ImageMagick manual for information on how these specifications -work. +scale% +scale-x%xscale-y% +width +xheight +widthxheight +widthxheight^ +widthxheight! +widthxheight> +widthxheight< +area@ +{size}{offset} {size}{+-}x{+-}y + +See the ImageMagick manual for more information. + +- :rotation specifies a rotation angle in degrees. + +- :index specifies which image inside an image bundle file format, such +as TIFF or DJVM, to view. The image-metadata function can be used to retrieve the total number -of images in an image bundle, and the :index property can be used to -show a particular image within the bundle. This is simmilar to how GIF -files work. - +of images in an image bundle. This is simmilar to how GIF files work. * Changelog entry -nothing yet +2010-06-12 Joakim Verona + * image.c + * image.el + * Manual entry -nothing yet \ No newline at end of file +nothing yet, but the NEWS entry could be adapted. \ No newline at end of file diff --git a/lisp/image.el b/lisp/image.el index fe6af0cefda..5b7b26b58e8 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -694,8 +694,8 @@ shall be displayed." (cons images tmo)))))) -(defconst imagemagick-types-inhibit - '(C HTML HTM TXT) +(defcustom imagemagick-types-inhibit + '(C HTML HTM TXT PDF) "Types the imagemagick loader should not try to handle.") ;;;###autoload diff --git a/src/image.c b/src/image.c index 9de83fa05e2..4b4eb4e1c2e 100644 --- a/src/image.c +++ b/src/image.c @@ -7645,21 +7645,28 @@ imagemagick_image_p (Lisp_Object object) #define DrawRectangle DrawRectangleGif #include -/* imagemagick_load_image is a helper function for imagemagick_load, which does the - actual loading given contents and size, apart from frame and image - structures, passed from imagemagick_load. +/* imagemagick_load_image is a helper function for imagemagick_load, + which does the actual loading given contents and size, apart from + frame and image structures, passed from imagemagick_load. Uses librimagemagick to do most of the image processing. - Returns non-zero when successful. + non-zero when successful. */ static int -imagemagick_load_image (struct frame *f, /* Pointer to emacs frame structure. */ - struct image *img, /* Pointer to emacs image structure. */ - unsigned char *contents,/* String containing the IMAGEMAGICK data to be parsed. */ - unsigned int size, /* Size of data in bytes. */ - unsigned char *filename)/* Filename, either pass filename or contents/size. */ +imagemagick_load_image (/* Pointer to emacs frame structure. */ + struct frame *f, + /* Pointer to emacs image structure. */ + struct image *img, + /* String containing the IMAGEMAGICK data to + be parsed. */ + unsigned char *contents, + /* Size of data in bytes. */ + unsigned int size, + /* Filename, either pass filename or + contents/size. */ + unsigned char *filename) { long unsigned int width; long unsigned int height; @@ -7716,17 +7723,17 @@ imagemagick_load_image (struct frame *f, /* Pointer to emacs frame struct if (MagickGetNumberImages(image_wand) > 1) - img->data.lisp_val = Fcons (Qcount, - Fcons (make_number (MagickGetNumberImages(image_wand)), - img->data.lisp_val)); + img->data.lisp_val = + Fcons (Qcount, + Fcons (make_number (MagickGetNumberImages(image_wand)), + img->data.lisp_val)); if(ino == 0) MagickSetFirstIterator(image_wand); else MagickSetIteratorIndex(image_wand, ino); - /* - If width and/or height is set in the display spec - assume we want to scale to those. */ + /* If width and/or height is set in the display spec assume we want + to scale to those. */ value = image_spec_value (img->spec, QCwidth, NULL); desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); @@ -7742,22 +7749,25 @@ imagemagick_load_image (struct frame *f, /* Pointer to emacs frame struct } } - /* Also support :geometry and :crop which are imagemagick specific descriptors. */ + /* Also support :geometry and :crop which are imagemagick specific + descriptors. */ crop = image_spec_value (img->spec, QCcrop, NULL); geometry = image_spec_value (img->spec, QCgeometry, NULL); if (STRINGP (crop) && STRINGP (geometry)) { printf("MagickTransformImage %s %s\n", SDATA(crop), SDATA(geometry)); - image_wand = MagickTransformImage (image_wand, SDATA (crop), SDATA (geometry)); + image_wand = MagickTransformImage (image_wand, SDATA (crop), + SDATA (geometry)); /* TODO differ between image_wand and transform_wand. */ } - /* Furthermore :rotation. we need background color and angle for rotation. */ + /* Furthermore :rotation. we need background color and angle for + rotation. */ /* - TODO background handling for rotation - specified_bg = image_spec_value (img->spec, QCbackground, NULL); - if (!STRINGP (specified_bg) + TODO background handling for rotation specified_bg = + image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP + (specified_bg) */ value = image_spec_value (img->spec, QCrotation, NULL); if (FLOATP (value)) @@ -7799,11 +7809,13 @@ imagemagick_load_image (struct frame *f, /* Pointer to emacs frame struct init_color_table (); - imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type) ? XFASTINT (Vimagemagick_render_type) : 0); + imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type) + ? XFASTINT (Vimagemagick_render_type) : 0); if (imagemagick_rendermethod == 0) { /* Try to create a x pixmap to hold the imagemagick pixmap. */ - if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) + if (!x_create_x_image_and_pixmap (f, width, height, 0, + &ximg, &img->pixmap)) { image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); goto imagemagick_error; @@ -7820,7 +7832,8 @@ imagemagick_load_image (struct frame *f, /* Pointer to emacs frame struct iterator = NewPixelIterator (image_wand); if ((iterator == (PixelIterator *) NULL)) { - image_error ("Imagemagick pixel iterator creation failed", Qnil, Qnil); + image_error ("Imagemagick pixel iterator creation failed", + Qnil, Qnil); goto imagemagick_error; } @@ -7832,7 +7845,11 @@ imagemagick_load_image (struct frame *f, /* Pointer to emacs frame struct for (x = 0; x < (long) width; x++) { PixelGetMagickColor (pixels[x], &pixel); - XPutPixel (ximg, x, y, lookup_rgb_color (f, pixel.red, pixel.green, pixel.blue)); + XPutPixel (ximg, x, y, + lookup_rgb_color (f, + pixel.red, + pixel.green, + pixel.blue)); } } DestroyPixelIterator (iterator); @@ -7841,13 +7858,16 @@ imagemagick_load_image (struct frame *f, /* Pointer to emacs frame struct if (imagemagick_rendermethod == 1) { /* Try if magicexportimage is any faster than pixelpushing. */ - /* printf("ximg: bitmap_unit:%d format:%d byte_order:%d depth:%d bits_per_pixel:%d\n", */ - /* ximg->bitmap_unit,ximg->format,ximg->byte_order,ximg->depth,ximg->bits_per_pixel); */ + /* printf("ximg: bitmap_unit:%d format:%d byte_order:%d depth:%d + bits_per_pixel:%d\n", */ + /* ximg->bitmap_unit,ximg->format,ximg->byte_order, + ximg->depth,ximg->bits_per_pixel); */ int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ /* Try to create a x pixmap to hold the imagemagick pixmap. */ printf("imagedepth:%d exportdepth:%s\n", imagedepth, exportdepth); - if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, &ximg, &img->pixmap)){ + if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, + &ximg, &img->pixmap)){ image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); goto imagemagick_error; } @@ -7884,7 +7904,7 @@ imagemagick_load_image (struct frame *f, /* Pointer to emacs frame struct /*&(img->pixmap));*/ ximg->data); #else - image_error("You dont have MagickExportImagePixels, upgrade ImageMagick if you want to try it!", + image_error("You dont have MagickExportImagePixels, upgrade ImageMagick!", Qnil, Qnil); #endif } @@ -7957,7 +7977,8 @@ imagemagick_load (struct frame *f, /* contents = slurp_file (SDATA (file), &size); */ /* if (contents == NULL) */ /* { */ - /* image_error ("Error loading IMAGEMAGICK image `%s'", img->spec, Qnil); */ + /* image_error ("Error loading IMAGEMAGICK image `%s'", + img->spec, Qnil); */ /* UNGCPRO; */ /* return 0; */ /* } */ @@ -7972,21 +7993,24 @@ imagemagick_load (struct frame *f, Lisp_Object data; data = image_spec_value (img->spec, QCdata, NULL); - success_p = imagemagick_load_image (f, img, SDATA (data), SBYTES (data), NULL); + success_p = imagemagick_load_image (f, img, SDATA (data), + SBYTES (data), NULL); } return success_p; } -/* Structure describing the image type `imagemagick'. Its the same type of - structure defined for all image formats, handled by Emacs image - functions. See struct image_type in dispextern.h. */ +/* Structure describing the image type `imagemagick'. Its the same + type of structure defined for all image formats, handled by Emacs + image functions. See struct image_type in dispextern.h. */ static struct image_type imagemagick_type = { - /* An identifier showing that this is an image structure for the IMAGEMAGICK format. */ + /* An identifier showing that this is an image structure for the + IMAGEMAGICK format. */ &Qimagemagick, - /* Handle to a function that can be used to identify a IMAGEMAGICK file. */ + /* Handle to a function that can be used to identify a IMAGEMAGICK + file. */ imagemagick_image_p, /* Handle to function used to load a IMAGEMAGICK file. */ imagemagick_load, @@ -8002,8 +8026,8 @@ static struct image_type imagemagick_type = DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0, doc: /* Return image file types supported by ImageMagick. - Since ImageMagick recognizes a lot of file-types that clash with Emacs, - such as .c, we want to be able to alter the list at the lisp level. */) +Since ImageMagick recognizes a lot of file-types that clash with Emacs, +such as .c, we want to be able to alter the list at the lisp level. */) () { Lisp_Object typelist = Qnil; @@ -8824,7 +8848,8 @@ of `image-library-alist', which see). */) if (EQ (type, Qimagemagick)){ /* MagickWandGenesis() initalizes the imagemagick library. */ MagickWandGenesis(); - return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions, libraries); + return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions, + libraries); } #endif From 630bda942a4061c16d7567412ab6692b1ead8a37 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Mon, 14 Jun 2010 23:45:08 +0200 Subject: [PATCH 010/101] attempt at Changelog entry, see README.imagemagick --- README.imagemagick | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index 22be443baa8..8b933b68f4b 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -106,9 +106,17 @@ of images in an image bundle. This is simmilar to how GIF files work. * Changelog entry 2010-06-12 Joakim Verona - * image.c - * image.el - + * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is + defined: + (imagemagick_image_p): New function to test for ImageMagic img. + (imagemagick_load): New function to load ImageMagick img. + (imagemagick_load_image): New function, helper for imagemagick_load + (imagemagick-types): New function. + (Qimagemagick): New Lisp_object. + * image.el: + (imagemagick-types-inhibit): New var. + (imagemagick-register-types): New function. + * config.in, Makefile.in, configure.in * Manual entry nothing yet, but the NEWS entry could be adapted. \ No newline at end of file From f663e78443d5fc1904c63e58df076d1b569499d5 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Tue, 15 Jun 2010 15:06:47 +0200 Subject: [PATCH 011/101] doc improvement --- README.imagemagick | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index 8b933b68f4b..a4910d212ee 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -79,7 +79,7 @@ imagemagick-types-inhibit if you do not want this. Images loaded with imagemagick will support a couple of new display specifications: -- :scale takes a geometry string as defined by ImageMagick: +- :geometry takes a geometry string as defined by ImageMagick: scale% scale-x%xscale-y% @@ -91,10 +91,14 @@ widthxheight! widthxheight> widthxheight< area@ -{size}{offset} {size}{+-}x{+-}y +{size}{offset} +{size}{+-}x{+-}y See the ImageMagick manual for more information. +Furthermore, if the :width and :height keywords are specified, these +values are used for scaling the image. + - :rotation specifies a rotation angle in degrees. - :index specifies which image inside an image bundle file format, such @@ -103,6 +107,13 @@ as TIFF or DJVM, to view. The image-metadata function can be used to retrieve the total number of images in an image bundle. This is simmilar to how GIF files work. +- :crop is used to specify a croping area, with the {size}{offset} +syntax. This is similar to the slice image specification, but has a +different purpose. :crop removes the croped areas from memory, so its +memory efficient if you only need to view a certain part of the +image. :slice can be used to pick diferent parts of the same image, so +its more disk and display efficient. + * Changelog entry 2010-06-12 Joakim Verona From bdf6a35df3d00c5fcf400176eac74fda86b3307a Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Thu, 17 Jun 2010 09:44:04 +0200 Subject: [PATCH 012/101] improved lisp interface to scaling, doc changed acordingly --- README.imagemagick | 58 +++++++++++++++++++++++++++++++--------------- src/image.c | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 19 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index a4910d212ee..ff1831e8c8f 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -76,9 +76,41 @@ This means imagemagick will be used also to load jpeg files, if you have both jpeg and imagemagick libraries linked. Add 'JPG to imagemagick-types-inhibit if you do not want this. -Images loaded with imagemagick will support a couple of new display -specifications: +imagemagick-render-type is a new variable which can be set to choose +between screen render methods. +- 0 is a conservative metod which works with older ImageMagick + versions. It is a bit slow, but robust. + +- 1 utilizes a newer ImageMagick method + + +Images loaded with imagemagick will support a couple of new display +specification behaviours: + +- if the :width and :height keywords are specified, these values are +used for scaling the image. If only one of :width or :height is +specified, the other one will be calculated so as to preserve the +aspect ratio.If both :width and :height are specified, aspect ratio +will not be preserved. + +- :rotation specifies a rotation angle in degrees. + +- :index specifies which image inside an image bundle file format, such +as TIFF or DJVM, to view. + +The image-metadata function can be used to retrieve the total number +of images in an image bundle. This is simmilar to how GIF files work. + +- :crop is used to specify a croping area: (width height x y). This +is similar to the slice image specification, but has a different +purpose. :crop removes the croped areas from memory, so its memory +efficient if you only need to view a certain part of the image. The +slice specification can be used to pick diferent parts of the same +image, so its more disk and display efficient. + + +* experimental - :geometry takes a geometry string as defined by ImageMagick: scale% @@ -96,24 +128,12 @@ area@ See the ImageMagick manual for more information. -Furthermore, if the :width and :height keywords are specified, these -values are used for scaling the image. - -- :rotation specifies a rotation angle in degrees. - -- :index specifies which image inside an image bundle file format, such -as TIFF or DJVM, to view. - -The image-metadata function can be used to retrieve the total number -of images in an image bundle. This is simmilar to how GIF files work. - -- :crop is used to specify a croping area, with the {size}{offset} -syntax. This is similar to the slice image specification, but has a -different purpose. :crop removes the croped areas from memory, so its -memory efficient if you only need to view a certain part of the -image. :slice can be used to pick diferent parts of the same image, so -its more disk and display efficient. +- :crop is used to specify a croping area, with the "{size}{offset}" syntax. +:geometry and :crop with a string argument, are both particular to +ImageMagick, whereas the lisp interface is more general. Currently it +seems like the lisp interface is good enough, so the string argument +interface will probably be removed. * Changelog entry 2010-06-12 Joakim Verona diff --git a/src/image.c b/src/image.c index 4b4eb4e1c2e..7c6f5645097 100644 --- a/src/image.c +++ b/src/image.c @@ -7739,6 +7739,21 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); value = image_spec_value (img->spec, QCheight, NULL); desired_height = (INTEGERP (value) ? XFASTINT (value) : -1); + /* TODO if h or w is left out, it should be calculated to preserve aspect ratio */ + /* get original w and h, these will be recalculated before final blit*/ + height = MagickGetImageHeight (image_wand); + width = MagickGetImageWidth (image_wand); + + if(desired_width != -1 && desired_height == -1) + { + /* w known, calculate h*/ + desired_height = ( (double)desired_width / width ) * height; + } + if(desired_width == -1 && desired_height != -1) + { + /* h known, calculate w*/ + desired_width = ( (double)desired_height / height ) * width; + } if(desired_width != -1 && desired_height != -1) { printf("MagickScaleImage %d %d\n", desired_width, desired_height); @@ -7754,6 +7769,33 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ crop = image_spec_value (img->spec, QCcrop, NULL); geometry = image_spec_value (img->spec, QCgeometry, NULL); + + if(CONSP (crop)) + { + /* TODO test if MagickCropImage is more efficient than MagickTransformImage + + idea: crop can be a list or a string. if its a string, do + "magicktransformimage" as before. if its a list, try MagickCropImage. + args should be somewhat compatible with "slice". + `(slice X Y WIDTH HEIGHT)' + + after some testing, it seems cropping is indeed faster this + way, but its early days still. this crop function seems to do + less copying, but it still reads the entire image into memory + before croping, which is aparently difficult to avoid when using imagemagick. + + also this interface is better because it is lisp based and not IM specific + */ + + int w,h,x,y; + w=XFASTINT(XCAR(crop)); + h=XFASTINT(XCAR(XCDR(crop))); + x=XFASTINT(XCAR(XCDR(XCDR(crop)))); + y=XFASTINT(XCAR(XCDR(XCDR(XCDR(crop))))); + printf("MagickCropImage(image_wand, %d,%d, %d,%d)\n", w, h, x, y); + MagickCropImage(image_wand, w,h, x,y); + } + if (STRINGP (crop) && STRINGP (geometry)) { printf("MagickTransformImage %s %s\n", SDATA(crop), SDATA(geometry)); @@ -7762,6 +7804,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ /* TODO differ between image_wand and transform_wand. */ } + /* Furthermore :rotation. we need background color and angle for rotation. */ /* From 65a192e9bde95812af4cd52201f631ad59c1e523 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Mon, 21 Jun 2010 20:19:25 +0200 Subject: [PATCH 013/101] documented some more --- README.imagemagick | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index ff1831e8c8f..e9d6a4166ea 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -13,6 +13,24 @@ autoconf ./configure --with-imagemagick +* TODO + +- image-type-header-regexps priorities the jpeg loader over the +imagemagick one. This is not wrong, but how should a user go about +prefering the imagemagick loader? The user might like zooming etc in +jpegs. + +- For some reason its unbearably slow to look at a page in a large + image bundle using the :index feature. The imagemagick "display" + command is also a bit slow, but nowhere near as slow as the emacs + code. It seems imagemagick tries to unpack every page when loading + the bundle. This feature is not the primary usecase for the + imagemagick patch though. + +- zooming the image like what is done for fonts in face-remap.el would + be a useful and demo friendly addition. + +- figure out what to do with the experimental features noted below. * TODO #B _ complete documentation drafts below @@ -102,15 +120,17 @@ as TIFF or DJVM, to view. The image-metadata function can be used to retrieve the total number of images in an image bundle. This is simmilar to how GIF files work. +* experimental + - :crop is used to specify a croping area: (width height x y). This is similar to the slice image specification, but has a different purpose. :crop removes the croped areas from memory, so its memory efficient if you only need to view a certain part of the image. The slice specification can be used to pick diferent parts of the same -image, so its more disk and display efficient. +image, so its more disk and display efficient. :crop works well, but +it would still be better to find a way to have :splice do the same +thing. - -* experimental - :geometry takes a geometry string as defined by ImageMagick: scale% From c7f514b5f17b4607690ebf37a3cb09538d5bcd8f Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Sat, 26 Jun 2010 23:17:02 +0200 Subject: [PATCH 014/101] image-mode changes. removed the imagemagick specific :geometry and :crop interface that wasnt very good. --- README.imagemagick | 49 ++++++++------------------------ lisp/image-mode.el | 71 +++++++++++++++++++++++++++++++++++++++++++++- src/image.c | 38 +++++++++++-------------- 3 files changed, 98 insertions(+), 60 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index e9d6a4166ea..80c665e0cef 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -27,11 +27,21 @@ jpegs. the bundle. This feature is not the primary usecase for the imagemagick patch though. +- optimize number of pages calculation for bundles as suggested by + imagemagick forum: "set the density to something low like 2 and use + MagickPingImage()" + - zooming the image like what is done for fonts in face-remap.el would - be a useful and demo friendly addition. + be a useful and demo friendly addition. Some work has been done on + image-mode.el to acihieve this. -- figure out what to do with the experimental features noted below. +- look for optimizations for handling images with low depth + +- it would be neat if the graphicsmagick fork of imagemagick could + optionaly be used. + + * TODO #B _ complete documentation drafts below @@ -120,41 +130,6 @@ as TIFF or DJVM, to view. The image-metadata function can be used to retrieve the total number of images in an image bundle. This is simmilar to how GIF files work. -* experimental - -- :crop is used to specify a croping area: (width height x y). This -is similar to the slice image specification, but has a different -purpose. :crop removes the croped areas from memory, so its memory -efficient if you only need to view a certain part of the image. The -slice specification can be used to pick diferent parts of the same -image, so its more disk and display efficient. :crop works well, but -it would still be better to find a way to have :splice do the same -thing. - -- :geometry takes a geometry string as defined by ImageMagick: - -scale% -scale-x%xscale-y% -width -xheight -widthxheight -widthxheight^ -widthxheight! -widthxheight> -widthxheight< -area@ -{size}{offset} -{size}{+-}x{+-}y - -See the ImageMagick manual for more information. - -- :crop is used to specify a croping area, with the "{size}{offset}" syntax. - -:geometry and :crop with a string argument, are both particular to -ImageMagick, whereas the lisp interface is more general. Currently it -seems like the lisp interface is good enough, so the string argument -interface will probably be removed. - * Changelog entry 2010-06-12 Joakim Verona * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 585d82e9beb..a278c47a555 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -471,7 +471,10 @@ was inserted." (buffer-substring-no-properties (point-min) (point-max))) filename)) (type (image-type file-or-data nil data-p)) - (image (create-animated-image file-or-data type data-p)) + (image0 (create-animated-image file-or-data type data-p)) + (image (append image0 + (image-transform-properties image0) + )) (props `(display ,image intangible ,image @@ -534,6 +537,72 @@ the image file and `image-mode' showing the image as an image." (when (not (string= image-type (bookmark-prop-get bmk 'image-type))) (image-toggle-display)))) + +(defvar image-transform-minor-mode-map + (let ((map (make-sparse-keymap))) +; (define-key map [(control ?+)] 'image-scale-in) +; (define-key map [(control ?-)] 'image-scale-out) +; (define-key map [(control ?=)] 'image-scale-none) +;; (define-key map "c f h" 'image-scale-fit-height) +;; (define-key map "c ]" 'image-rotate-right) + map) + "Minor mode keymap for transforming the view of images Image mode.") + +(define-minor-mode image-transform-mode + "minor mode for scaleing and rotation" + nil "image-transform" + image-transform-minor-mode-map) + +;;these are supposed to be buffer local +;(defvar image-transform-height 100);;nil should mean 100% +;;the interface could rather be: +(defvar image-transform-resize + nil + "values: fit-height number=scale nil=scale100% TODO fit-width fit-page" + ) + +;;TODO 0 90 180 270 degrees are the only reasonable angles here +;;otherwise combining with rescaling will get very awkward +(defvar image-transform-rotation 0.0) + +;;then it would be nice with a bunch of globals like: +;; image-transform-always-resize values: 'fit-height nil=100% number=scale TODO 'fit-width 'fit-page +;; image-transform-always-rotate value: angle + +(defun image-transform-properties (display) + (let* + ((size (image-size display t)) + (height + (cond + ((and (numberp image-transform-resize) (eq 100 image-transform-resize)) + nil) + ((numberp image-transform-resize) + (* image-transform-resize (cdr size))) + ((eq image-transform-resize 'fit-height) + (nth 3 (window-inside-pixel-edges))) + ))) + `(,@(if height (list :height height)) + ,@(if (not (equal 0.0 image-transform-rotation)) + (list :rotation image-transform-rotation)) + ))) + +(defun image-transform-set-scale (scale) + (interactive "nscale:") + (image-transform-set-resize (float scale))) + +(defun image-transform-fit-to-height () + (interactive) + (image-transform-set-resize 'fit-height)) + +(defun image-transform-set-resize (resize) + (setq image-transform-resize resize) + (image-toggle-display-image)) + +(defun image-transform-set-rotation (rotation) + (interactive "nrotation:") + (setq image-transform-rotation (float rotation)) + (image-toggle-display-image)) + (provide 'image-mode) ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb diff --git a/src/image.c b/src/image.c index 7c6f5645097..217f9221841 100644 --- a/src/image.c +++ b/src/image.c @@ -7592,6 +7592,10 @@ enum imagemagick_keyword_index IMAGEMAGICK_HEURISTIC_MASK, IMAGEMAGICK_MASK, IMAGEMAGICK_BACKGROUND, + IMAGEMAGICK_HEIGHT, + IMAGEMAGICK_WIDTH, + IMAGEMAGICK_ROTATION, + IMAGEMAGICK_CROP, IMAGEMAGICK_LAST }; @@ -7609,7 +7613,11 @@ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] = {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":height", IMAGE_INTEGER_VALUE, 0}, + {":width", IMAGE_INTEGER_VALUE, 0}, + {":rotation", IMAGE_NUMBER_VALUE, 0}, + {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0} }; /* Free X resources of imagemagick image IMG which is used on frame F. */ @@ -7733,14 +7741,15 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ MagickSetIteratorIndex(image_wand, ino); /* If width and/or height is set in the display spec assume we want - to scale to those. */ + to scale to those values. if either h or w is unspecified, the + unspecified should be calculated from the specified to preserve + aspect ratio. */ value = image_spec_value (img->spec, QCwidth, NULL); desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); value = image_spec_value (img->spec, QCheight, NULL); desired_height = (INTEGERP (value) ? XFASTINT (value) : -1); - /* TODO if h or w is left out, it should be calculated to preserve aspect ratio */ - /* get original w and h, these will be recalculated before final blit*/ + height = MagickGetImageHeight (image_wand); width = MagickGetImageWidth (image_wand); @@ -7796,15 +7805,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ MagickCropImage(image_wand, w,h, x,y); } - if (STRINGP (crop) && STRINGP (geometry)) - { - printf("MagickTransformImage %s %s\n", SDATA(crop), SDATA(geometry)); - image_wand = MagickTransformImage (image_wand, SDATA (crop), - SDATA (geometry)); - /* TODO differ between image_wand and transform_wand. */ - } - - /* Furthermore :rotation. we need background color and angle for rotation. */ /* @@ -7830,8 +7830,8 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ } } - /* Finaly we are done manipulating the image, - figure out resulting width, height, and then transfer ownerwship to Emacs. + /* Finaly we are done manipulating the image, figure out resulting + width, height, and then transfer ownerwship to Emacs. */ height = MagickGetImageHeight (image_wand); width = MagickGetImageWidth (image_wand); @@ -7866,9 +7866,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ /* Copy imagegmagick image to x with primitive yet robust pixel pusher loop. This has been tested a lot with many different - images, it doesnt work too well with image archive formats though! - - Also seems slow. + images. */ /* Copy pixels from the imagemagick image structure to the x image map. */ @@ -7901,10 +7899,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ if (imagemagick_rendermethod == 1) { /* Try if magicexportimage is any faster than pixelpushing. */ - /* printf("ximg: bitmap_unit:%d format:%d byte_order:%d depth:%d - bits_per_pixel:%d\n", */ - /* ximg->bitmap_unit,ximg->format,ximg->byte_order, - ximg->depth,ximg->bits_per_pixel); */ int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ /* Try to create a x pixmap to hold the imagemagick pixmap. */ From 3a50be5108590c360a5cf90f7010c36d870f9cd1 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Sun, 27 Jun 2010 02:18:55 +0200 Subject: [PATCH 015/101] support for fit-width --- lisp/image-mode.el | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index a278c47a555..78ec4772d16 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -579,12 +579,16 @@ the image file and `image-mode' showing the image as an image." ((numberp image-transform-resize) (* image-transform-resize (cdr size))) ((eq image-transform-resize 'fit-height) - (nth 3 (window-inside-pixel-edges))) - ))) - `(,@(if height (list :height height)) - ,@(if (not (equal 0.0 image-transform-rotation)) - (list :rotation image-transform-rotation)) - ))) + (- (nth 3 (window-inside-pixel-edges)) (nth 1 (window-inside-pixel-edges)))) + (t nil))) + (width (if (eq image-transform-resize 'fit-width) + (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges)))))) + + `(,@(if height (list :height height)) + ,@(if width (list :width width)) + ,@(if (not (equal 0.0 image-transform-rotation)) + (list :rotation image-transform-rotation)) + ))) (defun image-transform-set-scale (scale) (interactive "nscale:") @@ -594,9 +598,13 @@ the image file and `image-mode' showing the image as an image." (interactive) (image-transform-set-resize 'fit-height)) +(defun image-transform-fit-to-width () + (interactive) + (image-transform-set-resize 'fit-width)) + (defun image-transform-set-resize (resize) (setq image-transform-resize resize) - (image-toggle-display-image)) + (if (eq 'image-mode major-mode) (image-toggle-display-image))) (defun image-transform-set-rotation (rotation) (interactive "nrotation:") From f3700365595af9962677a9420d7a313e939f6719 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Thu, 1 Jul 2010 23:38:33 +0200 Subject: [PATCH 016/101] reworked :index functionality a bit so its faster --- README.imagemagick | 3 + src/image.c | 1106 ++++++++++++++++++++++---------------------- 2 files changed, 561 insertions(+), 548 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index 80c665e0cef..f1cde66e54a 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -27,6 +27,9 @@ jpegs. the bundle. This feature is not the primary usecase for the imagemagick patch though. + ImageMagick 6.6.2-8 introduced a bugfix for single page djvu load. + To benefit from the bugfix, the loader code in image.c must be changed. + - optimize number of pages calculation for bundles as suggested by imagemagick forum: "set the density to something low like 2 and use MagickPingImage()" diff --git a/src/image.c b/src/image.c index 217f9221841..372f17348e9 100644 --- a/src/image.c +++ b/src/image.c @@ -1,22 +1,22 @@ /* Functions for image support on window system. Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. -This file is part of GNU Emacs. + This file is part of GNU Emacs. -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see . */ #include #include @@ -115,7 +115,7 @@ typedef struct ns_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 #define FRAME_X_VISUAL FRAME_NS_DISPLAY_INFO(f)->visual -#define x_defined_color(f, name, color_def, alloc) \ +#define x_defined_color(f, name, color_def, alloc) \ ns_defined_color (f, name, color_def, alloc, 0) #define FRAME_X_SCREEN(f) 0 #define DefaultDepthOfScreen(screen) x_display_list->n_planes @@ -290,7 +290,7 @@ x_create_bitmap_from_data (f, bits, width, height) #ifdef HAVE_NS void *bitmap = ns_image_from_XBM(bits, width, height); if (!bitmap) - return -1; + return -1; #endif id = x_allocate_bitmap_record (f); @@ -338,7 +338,7 @@ x_create_bitmap_from_file (f, file) void *bitmap = ns_image_from_file(file); if (!bitmap) - return -1; + return -1; id = x_allocate_bitmap_record (f); @@ -572,7 +572,7 @@ x_create_bitmap_mask (f, id) /*********************************************************************** Image types - ***********************************************************************/ +***********************************************************************/ /* Value is the number of elements of vector VECTOR. */ @@ -627,10 +627,10 @@ static void x_emboss P_ ((struct frame *, struct image *)); static int x_build_heuristic_mask P_ ((struct frame *, struct image *, Lisp_Object)); -#define CACHE_IMAGE_TYPE(type, status) \ +#define CACHE_IMAGE_TYPE(type, status) \ do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0) -#define ADD_IMAGE_TYPE(type) \ +#define ADD_IMAGE_TYPE(type) \ do { Vimage_types = Fcons (type, Vimage_types); } while (0) /* Define a new image type from TYPE. This adds a copy of TYPE to @@ -737,23 +737,23 @@ image_error (format, arg1, arg2) /*********************************************************************** Image specifications - ***********************************************************************/ +***********************************************************************/ enum image_value_type -{ - IMAGE_DONT_CHECK_VALUE_TYPE, - IMAGE_STRING_VALUE, - IMAGE_STRING_OR_NIL_VALUE, - IMAGE_SYMBOL_VALUE, - IMAGE_POSITIVE_INTEGER_VALUE, - IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, - IMAGE_NON_NEGATIVE_INTEGER_VALUE, - IMAGE_ASCENT_VALUE, - IMAGE_INTEGER_VALUE, - IMAGE_FUNCTION_VALUE, - IMAGE_NUMBER_VALUE, - IMAGE_BOOL_VALUE -}; + { + IMAGE_DONT_CHECK_VALUE_TYPE, + IMAGE_STRING_VALUE, + IMAGE_STRING_OR_NIL_VALUE, + IMAGE_SYMBOL_VALUE, + IMAGE_POSITIVE_INTEGER_VALUE, + IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, + IMAGE_NON_NEGATIVE_INTEGER_VALUE, + IMAGE_ASCENT_VALUE, + IMAGE_INTEGER_VALUE, + IMAGE_FUNCTION_VALUE, + IMAGE_NUMBER_VALUE, + IMAGE_BOOL_VALUE + }; /* Structure used when parsing image specifications. */ @@ -956,10 +956,10 @@ image_spec_value (spec, key, found) DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). -PIXELS non-nil means return the size in pixels, otherwise return the -size in canonical character units. -FRAME is the frame on which the image will be displayed. FRAME nil -or omitted means use the selected frame. */) + PIXELS non-nil means return the size in pixels, otherwise return the + size in canonical character units. + FRAME is the frame on which the image will be displayed. FRAME nil + or omitted means use the selected frame. */) (spec, pixels, frame) Lisp_Object spec, pixels, frame; { @@ -989,8 +989,8 @@ or omitted means use the selected frame. */) DEFUN ("image-mask-p", Fimage_mask_p, Simage_mask_p, 1, 2, 0, doc: /* Return t if image SPEC has a mask bitmap. -FRAME is the frame on which the image will be displayed. FRAME nil -or omitted means use the selected frame. */) + FRAME is the frame on which the image will be displayed. FRAME nil + or omitted means use the selected frame. */) (spec, frame) Lisp_Object spec, frame; { @@ -1013,8 +1013,8 @@ or omitted means use the selected frame. */) DEFUN ("image-metadata", Fimage_metadata, Simage_metadata, 1, 2, 0, doc: /* Return metadata for image SPEC. -FRAME is the frame on which the image will be displayed. FRAME nil -or omitted means use the selected frame. */) + FRAME is the frame on which the image will be displayed. FRAME nil + or omitted means use the selected frame. */) (spec, frame) Lisp_Object spec, frame; { @@ -1035,7 +1035,7 @@ or omitted means use the selected frame. */) /*********************************************************************** Image type independent image structures - ***********************************************************************/ +***********************************************************************/ static struct image *make_image P_ ((Lisp_Object spec, unsigned hash)); static void free_image P_ ((struct frame *f, struct image *img)); @@ -1250,26 +1250,26 @@ four_corners_best (ximg, corners, width, height) #ifdef HAVE_NTGUI -#define Destroy_Image(img_dc, prev) \ +#define Destroy_Image(img_dc, prev) \ do { SelectObject (img_dc, prev); DeleteDC (img_dc); } while (0) -#define Free_Pixmap(display, pixmap) \ +#define Free_Pixmap(display, pixmap) \ DeleteObject (pixmap) #elif defined (HAVE_NS) -#define Destroy_Image(ximg, dummy) \ +#define Destroy_Image(ximg, dummy) \ ns_release_object(ximg) -#define Free_Pixmap(display, pixmap) \ +#define Free_Pixmap(display, pixmap) \ ns_release_object(pixmap) #else -#define Destroy_Image(ximg, dummy) \ +#define Destroy_Image(ximg, dummy) \ XDestroyImage (ximg) -#define Free_Pixmap(display, pixmap) \ +#define Free_Pixmap(display, pixmap) \ XFreePixmap (display, pixmap) #endif /* !HAVE_NTGUI && !HAVE_NS */ @@ -1369,7 +1369,7 @@ image_background_transparent (img, f, mask) /*********************************************************************** Helper functions for X image types - ***********************************************************************/ +***********************************************************************/ static void x_clear_image_1 P_ ((struct frame *, struct image *, int, int, int)); @@ -1470,7 +1470,7 @@ x_alloc_image_color (f, img, color_name, dflt) /*********************************************************************** Image Cache - ***********************************************************************/ +***********************************************************************/ static struct image *search_image_cache P_ ((struct frame *, Lisp_Object, unsigned)); static void cache_image P_ ((struct frame *f, struct image *img)); @@ -1673,10 +1673,10 @@ clear_image_caches (Lisp_Object filter) DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache, 0, 1, 0, doc: /* Clear the image cache. -FILTER nil or a frame means clear all images in the selected frame. -FILTER t means clear the image caches of all frames. -Anything else, means only clear those images which refer to FILTER, -which is then usually a filename. */) + FILTER nil or a frame means clear all images in the selected frame. + FILTER t means clear the image caches of all frames. + Anything else, means only clear those images which refer to FILTER, + which is then usually a filename. */) (filter) Lisp_Object filter; { @@ -1692,12 +1692,12 @@ which is then usually a filename. */) DEFUN ("image-flush", Fimage_flush, Simage_flush, 1, 2, 0, doc: /* Fush the image with specification SPEC on frame FRAME. -This removes the image from the Emacs image cache. If SPEC specifies -an image file, the next redisplay of this image will read from the -current contents of that file. + This removes the image from the Emacs image cache. If SPEC specifies + an image file, the next redisplay of this image will read from the + current contents of that file. -FRAME nil or omitted means use the selected frame. -FRAME t means refresh the image on all frames. */) + FRAME nil or omitted means use the selected frame. + FRAME t means refresh the image on all frames. */) (spec, frame) Lisp_Object spec, frame; { @@ -1991,7 +1991,7 @@ mark_image_cache (struct image_cache *c) /*********************************************************************** X / NS / W32 support code - ***********************************************************************/ +***********************************************************************/ #ifdef HAVE_NTGUI @@ -1999,9 +1999,9 @@ mark_image_cache (struct image_cache *c) #define DEF_IMGLIB_FN(func) int (FAR CDECL *fn_##func)() /* Macro for loading those image functions from the library. */ -#define LOAD_IMGLIB_FN(lib,func) { \ - fn_##func = (void *) GetProcAddress (lib, #func); \ - if (!fn_##func) return 0; \ +#define LOAD_IMGLIB_FN(lib,func) { \ + fn_##func = (void *) GetProcAddress (lib, #func); \ + if (!fn_##func) return 0; \ } /* Load a DLL implementing an image type. @@ -2251,7 +2251,7 @@ x_put_x_image (f, ximg, pixmap, width, height) /*********************************************************************** File Handling - ***********************************************************************/ +***********************************************************************/ static unsigned char *slurp_file P_ ((char *, int *)); @@ -2331,7 +2331,7 @@ slurp_file (file, size) /*********************************************************************** XBM images - ***********************************************************************/ +***********************************************************************/ static int xbm_scan P_ ((unsigned char **, unsigned char *, char *, int *)); static int xbm_load P_ ((struct frame *f, struct image *img)); @@ -2347,61 +2347,61 @@ static int xbm_file_p P_ ((Lisp_Object)); /* Indices of image specification fields in xbm_format, below. */ enum xbm_keyword_index -{ - XBM_TYPE, - XBM_FILE, - XBM_WIDTH, - XBM_HEIGHT, - XBM_DATA, - XBM_FOREGROUND, - XBM_BACKGROUND, - XBM_ASCENT, - XBM_MARGIN, - XBM_RELIEF, - XBM_ALGORITHM, - XBM_HEURISTIC_MASK, - XBM_MASK, - XBM_LAST -}; + { + XBM_TYPE, + XBM_FILE, + XBM_WIDTH, + XBM_HEIGHT, + XBM_DATA, + XBM_FOREGROUND, + XBM_BACKGROUND, + XBM_ASCENT, + XBM_MARGIN, + XBM_RELIEF, + XBM_ALGORITHM, + XBM_HEURISTIC_MASK, + XBM_MASK, + XBM_LAST + }; /* Vector of image_keyword structures describing the format of valid XBM image specifications. */ static const struct image_keyword xbm_format[XBM_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 0}, - {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, - {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, - {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 0}, + {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, + {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, + {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} + }; /* Structure describing the image type XBM. */ static struct image_type xbm_type = -{ - &Qxbm, - xbm_image_p, - xbm_load, - x_clear_image, - NULL -}; + { + &Qxbm, + xbm_image_p, + xbm_load, + x_clear_image, + NULL + }; /* Tokens returned from xbm_scan. */ enum xbm_token -{ - XBM_TK_IDENT = 256, - XBM_TK_NUMBER -}; + { + XBM_TK_IDENT = 256, + XBM_TK_NUMBER + }; /* Return non-zero if OBJECT is a valid XBM-type image specification. @@ -2752,20 +2752,20 @@ xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error int value; int LA1; -#define match() \ - LA1 = xbm_scan (&s, end, buffer, &value) +#define match() \ + LA1 = xbm_scan (&s, end, buffer, &value) -#define expect(TOKEN) \ - if (LA1 != (TOKEN)) \ - goto failure; \ - else \ - match () +#define expect(TOKEN) \ + if (LA1 != (TOKEN)) \ + goto failure; \ + else \ + match () #define expect_ident(IDENT) \ - if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ - match (); \ - else \ - goto failure + if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ + match (); \ + else \ + goto failure *width = *height = -1; if (data) @@ -3110,7 +3110,7 @@ xbm_load (f, img) /*********************************************************************** XPM images - ***********************************************************************/ +***********************************************************************/ #if defined (HAVE_XPM) || defined (HAVE_NS) @@ -3149,49 +3149,49 @@ Lisp_Object Qxpm; /* Indices of image specification fields in xpm_format, below. */ enum xpm_keyword_index -{ - XPM_TYPE, - XPM_FILE, - XPM_DATA, - XPM_ASCENT, - XPM_MARGIN, - XPM_RELIEF, - XPM_ALGORITHM, - XPM_HEURISTIC_MASK, - XPM_MASK, - XPM_COLOR_SYMBOLS, - XPM_BACKGROUND, - XPM_LAST -}; + { + XPM_TYPE, + XPM_FILE, + XPM_DATA, + XPM_ASCENT, + XPM_MARGIN, + XPM_RELIEF, + XPM_ALGORITHM, + XPM_HEURISTIC_MASK, + XPM_MASK, + XPM_COLOR_SYMBOLS, + XPM_BACKGROUND, + XPM_LAST + }; /* Vector of image_keyword structures describing the format of valid XPM image specifications. */ static const struct image_keyword xpm_format[XPM_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 0}, - {":data", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 0}, + {":data", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Structure describing the image type XPM. */ static struct image_type xpm_type = -{ - &Qxpm, - xpm_image_p, - xpm_load, - x_clear_image, - NULL -}; + { + &Qxpm, + xpm_image_p, + xpm_load, + x_clear_image, + NULL + }; #ifdef HAVE_X_WINDOWS @@ -3755,15 +3755,15 @@ xpm_load (f, img) static int xpm_scan P_ ((const unsigned char **, const unsigned char *, const unsigned char **, int *)); static Lisp_Object xpm_make_color_table_v - P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), - Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); +P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); static void xpm_put_color_table_v P_ ((Lisp_Object, const unsigned char *, int, Lisp_Object)); static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object, const unsigned char *, int)); static Lisp_Object xpm_make_color_table_h - P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), - Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); +P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); static void xpm_put_color_table_h P_ ((Lisp_Object, const unsigned char *, int, Lisp_Object)); static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object, @@ -3775,11 +3775,11 @@ static int xpm_load_image P_ ((struct frame *, struct image *, /* Tokens returned from xpm_scan. */ enum xpm_token -{ - XPM_TK_IDENT = 256, - XPM_TK_STRING, - XPM_TK_EOF -}; + { + XPM_TK_IDENT = 256, + XPM_TK_STRING, + XPM_TK_EOF + }; /* Scan an XPM data and return a character (< 256) or a token defined by enum xpm_token above. *S and END are the start (inclusive) and @@ -3808,7 +3808,7 @@ xpm_scan (s, end, beg, len) *beg = *s - 1; while (*s < end && (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+')) - ++*s; + ++*s; *len = *s - *beg; return XPM_TK_IDENT; } @@ -3965,21 +3965,21 @@ xpm_load_image (f, img, contents, end) int best_key, have_mask = 0; XImagePtr ximg = NULL, mask_img = NULL; -#define match() \ - LA1 = xpm_scan (&s, end, &beg, &len) +#define match() \ + LA1 = xpm_scan (&s, end, &beg, &len) -#define expect(TOKEN) \ - if (LA1 != (TOKEN)) \ - goto failure; \ - else \ - match () +#define expect(TOKEN) \ + if (LA1 != (TOKEN)) \ + goto failure; \ + else \ + match () -#define expect_ident(IDENT) \ - if (LA1 == XPM_TK_IDENT \ - && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \ - match (); \ - else \ - goto failure +#define expect_ident(IDENT) \ + if (LA1 == XPM_TK_IDENT \ + && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \ + match (); \ + else \ + goto failure if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0)) goto failure; @@ -4239,7 +4239,7 @@ xpm_load (f, img) /*********************************************************************** Color table - ***********************************************************************/ +***********************************************************************/ #ifdef COLOR_TABLE_SUPPORT @@ -4513,7 +4513,7 @@ init_color_table () /*********************************************************************** Algorithms - ***********************************************************************/ +***********************************************************************/ static XColor *x_to_xcolors P_ ((struct frame *, struct image *, int)); static void x_from_xcolors P_ ((struct frame *, struct image *, XColor *)); @@ -4532,17 +4532,17 @@ int cross_disabled_images; strategies. */ static int emboss_matrix[9] = { - /* x - 1 x x + 1 */ - 2, -1, 0, /* y - 1 */ - -1, 0, 1, /* y */ - 0, 1, -2 /* y + 1 */ + /* x - 1 x x + 1 */ + 2, -1, 0, /* y - 1 */ + -1, 0, 1, /* y */ + 0, 1, -2 /* y + 1 */ }; static int laplace_matrix[9] = { - /* x - 1 x x + 1 */ - 1, 0, 0, /* y - 1 */ - 0, 0, 0, /* y */ - 0, 0, -1 /* y + 1 */ + /* x - 1 x x + 1 */ + 1, 0, 0, /* y - 1 */ + 0, 0, 0, /* y */ + 0, 0, -1 /* y + 1 */ }; /* Value is the intensity of the color whose red/green/blue values @@ -5046,8 +5046,8 @@ x_build_heuristic_mask (f, img, how) XPutPixel (mask_img, x, y, (XGetPixel (ximg, x, y) != bg ? PIX_MASK_DRAW : PIX_MASK_RETAIN)); #else - if (XGetPixel (ximg, x, y) == bg) - ns_set_alpha(ximg, x, y, 0); + if (XGetPixel (ximg, x, y) == bg) + ns_set_alpha(ximg, x, y, 0); #endif /* HAVE_NS */ #ifndef HAVE_NS /* Fill in the background_transparent field while we have the mask handy. */ @@ -5085,7 +5085,7 @@ x_build_heuristic_mask (f, img, how) /*********************************************************************** PBM (mono, gray, color) - ***********************************************************************/ +***********************************************************************/ static int pbm_image_p P_ ((Lisp_Object object)); static int pbm_load P_ ((struct frame *f, struct image *img)); @@ -5098,49 +5098,49 @@ Lisp_Object Qpbm; /* Indices of image specification fields in gs_format, below. */ enum pbm_keyword_index -{ - PBM_TYPE, - PBM_FILE, - PBM_DATA, - PBM_ASCENT, - PBM_MARGIN, - PBM_RELIEF, - PBM_ALGORITHM, - PBM_HEURISTIC_MASK, - PBM_MASK, - PBM_FOREGROUND, - PBM_BACKGROUND, - PBM_LAST -}; + { + PBM_TYPE, + PBM_FILE, + PBM_DATA, + PBM_ASCENT, + PBM_MARGIN, + PBM_RELIEF, + PBM_ALGORITHM, + PBM_HEURISTIC_MASK, + PBM_MASK, + PBM_FOREGROUND, + PBM_BACKGROUND, + PBM_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword pbm_format[PBM_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 0}, - {":data", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 0}, + {":data", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Structure describing the image type `pbm'. */ static struct image_type pbm_type = -{ - &Qpbm, - pbm_image_p, - pbm_load, - x_clear_image, - NULL -}; + { + &Qpbm, + pbm_image_p, + pbm_load, + x_clear_image, + NULL + }; /* Return non-zero if OBJECT is a valid PBM image specification. */ @@ -5505,7 +5505,7 @@ pbm_load (f, img) /*********************************************************************** PNG - ***********************************************************************/ +***********************************************************************/ #if defined (HAVE_PNG) || defined (HAVE_NS) @@ -5521,47 +5521,47 @@ Lisp_Object Qpng; /* Indices of image specification fields in png_format, below. */ enum png_keyword_index -{ - PNG_TYPE, - PNG_DATA, - PNG_FILE, - PNG_ASCENT, - PNG_MARGIN, - PNG_RELIEF, - PNG_ALGORITHM, - PNG_HEURISTIC_MASK, - PNG_MASK, - PNG_BACKGROUND, - PNG_LAST -}; + { + PNG_TYPE, + PNG_DATA, + PNG_FILE, + PNG_ASCENT, + PNG_MARGIN, + PNG_RELIEF, + PNG_ALGORITHM, + PNG_HEURISTIC_MASK, + PNG_MASK, + PNG_BACKGROUND, + PNG_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword png_format[PNG_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Structure describing the image type `png'. */ static struct image_type png_type = -{ - &Qpng, - png_image_p, - png_load, - x_clear_image, - NULL -}; + { + &Qpng, + png_image_p, + png_load, + x_clear_image, + NULL + }; /* Return non-zero if OBJECT is a valid PNG image specification. */ @@ -6109,7 +6109,7 @@ png_load (struct frame *f, struct image *img) /*********************************************************************** JPEG - ***********************************************************************/ +***********************************************************************/ #if defined (HAVE_JPEG) || defined (HAVE_NS) @@ -6123,47 +6123,47 @@ Lisp_Object Qjpeg; /* Indices of image specification fields in gs_format, below. */ enum jpeg_keyword_index -{ - JPEG_TYPE, - JPEG_DATA, - JPEG_FILE, - JPEG_ASCENT, - JPEG_MARGIN, - JPEG_RELIEF, - JPEG_ALGORITHM, - JPEG_HEURISTIC_MASK, - JPEG_MASK, - JPEG_BACKGROUND, - JPEG_LAST -}; + { + JPEG_TYPE, + JPEG_DATA, + JPEG_FILE, + JPEG_ASCENT, + JPEG_MARGIN, + JPEG_RELIEF, + JPEG_ALGORITHM, + JPEG_HEURISTIC_MASK, + JPEG_MASK, + JPEG_BACKGROUND, + JPEG_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword jpeg_format[JPEG_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Structure describing the image type `jpeg'. */ static struct image_type jpeg_type = -{ - &Qjpeg, - jpeg_image_p, - jpeg_load, - x_clear_image, - NULL -}; + { + &Qjpeg, + jpeg_image_p, + jpeg_load, + x_clear_image, + NULL + }; /* Return non-zero if OBJECT is a valid JPEG image specification. */ @@ -6462,7 +6462,7 @@ jpeg_file_src (cinfo, fp) struct jpeg_stdio_mgr *src; if (cinfo->src != NULL) - src = (struct jpeg_stdio_mgr *) cinfo->src; + src = (struct jpeg_stdio_mgr *) cinfo->src; else { /* First time for this JPEG object? */ @@ -6471,8 +6471,8 @@ jpeg_file_src (cinfo, fp) sizeof (struct jpeg_stdio_mgr)); src = (struct jpeg_stdio_mgr *) cinfo->src; src->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - JPEG_STDIO_BUFFER_SIZE); + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + JPEG_STDIO_BUFFER_SIZE); } src->file = fp; @@ -6566,7 +6566,7 @@ jpeg_load (f, img) } /* Create the JPEG decompression object. Let it read from fp. - Read the JPEG image header. */ + Read the JPEG image header. */ fn_jpeg_CreateDecompress (&cinfo, JPEG_LIB_VERSION, sizeof (cinfo)); if (NILP (specified_data)) @@ -6578,7 +6578,7 @@ jpeg_load (f, img) fn_jpeg_read_header (&cinfo, 1); /* Customize decompression so that color quantization will be used. - Start decompression. */ + Start decompression. */ cinfo.quantize_colors = 1; fn_jpeg_start_decompress (&cinfo); width = img->width = cinfo.output_width; @@ -6681,7 +6681,7 @@ jpeg_load (struct frame *f, struct image *img) /*********************************************************************** TIFF - ***********************************************************************/ +***********************************************************************/ #if defined (HAVE_TIFF) || defined (HAVE_NS) @@ -6695,49 +6695,49 @@ Lisp_Object Qtiff; /* Indices of image specification fields in tiff_format, below. */ enum tiff_keyword_index -{ - TIFF_TYPE, - TIFF_DATA, - TIFF_FILE, - TIFF_ASCENT, - TIFF_MARGIN, - TIFF_RELIEF, - TIFF_ALGORITHM, - TIFF_HEURISTIC_MASK, - TIFF_MASK, - TIFF_BACKGROUND, - TIFF_INDEX, - TIFF_LAST -}; + { + TIFF_TYPE, + TIFF_DATA, + TIFF_FILE, + TIFF_ASCENT, + TIFF_MARGIN, + TIFF_RELIEF, + TIFF_ALGORITHM, + TIFF_HEURISTIC_MASK, + TIFF_MASK, + TIFF_BACKGROUND, + TIFF_INDEX, + TIFF_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword tiff_format[TIFF_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0} + }; /* Structure describing the image type `tiff'. */ static struct image_type tiff_type = -{ - &Qtiff, - tiff_image_p, - tiff_load, - x_clear_image, - NULL -}; + { + &Qtiff, + tiff_image_p, + tiff_load, + x_clear_image, + NULL + }; /* Return non-zero if OBJECT is a valid TIFF image specification. */ @@ -6820,7 +6820,7 @@ typedef struct size_t len; int index; } -tiff_memory_source; + tiff_memory_source; static size_t tiff_read_from_memory (data, buf, size) @@ -7132,7 +7132,7 @@ tiff_load (struct frame *f, struct image *img) /*********************************************************************** GIF - ***********************************************************************/ +***********************************************************************/ #if defined (HAVE_GIF) || defined (HAVE_NS) @@ -7147,49 +7147,49 @@ Lisp_Object Qgif; /* Indices of image specification fields in gif_format, below. */ enum gif_keyword_index -{ - GIF_TYPE, - GIF_DATA, - GIF_FILE, - GIF_ASCENT, - GIF_MARGIN, - GIF_RELIEF, - GIF_ALGORITHM, - GIF_HEURISTIC_MASK, - GIF_MASK, - GIF_IMAGE, - GIF_BACKGROUND, - GIF_LAST -}; + { + GIF_TYPE, + GIF_DATA, + GIF_FILE, + GIF_ASCENT, + GIF_MARGIN, + GIF_RELIEF, + GIF_ALGORITHM, + GIF_HEURISTIC_MASK, + GIF_MASK, + GIF_IMAGE, + GIF_BACKGROUND, + GIF_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword gif_format[GIF_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Structure describing the image type `gif'. */ static struct image_type gif_type = -{ - &Qgif, - gif_image_p, - gif_load, - gif_clear_image, - NULL -}; + { + &Qgif, + gif_image_p, + gif_load, + gif_clear_image, + NULL + }; /* Free X resources of GIF image IMG which is used on frame F. */ @@ -7282,7 +7282,7 @@ typedef struct size_t len; int index; } -gif_memory_source; + gif_memory_source; /* Make the current memory source available to gif_read_from_memory. It's done this way because not all versions of libungif support @@ -7659,7 +7659,7 @@ imagemagick_image_p (Lisp_Object object) Uses librimagemagick to do most of the image processing. - non-zero when successful. + non-zero when successful. */ static int @@ -7689,6 +7689,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ int y; MagickWand *image_wand; + MagickWand *ping_wand; PixelIterator *iterator; PixelWand **pixels; MagickPixelPacket pixel; @@ -7700,28 +7701,31 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ double rotation; int imagemagick_rendermethod; int pixelwidth; + ImageInfo *image_info; + ExceptionInfo *exception; + Image * im_image; - - /* image_wand will contain the image. */ - image_wand = NewMagickWand(); - - /* Parse the contents argument and initialize image_wand. */ - if(filename != NULL) - status = MagickReadImage(image_wand, filename); - else - status = MagickReadImageBlob(image_wand, contents, size); - image_error ("im read failed", Qnil, Qnil); - if (status == MagickFalse) goto imagemagick_error; - - /* Handle image index for image types who can contain more than one image. - Interface :index is same as for GIF. */ - + + /* Handle image index for image types who can contain more than one + image. Interface :index is same as for GIF. First we "ping" the + image to see how many sub-images it contains. Pinging is faster + than loading the image to find out things about it. + */ + printf("im ping file %s\n", filename); image = image_spec_value (img->spec, QCindex, NULL); ino = INTEGERP (image) ? XFASTINT (image) : 0; - - - - if (ino >= MagickGetNumberImages(image_wand)) + ping_wand=NewMagickWand(); + MagickSetResolution(ping_wand, 2, 2); + if (filename != NULL) + { + status = MagickPingImage(ping_wand, filename); + } + else + { + status = MagickPingImageBlob(ping_wand, contents, size); + } + + if (ino >= MagickGetNumberImages(ping_wand)) { image_error ("Invalid image number `%s' in image `%s'", image, img->spec); @@ -7729,21 +7733,53 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ return 0; } - - if (MagickGetNumberImages(image_wand) > 1) + if (MagickGetNumberImages(ping_wand) > 1) img->data.lisp_val = Fcons (Qcount, - Fcons (make_number (MagickGetNumberImages(image_wand)), + Fcons (make_number (MagickGetNumberImages(ping_wand)), img->data.lisp_val)); - if(ino == 0) - MagickSetFirstIterator(image_wand); + + DestroyMagickWand (ping_wand); + /* Now, after pinging, we know how many images are inside the + file. If its not a bundle, just one. + */ + + if (filename != NULL) + { + printf("im read file %s\n", filename); + image_info=CloneImageInfo((ImageInfo *) NULL); + (void) strcpy(image_info->filename, filename); + image_info -> number_scenes = 1; + image_info -> scene = ino; + exception=AcquireExceptionInfo(); + + im_image = ReadImage (image_info, exception); + CatchException(exception); + + printf("im wand from image\n"); + image_wand = NewMagickWandFromImage(im_image); + } else - MagickSetIteratorIndex(image_wand, ino); + { + image_wand = NewMagickWand(); + status = MagickReadImageBlob(image_wand, contents, size); + } + image_error ("im read failed", Qnil, Qnil); + if (status == MagickFalse) goto imagemagick_error; + + + /* if(ino == 0) */ + /* MagickSetFirstIterator(image_wand); */ + /* else */ + /* MagickSetIteratorIndex(image_wand, ino); */ + + //MagickSetFirstIterator(image_wand); + /* If width and/or height is set in the display spec assume we want - to scale to those values. if either h or w is unspecified, the - unspecified should be calculated from the specified to preserve - aspect ratio. */ + to scale to those values. if either h or w is unspecified, the + unspecified should be calculated from the specified to preserve + aspect ratio. */ value = image_spec_value (img->spec, QCwidth, NULL); desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); @@ -7773,27 +7809,19 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ } } - /* Also support :geometry and :crop which are imagemagick specific - descriptors. */ + /* crop behaves similar to image slicing in Emacs but is more memory + efficient */ crop = image_spec_value (img->spec, QCcrop, NULL); - geometry = image_spec_value (img->spec, QCgeometry, NULL); - + if(CONSP (crop)) { - /* TODO test if MagickCropImage is more efficient than MagickTransformImage - - idea: crop can be a list or a string. if its a string, do - "magicktransformimage" as before. if its a list, try MagickCropImage. - args should be somewhat compatible with "slice". - `(slice X Y WIDTH HEIGHT)' - - after some testing, it seems cropping is indeed faster this - way, but its early days still. this crop function seems to do - less copying, but it still reads the entire image into memory - before croping, which is aparently difficult to avoid when using imagemagick. - - also this interface is better because it is lisp based and not IM specific + /* + after some testing, it seems MagickCropImage is the fastest + crop function in ImageMagick. This crop function seems to do + less copying than the alternatives, but it still reads the + entire image into memory before croping, which is aparently + difficult to avoid when using imagemagick. */ int w,h,x,y; @@ -7928,8 +7956,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ - bw djvu images on rgb display. seems about 3 times as fast as pixel pushing(not carefully measured) - with color djvu, the bitplanes are mapped to wrong color(seems fixed). - */ pixelwidth = CharPixel;/*??? TODO figure out*/ #ifdef HAVE_MAGICKEXPORTIMAGEPIXELS @@ -7957,18 +7983,13 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ img->width = width; img->height = height; - /* Maybe fill in the background field while we have ximg handy. - Casting avoids a GCC warning. */ - /* IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);*/ - /* Put the image into the pixmap, then free the X image and its buffer. */ x_put_x_image (f, ximg, img->pixmap, width, height); - x_destroy_x_image (ximg); - /* JAVE TODO more cleanup. */ + /* Final cleanup. image_wand should be the only resource left. */ DestroyMagickWand (image_wand); return 1; @@ -8009,17 +8030,6 @@ imagemagick_load (struct frame *f, UNGCPRO; return 0; } - - /* Read the entire file into memory. */ - /* contents = slurp_file (SDATA (file), &size); */ - /* if (contents == NULL) */ - /* { */ - /* image_error ("Error loading IMAGEMAGICK image `%s'", - img->spec, Qnil); */ - /* UNGCPRO; */ - /* return 0; */ - /* } */ - /* If the file was slurped into memory properly, parse it. */ success_p = imagemagick_load_image (f, img, 0, 0, SDATA(file_name)); UNGCPRO; } @@ -8063,8 +8073,8 @@ static struct image_type imagemagick_type = DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0, doc: /* Return image file types supported by ImageMagick. -Since ImageMagick recognizes a lot of file-types that clash with Emacs, -such as .c, we want to be able to alter the list at the lisp level. */) + Since ImageMagick recognizes a lot of file-types that clash with Emacs, + such as .c, we want to be able to alter the list at the lisp level. */) () { Lisp_Object typelist = Qnil; @@ -8076,9 +8086,9 @@ such as .c, we want to be able to alter the list at the lisp level. */) for (i = 0; i < numf; i++) { Qimagemagicktype = intern (imtypes[i]); - typelist = Fcons (Qimagemagicktype, typelist); -} -return typelist; + typelist = Fcons (Qimagemagicktype, typelist); + } + return typelist; } #endif /* defined (HAVE_IMAGEMAGICK) */ @@ -8087,7 +8097,7 @@ return typelist; /*********************************************************************** SVG - ***********************************************************************/ +***********************************************************************/ #if defined (HAVE_RSVG) @@ -8106,55 +8116,55 @@ Lisp_Object Qsvg; /* Indices of image specification fields in svg_format, below. */ enum svg_keyword_index -{ - SVG_TYPE, - SVG_DATA, - SVG_FILE, - SVG_ASCENT, - SVG_MARGIN, - SVG_RELIEF, - SVG_ALGORITHM, - SVG_HEURISTIC_MASK, - SVG_MASK, - SVG_BACKGROUND, - SVG_LAST -}; + { + SVG_TYPE, + SVG_DATA, + SVG_FILE, + SVG_ASCENT, + SVG_MARGIN, + SVG_RELIEF, + SVG_ALGORITHM, + SVG_HEURISTIC_MASK, + SVG_MASK, + SVG_BACKGROUND, + SVG_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword svg_format[SVG_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Structure describing the image type `svg'. Its the same type of structure defined for all image formats, handled by emacs image functions. See struct image_type in dispextern.h. */ static struct image_type svg_type = -{ - /* An identifier showing that this is an image structure for the SVG format. */ - &Qsvg, - /* Handle to a function that can be used to identify a SVG file. */ - svg_image_p, - /* Handle to function used to load a SVG file. */ - svg_load, - /* Handle to function to free sresources for SVG. */ - x_clear_image, - /* An internal field to link to the next image type in a list of - image types, will be filled in when registering the format. */ - NULL -}; + { + /* An identifier showing that this is an image structure for the SVG format. */ + &Qsvg, + /* Handle to a function that can be used to identify a SVG file. */ + svg_image_p, + /* Handle to function used to load a SVG file. */ + svg_load, + /* Handle to function to free sresources for SVG. */ + x_clear_image, + /* An internal field to link to the next image type in a list of + image types, will be filled in when registering the format. */ + NULL + }; /* Return non-zero if OBJECT is a valid SVG image specification. Do @@ -8325,7 +8335,7 @@ svg_load (f, img) Returns non-zero when successful. */ static int svg_load_image (f, img, contents, size) - /* Pointer to emacs frame structure. */ +/* Pointer to emacs frame structure. */ struct frame *f; /* Pointer to emacs image structure. */ struct image *img; @@ -8487,7 +8497,7 @@ svg_load_image (f, img, contents, size) /*********************************************************************** Ghostscript - ***********************************************************************/ +***********************************************************************/ #ifdef HAVE_X_WINDOWS #define HAVE_GHOSTSCRIPT 1 @@ -8510,53 +8520,53 @@ Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height; /* Indices of image specification fields in gs_format, below. */ enum gs_keyword_index -{ - GS_TYPE, - GS_PT_WIDTH, - GS_PT_HEIGHT, - GS_FILE, - GS_LOADER, - GS_BOUNDING_BOX, - GS_ASCENT, - GS_MARGIN, - GS_RELIEF, - GS_ALGORITHM, - GS_HEURISTIC_MASK, - GS_MASK, - GS_BACKGROUND, - GS_LAST -}; + { + GS_TYPE, + GS_PT_WIDTH, + GS_PT_HEIGHT, + GS_FILE, + GS_LOADER, + GS_BOUNDING_BOX, + GS_ASCENT, + GS_MARGIN, + GS_RELIEF, + GS_ALGORITHM, + GS_HEURISTIC_MASK, + GS_MASK, + GS_BACKGROUND, + GS_LAST + }; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword gs_format[GS_LAST] = -{ - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1}, - {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 1}, - {":loader", IMAGE_FUNCTION_VALUE, 0}, - {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} -}; + { + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1}, + {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 1}, + {":loader", IMAGE_FUNCTION_VALUE, 0}, + {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} + }; /* Structure describing the image type `ghostscript'. */ static struct image_type gs_type = -{ - &Qpostscript, - gs_image_p, - gs_load, - gs_clear_image, - NULL -}; + { + &Qpostscript, + gs_image_p, + gs_load, + gs_clear_image, + NULL + }; /* Free X resources of Ghostscript image IMG which is used on frame F. */ @@ -8791,13 +8801,13 @@ x_kill_gs_process (pixmap, f) /*********************************************************************** Tests - ***********************************************************************/ +***********************************************************************/ #if GLYPH_DEBUG DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0, doc: /* Value is non-nil if SPEC is a valid image specification. */) - (spec) + (spec) Lisp_Object spec; { return valid_image_p (spec) ? Qt : Qnil; @@ -8805,7 +8815,7 @@ DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0, DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") - (spec) + (spec) Lisp_Object spec; { int id = -1; @@ -8822,7 +8832,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") /*********************************************************************** Initialization - ***********************************************************************/ +***********************************************************************/ #ifdef HAVE_NTGUI /* Image types that rely on external libraries are loaded dynamically @@ -8836,13 +8846,13 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, doc: /* Initialize image library implementing image type TYPE. -Return non-nil if TYPE is a supported image type. + Return non-nil if TYPE is a supported image type. -Image types pbm and xbm are prebuilt; other types are loaded here. -Libraries to load are specified in alist LIBRARIES (usually, the value -of `image-library-alist', which see). */) - (type, libraries) - Lisp_Object type, libraries; + Image types pbm and xbm are prebuilt; other types are loaded here. + Libraries to load are specified in alist LIBRARIES (usually, the value + of `image-library-alist', which see). */) + (type, libraries) + Lisp_Object type, libraries; { Lisp_Object tested; @@ -8914,13 +8924,13 @@ syms_of_image () /* Must be defined now becase we're going to update it below, while defining the supported image types. */ DEFVAR_LISP ("image-types", &Vimage_types, - doc: /* List of potentially supported image types. -Each element of the list is a symbol for an image type, like 'jpeg or 'png. -To check whether it is really supported, use `image-type-available-p'. */); + doc: /* List of potentially supported image types. + Each element of the list is a symbol for an image type, like 'jpeg or 'png. + To check whether it is really supported, use `image-type-available-p'. */); Vimage_types = Qnil; DEFVAR_LISP ("image-library-alist", &Vimage_library_alist, - doc: /* Alist of image types vs external libraries needed to display them. + doc: /* Alist of image types vs external libraries needed to display them. Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol representing a supported image type, and the rest are strings giving @@ -8934,15 +8944,15 @@ listed; they are always supported. */); Fput (intern_c_string ("image-library-alist"), Qrisky_local_variable, Qt); DEFVAR_LISP ("max-image-size", &Vmax_image_size, - doc: /* Maximum size of images. -Emacs will not load an image into memory if its pixel width or -pixel height exceeds this limit. + doc: /* Maximum size of images. + Emacs will not load an image into memory if its pixel width or + pixel height exceeds this limit. -If the value is an integer, it directly specifies the maximum -image height and width, measured in pixels. If it is a floating -point number, it specifies the maximum image height and width -as a ratio to the frame height and width. If the value is -non-numeric, there is no explicit limit on the size of images. */); + If the value is an integer, it directly specifies the maximum + image height and width, measured in pixels. If it is a floating + point number, it specifies the maximum image height and width + as a ratio to the frame height and width. If the value is + non-numeric, there is no explicit limit on the size of images. */); Vmax_image_size = make_float (MAX_IMAGE_SIZE); Vimage_type_cache = Qnil; @@ -9082,22 +9092,22 @@ non-numeric, there is no explicit limit on the size of images. */); #endif DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images, - doc: /* Non-nil means always draw a cross over disabled images. -Disabled images are those having a `:conversion disabled' property. -A cross is always drawn on black & white displays. */); + doc: /* Non-nil means always draw a cross over disabled images. + Disabled images are those having a `:conversion disabled' property. + A cross is always drawn on black & white displays. */); cross_disabled_images = 0; DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path, - doc: /* List of directories to search for window system bitmap files. */); + doc: /* List of directories to search for window system bitmap files. */); Vx_bitmap_file_path = decode_env_path ((char *) 0, PATH_BITMAPS); DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay, - doc: /* Maximum time after which images are removed from the cache. -When an image has not been displayed this many seconds, Emacs -automatically removes it from the image cache. If the cache contains -a large number of images, the actual eviction time may be shorter. -The value can also be nil, meaning the cache is never cleared. -The function `clear-image-cache' disregards this variable. */); + doc: /* Maximum time after which images are removed from the cache. + When an image has not been displayed this many seconds, Emacs + automatically removes it from the image cache. If the cache contains + a large number of images, the actual eviction time may be shorter. + The value can also be nil, meaning the cache is never cleared. + The function `clear-image-cache' disregards this variable. */); Vimage_cache_eviction_delay = make_number (300); #ifdef HAVE_IMAGEMAGICK DEFVAR_LISP ("imagemagick-render-type", &Vimagemagick_render_type, From 788489aa741e8cefdccf881459eac789c7041e92 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Thu, 1 Jul 2010 23:41:24 +0200 Subject: [PATCH 017/101] some README changes --- README.imagemagick | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index f1cde66e54a..d297c76675a 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -20,32 +20,31 @@ imagemagick one. This is not wrong, but how should a user go about prefering the imagemagick loader? The user might like zooming etc in jpegs. -- For some reason its unbearably slow to look at a page in a large +#B _ For some reason its unbearably slow to look at a page in a large image bundle using the :index feature. The imagemagick "display" command is also a bit slow, but nowhere near as slow as the emacs code. It seems imagemagick tries to unpack every page when loading the bundle. This feature is not the primary usecase for the imagemagick patch though. - ImageMagick 6.6.2-8 introduced a bugfix for single page djvu load. - To benefit from the bugfix, the loader code in image.c must be changed. - -- optimize number of pages calculation for bundles as suggested by + ImageMagick 6.6.2-9 introduced a bugfix for single page djvu load. + It is now way faster to use the :index feature, but its still not + very fast. + +#B X optimize number of pages calculation for bundles as suggested by imagemagick forum: "set the density to something low like 2 and use MagickPingImage()" -- zooming the image like what is done for fonts in face-remap.el would + +#B _ zooming the image like what is done for fonts in face-remap.el would be a useful and demo friendly addition. Some work has been done on image-mode.el to acihieve this. -- look for optimizations for handling images with low depth +#B _ look for optimizations for handling images with low depth -- it would be neat if the graphicsmagick fork of imagemagick could - optionaly be used. - - * TODO + #B _ complete documentation drafts below #B X fix inconsistencys with spelling of imagemagick in the src From fe72c5b4651334677326104ec138e7cdd50f2ffe Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Sat, 10 Jul 2010 22:35:42 +0200 Subject: [PATCH 018/101] some more docs and polish --- README.imagemagick | 91 +++++++++++++++++++++++++++------------------- lisp/image-mode.el | 34 +++++++++-------- 2 files changed, 72 insertions(+), 53 deletions(-) diff --git a/README.imagemagick b/README.imagemagick index d297c76675a..600fb393632 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -1,3 +1,5 @@ +* README for the ImageMagick Emacs branch + This is the imagemagick branch of Emacs. Imagemagick can now be used to load many new image formats, and also do useful transforms like scaling and rotation. @@ -13,14 +15,15 @@ autoconf ./configure --with-imagemagick -* TODO - -- image-type-header-regexps priorities the jpeg loader over the +* TODO image-type-header-regexps priorities the jpeg loader over the imagemagick one. This is not wrong, but how should a user go about prefering the imagemagick loader? The user might like zooming etc in -jpegs. +jpegs. -#B _ For some reason its unbearably slow to look at a page in a large +try (setq image-type-header-regexps nil) for a quick hack to prefer +imagemagick over the jpg loader. + +* TODO For some reason its unbearably slow to look at a page in a large image bundle using the :index feature. The imagemagick "display" command is also a bit slow, but nowhere near as slow as the emacs code. It seems imagemagick tries to unpack every page when loading @@ -31,60 +34,72 @@ jpegs. It is now way faster to use the :index feature, but its still not very fast. -#B X optimize number of pages calculation for bundles as suggested by +** DONE optimize number of pages calculation for bundles as suggested by imagemagick forum: "set the density to something low like 2 and use MagickPingImage()" - -#B _ zooming the image like what is done for fonts in face-remap.el would - be a useful and demo friendly addition. Some work has been done on - image-mode.el to acihieve this. +** TODO try to cache the num pages calculation. it can take a while to + calculate the number of pages, and if you need to do it for each + page view, page-flipping becomes uselessly slow. -#B _ look for optimizations for handling images with low depth - - -* TODO +* TODO integrate with image-dired -#B _ complete documentation drafts below +* TODO integrate with docview. + +* TODO integrate with image-mode +Some work has been done, M-x image-transform-fit-to-height will fit +the image to the height of the Emacs window for instance. -#B X fix inconsistencys with spelling of imagemagick in the src -#B X report number of images in image bundle types somehow +* TODO look for optimizations for handling images with low depth +Currently the code seems to default to 24 bit RGB which is costly for +images with lower bit depth. + +* TODO complete documentation drafts below + +* DONE fix inconsistencys with spelling of imagemagick in the src +* DONE report number of images in image bundle types somehow Works like for "gif" support. Thanks to Juri Linkov. -#B X probably add pdf to inhibited types -#B X inhibit types is defconst should probably be defcustom -#B _ decide what to do with some uncommitted imagemagick support +* DONE probably add pdf to inhibited types +* DONE inhibit types is defconst should probably be defcustom +* TODO decide what to do with some uncommitted imagemagick support functions for image size etc. -#B _ Test with more systems +* TODO Test with more systems Tested on Fedora 12 so far, and the libmagick that ships with it. -Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. -#B X Also need some way to handle render methods that only work on newer ImageMagicks +Ubuntu 8.04 was also tested, but it seems it ships a broken +ImageMagick. + +I also tried using an imagemagick compiled from their SVN, in +parallell with the one packaged by Fedora, it worked well. + +* DONE Also need some way to handle render methods that only work on newer ImageMagicks Is handled by configure now * Some nits from Stefan Monnier I just took a quick look at the code and I see the following nits to fix: -#B _ obviously a merge will have to come with a good ChangeLog. -#B X also the merge will need to come with documentation. Maybe not in the + +** TODO obviously a merge will have to come with a good ChangeLog. +** DONE also the merge will need to come with documentation. Maybe not in the Texinfo form yet, but at least in the etc/NEWS with enough info that describes the `scale' and other such arguments that someone can start using them. -#B X the README talks about naming inconsistencies, I think these should be +** DONE the README talks about naming inconsistencies, I think these should be fixed before a first commit (should be straightforward). -#B X the "let" in image.el should not be followed by a line break and the while +** DONE the "let" in image.el should not be followed by a line break and the while should be replaced by a dolist. -#B X the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]]) +** DONE the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]]) its args, not sure what happened. -#B X a few lines in the C code break the 80columns limit. -#B X please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]]) -#B X you can get rid of the prototypes by reordering the code. ([[2010.06.14]]) -#B X the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]]) +** DONE a few lines in the C code break the 80columns limit. +** DONE please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]]) +** DONE you can get rid of the prototypes by reordering the code. ([[2010.06.14]]) +** DONE the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]]) weirdly otherwise in C-h f). -#B X Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]]) -#B X why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]]) -#B X some "," lack a space after them. ([[2010.06.14]]) -#B X several "=" and "==" lack spaces around them. ([[2010.06.14]]) - +** DONE Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]]) +** DONE why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]]) +** DONE some "," lack a space after them. ([[2010.06.14]]) +** DONE several "=" and "==" lack spaces around them. ([[2010.06.14]]) + * NEWS entry ** ImageMagick support @@ -147,4 +162,4 @@ of images in an image bundle. This is simmilar to how GIF files work. * config.in, Makefile.in, configure.in * Manual entry -nothing yet, but the NEWS entry could be adapted. \ No newline at end of file +nothing yet, but the NEWS entry could be adapted. diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 78ec4772d16..9bd5a76d5da 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -543,8 +543,8 @@ the image file and `image-mode' showing the image as an image." ; (define-key map [(control ?+)] 'image-scale-in) ; (define-key map [(control ?-)] 'image-scale-out) ; (define-key map [(control ?=)] 'image-scale-none) -;; (define-key map "c f h" 'image-scale-fit-height) -;; (define-key map "c ]" 'image-rotate-right) +;; (define-key map "c f h" 'image-scale-fit-height) +;; (define-key map "c ]" 'image-rotate-right) map) "Minor mode keymap for transforming the view of images Image mode.") @@ -553,23 +553,16 @@ the image file and `image-mode' showing the image as an image." nil "image-transform" image-transform-minor-mode-map) -;;these are supposed to be buffer local -;(defvar image-transform-height 100);;nil should mean 100% -;;the interface could rather be: -(defvar image-transform-resize - nil - "values: fit-height number=scale nil=scale100% TODO fit-width fit-page" - ) +(defvar image-transform-resize nil + "The image resize operation. See the command + `image-transform-set-scale' for more information." ) -;;TODO 0 90 180 270 degrees are the only reasonable angles here -;;otherwise combining with rescaling will get very awkward (defvar image-transform-rotation 0.0) -;;then it would be nice with a bunch of globals like: -;; image-transform-always-resize values: 'fit-height nil=100% number=scale TODO 'fit-width 'fit-page -;; image-transform-always-rotate value: angle (defun image-transform-properties (display) + "Calculate the display properties for transformations; scaling +and rotation. " (let* ((size (image-size display t)) (height @@ -588,28 +581,39 @@ the image file and `image-mode' showing the image as an image." ,@(if width (list :width width)) ,@(if (not (equal 0.0 image-transform-rotation)) (list :rotation image-transform-rotation)) + ;;TODO fit-to-* should consider the rotation angle ))) (defun image-transform-set-scale (scale) + "SCALE sets the scaling for images. " (interactive "nscale:") (image-transform-set-resize (float scale))) (defun image-transform-fit-to-height () + "Fit image height to window height. " (interactive) (image-transform-set-resize 'fit-height)) (defun image-transform-fit-to-width () + "Fit image width to window width. " (interactive) (image-transform-set-resize 'fit-width)) (defun image-transform-set-resize (resize) + "Set the resize mode for images. The RESIZE value can be the +symbol fit-height which fits the image to the window height. The +symbol fit-width fits the image to the window width. A number +indicates a scaling factor. nil indicates scale to 100%. " (setq image-transform-resize resize) (if (eq 'image-mode major-mode) (image-toggle-display-image))) (defun image-transform-set-rotation (rotation) + "Set the image ROTATION angle. " (interactive "nrotation:") + ;;TODO 0 90 180 270 degrees are the only reasonable angles here + ;;otherwise combining with rescaling will get very awkward (setq image-transform-rotation (float rotation)) - (image-toggle-display-image)) + (if (eq major-mode 'image-mode) (image-toggle-display-image))) (provide 'image-mode) From 1fcf76afe76188b1f555f3e9b619fee70907d4c8 Mon Sep 17 00:00:00 2001 From: Geoff Gole Date: Sun, 8 Aug 2010 22:23:35 -0400 Subject: [PATCH 019/101] * whitespace.el (whitespace-color-off): Remove post-command-hook locally. --- lisp/ChangeLog | 5 +++++ lisp/whitespace.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3a37cf2dfb4..0bdb6535045 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-09 Geoff Gole (tiny change) + + * whitespace.el (whitespace-color-off): Remove post-command-hook + locally. + 2010-08-08 Johan Bockgård * replace.el (replace-highlight): Bind isearch-forward and diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 183698a28f3..5c7d4e95caf 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2297,7 +2297,7 @@ resultant list will be returned." ;; turn off font lock (when (whitespace-style-face-p) (font-lock-mode 0) - (remove-hook 'post-command-hook #'whitespace-post-command-hook) + (remove-hook 'post-command-hook #'whitespace-post-command-hook t) (when whitespace-font-lock (setq whitespace-font-lock nil font-lock-keywords whitespace-font-lock-keywords)) From 4360344208820b1363ec42a4ac7aab9281304d0f Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 9 Aug 2010 11:28:25 +0900 Subject: [PATCH 020/101] quail/greek.el ("greek"): Add rules for Greek style quotes. --- leim/ChangeLog | 4 ++++ leim/quail/greek.el | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/leim/ChangeLog b/leim/ChangeLog index a16f52b8c78..836aeb033fe 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,7 @@ +2010-08-09 Kenichi Handa + + * quail/greek.el ("greek"): Add rules for Greek style quotes. + 2010-05-07 Chong Yidong * Version 23.2 released. diff --git a/leim/quail/greek.el b/leim/quail/greek.el index 1085ca229cf..4ceb0a52b0e 100644 --- a/leim/quail/greek.el +++ b/leim/quail/greek.el @@ -1279,7 +1279,9 @@ e.g. (";:i" ?,F@(B) (":;i" ?,F@(B) (";:y" ?,F`(B) - (":;y" ?,F`(B)) + (":;y" ?,F`(B) + (";<" "$(Q)((B") + (";>" "$(Q)2(B")) (quail-define-package "greek-postfix" "GreekPost" ",FX(B" nil From 2294b255d8e8e4e4a8ea66698dbae23c296f19a8 Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Mon, 9 Aug 2010 08:51:28 -0700 Subject: [PATCH 021/101] * src/s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK): New definitions. (HAVE_TERMIO): Remove. --- src/ChangeLog | 6 ++++++ src/s/hpux10-20.h | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 514c42cd922..d4130ccdcf8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-08-09 Peter O'Gorman (tiny change) + + * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK): New + definitions. + (HAVE_TERMIO): Remove. + 2010-08-06 Kenichi Handa * charset.c: Include diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h index cf670cd51a0..5d231986010 100644 --- a/src/s/hpux10-20.h +++ b/src/s/hpux10-20.h @@ -41,12 +41,10 @@ along with GNU Emacs. If not, see . */ #define FIRST_PTY_LETTER 'p' -/* - * Define HAVE_TERMIO if the system provides sysV-style ioctls - * for terminal control. - */ +#define HAVE_TERMIOS +#define NO_TERMIO -#define HAVE_TERMIO +#define ORDINARY_LINK /* * Define HAVE_PTYS if the system supports pty devices. From 7467d0a812ca803105e6d28dbb75c7246521e862 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 11 Aug 2010 15:43:49 +0200 Subject: [PATCH 022/101] * subr.el (ignore-errors): Add debug declaration. --- lisp/ChangeLog | 4 ++++ lisp/subr.el | 1 + 2 files changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0bdb6535045..0ae95366b6d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-11 Andreas Schwab + + * subr.el (ignore-errors): Add debug declaration. + 2010-08-09 Geoff Gole (tiny change) * whitespace.el (whitespace-color-off): Remove post-command-hook diff --git a/lisp/subr.el b/lisp/subr.el index 16ea5b41342..44ae84ab76b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -219,6 +219,7 @@ Treated as a declaration when used at the right place in a (defmacro ignore-errors (&rest body) "Execute BODY; if an error occurs, return nil. Otherwise, return result of last form in BODY." + (declare (debug t) (indent 0)) `(condition-case nil (progn ,@body) (error nil))) ;;;; Basic Lisp functions. From ac14bd09e395f8ba25ef793d15251d4655fd173a Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 13 Aug 2010 15:26:27 +0900 Subject: [PATCH 023/101] quail/greek.el ("greek-postfix"): Add rules for Greek style quotes. --- leim/ChangeLog | 5 +++++ leim/quail/greek.el | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/leim/ChangeLog b/leim/ChangeLog index 836aeb033fe..f6a4e815019 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,8 @@ +2010-08-13 Kenichi Handa + + * quail/greek.el ("greek-postfix"): Add rules for Greek style + quotes. + 2010-08-09 Kenichi Handa * quail/greek.el ("greek"): Add rules for Greek style quotes. diff --git a/leim/quail/greek.el b/leim/quail/greek.el index 4ceb0a52b0e..6b183111fcc 100644 --- a/leim/quail/greek.el +++ b/leim/quail/greek.el @@ -1421,7 +1421,12 @@ e.g. ("i:;" ?,F@(B) ("i;:" ?,F@(B) ("y:;" ?,F`(B) - ("y;:" ?,F`(B)) + ("y;:" ?,F`(B) + ;; There two are asymmetric with ";<" and ";>" in "greek" input + ;; method. But, as the other Latin postfix methdos adopt "<<" and + ;; ">>", it may be better to follow them. + ("<<" "$(Q)((B") + (">>" "$(Q)2(B")) ;; arch-tag: 2a37e042-db1b-4ecf-b755-117775a3c150 From 7d1b9df355b53c9c022105ad7d657a672a0ff293 Mon Sep 17 00:00:00 2001 From: Jan D Date: Fri, 13 Aug 2010 12:32:37 +0200 Subject: [PATCH 024/101] * doc.c (Fsnarf_documentation): Initialize skip_file before build-files test. --- src/ChangeLog | 5 +++++ src/doc.c | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index d4130ccdcf8..f36714d3792 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-13 Jan Djärv + + * doc.c (Fsnarf_documentation): Initialize skip_file before + build-files test. + 2010-08-09 Peter O'Gorman (tiny change) * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK): New diff --git a/src/doc.c b/src/doc.c index 303aed0486d..6543eb41db1 100644 --- a/src/doc.c +++ b/src/doc.c @@ -644,6 +644,7 @@ the same file name is found in the `doc-directory'. */) if (p != end) { end = (char *) index (p, '\n'); + skip_file = 0; /* See if this is a file name, and if it is a file in build-files. */ if (p[1] == 'S' && end - p > 4 && end[-2] == '.' From 721dce172ba46f32208e7f0ddf5bfb326094e5a8 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 13 Aug 2010 18:56:35 -0700 Subject: [PATCH 025/101] Minor diary-lib.el fix. * lisp/calendar/diary-lib.el (diary-header-line-format): Fit it to the window, not the frame. --- lisp/ChangeLog | 5 +++++ lisp/calendar/diary-lib.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0ae95366b6d..718f6f402e5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-14 Glenn Morris + + * calendar/diary-lib.el (diary-header-line-format): + Fit it to the window, not the frame. + 2010-08-11 Andreas Schwab * subr.el (ignore-errors): Add debug declaration. diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 8fb464aa7e6..fc416d869bb 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -383,7 +383,7 @@ The format of the header is specified by `diary-header-line-format'." "Some text is hidden - press \"s\" in calendar \ before edit/copy" "Diary")) - ?\s (frame-width))) + ?\s (window-width))) "Format of the header line displayed by `diary-simple-display'. Only used if `diary-header-line-flag' is non-nil." :group 'diary From ec1339fbce4df95a3ae96b7796a28dfe6186db4e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 13 Aug 2010 19:23:56 -0700 Subject: [PATCH 026/101] * lisp/calendar/diary-lib.el: Bump custom :version for previous change. --- lisp/calendar/diary-lib.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index fc416d869bb..39354bd31e3 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -390,7 +390,7 @@ Only used if `diary-header-line-flag' is non-nil." :type 'sexp :initialize 'custom-initialize-default :set 'diary-set-header - :version "22.1") + :version "23.3") ; frame-width -> window-width ;; The first version of this also checked for diary-selective-display ;; in the non-fancy case. This was an attempt to distinguish between From 983b8302209c32043178edd8b89941857699d6b4 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sat, 14 Aug 2010 08:42:09 +0200 Subject: [PATCH 027/101] * doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S. --- src/ChangeLog | 4 ++++ src/doc.c | 27 +++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f36714d3792..2f011db3784 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-08-14 Jan Djärv + + * doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S. + 2010-08-13 Jan Djärv * doc.c (Fsnarf_documentation): Initialize skip_file before diff --git a/src/doc.c b/src/doc.c index 6543eb41db1..d1cc6e48fcf 100644 --- a/src/doc.c +++ b/src/doc.c @@ -640,25 +640,28 @@ the same file name is found in the `doc-directory'. */) p = buf; end = buf + (filled < 512 ? filled : filled - 128); while (p != end && *p != '\037') p++; - /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */ + /* p points to ^_Ffunctionname\n or ^_Vvarname\n or ^_Sfilename\n. */ if (p != end) { end = (char *) index (p, '\n'); - skip_file = 0; /* See if this is a file name, and if it is a file in build-files. */ - if (p[1] == 'S' && end - p > 4 && end[-2] == '.' - && (end[-1] == 'o' || end[-1] == 'c')) + if (p[1] == 'S') { - int len = end - p - 2; - char *fromfile = alloca (len + 1); - strncpy (fromfile, &p[2], len); - fromfile[len] = 0; - if (fromfile[len-1] == 'c') - fromfile[len-1] = 'o'; + skip_file = 0; + if (end - p > 4 && end[-2] == '.' + && (end[-1] == 'o' || end[-1] == 'c')) + { + int len = end - p - 2; + char *fromfile = alloca (len + 1); + strncpy (fromfile, &p[2], len); + fromfile[len] = 0; + if (fromfile[len-1] == 'c') + fromfile[len-1] = 'o'; - skip_file = NILP (Fmember (build_string (fromfile), - Vbuild_files)); + skip_file = NILP (Fmember (build_string (fromfile), + Vbuild_files)); + } } sym = oblookup (Vobarray, p + 2, From 086852797eb641df5ab99d09f5475246dd922fd4 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 14 Aug 2010 10:00:34 +0200 Subject: [PATCH 028/101] * quail/greek.el ("greek", "greek-postfix"): Change string to character. --- leim/ChangeLog | 5 +++++ leim/quail/greek.el | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/leim/ChangeLog b/leim/ChangeLog index f6a4e815019..21d63dd663a 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,8 @@ +2010-08-14 Andreas Schwab + + * quail/greek.el ("greek", "greek-postfix"): Change string to + character. + 2010-08-13 Kenichi Handa * quail/greek.el ("greek-postfix"): Add rules for Greek style diff --git a/leim/quail/greek.el b/leim/quail/greek.el index 6b183111fcc..688b247b0b5 100644 --- a/leim/quail/greek.el +++ b/leim/quail/greek.el @@ -1280,8 +1280,8 @@ e.g. (":;i" ?,F@(B) (";:y" ?,F`(B) (":;y" ?,F`(B) - (";<" "$(Q)((B") - (";>" "$(Q)2(B")) + (";<" ?$(Q)((B) + (";>" ?$(Q)2(B)) (quail-define-package "greek-postfix" "GreekPost" ",FX(B" nil @@ -1422,11 +1422,11 @@ e.g. ("i;:" ?,F@(B) ("y:;" ?,F`(B) ("y;:" ?,F`(B) - ;; There two are asymmetric with ";<" and ";>" in "greek" input - ;; method. But, as the other Latin postfix methdos adopt "<<" and + ;; These two are asymmetric with ";<" and ";>" in "greek" input + ;; method. But, as the other Latin postfix methods adopt "<<" and ;; ">>", it may be better to follow them. - ("<<" "$(Q)((B") - (">>" "$(Q)2(B")) + ("<<" ?$(Q)((B) + (">>" ?$(Q)2(B)) ;; arch-tag: 2a37e042-db1b-4ecf-b755-117775a3c150 From e099e659e1a5fe07a7f5b0775aa3212f074c8879 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 14 Aug 2010 10:20:08 +0200 Subject: [PATCH 029/101] Avoid mismatching parens * quail/arabic.el: Quote [ and ]. * quail/latin-ltx.el: Likewise. --- leim/ChangeLog | 3 +++ leim/quail/arabic.el | 4 ++-- leim/quail/latin-ltx.el | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/leim/ChangeLog b/leim/ChangeLog index 21d63dd663a..ae499daef49 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,5 +1,8 @@ 2010-08-14 Andreas Schwab + * quail/arabic.el: Quote [ and ]. + * quail/latin-ltx.el: Likewise. + * quail/greek.el ("greek", "greek-postfix"): Change string to character. diff --git a/leim/quail/arabic.el b/leim/quail/arabic.el index 4e613cad16e..cb77183bc96 100644 --- a/leim/quail/arabic.el +++ b/leim/quail/arabic.el @@ -57,8 +57,8 @@ Based on Arabic table in X Keyboard Configuration DB. ("A" ?ِ) ("S" ?ٍ) - ("D" ?]) - ("F" ?[) + ("D" ?\]) + ("F" ?\[) ("G" ["لأ"]) ("H" ?أ) ("J" ?ـ) diff --git a/leim/quail/latin-ltx.el b/leim/quail/latin-ltx.el index 5001c4dd0ef..8b58bf39d54 100644 --- a/leim/quail/latin-ltx.el +++ b/leim/quail/latin-ltx.el @@ -653,7 +653,7 @@ system, including many technical ones. Examples: ("\\lambda" ?λ) ("\\langle" ?〈) ("\\lbrace" ?{) - ("\\lbrack" ?[) + ("\\lbrack" ?\[) ("\\lceil" ?⌈) ("\\ldots" ?…) ("\\le" ?≤) @@ -788,7 +788,7 @@ system, including many technical ones. Examples: ("\\quad" ? ) ("\\rangle" ?〉) ("\\rbrace" ?}) - ("\\rbrack" ?]) + ("\\rbrack" ?\]) ("\\rceil" ?⌉) ("\\rfloor" ?⌋) ("\\rightarrow" ?→) From a4aae1a5322c264d5b9d2f605a4b31acec78e526 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 14 Aug 2010 19:21:40 -0400 Subject: [PATCH 030/101] * simple.el (kill-region): Doc fix (Bug#6787). --- lisp/ChangeLog | 4 ++++ lisp/simple.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 718f6f402e5..a0cdf2f8a77 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-14 Chong Yidong + + * simple.el (kill-region): Doc fix (Bug#6787). + 2010-08-14 Glenn Morris * calendar/diary-lib.el (diary-header-line-format): diff --git a/lisp/simple.el b/lisp/simple.el index d0c27656e41..9b38f3cdbf3 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2959,7 +2959,8 @@ If the buffer is read-only, Emacs will beep and refrain from deleting the text, but put the text in the kill ring anyway. This means that you can use the killing commands to copy text from a read-only buffer. -This is the primitive for programs to kill text (as opposed to deleting it). +Lisp programs should use this function for killing text. + (To delete text, use `delete-region'.) Supply two arguments, character positions indicating the stretch of text to be killed. Any command that calls this function is a \"kill command\". From b514a395cc3e6451e85d22a44475a1185c193a90 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 15 Aug 2010 11:34:53 +0200 Subject: [PATCH 031/101] * quail/georgian.el: Remove extra backslashes. --- leim/ChangeLog | 4 ++++ leim/quail/georgian.el | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/leim/ChangeLog b/leim/ChangeLog index ae499daef49..a7fafd1a216 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,7 @@ +2010-08-15 Andreas Schwab + + * quail/georgian.el: Remove extra backslashes. + 2010-08-14 Andreas Schwab * quail/arabic.el: Quote [ and ]. diff --git a/leim/quail/georgian.el b/leim/quail/georgian.el index 0101a930d37..a063d126667 100644 --- a/leim/quail/georgian.el +++ b/leim/quail/georgian.el @@ -51,7 +51,7 @@ ("n" ?ნ) ("o" ?ო) (".p" ?პ) - ("\+z" ?ჟ) + ("+z" ?ჟ) ("r" ?რ) ("s" ?ს) (".t" ?ტ) @@ -60,14 +60,14 @@ ("k" ?ქ) (".g" ?ღ) ("q" ?ყ) - ("\+s" ?შ) - ("\+c" ?ჩ) + ("+s" ?შ) + ("+c" ?ჩ) ("c" ?ც) ("j" ?ძ) (".c" ?წ) - (".\+c" ?ჭ) + (".+c" ?ჭ) ("x" ?ხ) - ("\+j" ?ჯ) + ("+j" ?ჯ) ("h" ?ჰ) ("q1" ?ჴ) ("e0" ?ჱ) From 05a9766a14f990245816f9bbb37497c05ef3fd59 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 15 Aug 2010 11:36:19 +0200 Subject: [PATCH 032/101] * quail/vntelex.el ("vietnamese-telex"): Doc fix. --- leim/ChangeLog | 2 ++ leim/quail/vntelex.el | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/leim/ChangeLog b/leim/ChangeLog index a7fafd1a216..dd33ae5a32f 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,5 +1,7 @@ 2010-08-15 Andreas Schwab + * quail/vntelex.el ("vietnamese-telex"): Doc fix. + * quail/georgian.el: Remove extra backslashes. 2010-08-14 Andreas Schwab diff --git a/leim/quail/vntelex.el b/leim/quail/vntelex.el index 8af020b093c..4a94a4be59c 100644 --- a/leim/quail/vntelex.el +++ b/leim/quail/vntelex.el @@ -53,7 +53,7 @@ Other diacritics: acute s as -> ,1a(B grave f af -> ,1`(B hook above r ar -> ,1d(B - tilde x ax -> ,1c(B + tilde x ax -> ,1c(B dot below j aj -> ,1U(B d bar dd -> ,1p(B From 3a7a912990d6583aabe7e1e807bb9c044f403b30 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 17 Aug 2010 12:34:28 -0400 Subject: [PATCH 033/101] Avoid stack overflow in let, eval, and apply (Bug#6214). * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA (Bug#6214). --- src/ChangeLog | 5 +++++ src/eval.c | 31 ++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2f011db3784..ce409d0fbbd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-17 Chong Yidong + + * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA + (Bug#6214). + 2010-08-14 Jan Djärv * doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S. diff --git a/src/eval.c b/src/eval.c index 6609d3b5c8a..7bd27a0f144 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1028,12 +1028,13 @@ usage: (let VARLIST BODY...) */) int count = SPECPDL_INDEX (); register int argnum; struct gcpro gcpro1, gcpro2; + USE_SAFE_ALLOCA; varlist = Fcar (args); /* Make space to hold the values to give the bound variables */ elt = Flength (varlist); - temps = (Lisp_Object *) alloca (XFASTINT (elt) * sizeof (Lisp_Object)); + SAFE_ALLOCA (temps, Lisp_Object *, XFASTINT (elt) * sizeof (Lisp_Object)); /* Compute the values and store them in `temps' */ @@ -1066,6 +1067,7 @@ usage: (let VARLIST BODY...) */) } elt = Fprogn (Fcdr (args)); + SAFE_FREE (); return unbind_to (count, elt); } @@ -2299,8 +2301,10 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, /* Pass a vector of evaluated arguments */ Lisp_Object *vals; register int argnum = 0; + USE_SAFE_ALLOCA; - vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); + SAFE_ALLOCA (vals, Lisp_Object *, + XINT (numargs) * sizeof (Lisp_Object)); GCPRO3 (args_left, fun, fun); gcpro3.var = vals; @@ -2318,6 +2322,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, val = (*XSUBR (fun)->function) (XINT (numargs), vals); UNGCPRO; + SAFE_FREE (); goto done; } @@ -2430,8 +2435,9 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) register int i, numargs; register Lisp_Object spread_arg; register Lisp_Object *funcall_args; - Lisp_Object fun; + Lisp_Object fun, retval; struct gcpro gcpro1; + USE_SAFE_ALLOCA; fun = args [0]; funcall_args = 0; @@ -2470,8 +2476,8 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) { /* Avoid making funcall cons up a yet another new vector of arguments by explicitly supplying nil's for optional values */ - funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args) - * sizeof (Lisp_Object)); + SAFE_ALLOCA (funcall_args, Lisp_Object *, + (1 + XSUBR (fun)->max_args) * sizeof (Lisp_Object)); for (i = numargs; i < XSUBR (fun)->max_args;) funcall_args[++i] = Qnil; GCPRO1 (*funcall_args); @@ -2483,8 +2489,8 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) function itself as well as its arguments. */ if (!funcall_args) { - funcall_args = (Lisp_Object *) alloca ((1 + numargs) - * sizeof (Lisp_Object)); + SAFE_ALLOCA (funcall_args, Lisp_Object *, + (1 + numargs) * sizeof (Lisp_Object)); GCPRO1 (*funcall_args); gcpro1.nvars = 1 + numargs; } @@ -2500,7 +2506,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) } /* By convention, the caller needs to gcpro Ffuncall's args. */ - RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); + retval = Ffuncall (gcpro1.nvars, funcall_args); + UNGCPRO; + SAFE_FREE (); + + return retval; } /* Run hook variables in various ways. */ @@ -3108,9 +3118,11 @@ apply_lambda (fun, args, eval_flag) struct gcpro gcpro1, gcpro2, gcpro3; register int i; register Lisp_Object tem; + USE_SAFE_ALLOCA; numargs = Flength (args); - arg_vector = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); + SAFE_ALLOCA (arg_vector, Lisp_Object *, + XINT (numargs) * sizeof (Lisp_Object)); args_left = args; GCPRO3 (*arg_vector, args_left, fun); @@ -3139,6 +3151,7 @@ apply_lambda (fun, args, eval_flag) tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); /* Don't do it again when we return to eval. */ backtrace_list->debug_on_exit = 0; + SAFE_FREE (); return tem; } From b72e07172e5ce15093094d521b133a6283d5d94c Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 17 Aug 2010 23:07:50 +0200 Subject: [PATCH 034/101] * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA_LISP instead of SAFE_ALLOCA. --- src/ChangeLog | 5 +++++ src/eval.c | 14 +++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ce409d0fbbd..5b4fac632bd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-17 Andreas Schwab + + * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA_LISP + instead of SAFE_ALLOCA. + 2010-08-17 Chong Yidong * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA diff --git a/src/eval.c b/src/eval.c index 7bd27a0f144..6b74f5b884d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1034,7 +1034,7 @@ usage: (let VARLIST BODY...) */) /* Make space to hold the values to give the bound variables */ elt = Flength (varlist); - SAFE_ALLOCA (temps, Lisp_Object *, XFASTINT (elt) * sizeof (Lisp_Object)); + SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); /* Compute the values and store them in `temps' */ @@ -2303,8 +2303,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, register int argnum = 0; USE_SAFE_ALLOCA; - SAFE_ALLOCA (vals, Lisp_Object *, - XINT (numargs) * sizeof (Lisp_Object)); + SAFE_ALLOCA_LISP (vals, XINT (numargs)); GCPRO3 (args_left, fun, fun); gcpro3.var = vals; @@ -2476,8 +2475,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) { /* Avoid making funcall cons up a yet another new vector of arguments by explicitly supplying nil's for optional values */ - SAFE_ALLOCA (funcall_args, Lisp_Object *, - (1 + XSUBR (fun)->max_args) * sizeof (Lisp_Object)); + SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); for (i = numargs; i < XSUBR (fun)->max_args;) funcall_args[++i] = Qnil; GCPRO1 (*funcall_args); @@ -2489,8 +2487,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) function itself as well as its arguments. */ if (!funcall_args) { - SAFE_ALLOCA (funcall_args, Lisp_Object *, - (1 + numargs) * sizeof (Lisp_Object)); + SAFE_ALLOCA_LISP (funcall_args, 1 + numargs); GCPRO1 (*funcall_args); gcpro1.nvars = 1 + numargs; } @@ -3121,8 +3118,7 @@ apply_lambda (fun, args, eval_flag) USE_SAFE_ALLOCA; numargs = Flength (args); - SAFE_ALLOCA (arg_vector, Lisp_Object *, - XINT (numargs) * sizeof (Lisp_Object)); + SAFE_ALLOCA_LISP (arg_vector, XINT (numargs)); args_left = args; GCPRO3 (*arg_vector, args_left, fun); From bb25c8d7a1da7de1cb5d12a47e27be30879c4237 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 17 Aug 2010 19:33:13 -0700 Subject: [PATCH 035/101] * lisp/woman.el (woman-translate): Case matters. (Bug#6849) --- lisp/ChangeLog | 4 ++++ lisp/woman.el | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a0cdf2f8a77..8d74713da93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-18 Glenn Morris + + * woman.el (woman-translate): Case matters. (Bug#6849) + 2010-08-14 Chong Yidong * simple.el (kill-region): Doc fix (Bug#6787). diff --git a/lisp/woman.el b/lisp/woman.el index 79d6d84aff1..eb21f01e564 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -3384,7 +3384,10 @@ Format paragraphs upto TO. Supports special chars. "Translate up to marker TO. Do this last of all transformations." (if translations (let ((matches (car translations)) - (alist (cdr translations))) + (alist (cdr translations)) + ;; Translations are case-sensitive, eg ".tr ab" does not + ;; affect "A" (bug#6849). + (case-fold-search nil)) (while (re-search-forward matches to t) ;; Done like this to retain text properties and ;; support translation of special characters: From f3cc64f80843f278814b69bd0a8b2642d31dda77 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 18 Aug 2010 17:07:58 +0900 Subject: [PATCH 036/101] files.el: Add word-wrap as safe local variable. --- lisp/ChangeLog | 4 ++++ lisp/files.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8d74713da93..7f31ac6a673 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-18 Kenichi Handa + + * files.el: Add `word-wrap' as safe local variable. + 2010-08-18 Glenn Morris * woman.el (woman-translate): Case matters. (Bug#6849) diff --git a/lisp/files.el b/lisp/files.el index 4c819972555..f6564768ae7 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2774,7 +2774,8 @@ asking you for confirmation." (left-margin . integerp) ;; C source code (no-update-autoloads . booleanp) (tab-width . integerp) ;; C source code - (truncate-lines . booleanp))) ;; C source code + (truncate-lines . booleanp) ;; C source code + (word-wrap . booleanp))) ;; C source code (put 'c-set-style 'safe-local-eval-function t) From 3234a340f4be698212341eccd64a94cec66c104b Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Wed, 18 Aug 2010 11:09:46 +0200 Subject: [PATCH 037/101] minor cleanup --- src/image.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/image.c b/src/image.c index e39c46b392a..b198e6aab00 100644 --- a/src/image.c +++ b/src/image.c @@ -7542,15 +7542,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ image_error ("im read failed", Qnil, Qnil); if (status == MagickFalse) goto imagemagick_error; - - /* if(ino == 0) */ - /* MagickSetFirstIterator(image_wand); */ - /* else */ - /* MagickSetIteratorIndex(image_wand, ino); */ - - //MagickSetFirstIterator(image_wand); - - /* If width and/or height is set in the display spec assume we want to scale to those values. if either h or w is unspecified, the unspecified should be calculated from the specified to preserve @@ -7701,7 +7692,9 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ if (imagemagick_rendermethod == 1) { - /* Try if magicexportimage is any faster than pixelpushing. */ + /* Magicexportimage is normaly faster than pixelpushing. This + method is also well tested. Some aspects of this method are + ad-hoc and needs to be more researched. */ int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ /* Try to create a x pixmap to hold the imagemagick pixmap. */ From 16a911401bdd45cbe05b42db9880bf2941308a78 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Wed, 18 Aug 2010 12:35:23 +0200 Subject: [PATCH 038/101] documentation changes --- ChangeLog | 15 +++++++++++++ README.imagemagick | 18 ++-------------- doc/lispref/display.texi | 46 ++++++++++++++++++++++++++++++++++++++++ etc/NEWS | 16 ++++++++++++++ 4 files changed, 79 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71b597d889b..e2d707300ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -139,6 +139,21 @@ * Makefile.in (install-arch-indep): Delete any old info .gz files first. +2010-06-12 Joakim Verona + + * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is + defined: + (imagemagick_image_p): New function to test for ImageMagic img. + (imagemagick_load): New function to load ImageMagick img. + (imagemagick_load_image): New function, helper for imagemagick_load + (imagemagick-types): New function. + (Qimagemagick): New Lisp_object. + (imagemagick-render-type): New var, decides which renderer to use + * image.el: + (imagemagick-types-inhibit): New var. + (imagemagick-register-types): New function. + * config.in, Makefile.in, configure.in + 2010-06-11 Glenn Morris * configure.in (--without-compress-info): New option. diff --git a/README.imagemagick b/README.imagemagick index 600fb393632..792e9fd90ea 100644 --- a/README.imagemagick +++ b/README.imagemagick @@ -64,7 +64,7 @@ Works like for "gif" support. Thanks to Juri Linkov. * TODO decide what to do with some uncommitted imagemagick support functions for image size etc. * TODO Test with more systems -Tested on Fedora 12 so far, and the libmagick that ships with it. +Tested on Fedora 12, Fedora 14 so far, and the libmagick that ships with it. Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. @@ -77,7 +77,7 @@ Is handled by configure now * Some nits from Stefan Monnier I just took a quick look at the code and I see the following nits to fix: -** TODO obviously a merge will have to come with a good ChangeLog. +** DONE obviously a merge will have to come with a good ChangeLog. ** DONE also the merge will need to come with documentation. Maybe not in the Texinfo form yet, but at least in the etc/NEWS with enough info that describes the `scale' and other such arguments that someone can start @@ -147,19 +147,5 @@ as TIFF or DJVM, to view. The image-metadata function can be used to retrieve the total number of images in an image bundle. This is simmilar to how GIF files work. -* Changelog entry -2010-06-12 Joakim Verona - * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is - defined: - (imagemagick_image_p): New function to test for ImageMagic img. - (imagemagick_load): New function to load ImageMagick img. - (imagemagick_load_image): New function, helper for imagemagick_load - (imagemagick-types): New function. - (Qimagemagick): New Lisp_object. - * image.el: - (imagemagick-types-inhibit): New var. - (imagemagick-register-types): New function. - * config.in, Makefile.in, configure.in - * Manual entry nothing yet, but the NEWS entry could be adapted. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 9f07fb42ef4..716efbd9059 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -4039,6 +4039,7 @@ displayed (@pxref{Display Feature Testing}). * GIF Images:: Special features for GIF format. * TIFF Images:: Special features for TIFF format. * PostScript Images:: Special features for PostScript format. +* ImageMagick Images:: Special features available through ImageMagick. * Other Image Types:: Various other formats are supported. * Defining Images:: Convenient ways to define an image for later use. * Showing Images:: Convenient ways to display an image once it is defined. @@ -4463,6 +4464,51 @@ specifying the bounding box of the PostScript image, analogous to the @end example @end table +@node ImageMagick Images +@subsection ImageMagick Images +The Imagemagick library can be used to load many image formats in Emacs. + +The function (imagemagick-types) returns a list of image file +extensions that your installation of imagemagick supports. + +The function (imagemagick-register-types) will enable the imagemagick +support for the extensions in imagemagick-types minus the types listed +in imagemagick-types-inhibit. + +imagemagick-types-inhibit has the value '(C HTML HTM TXT PDF) by +default. There can be overlap between image loaders in your Emacs +installation. If you never want to use the ImageMagick loader to use +Jpeg files, for instance, add 'JPG to imagemagick-types-inhibit. Which +loader that will be used in practice depends on the priority of the +loaders. + +imagemagick-render-type is a new variable which can be set to choose +between screen render methods for the ImageMagick loader. + +- 0 is a conservative metod which works with older ImageMagick + versions. It is a bit slow, but robust. + +- 1 utilizes a newer ImageMagick method + + +Images loaded with imagemagick will support a couple of new display +specification behaviours: + +- if the :width and :height keywords are specified, these values are +used for scaling the image. If only one of :width or :height is +specified, the other one will be calculated so as to preserve the +aspect ratio.If both :width and :height are specified, aspect ratio +will not be preserved. + +- :rotation specifies a rotation angle in degrees. + +- :index specifies which image inside an image bundle file format, such +as TIFF or DJVM, to view. + +The image-metadata function can be used to retrieve the total number +of images in an image bundle. This is simmilar to how GIF files work. + + @node Other Image Types @subsection Other Image Types @cindex PBM diff --git a/etc/NEWS b/etc/NEWS index d489e2d32c7..836222b4861 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -109,6 +109,22 @@ The frame-parameter tool-bar-position controls this. It takes the values top, left, right or bottom. The Options => Show/Hide menu has entries for this. +** ImageMagick support +It is now possible to use the Imagemagick library to load many new +image formats in Emacs. + +To enable, use the following configure option: +--with-imagemagick + +The new function (imagemagick-types) returns a list of image file +extensions that your installation of imagemagick supports. + +The function (imagemagick-register-types) will enable the imagemagick +support for the extensions in imagemagick-types minus the types listed +in imagemagick-types-inhibit. + +See the Emacs Manual for more information. + ** The colors for selected text (the region face) are taken from the GTK theme when Emacs is built with GTK. From a67e6f13345ce7307ada22a8226da192f47299ac Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 18 Aug 2010 20:24:52 +0200 Subject: [PATCH 039/101] * progmodes/flymake.el (flymake-start-syntax-check-process): Use `start-file-process' in order to let it run also on remote hosts. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/flymake.el | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7f31ac6a673..45c5fd52d99 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-18 Michael Albinus + + * progmodes/flymake.el (flymake-start-syntax-check-process): Use + `start-file-process' in order to let it run also on remote hosts. + 2010-08-18 Kenichi Handa * files.el: Add `word-wrap' as safe local variable. @@ -68,6 +73,7 @@ (ctext-no-compositions): Doc fix. (compound-text-with-extensions): Doc fix. +>>>>>>> MERGE-SOURCE 2010-08-04 Stefan Monnier * simple.el (exchange-dot-and-mark): Mark obsolete, finally. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 2a198215536..712af6fd288 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1152,7 +1152,8 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'." (when dir (let ((default-directory dir)) (flymake-log 3 "starting process on dir %s" default-directory))) - (setq process (apply 'start-process "flymake-proc" (current-buffer) cmd args)) + (setq process (apply 'start-file-process + "flymake-proc" (current-buffer) cmd args)) (set-process-sentinel process 'flymake-process-sentinel) (set-process-filter process 'flymake-process-filter) (push process flymake-processes) From 9b3d6a42efd17fb2a9f01b128b10b17da5296c98 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 19 Aug 2010 01:32:39 +0200 Subject: [PATCH 040/101] lisp/ChangeLog: Remove merge markers. --- lisp/ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 45c5fd52d99..578f5e4fb49 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -73,7 +73,6 @@ (ctext-no-compositions): Doc fix. (compound-text-with-extensions): Doc fix. ->>>>>>> MERGE-SOURCE 2010-08-04 Stefan Monnier * simple.el (exchange-dot-and-mark): Mark obsolete, finally. From b0c396f73b2320e664e6bc620c12d0d6ac6ded51 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Thu, 19 Aug 2010 09:23:06 +0200 Subject: [PATCH 041/101] fix some accidental whitespace changes --- src/image.c | 903 ++++++++++++++++++++++++++-------------------------- 1 file changed, 449 insertions(+), 454 deletions(-) diff --git a/src/image.c b/src/image.c index b198e6aab00..176d3b41d09 100644 --- a/src/image.c +++ b/src/image.c @@ -1,22 +1,22 @@ /* Functions for image support on window system. Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. - This file is part of GNU Emacs. +This file is part of GNU Emacs. - GNU Emacs is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - GNU Emacs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with GNU Emacs. If not, see . */ +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ #include #include @@ -115,7 +115,7 @@ typedef struct ns_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 #define FRAME_X_VISUAL FRAME_NS_DISPLAY_INFO(f)->visual -#define x_defined_color(f, name, color_def, alloc) \ +#define x_defined_color(f, name, color_def, alloc) \ ns_defined_color (f, name, color_def, alloc, 0) #define FRAME_X_SCREEN(f) 0 #define DefaultDepthOfScreen(screen) x_display_list->n_planes @@ -279,7 +279,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi #ifdef HAVE_NS void *bitmap = ns_image_from_XBM (bits, width, height); if (!bitmap) - return -1; + return -1; #endif id = x_allocate_bitmap_record (f); @@ -325,7 +325,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file) void *bitmap = ns_image_from_file (file); if (!bitmap) - return -1; + return -1; id = x_allocate_bitmap_record (f); @@ -552,7 +552,7 @@ x_create_bitmap_mask (struct frame *f, int id) /*********************************************************************** Image types -***********************************************************************/ + ***********************************************************************/ /* Value is the number of elements of vector VECTOR. */ @@ -604,10 +604,10 @@ static void x_emboss (struct frame *, struct image *); static int x_build_heuristic_mask (struct frame *, struct image *, Lisp_Object); -#define CACHE_IMAGE_TYPE(type, status) \ +#define CACHE_IMAGE_TYPE(type, status) \ do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0) -#define ADD_IMAGE_TYPE(type) \ +#define ADD_IMAGE_TYPE(type) \ do { Vimage_types = Fcons (type, Vimage_types); } while (0) /* Define a new image type from TYPE. This adds a copy of TYPE to @@ -708,23 +708,23 @@ image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2) /*********************************************************************** Image specifications -***********************************************************************/ + ***********************************************************************/ enum image_value_type - { - IMAGE_DONT_CHECK_VALUE_TYPE, - IMAGE_STRING_VALUE, - IMAGE_STRING_OR_NIL_VALUE, - IMAGE_SYMBOL_VALUE, - IMAGE_POSITIVE_INTEGER_VALUE, - IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, - IMAGE_NON_NEGATIVE_INTEGER_VALUE, - IMAGE_ASCENT_VALUE, - IMAGE_INTEGER_VALUE, - IMAGE_FUNCTION_VALUE, - IMAGE_NUMBER_VALUE, - IMAGE_BOOL_VALUE - }; +{ + IMAGE_DONT_CHECK_VALUE_TYPE, + IMAGE_STRING_VALUE, + IMAGE_STRING_OR_NIL_VALUE, + IMAGE_SYMBOL_VALUE, + IMAGE_POSITIVE_INTEGER_VALUE, + IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, + IMAGE_NON_NEGATIVE_INTEGER_VALUE, + IMAGE_ASCENT_VALUE, + IMAGE_INTEGER_VALUE, + IMAGE_FUNCTION_VALUE, + IMAGE_NUMBER_VALUE, + IMAGE_BOOL_VALUE +}; /* Structure used when parsing image specifications. */ @@ -998,7 +998,7 @@ or omitted means use the selected frame. */) /*********************************************************************** Image type independent image structures -***********************************************************************/ + ***********************************************************************/ static struct image *make_image (Lisp_Object spec, unsigned hash); static void free_image (struct frame *f, struct image *img); @@ -1203,10 +1203,10 @@ four_corners_best (XImagePtr_or_DC ximg, int *corners, #ifdef HAVE_NTGUI -#define Destroy_Image(img_dc, prev) \ +#define Destroy_Image(img_dc, prev) \ do { SelectObject (img_dc, prev); DeleteDC (img_dc); } while (0) -#define Free_Pixmap(display, pixmap) \ +#define Free_Pixmap(display, pixmap) \ DeleteObject (pixmap) #elif defined (HAVE_NS) @@ -1219,10 +1219,10 @@ four_corners_best (XImagePtr_or_DC ximg, int *corners, #else -#define Destroy_Image(ximg, dummy) \ +#define Destroy_Image(ximg, dummy) \ XDestroyImage (ximg) -#define Free_Pixmap(display, pixmap) \ +#define Free_Pixmap(display, pixmap) \ XFreePixmap (display, pixmap) #endif /* !HAVE_NTGUI && !HAVE_NS */ @@ -1316,7 +1316,7 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D /*********************************************************************** Helper functions for X image types -***********************************************************************/ + ***********************************************************************/ static void x_clear_image_1 (struct frame *, struct image *, int, int, int); @@ -1410,7 +1410,7 @@ x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name, /*********************************************************************** Image Cache -***********************************************************************/ + ***********************************************************************/ static struct image *search_image_cache (struct frame *, Lisp_Object, unsigned); static void cache_image (struct frame *f, struct image *img); @@ -1625,9 +1625,9 @@ which is then usually a filename. */) DEFUN ("image-flush", Fimage_flush, Simage_flush, 1, 2, 0, doc: /* Fush the image with specification SPEC on frame FRAME. - This removes the image from the Emacs image cache. If SPEC specifies - an image file, the next redisplay of this image will read from the - current contents of that file. +This removes the image from the Emacs image cache. If SPEC specifies +an image file, the next redisplay of this image will read from the +current contents of that file. FRAME nil or omitted means use the selected frame. FRAME t means refresh the image on all frames. */) @@ -1914,7 +1914,7 @@ mark_image_cache (struct image_cache *c) /*********************************************************************** X / NS / W32 support code -***********************************************************************/ + ***********************************************************************/ #ifdef HAVE_NTGUI @@ -1922,9 +1922,9 @@ mark_image_cache (struct image_cache *c) #define DEF_IMGLIB_FN(func) int (FAR CDECL *fn_##func)() /* Macro for loading those image functions from the library. */ -#define LOAD_IMGLIB_FN(lib,func) { \ - fn_##func = (void *) GetProcAddress (lib, #func); \ - if (!fn_##func) return 0; \ +#define LOAD_IMGLIB_FN(lib,func) { \ + fn_##func = (void *) GetProcAddress (lib, #func); \ + if (!fn_##func) return 0; \ } /* Load a DLL implementing an image type. @@ -2166,7 +2166,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he /*********************************************************************** File Handling -***********************************************************************/ + ***********************************************************************/ static unsigned char *slurp_file (char *, int *); @@ -2243,7 +2243,7 @@ slurp_file (char *file, int *size) /*********************************************************************** XBM images -***********************************************************************/ + ***********************************************************************/ static int xbm_scan (unsigned char **, unsigned char *, char *, int *); static int xbm_load (struct frame *f, struct image *img); @@ -2259,61 +2259,61 @@ static int xbm_file_p (Lisp_Object); /* Indices of image specification fields in xbm_format, below. */ enum xbm_keyword_index - { - XBM_TYPE, - XBM_FILE, - XBM_WIDTH, - XBM_HEIGHT, - XBM_DATA, - XBM_FOREGROUND, - XBM_BACKGROUND, - XBM_ASCENT, - XBM_MARGIN, - XBM_RELIEF, - XBM_ALGORITHM, - XBM_HEURISTIC_MASK, - XBM_MASK, - XBM_LAST - }; +{ + XBM_TYPE, + XBM_FILE, + XBM_WIDTH, + XBM_HEIGHT, + XBM_DATA, + XBM_FOREGROUND, + XBM_BACKGROUND, + XBM_ASCENT, + XBM_MARGIN, + XBM_RELIEF, + XBM_ALGORITHM, + XBM_HEURISTIC_MASK, + XBM_MASK, + XBM_LAST +}; /* Vector of image_keyword structures describing the format of valid XBM image specifications. */ static const struct image_keyword xbm_format[XBM_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 0}, - {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, - {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, - {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 0}, + {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, + {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, + {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} +}; /* Structure describing the image type XBM. */ static struct image_type xbm_type = - { - &Qxbm, - xbm_image_p, - xbm_load, - x_clear_image, - NULL - }; +{ + &Qxbm, + xbm_image_p, + xbm_load, + x_clear_image, + NULL +}; /* Tokens returned from xbm_scan. */ enum xbm_token - { - XBM_TK_IDENT = 256, - XBM_TK_NUMBER - }; +{ + XBM_TK_IDENT = 256, + XBM_TK_NUMBER +}; /* Return non-zero if OBJECT is a valid XBM-type image specification. @@ -2652,20 +2652,20 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e int value; int LA1; -#define match() \ - LA1 = xbm_scan (&s, end, buffer, &value) +#define match() \ + LA1 = xbm_scan (&s, end, buffer, &value) -#define expect(TOKEN) \ - if (LA1 != (TOKEN)) \ - goto failure; \ - else \ - match () +#define expect(TOKEN) \ + if (LA1 != (TOKEN)) \ + goto failure; \ + else \ + match () #define expect_ident(IDENT) \ - if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ - match (); \ - else \ - goto failure + if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ + match (); \ + else \ + goto failure *width = *height = -1; if (data) @@ -3005,7 +3005,7 @@ xbm_load (struct frame *f, struct image *img) /*********************************************************************** XPM images -***********************************************************************/ + ***********************************************************************/ #if defined (HAVE_XPM) || defined (HAVE_NS) @@ -3044,49 +3044,49 @@ Lisp_Object Qxpm; /* Indices of image specification fields in xpm_format, below. */ enum xpm_keyword_index - { - XPM_TYPE, - XPM_FILE, - XPM_DATA, - XPM_ASCENT, - XPM_MARGIN, - XPM_RELIEF, - XPM_ALGORITHM, - XPM_HEURISTIC_MASK, - XPM_MASK, - XPM_COLOR_SYMBOLS, - XPM_BACKGROUND, - XPM_LAST - }; +{ + XPM_TYPE, + XPM_FILE, + XPM_DATA, + XPM_ASCENT, + XPM_MARGIN, + XPM_RELIEF, + XPM_ALGORITHM, + XPM_HEURISTIC_MASK, + XPM_MASK, + XPM_COLOR_SYMBOLS, + XPM_BACKGROUND, + XPM_LAST +}; /* Vector of image_keyword structures describing the format of valid XPM image specifications. */ static const struct image_keyword xpm_format[XPM_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 0}, - {":data", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 0}, + {":data", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; /* Structure describing the image type XPM. */ static struct image_type xpm_type = - { - &Qxpm, - xpm_image_p, - xpm_load, - x_clear_image, - NULL - }; +{ + &Qxpm, + xpm_image_p, + xpm_load, + x_clear_image, + NULL +}; #ifdef HAVE_X_WINDOWS @@ -3645,11 +3645,11 @@ static int xpm_load_image (struct frame *, struct image *, /* Tokens returned from xpm_scan. */ enum xpm_token - { - XPM_TK_IDENT = 256, - XPM_TK_STRING, - XPM_TK_EOF - }; +{ + XPM_TK_IDENT = 256, + XPM_TK_STRING, + XPM_TK_EOF +}; /* Scan an XPM data and return a character (< 256) or a token defined by enum xpm_token above. *S and END are the start (inclusive) and @@ -3679,7 +3679,7 @@ xpm_scan (const unsigned char **s, *beg = *s - 1; while (*s < end && (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+')) - ++*s; + ++*s; *len = *s - *beg; return XPM_TK_IDENT; } @@ -3839,21 +3839,21 @@ xpm_load_image (struct frame *f, int best_key, have_mask = 0; XImagePtr ximg = NULL, mask_img = NULL; -#define match() \ - LA1 = xpm_scan (&s, end, &beg, &len) +#define match() \ + LA1 = xpm_scan (&s, end, &beg, &len) -#define expect(TOKEN) \ - if (LA1 != (TOKEN)) \ - goto failure; \ - else \ - match () +#define expect(TOKEN) \ + if (LA1 != (TOKEN)) \ + goto failure; \ + else \ + match () -#define expect_ident(IDENT) \ - if (LA1 == XPM_TK_IDENT \ - && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \ - match (); \ - else \ - goto failure +#define expect_ident(IDENT) \ + if (LA1 == XPM_TK_IDENT \ + && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \ + match (); \ + else \ + goto failure if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0)) goto failure; @@ -4112,7 +4112,7 @@ xpm_load (struct frame *f, /*********************************************************************** Color table -***********************************************************************/ + ***********************************************************************/ #ifdef COLOR_TABLE_SUPPORT @@ -4379,7 +4379,7 @@ init_color_table (void) /*********************************************************************** Algorithms -***********************************************************************/ + ***********************************************************************/ static XColor *x_to_xcolors (struct frame *, struct image *, int); static void x_from_xcolors (struct frame *, struct image *, XColor *); @@ -4398,17 +4398,17 @@ int cross_disabled_images; strategies. */ static int emboss_matrix[9] = { - /* x - 1 x x + 1 */ - 2, -1, 0, /* y - 1 */ - -1, 0, 1, /* y */ - 0, 1, -2 /* y + 1 */ + /* x - 1 x x + 1 */ + 2, -1, 0, /* y - 1 */ + -1, 0, 1, /* y */ + 0, 1, -2 /* y + 1 */ }; static int laplace_matrix[9] = { - /* x - 1 x x + 1 */ - 1, 0, 0, /* y - 1 */ - 0, 0, 0, /* y */ - 0, 0, -1 /* y + 1 */ + /* x - 1 x x + 1 */ + 1, 0, 0, /* y - 1 */ + 0, 0, 0, /* y */ + 0, 0, -1 /* y + 1 */ }; /* Value is the intensity of the color whose red/green/blue values @@ -4928,7 +4928,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) /*********************************************************************** PBM (mono, gray, color) -***********************************************************************/ + ***********************************************************************/ static int pbm_image_p (Lisp_Object object); static int pbm_load (struct frame *f, struct image *img); @@ -4941,49 +4941,49 @@ Lisp_Object Qpbm; /* Indices of image specification fields in gs_format, below. */ enum pbm_keyword_index - { - PBM_TYPE, - PBM_FILE, - PBM_DATA, - PBM_ASCENT, - PBM_MARGIN, - PBM_RELIEF, - PBM_ALGORITHM, - PBM_HEURISTIC_MASK, - PBM_MASK, - PBM_FOREGROUND, - PBM_BACKGROUND, - PBM_LAST - }; +{ + PBM_TYPE, + PBM_FILE, + PBM_DATA, + PBM_ASCENT, + PBM_MARGIN, + PBM_RELIEF, + PBM_ALGORITHM, + PBM_HEURISTIC_MASK, + PBM_MASK, + PBM_FOREGROUND, + PBM_BACKGROUND, + PBM_LAST +}; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword pbm_format[PBM_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 0}, - {":data", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 0}, + {":data", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; /* Structure describing the image type `pbm'. */ static struct image_type pbm_type = - { - &Qpbm, - pbm_image_p, - pbm_load, - x_clear_image, - NULL - }; +{ + &Qpbm, + pbm_image_p, + pbm_load, + x_clear_image, + NULL +}; /* Return non-zero if OBJECT is a valid PBM image specification. */ @@ -5344,7 +5344,7 @@ pbm_load (struct frame *f, struct image *img) /*********************************************************************** PNG -***********************************************************************/ + ***********************************************************************/ #if defined (HAVE_PNG) || defined (HAVE_NS) @@ -5360,47 +5360,47 @@ Lisp_Object Qpng; /* Indices of image specification fields in png_format, below. */ enum png_keyword_index - { - PNG_TYPE, - PNG_DATA, - PNG_FILE, - PNG_ASCENT, - PNG_MARGIN, - PNG_RELIEF, - PNG_ALGORITHM, - PNG_HEURISTIC_MASK, - PNG_MASK, - PNG_BACKGROUND, - PNG_LAST - }; +{ + PNG_TYPE, + PNG_DATA, + PNG_FILE, + PNG_ASCENT, + PNG_MARGIN, + PNG_RELIEF, + PNG_ALGORITHM, + PNG_HEURISTIC_MASK, + PNG_MASK, + PNG_BACKGROUND, + PNG_LAST +}; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword png_format[PNG_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; /* Structure describing the image type `png'. */ static struct image_type png_type = - { - &Qpng, - png_image_p, - png_load, - x_clear_image, - NULL - }; +{ + &Qpng, + png_image_p, + png_load, + x_clear_image, + NULL +}; /* Return non-zero if OBJECT is a valid PNG image specification. */ @@ -5935,7 +5935,7 @@ png_load (struct frame *f, struct image *img) /*********************************************************************** JPEG -***********************************************************************/ + ***********************************************************************/ #if defined (HAVE_JPEG) || defined (HAVE_NS) @@ -5949,47 +5949,47 @@ Lisp_Object Qjpeg; /* Indices of image specification fields in gs_format, below. */ enum jpeg_keyword_index - { - JPEG_TYPE, - JPEG_DATA, - JPEG_FILE, - JPEG_ASCENT, - JPEG_MARGIN, - JPEG_RELIEF, - JPEG_ALGORITHM, - JPEG_HEURISTIC_MASK, - JPEG_MASK, - JPEG_BACKGROUND, - JPEG_LAST - }; +{ + JPEG_TYPE, + JPEG_DATA, + JPEG_FILE, + JPEG_ASCENT, + JPEG_MARGIN, + JPEG_RELIEF, + JPEG_ALGORITHM, + JPEG_HEURISTIC_MASK, + JPEG_MASK, + JPEG_BACKGROUND, + JPEG_LAST +}; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword jpeg_format[JPEG_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; /* Structure describing the image type `jpeg'. */ static struct image_type jpeg_type = - { - &Qjpeg, - jpeg_image_p, - jpeg_load, - x_clear_image, - NULL - }; +{ + &Qjpeg, + jpeg_image_p, + jpeg_load, + x_clear_image, + NULL +}; /* Return non-zero if OBJECT is a valid JPEG image specification. */ @@ -6271,7 +6271,7 @@ jpeg_file_src (j_decompress_ptr cinfo, FILE *fp) struct jpeg_stdio_mgr *src; if (cinfo->src != NULL) - src = (struct jpeg_stdio_mgr *) cinfo->src; + src = (struct jpeg_stdio_mgr *) cinfo->src; else { /* First time for this JPEG object? */ @@ -6280,8 +6280,8 @@ jpeg_file_src (j_decompress_ptr cinfo, FILE *fp) sizeof (struct jpeg_stdio_mgr)); src = (struct jpeg_stdio_mgr *) cinfo->src; src->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - JPEG_STDIO_BUFFER_SIZE); + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + JPEG_STDIO_BUFFER_SIZE); } src->file = fp; @@ -6373,7 +6373,7 @@ jpeg_load (struct frame *f, struct image *img) } /* Create the JPEG decompression object. Let it read from fp. - Read the JPEG image header. */ + Read the JPEG image header. */ fn_jpeg_CreateDecompress (&cinfo, JPEG_LIB_VERSION, sizeof (cinfo)); if (NILP (specified_data)) @@ -6385,7 +6385,7 @@ jpeg_load (struct frame *f, struct image *img) fn_jpeg_read_header (&cinfo, 1); /* Customize decompression so that color quantization will be used. - Start decompression. */ + Start decompression. */ cinfo.quantize_colors = 1; fn_jpeg_start_decompress (&cinfo); width = img->width = cinfo.output_width; @@ -6488,7 +6488,7 @@ jpeg_load (struct frame *f, struct image *img) /*********************************************************************** TIFF -***********************************************************************/ + ***********************************************************************/ #if defined (HAVE_TIFF) || defined (HAVE_NS) @@ -6502,49 +6502,49 @@ Lisp_Object Qtiff; /* Indices of image specification fields in tiff_format, below. */ enum tiff_keyword_index - { - TIFF_TYPE, - TIFF_DATA, - TIFF_FILE, - TIFF_ASCENT, - TIFF_MARGIN, - TIFF_RELIEF, - TIFF_ALGORITHM, - TIFF_HEURISTIC_MASK, - TIFF_MASK, - TIFF_BACKGROUND, - TIFF_INDEX, - TIFF_LAST - }; +{ + TIFF_TYPE, + TIFF_DATA, + TIFF_FILE, + TIFF_ASCENT, + TIFF_MARGIN, + TIFF_RELIEF, + TIFF_ALGORITHM, + TIFF_HEURISTIC_MASK, + TIFF_MASK, + TIFF_BACKGROUND, + TIFF_INDEX, + TIFF_LAST +}; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword tiff_format[TIFF_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, - {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0} +}; /* Structure describing the image type `tiff'. */ static struct image_type tiff_type = - { - &Qtiff, - tiff_image_p, - tiff_load, - x_clear_image, - NULL - }; +{ + &Qtiff, + tiff_image_p, + tiff_load, + x_clear_image, + NULL +}; /* Return non-zero if OBJECT is a valid TIFF image specification. */ @@ -6626,7 +6626,7 @@ typedef struct size_t len; int index; } - tiff_memory_source; +tiff_memory_source; static size_t tiff_read_from_memory (thandle_t data, tdata_t buf, tsize_t size) @@ -6915,7 +6915,7 @@ tiff_load (struct frame *f, struct image *img) /*********************************************************************** GIF -***********************************************************************/ + ***********************************************************************/ #if defined (HAVE_GIF) || defined (HAVE_NS) @@ -6930,49 +6930,49 @@ Lisp_Object Qgif; /* Indices of image specification fields in gif_format, below. */ enum gif_keyword_index - { - GIF_TYPE, - GIF_DATA, - GIF_FILE, - GIF_ASCENT, - GIF_MARGIN, - GIF_RELIEF, - GIF_ALGORITHM, - GIF_HEURISTIC_MASK, - GIF_MASK, - GIF_IMAGE, - GIF_BACKGROUND, - GIF_LAST - }; +{ + GIF_TYPE, + GIF_DATA, + GIF_FILE, + GIF_ASCENT, + GIF_MARGIN, + GIF_RELIEF, + GIF_ALGORITHM, + GIF_HEURISTIC_MASK, + GIF_MASK, + GIF_IMAGE, + GIF_BACKGROUND, + GIF_LAST +}; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword gif_format[GIF_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":index", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; /* Structure describing the image type `gif'. */ static struct image_type gif_type = - { - &Qgif, - gif_image_p, - gif_load, - gif_clear_image, - NULL - }; +{ + &Qgif, + gif_image_p, + gif_load, + gif_clear_image, + NULL +}; /* Free X resources of GIF image IMG which is used on frame F. */ @@ -7062,7 +7062,7 @@ typedef struct size_t len; int index; } - gif_memory_source; +gif_memory_source; /* Make the current memory source available to gif_read_from_memory. It's done this way because not all versions of libungif support @@ -7865,7 +7865,7 @@ DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0, /*********************************************************************** SVG -***********************************************************************/ + ***********************************************************************/ #if defined (HAVE_RSVG) @@ -7884,55 +7884,55 @@ Lisp_Object Qsvg; /* Indices of image specification fields in svg_format, below. */ enum svg_keyword_index - { - SVG_TYPE, - SVG_DATA, - SVG_FILE, - SVG_ASCENT, - SVG_MARGIN, - SVG_RELIEF, - SVG_ALGORITHM, - SVG_HEURISTIC_MASK, - SVG_MASK, - SVG_BACKGROUND, - SVG_LAST - }; +{ + SVG_TYPE, + SVG_DATA, + SVG_FILE, + SVG_ASCENT, + SVG_MARGIN, + SVG_RELIEF, + SVG_ALGORITHM, + SVG_HEURISTIC_MASK, + SVG_MASK, + SVG_BACKGROUND, + SVG_LAST +}; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword svg_format[SVG_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":data", IMAGE_STRING_VALUE, 0}, - {":file", IMAGE_STRING_VALUE, 0}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":data", IMAGE_STRING_VALUE, 0}, + {":file", IMAGE_STRING_VALUE, 0}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; /* Structure describing the image type `svg'. Its the same type of structure defined for all image formats, handled by emacs image functions. See struct image_type in dispextern.h. */ static struct image_type svg_type = - { - /* An identifier showing that this is an image structure for the SVG format. */ - &Qsvg, - /* Handle to a function that can be used to identify a SVG file. */ - svg_image_p, - /* Handle to function used to load a SVG file. */ - svg_load, - /* Handle to function to free sresources for SVG. */ - x_clear_image, - /* An internal field to link to the next image type in a list of - image types, will be filled in when registering the format. */ - NULL - }; +{ + /* An identifier showing that this is an image structure for the SVG format. */ + &Qsvg, + /* Handle to a function that can be used to identify a SVG file. */ + svg_image_p, + /* Handle to function used to load a SVG file. */ + svg_load, + /* Handle to function to free sresources for SVG. */ + x_clear_image, + /* An internal field to link to the next image type in a list of + image types, will be filled in when registering the format. */ + NULL +}; /* Return non-zero if OBJECT is a valid SVG image specification. Do @@ -8257,7 +8257,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * /*********************************************************************** Ghostscript -***********************************************************************/ + ***********************************************************************/ #ifdef HAVE_X_WINDOWS #define HAVE_GHOSTSCRIPT 1 @@ -8276,53 +8276,53 @@ Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height; /* Indices of image specification fields in gs_format, below. */ enum gs_keyword_index - { - GS_TYPE, - GS_PT_WIDTH, - GS_PT_HEIGHT, - GS_FILE, - GS_LOADER, - GS_BOUNDING_BOX, - GS_ASCENT, - GS_MARGIN, - GS_RELIEF, - GS_ALGORITHM, - GS_HEURISTIC_MASK, - GS_MASK, - GS_BACKGROUND, - GS_LAST - }; +{ + GS_TYPE, + GS_PT_WIDTH, + GS_PT_HEIGHT, + GS_FILE, + GS_LOADER, + GS_BOUNDING_BOX, + GS_ASCENT, + GS_MARGIN, + GS_RELIEF, + GS_ALGORITHM, + GS_HEURISTIC_MASK, + GS_MASK, + GS_BACKGROUND, + GS_LAST +}; /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ static const struct image_keyword gs_format[GS_LAST] = - { - {":type", IMAGE_SYMBOL_VALUE, 1}, - {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1}, - {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1}, - {":file", IMAGE_STRING_VALUE, 1}, - {":loader", IMAGE_FUNCTION_VALUE, 0}, - {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1}, - {":ascent", IMAGE_ASCENT_VALUE, 0}, - {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, - {":relief", IMAGE_INTEGER_VALUE, 0}, - {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":background", IMAGE_STRING_OR_NIL_VALUE, 0} - }; +{ + {":type", IMAGE_SYMBOL_VALUE, 1}, + {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1}, + {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1}, + {":file", IMAGE_STRING_VALUE, 1}, + {":loader", IMAGE_FUNCTION_VALUE, 0}, + {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1}, + {":ascent", IMAGE_ASCENT_VALUE, 0}, + {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, + {":relief", IMAGE_INTEGER_VALUE, 0}, + {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} +}; /* Structure describing the image type `ghostscript'. */ static struct image_type gs_type = - { - &Qpostscript, - gs_image_p, - gs_load, - gs_clear_image, - NULL - }; +{ + &Qpostscript, + gs_image_p, + gs_load, + gs_clear_image, + NULL +}; /* Free X resources of Ghostscript image IMG which is used on frame F. */ @@ -8550,7 +8550,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) /*********************************************************************** Tests -***********************************************************************/ + ***********************************************************************/ #if GLYPH_DEBUG @@ -8579,7 +8579,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") /*********************************************************************** Initialization -***********************************************************************/ + ***********************************************************************/ #ifdef HAVE_NTGUI /* Image types that rely on external libraries are loaded dynamically @@ -8593,7 +8593,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, doc: /* Initialize image library implementing image type TYPE. - Return non-nil if TYPE is a supported image type. +Return non-nil if TYPE is a supported image type. Image types pbm and xbm are prebuilt; other types are loaded here. Libraries to load are specified in alist LIBRARIES (usually, the value @@ -8656,7 +8656,6 @@ of `image-library-alist', which see). */) return Qnil; } - void syms_of_image (void) { @@ -8668,13 +8667,13 @@ syms_of_image (void) /* Must be defined now becase we're going to update it below, while defining the supported image types. */ DEFVAR_LISP ("image-types", &Vimage_types, - doc: /* List of potentially supported image types. - Each element of the list is a symbol for an image type, like 'jpeg or 'png. - To check whether it is really supported, use `image-type-available-p'. */); + doc: /* List of potentially supported image types. +Each element of the list is a symbol for an image type, like 'jpeg or 'png. +To check whether it is really supported, use `image-type-available-p'. */); Vimage_types = Qnil; DEFVAR_LISP ("image-library-alist", &Vimage_library_alist, - doc: /* Alist of image types vs external libraries needed to display them. + doc: /* Alist of image types vs external libraries needed to display them. Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol representing a supported image type, and the rest are strings giving @@ -8688,15 +8687,15 @@ listed; they are always supported. */); Fput (intern_c_string ("image-library-alist"), Qrisky_local_variable, Qt); DEFVAR_LISP ("max-image-size", &Vmax_image_size, - doc: /* Maximum size of images. - Emacs will not load an image into memory if its pixel width or - pixel height exceeds this limit. + doc: /* Maximum size of images. +Emacs will not load an image into memory if its pixel width or +pixel height exceeds this limit. - If the value is an integer, it directly specifies the maximum - image height and width, measured in pixels. If it is a floating - point number, it specifies the maximum image height and width - as a ratio to the frame height and width. If the value is - non-numeric, there is no explicit limit on the size of images. */); +If the value is an integer, it directly specifies the maximum +image height and width, measured in pixels. If it is a floating +point number, it specifies the maximum image height and width +as a ratio to the frame height and width. If the value is +non-numeric, there is no explicit limit on the size of images. */); Vmax_image_size = make_float (MAX_IMAGE_SIZE); Vimage_type_cache = Qnil; @@ -8739,7 +8738,6 @@ listed; they are always supported. */); QCrotation = intern (":rotation"); staticpro (&QCrotation); QCmatrix = intern_c_string (":matrix"); - staticpro (&QCmatrix); QCcolor_adjustment = intern_c_string (":color-adjustment"); staticpro (&QCcolor_adjustment); @@ -8836,22 +8834,23 @@ listed; they are always supported. */); #endif DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images, - doc: /* Non-nil means always draw a cross over disabled images. - Disabled images are those having a `:conversion disabled' property. - A cross is always drawn on black & white displays. */); + doc: /* Non-nil means always draw a cross over disabled images. +Disabled images are those having a `:conversion disabled' property. +A cross is always drawn on black & white displays. */); cross_disabled_images = 0; DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path, - doc: /* List of directories to search for window system bitmap files. */); + doc: /* List of directories to search for window system bitmap files. */); Vx_bitmap_file_path = decode_env_path ((char *) 0, PATH_BITMAPS); DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay, - doc: /* Maximum time after which images are removed from the cache. - When an image has not been displayed this many seconds, Emacs - automatically removes it from the image cache. If the cache contains - a large number of images, the actual eviction time may be shorter. - The value can also be nil, meaning the cache is never cleared. - The function `clear-image-cache' disregards this variable. */); + doc: /* Maximum time after which images are removed from the cache. +When an image has not been displayed this many seconds, Emacs +automatically removes it from the image cache. If the cache contains +a large number of images, the actual eviction time may be shorter. +The value can also be nil, meaning the cache is never cleared. + +The function `clear-image-cache' disregards this variable. */); Vimage_cache_eviction_delay = make_number (300); #ifdef HAVE_IMAGEMAGICK DEFVAR_LISP ("imagemagick-render-type", &Vimagemagick_render_type, @@ -8860,14 +8859,10 @@ listed; they are always supported. */); } - void init_image (void) { - } - - /* arch-tag: 123c2a5e-14a8-4c53-ab95-af47d7db49b9 (do not change this comment) */ From 549a73b97bce9fe51547332424e0a6cb7070df1a Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Thu, 19 Aug 2010 09:29:27 +0200 Subject: [PATCH 042/101] some minor cosmetic fixes in comments --- src/image.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/image.c b/src/image.c index 176d3b41d09..e2aeae3f357 100644 --- a/src/image.c +++ b/src/image.c @@ -7484,8 +7484,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ /* Handle image index for image types who can contain more than one image. Interface :index is same as for GIF. First we "ping" the image to see how many sub-images it contains. Pinging is faster - than loading the image to find out things about it. - */ + than loading the image to find out things about it. */ printf("im ping file %s\n", filename); image = image_spec_value (img->spec, QCindex, NULL); ino = INTEGERP (image) ? XFASTINT (image) : 0; @@ -7516,8 +7515,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ DestroyMagickWand (ping_wand); /* Now, after pinging, we know how many images are inside the - file. If its not a bundle, just one. - */ + file. If its not a bundle, just one. */ if (filename != NULL) { @@ -7545,7 +7543,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ /* If width and/or height is set in the display spec assume we want to scale to those values. if either h or w is unspecified, the unspecified should be calculated from the specified to preserve - aspect ratio. */ + aspect ratio. */ value = image_spec_value (img->spec, QCwidth, NULL); desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); @@ -7557,12 +7555,12 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ if(desired_width != -1 && desired_height == -1) { - /* w known, calculate h*/ + /* w known, calculate h. */ desired_height = ( (double)desired_width / width ) * height; } if(desired_width == -1 && desired_height != -1) { - /* h known, calculate w*/ + /* h known, calculate w. */ desired_width = ( (double)desired_height / height ) * width; } if(desired_width != -1 && desired_height != -1) @@ -7587,8 +7585,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ crop function in ImageMagick. This crop function seems to do less copying than the alternatives, but it still reads the entire image into memory before croping, which is aparently - difficult to avoid when using imagemagick. - */ + difficult to avoid when using imagemagick. */ int w,h,x,y; w=XFASTINT(XCAR(crop)); @@ -7604,8 +7601,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ /* TODO background handling for rotation specified_bg = image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP - (specified_bg) - */ + (specified_bg). */ value = image_spec_value (img->spec, QCrotation, NULL); if (FLOATP (value)) { @@ -7625,8 +7621,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ } /* Finaly we are done manipulating the image, figure out resulting - width, height, and then transfer ownerwship to Emacs. - */ + width, height, and then transfer ownerwship to Emacs. */ height = MagickGetImageHeight (image_wand); width = MagickGetImageWidth (image_wand); if (status == MagickFalse) @@ -7643,7 +7638,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ /* We can now get a valid pixel buffer from the imagemagick file, if all went ok. */ - init_color_table (); imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type) @@ -7660,8 +7654,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ /* Copy imagegmagick image to x with primitive yet robust pixel pusher loop. This has been tested a lot with many different - images. - */ + images. */ /* Copy pixels from the imagemagick image structure to the x image map. */ iterator = NewPixelIterator (image_wand); From 4b9c0a498d25344ac6da4e67375f853e438a102a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Aug 2010 11:37:40 +0200 Subject: [PATCH 043/101] * lisp/simple.el (blink-matching-open): Obey forward-sexp-function. --- lisp/ChangeLog | 4 ++++ lisp/simple.el | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ce5baa1b1a1..0d8c1304e6c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-19 Stefan Monnier + + * simple.el (blink-matching-open): Obey forward-sexp-function. + 2010-08-18 Stefan Monnier * simple.el (prog-mode-map): New var. diff --git a/lisp/simple.el b/lisp/simple.el index 7c941fd63b9..b998eef88a0 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5495,7 +5495,9 @@ it skips the contents of comments that end before point." (and parse-sexp-ignore-comments (not blink-matching-paren-dont-ignore-comments)))) (condition-case () - (scan-sexps oldpos -1) + (progn + (forward-sexp -1) + (point)) (error nil)))))) (matching-paren (and blinkpos From 186e86dbac28ca3bd9aa23cb6c8123f2b5ff919a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Aug 2010 16:37:31 +0200 Subject: [PATCH 044/101] * lisp/subr.el (read-key): Don't hide the menu-bar entries. Fixes: debbugs:6881 --- lisp/ChangeLog | 20 +++++++++++--------- lisp/subr.el | 7 ++++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 578f5e4fb49..83578620420 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,11 @@ +2010-08-19 Stefan Monnier + + * subr.el (read-key): Don't hide the menu-bar entries (bug#6881). + 2010-08-18 Michael Albinus - * progmodes/flymake.el (flymake-start-syntax-check-process): Use - `start-file-process' in order to let it run also on remote hosts. + * progmodes/flymake.el (flymake-start-syntax-check-process): + Use `start-file-process' in order to let it run also on remote hosts. 2010-08-18 Kenichi Handa @@ -41,10 +45,8 @@ 2010-08-06 Kenichi Handa - * international/mule.el (define-charset): Store NAME as :base - property. - (ctext-non-standard-encodings-table): Pay attention to charset - aliases. + * international/mule.el (define-charset): Store NAME as :base property. + (ctext-non-standard-encodings-table): Pay attention to charset aliases. (ctext-pre-write-conversion): Sort ctext-standard-encodings by the current priority. Force using the designation of the specific charset by adding `charset' text property. Improve the whole @@ -61,12 +63,12 @@ * language/cyrillic.el: Don't add "microsoft-cp1251" to ctext-non-standard-encodings-alist here. - * international/mule.el (ctext-non-standard-encodings-alist): Add - "koi8-r" and "microsoft-cp1251". + * international/mule.el (ctext-non-standard-encodings-alist): + Add "koi8-r" and "microsoft-cp1251". (ctext-standard-encodings): New variable. (ctext-non-standard-encodings-table): List only elements for non-standard encodings. - (ctext-pre-write-conversion): Adjusted for the above change. + (ctext-pre-write-conversion): Adjust for the above change. Check ctext-standard-encodings. * international/mule-conf.el (compound-text): Doc fix. diff --git a/lisp/subr.el b/lisp/subr.el index 44ae84ab76b..ad939dc6bb4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1842,7 +1842,12 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." (throw 'read-key keys))))))) (unwind-protect (progn - (use-global-map read-key-empty-map) + (use-global-map + (let ((map (make-sparse-keymap))) + ;; Don't hide the menu-bar and tool-bar entries. + (define-key map [menu-bar] (lookup-key global-map [menu-bar])) + (define-key map [tool-bar] (lookup-key global-map [tool-bar])) + map)) (aref (catch 'read-key (read-key-sequence-vector prompt nil t)) 0)) (cancel-timer timer) (use-global-map old-global-map)))) From 20d60baf356016231980a55673950dcdbc512b37 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Thu, 19 Aug 2010 22:51:09 +0800 Subject: [PATCH 045/101] (w32_wnd_proc): Don't check context before initializing. --- src/ChangeLog | 4 ++++ src/w32fns.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0a1a268d962..649964178d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-08-19 Jason Rumney + + * w32fns.c (w32_wnd_proc): Don't check context before initializing. + 2010-08-19 Jan Djärv * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary". diff --git a/src/w32fns.c b/src/w32fns.c index 64d0d8cb6d1..f91ad948828 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -3109,9 +3109,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) HIMC context; struct window *w; - if (!context) - break; - f = x_window_to_frame (dpyinfo, hwnd); w = XWINDOW (FRAME_SELECTED_WINDOW (f)); @@ -3129,6 +3126,10 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) - WINDOW_MODE_LINE_HEIGHT (w)); context = get_ime_context_fn (hwnd); + + if (!context) + break; + set_ime_composition_window_fn (context, &form); release_ime_context_fn (hwnd, context); } From a2e5caf79e75361fb4d7e096e782398299ad1083 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Aug 2010 17:43:45 +0200 Subject: [PATCH 046/101] New post-self-insert-hook. * src/cmds.c (Vself_insert_face, Vself_insert_face_command): Remove. (Qpost_self_insert_hook, Vpost_self_insert_hook): New vars. (internal_self_insert): Run post-self-insert-hook rather than handle self-insert-face. (syms_of_cmds): Initialize the new vars. * lisp/facemenu.el (facemenu-self-insert-data): New var. (facemenu-post-self-insert-function, facemenu-set-self-insert-face): New funs. (facemenu-add-face): Use them. --- etc/NEWS | 2 + lisp/ChangeLog | 5 +++ lisp/facemenu.el | 105 +++++++++++++++++++++++++++-------------------- src/ChangeLog | 8 ++++ src/cmds.c | 41 +++++++----------- 5 files changed, 90 insertions(+), 71 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index fe111ad7038..0df0d20dbac 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -453,6 +453,8 @@ has now been removed. * Lisp changes in Emacs 24.1 +** New hook post-self-insert-hook run at the end of self-insert-command. + ** Syntax tables support a new "comment style c" additionally to style b. ** frame-local variables cannot be let-bound any more. ** prog-mode is a new major-mode meant to be the parent of programming mode. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0d8c1304e6c..62d61759aa7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2010-08-19 Stefan Monnier + * facemenu.el (facemenu-self-insert-data): New var. + (facemenu-post-self-insert-function, facemenu-set-self-insert-face): + New functions. + (facemenu-add-face): Use them. + * simple.el (blink-matching-open): Obey forward-sexp-function. 2010-08-18 Stefan Monnier diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 20b86676ea9..992c6418d45 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -699,6 +699,22 @@ determine the correct answer." (cond ((equal a b) t) ((equal (color-values a) (color-values b))))) + +(defvar facemenu-self-insert-data nil) + +(defun facemenu-post-self-insert-function () + (when (and (car facemenu-self-insert-data) + (eq last-command (cdr facemenu-self-insert-data))) + (put-text-property (1- (point)) (point) + 'face (car facemenu-self-insert-data)) + (setq facemenu-self-insert-data nil)) + (remove-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) + +(defun facemenu-set-self-insert-face (face) + "Arrange for the next self-inserted char to have face `face'." + (setq facemenu-self-insert-data (cons face this-command)) + (add-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) + (defun facemenu-add-face (face &optional start end) "Add FACE to text between START and END. If START is nil or START to END is empty, add FACE to next typed character @@ -712,51 +728,52 @@ As a special case, if FACE is `default', then the region is left with NO face text property. Otherwise, selecting the default face would not have any effect. See `facemenu-remove-face-function'." (interactive "*xFace: \nr") - (if (and (eq face 'default) - (not (eq facemenu-remove-face-function t))) - (if facemenu-remove-face-function - (funcall facemenu-remove-face-function start end) - (if (and start (< start end)) - (remove-text-properties start end '(face default)) - (setq self-insert-face 'default - self-insert-face-command this-command))) - (if facemenu-add-face-function - (save-excursion - (if end (goto-char end)) - (save-excursion - (if start (goto-char start)) - (insert-before-markers - (funcall facemenu-add-face-function face end))) - (if facemenu-end-add-face - (insert (if (stringp facemenu-end-add-face) - facemenu-end-add-face - (funcall facemenu-end-add-face face))))) + (cond + ((and (eq face 'default) + (not (eq facemenu-remove-face-function t))) + (if facemenu-remove-face-function + (funcall facemenu-remove-face-function start end) (if (and start (< start end)) - (let ((part-start start) part-end) - (while (not (= part-start end)) - (setq part-end (next-single-property-change part-start 'face - nil end)) - (let ((prev (get-text-property part-start 'face))) - (put-text-property part-start part-end 'face - (if (null prev) - face - (facemenu-active-faces - (cons face - (if (listp prev) - prev - (list prev))) - ;; Specify the selected frame - ;; because nil would mean to use - ;; the new-frame default settings, - ;; and those are usually nil. - (selected-frame))))) - (setq part-start part-end))) - (setq self-insert-face (if (eq last-command self-insert-face-command) - (cons face (if (listp self-insert-face) - self-insert-face - (list self-insert-face))) - face) - self-insert-face-command this-command)))) + (remove-text-properties start end '(face default)) + (facemenu-set-self-insert-face 'default)))) + (facemenu-add-face-function + (save-excursion + (if end (goto-char end)) + (save-excursion + (if start (goto-char start)) + (insert-before-markers + (funcall facemenu-add-face-function face end))) + (if facemenu-end-add-face + (insert (if (stringp facemenu-end-add-face) + facemenu-end-add-face + (funcall facemenu-end-add-face face)))))) + ((and start (< start end)) + (let ((part-start start) part-end) + (while (not (= part-start end)) + (setq part-end (next-single-property-change part-start 'face + nil end)) + (let ((prev (get-text-property part-start 'face))) + (put-text-property part-start part-end 'face + (if (null prev) + face + (facemenu-active-faces + (cons face + (if (listp prev) + prev + (list prev))) + ;; Specify the selected frame + ;; because nil would mean to use + ;; the new-frame default settings, + ;; and those are usually nil. + (selected-frame))))) + (setq part-start part-end)))) + (t + (facemenu-set-self-insert-face + (if (eq last-command (cdr facemenu-self-insert-data)) + (cons face (if (listp (car facemenu-self-insert-data)) + (car facemenu-self-insert-data) + (list (car facemenu-self-insert-data)))) + face)))) (unless (facemenu-enable-faces-p) (message "Font-lock mode will override any faces you set in this buffer"))) diff --git a/src/ChangeLog b/src/ChangeLog index 649964178d5..96d5c774339 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-08-19 Stefan Monnier + + * cmds.c (Vself_insert_face, Vself_insert_face_command): Remove. + (Qpost_self_insert_hook, Vpost_self_insert_hook): New vars. + (internal_self_insert): Run Qpost_self_insert_hook rather than handle + self-insert-face. + (syms_of_cmds): Initialize the new vars. + 2010-08-19 Jason Rumney * w32fns.c (w32_wnd_proc): Don't check context before initializing. diff --git a/src/cmds.c b/src/cmds.c index 4cb6ca199e7..f306ede7ca5 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -37,12 +37,6 @@ Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function; /* A possible value for a buffer's overwrite-mode variable. */ Lisp_Object Qoverwrite_mode_binary; -/* Non-nil means put this face on the next self-inserting character. */ -Lisp_Object Vself_insert_face; - -/* This is the command that set up Vself_insert_face. */ -Lisp_Object Vself_insert_face_command; - static int internal_self_insert (int, int); DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, @@ -346,6 +340,7 @@ After insertion, the value of `auto-fill-function' is called if the A value of 2 means this did things that call for an undo boundary. */ static Lisp_Object Qexpand_abbrev; +static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook; static int internal_self_insert (int c, int noautofill) @@ -451,10 +446,10 @@ internal_self_insert (int c, int noautofill) && synt != Sword && NILP (current_buffer->read_only) && PT > BEGV - && (!NILP (current_buffer->enable_multibyte_characters) - ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword - : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) - == Sword))) + && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters) + ? XFASTINT (Fprevious_char ()) + : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) + == Sword)) { int modiff = MODIFF; Lisp_Object sym; @@ -514,15 +509,6 @@ internal_self_insert (int c, int noautofill) hairy = 2; } - /* If previous command specified a face to use, use it. */ - if (!NILP (Vself_insert_face) - && EQ (current_kboard->Vlast_command, Vself_insert_face_command)) - { - Fput_text_property (make_number (PT - 1), make_number (PT), - Qface, Vself_insert_face, Qnil); - Vself_insert_face = Qnil; - } - if ((synt == Sclose || synt == Smath) && !NILP (Vblink_paren_function) && INTERACTIVE && !noautofill) @@ -530,6 +516,9 @@ internal_self_insert (int c, int noautofill) call0 (Vblink_paren_function); hairy = 2; } + /* Run hooks for electric keys. */ + call1 (Vrun_hooks, Qpost_self_insert_hook); + return hairy; } @@ -550,15 +539,13 @@ syms_of_cmds (void) Qexpand_abbrev = intern_c_string ("expand-abbrev"); staticpro (&Qexpand_abbrev); - DEFVAR_LISP ("self-insert-face", &Vself_insert_face, - doc: /* If non-nil, set the face of the next self-inserting character to this. -See also `self-insert-face-command'. */); - Vself_insert_face = Qnil; + Qpost_self_insert_hook = intern_c_string ("post-self-insert-hook"); + staticpro (&Qpost_self_insert_hook); - DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command, - doc: /* This is the command that set up `self-insert-face'. -If `last-command' does not equal this value, we ignore `self-insert-face'. */); - Vself_insert_face_command = Qnil; + DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook, + doc: /* Hook run at the end of `self-insert-command'. +This run is run after inserting the charater. */); + Vpost_self_insert_hook = Qnil; DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, doc: /* Function called, if non-nil, whenever a close parenthesis is inserted. From cc477da7cce7f574fcb86eeb356ae63465f0e7ca Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Thu, 19 Aug 2010 23:53:08 +0800 Subject: [PATCH 047/101] (set_frame_menubar): Remove call to undefined function. --- src/ChangeLog | 2 ++ src/w32menu.c | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 96d5c774339..df0b500c485 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,8 @@ 2010-08-19 Jason Rumney + * w32menu.c (set_frame_menubar): Remove call to undefined function. + * w32fns.c (w32_wnd_proc): Don't check context before initializing. 2010-08-19 Jan Djärv diff --git a/src/w32menu.c b/src/w32menu.c index 1146843bec8..0ed9bffe70c 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -420,12 +420,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) set_buffer_internal_1 (XBUFFER (buffer)); - /* Run the Lucid hook. */ + /* Run the hooks. */ safe_run_hooks (Qactivate_menubar_hook); - /* If it has changed current-menubar from previous value, - really recompute the menubar from the value. */ - if (! NILP (Vlucid_menu_bar_dirty_flag)) - call0 (Qrecompute_lucid_menubar); safe_run_hooks (Qmenu_bar_update_hook); FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); From 926cd98cf11c307a3cce8c4fd963e1af719acd8d Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 19 Aug 2010 18:38:41 +0200 Subject: [PATCH 048/101] nt/addpm.c (add_registry): Create App Paths of type REG_EXPAND_SZ. --- nt/ChangeLog | 4 ++++ nt/addpm.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nt/ChangeLog b/nt/ChangeLog index 07550e1b2d2..05f01767bd3 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2010-08-19 Juanma Barranquero + + * addpm.c (add_registry): Create App Paths of type REG_EXPAND_SZ. + 2010-08-12 Jason Rumney * addpm.c (add_registry): Set path for runemacs.exe to use. diff --git a/nt/addpm.c b/nt/addpm.c index 4fcebe2ca14..de09fd5382c 100644 --- a/nt/addpm.c +++ b/nt/addpm.c @@ -113,7 +113,7 @@ add_registry (char *path) emacs_path = (char *) alloca (len); sprintf (emacs_path, "%s\\bin\\emacs.exe", path); - RegSetValueEx (hrootkey, NULL, 0, REG_SZ, emacs_path, len); + RegSetValueEx (hrootkey, NULL, 0, REG_EXPAND_SZ, emacs_path, len); /* Look for a GTK installation. If found, add it to the library search path for Emacs so that the image libraries it provides are available @@ -135,7 +135,8 @@ add_registry (char *path) len = strlen (path) + 5 + size; dll_paths = (char *) alloca (size + strlen (path) + 1); sprintf (dll_paths, "%s\\bin;%s", path, gtk_path); - RegSetValueEx (hrootkey, "Path", 0, REG_SZ, dll_paths, len); + RegSetValueEx (hrootkey, "Path", 0, REG_EXPAND_SZ, + dll_paths, len); /* Set the same path for runemacs.exe, as the Explorer shell looks this up, so the above does not take effect when @@ -145,7 +146,7 @@ add_registry (char *path) KEY_WRITE, NULL, &runemacs_key, NULL) == ERROR_SUCCESS) { - RegSetValueEx (runemacs_key, "Path", 0, REG_SZ, + RegSetValueEx (runemacs_key, "Path", 0, REG_EXPAND_SZ, dll_paths, len); RegCloseKey (runemacs_key); From 118cf45490e054aa813300e101650021b63cbb93 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Aug 2010 23:21:21 +0200 Subject: [PATCH 049/101] * lisp/files.el (locate-file-completion-table): Only list the .el and .elc extensions if there's no other choice. Fixes: debbugs:5955 --- lisp/ChangeLog | 3 +++ lisp/files.el | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 62d61759aa7..ced3cf2dfa4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-08-19 Stefan Monnier + * files.el (locate-file-completion-table): Only list the .el and .elc + extensions if there's no other choice (bug#5955). + * facemenu.el (facemenu-self-insert-data): New var. (facemenu-post-self-insert-function, facemenu-set-self-insert-face): New functions. diff --git a/lisp/files.el b/lisp/files.el index 8b131e04ebc..9a07509ed8b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -757,21 +757,44 @@ one or more of those symbols." (let ((x (file-name-directory suffix))) (if x (1- (length x)) (length suffix)))))) (t - (let ((names nil) + (let ((names '()) + ;; If we have files like "foo.el" and "foo.elc", we could load one of + ;; them with "foo.el", "foo.elc", or "foo", where just "foo" is the + ;; preferred way. So if we list all 3, that gives a lot of redundant + ;; entries for the poor soul looking just for "foo". OTOH, sometimes + ;; the user does want to pay attention to the extension. We try to + ;; diffuse this tension by stripping the suffix, except when the + ;; result is a single element (i.e. usually we only list "foo" unless + ;; it's the only remaining element in the list, in which case we do + ;; list "foo", "foo.elc" and "foo.el"). + (fullnames '()) (suffix (concat (regexp-opt suffixes t) "\\'")) (string-dir (file-name-directory string)) (string-file (file-name-nondirectory string))) (dolist (dir dirs) - (unless dir - (setq dir default-directory)) - (if string-dir (setq dir (expand-file-name string-dir dir))) - (when (file-directory-p dir) - (dolist (file (file-name-all-completions - string-file dir)) - (push file names) - (when (string-match suffix file) - (setq file (substring file 0 (match-beginning 0))) - (push file names))))) + (unless dir + (setq dir default-directory)) + (if string-dir (setq dir (expand-file-name string-dir dir))) + (when (file-directory-p dir) + (dolist (file (file-name-all-completions + string-file dir)) + (if (not (string-match suffix file)) + (push file names) + (push file fullnames) + (push (substring file 0 (match-beginning 0)) names))))) + ;; Switching from names to names+fullnames creates a non-monotonicity + ;; which can cause problems with things like partial-completion. + ;; To minimize the problem, filter out completion-regexp-list, so that + ;; M-x load-library RET t/x.e TAB finds some files. + (if completion-regexp-list + (setq names (all-completions "" names))) + ;; Remove duplicates of the first element, so that we can easily check + ;; if `names' really only contains a single element. + (when (cdr names) (setcdr names (delete (car names) (cdr names)))) + (unless (cdr names) + ;; There's no more than one matching non-suffixed element, so expand + ;; the list by adding the suffixed elements as well. + (setq names (nconc names fullnames))) (completion-table-with-context string-dir names string-file pred action))))) From 96b1842de8277af1c53c645935dde26d9fd718cd Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 19 Aug 2010 19:23:13 -0400 Subject: [PATCH 050/101] * objects.texi (Bool-Vector Type): Minor definition tweak (Bug#6878). --- doc/lispref/ChangeLog | 4 ++++ doc/lispref/objects.texi | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 4559864c23f..9379301ea4a 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2010-08-19 Chong Yidong + + * objects.texi (Bool-Vector Type): Minor definition tweak (Bug#6878). + 2010-08-02 Christoph * control.texi (Handling Errors) : Fix arg name. diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 5c3ac13cdaf..c8ccb15a2d3 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -1189,8 +1189,8 @@ Syntax tables (@pxref{Syntax Tables}). @node Bool-Vector Type @subsection Bool-Vector Type - A @dfn{bool-vector} is a one-dimensional array of elements that -must be @code{t} or @code{nil}. + A @dfn{bool-vector} is a one-dimensional array whose elements must +be @code{t} or @code{nil}. The printed representation of a bool-vector is like a string, except that it begins with @samp{#&} followed by the length. The string From fb89a65490016bfb747b80a6967dc619944ef945 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 20 Aug 2010 00:11:35 -0700 Subject: [PATCH 051/101] Fix rmail-forward with non-sendmail sending function. * lisp/mail/rmail.el (rmail-forward): Replace mail-text-start with its expansion, so as not to need sendmail. (mail-text-start): Remove declaration. (rmail-retry-failure): Require sendmail. --- lisp/ChangeLog | 7 +++++++ lisp/mail/rmail.el | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 83578620420..c104d38cdfd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2010-08-20 Glenn Morris + + * mail/rmail.el (rmail-forward): Replace mail-text-start with its + expansion, so as not to need sendmail. + (mail-text-start): Remove declaration. + (rmail-retry-failure): Require sendmail. + 2010-08-19 Stefan Monnier * subr.el (read-key): Don't hide the menu-bar entries (bug#6881). diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index fbf5c534a28..fa0b7bef207 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -191,8 +191,6 @@ please report it with \\[report-emacs-bug].") :group 'rmail-retrieve :type '(repeat (directory))) -(declare-function mail-position-on-field "sendmail" (field &optional soft)) -(declare-function mail-text-start "sendmail" ()) (declare-function rmail-dont-reply-to "mail-utils" (destinations)) (declare-function rmail-update-summary "rmailsum" (&rest ignore)) @@ -1643,8 +1641,6 @@ The duplicate copy goes into the Rmail file just after the original." (declare-function rmail-summary-mark-deleted "rmailsum" (&optional n undel)) (declare-function rfc822-addresses "rfc822" (header-text)) (declare-function mail-abbrev-make-syntax-table "mailabbrev.el" ()) -(declare-function mail-sendmail-delimit-header "sendmail" ()) -(declare-function mail-header-end "sendmail" ()) ;; RLK feature not added in this version: ;; argument specifies inbox file or files in various ways. @@ -3686,7 +3682,8 @@ see the documentation of `rmail-resend'." ;; The mail buffer is now current. (save-excursion ;; Insert after header separator--before signature if any. - (goto-char (mail-text-start)) + (rfc822-goto-eoh) + (forward-line 1) (if (or rmail-enable-mime rmail-enable-mime-composing) (funcall rmail-insert-mime-forwarded-message-function forward-buffer) @@ -3841,6 +3838,10 @@ The message should be narrowed to just the headers." (1- (point)) (point-max))))))) +(declare-function mail-sendmail-delimit-header "sendmail" ()) +(declare-function mail-header-end "sendmail" ()) +(declare-function mail-position-on-field "sendmail" (field &optional soft)) + (defun rmail-retry-failure () "Edit a mail message which is based on the contents of the current message. For a message rejected by the mail system, extract the interesting headers and @@ -3932,6 +3933,8 @@ specifying headers which should not be copied into the new message." (goto-char (point-min)) (if bounce-indent (indent-rigidly (point-min) (point-max) bounce-indent)) + ;; FIXME better to replace sendmail functions. + (require 'sendmail) (mail-sendmail-delimit-header) (save-restriction (narrow-to-region (point-min) (mail-header-end)) From 9130a2d65e43df830bc987b519b46904bf111334 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 20 Aug 2010 00:33:06 -0700 Subject: [PATCH 052/101] Minor align-regexp fix. * lisp/align.el (align-regexp): Make group and spacing arguments use the interactive defaults when non-interactive. (Bug#6698) --- lisp/ChangeLog | 3 +++ lisp/align.el | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c104d38cdfd..0b9731ae904 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-08-20 Glenn Morris + * align.el (align-regexp): Make group and spacing arguments + use the interactive defaults when non-interactive. (Bug#6698) + * mail/rmail.el (rmail-forward): Replace mail-text-start with its expansion, so as not to need sendmail. (mail-text-start): Remove declaration. diff --git a/lisp/align.el b/lisp/align.el index 9d811327021..0812d362875 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -1,7 +1,7 @@ ;;; align.el --- align text to a specific column, by regexp -;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +;; 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Maintainer: FSF @@ -944,6 +944,8 @@ region, call `align-regexp' and type in that regular expression." (list (concat "\\(\\s-*\\)" (read-string "Align regexp: ")) 1 align-default-spacing nil)))) + (or group (setq group 1)) + (or spacing (setq spacing align-default-spacing)) (let ((rule (list (list nil (cons 'regexp regexp) (cons 'group (abs group)) From 7df6150a5fb544781c340240add66951a30ecb02 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 20 Aug 2010 14:02:43 +0200 Subject: [PATCH 053/101] * image.c (imagemagick_clear_image): Remove debugging output. --- src/ChangeLog | 4 ++++ src/image.c | 9 --------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index df0b500c485..c3f250aa519 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-08-20 Andreas Schwab + + * image.c (imagemagick_clear_image): Remove debugging output. + 2010-08-19 Stefan Monnier * cmds.c (Vself_insert_face, Vself_insert_face_command): Remove. diff --git a/src/image.c b/src/image.c index e2aeae3f357..ae4bf2fd937 100644 --- a/src/image.c +++ b/src/image.c @@ -7400,7 +7400,6 @@ static void imagemagick_clear_image (struct frame *f, struct image *img) { - printf("clearing imagemagick image\n"); x_clear_image (f, img); } @@ -7485,7 +7484,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ image. Interface :index is same as for GIF. First we "ping" the image to see how many sub-images it contains. Pinging is faster than loading the image to find out things about it. */ - printf("im ping file %s\n", filename); image = image_spec_value (img->spec, QCindex, NULL); ino = INTEGERP (image) ? XFASTINT (image) : 0; ping_wand=NewMagickWand(); @@ -7519,7 +7517,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ if (filename != NULL) { - printf("im read file %s\n", filename); image_info=CloneImageInfo((ImageInfo *) NULL); (void) strcpy(image_info->filename, filename); image_info -> number_scenes = 1; @@ -7529,7 +7526,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ im_image = ReadImage (image_info, exception); CatchException(exception); - printf("im wand from image\n"); image_wand = NewMagickWandFromImage(im_image); } else @@ -7565,7 +7561,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ } if(desired_width != -1 && desired_height != -1) { - printf("MagickScaleImage %d %d\n", desired_width, desired_height); status = MagickScaleImage(image_wand, desired_width, desired_height); if (status == MagickFalse) { image_error ("Imagemagick scale failed", Qnil, Qnil); @@ -7592,7 +7587,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ h=XFASTINT(XCAR(XCDR(crop))); x=XFASTINT(XCAR(XCDR(XCDR(crop)))); y=XFASTINT(XCAR(XCDR(XCDR(XCDR(crop))))); - printf("MagickCropImage(image_wand, %d,%d, %d,%d)\n", w, h, x, y); MagickCropImage(image_wand, w,h, x,y); } @@ -7609,7 +7603,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/ rotation = extract_float (value); - printf ("MagickRotateImage %f\n", rotation); status = MagickRotateImage (image_wand, background, rotation); DestroyPixelWand (background); @@ -7691,7 +7684,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ /* Try to create a x pixmap to hold the imagemagick pixmap. */ - printf("imagedepth:%d exportdepth:%s\n", imagedepth, exportdepth); if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, &ximg, &img->pixmap)){ image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); @@ -7758,7 +7750,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */ imagemagick_error: /* TODO more cleanup. */ image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); - printf("Imagemagick error, see *Messages*\n"); return 0; } From 2396cbba625bc61b38be5b0be9d4c69e93de50f4 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 20 Aug 2010 17:19:39 +0300 Subject: [PATCH 054/101] Fix mouse clicks, drag, and highlight in R2L lines. dispnew.c (buffer_posn_from_coords): Fix calculation of buffer position for R2L lines by mirroring the pixel position wrt the text are box. Improve commentary. --- src/ChangeLog | 6 ++++++ src/dispnew.c | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c3f250aa519..d6b1c2347a2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-08-20 Eli Zaretskii + + * dispnew.c (buffer_posn_from_coords): Fix calculation of buffer + position for R2L lines by mirroring the pixel position wrt the + text are box. Improve commentary. + 2010-08-20 Andreas Schwab * image.c (imagemagick_clear_image): Remove debugging output. diff --git a/src/dispnew.c b/src/dispnew.c index 35893872c73..efcfd101782 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5351,9 +5351,15 @@ update_frame_line (struct frame *f, int vpos) ***********************************************************************/ /* Determine what's under window-relative pixel position (*X, *Y). - Return the object (string or buffer) that's there. + Return the OBJECT (string or buffer) that's there. Return in *POS the position in that object. - Adjust *X and *Y to character positions. */ + Adjust *X and *Y to character positions. + Return in *DX and *DY the pixel coordinates of the click, + relative to the top left corner of OBJECT, or relative to + the top left corner of the character glyph at (*X, *Y) + if OBJECT is nil. + Return WIDTH and HEIGHT of the object at (*X, *Y), or zero + if the coordinates point to an empty area of the display. */ Lisp_Object buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) @@ -5366,7 +5372,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p #ifdef HAVE_WINDOW_SYSTEM struct image *img = 0; #endif - int x0, x1; + int x0, x1, to_x; /* We used to set current_buffer directly here, but that does the wrong thing with `face-remapping-alist' (bug#2044). */ @@ -5377,8 +5383,29 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p start_display (&it, w, startp); x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); - move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1, - MOVE_TO_X | MOVE_TO_Y); + + /* First, move to the beginning of the row corresponding to *Y. We + need to be in that row to get the correct value of base paragraph + direction for the paragraph at *X. */ + move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y); + + /* TO_X is the pixel position that the iterator will compute for the + glyph at *X. This is because iterator positions are not offset + due to hscroll. */ + to_x = x0 + it.first_visible_x; + if (it.bidi_it.paragraph_dir == R2L) + /* For lines in an R2L paragraph, we need to mirror TO_X wrt the + text area. This is because the iterator, even in R2L + paragraphs, delivers glyphs as if they started at the left + margin of the window. (When we actually produce glyphs for + display, we reverse their order in PRODUCE_GLYPHS, but the + iterator doesn't know about that.) The following line adjusts + the pixel position to the iterator geometry, which is what + move_it_* routines use. */ + to_x = window_box_width (w, TEXT_AREA) - to_x; + + /* Now move horizontally in the row to the glyph under *X. */ + move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); Fset_buffer (old_current_buffer); From c30b8a12a4a57bfe070dd68b014d7d425bab8ed9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 20 Aug 2010 17:31:38 +0300 Subject: [PATCH 055/101] xdisp.c: Add commentary about iterator geometry in R2L paragraphs. --- src/xdisp.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index d730387a51b..c80e1f35df3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -217,7 +217,26 @@ along with GNU Emacs. If not, see . */ glyph with suitably computed width. Both the blanks and the stretch glyph are given the face of the background of the line. This way, the terminal-specific back-end can still draw the glyphs - left to right, even for R2L lines. */ + left to right, even for R2L lines. + + Note one important detail mentioned above: that the bidi reordering + engine, driven by the iterator, produces characters in R2L rows + starting at the character that will be the rightmost on display. + As far as the iterator is concerned, the geometry of such rows is + still left to right, i.e. the iterator "thinks" the first character + is at the leftmost pixel position. The iterator does not know that + PRODUCE_GLYPHS reverses the order of the glyphs that the iterator + delivers. This is important when functions from the the move_it_* + family are used to get to certain screen position or to match + screen coordinates with buffer coordinates: these functions use the + iterator geometry, which is left to right even in R2L paragraphs. + This works well with most callers of move_it_*, because they need + to get to a specific column, and columns are still numbered in the + reading order, i.e. the rightmost character in a R2L paragraph is + still column zero. But some callers do not get well with this; a + notable example is mouse clicks that need to find the character + that corresponds to certain pixel coordinates. See + buffer_posn_from_coords in dispnew.c for how this is handled. */ #include #include From 491a154635caf0bf90fd1c4ad35f02d43eac98ee Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 20 Aug 2010 22:45:24 +0300 Subject: [PATCH 056/101] Fix version string in top-level MSDOS Makefile. msods/mainmake.v2 (version): Update due to change in emacs.c. src/emacs.c : Add a comment regarding msdos/mainmake.v2's dependency on the syntax of this declaration. --- msdos/ChangeLog | 4 ++++ msdos/mainmake.v2 | 2 +- src/ChangeLog | 5 +++++ src/emacs.c | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 7df89880410..7227b8b8b51 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,7 @@ +2010-08-15 Eli Zaretskii + + * mainmake.v2 (version): Update due to change in emacs.c. + 2010-08-05 Eli Zaretskii * sed1v2.inp (UNEXEC_OBJ): Edit to unexcoff.o, due to renaming of diff --git a/msdos/mainmake.v2 b/msdos/mainmake.v2 index 4bb13e367ed..79bd827d8c6 100644 --- a/msdos/mainmake.v2 +++ b/msdos/mainmake.v2 @@ -65,7 +65,7 @@ MAKESHELL=/xyzzy/command top_srcdir := $(subst \,/,$(shell cd)) # Find out which version of Emacs this is. -version := ${shell sed -n -e '/^const char emacs_version/s/^[^"]*\("[^"]*"\).*/\1/p' src/emacs.c} +version := ${shell sed -n -e '/^static const char emacs_version/s/^[^"]*\("[^"]*"\).*/\1/p' src/emacs.c} # Q: Do we need to bootstrap? # A: Only if we find admin/admin.el, i.e. we are building out of diff --git a/src/ChangeLog b/src/ChangeLog index 024cf18efb6..24754355fdc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-15 Eli Zaretskii + + * emacs.c : Add a comment regarding + msdos/mainmake.v2's dependency on the syntax of this declaration. + 2010-08-13 Eli Zaretskii * unexcoff.c: Remove the parts used when "emacs" is not defined. diff --git a/src/emacs.c b/src/emacs.c index 026a210af50..67a99d674e7 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -91,6 +91,8 @@ along with GNU Emacs. If not, see . */ #endif #endif +/* If you change the following line, remember to update + msdos/mainmake.v2 which gleans the Emacs version from it! */ static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; static const char emacs_version[] = "24.0.50"; From ccd806186417c006a97ac89162d2af3acb3d3047 Mon Sep 17 00:00:00 2001 From: Joakim Verona Date: Fri, 20 Aug 2010 21:55:21 +0200 Subject: [PATCH 057/101] minor imagemagick tweaks, one configure bugfix, and some ChangeLogs --- ChangeLog | 19 ++++--------------- configure | 2 +- configure.in | 2 +- lisp/ChangeLog | 11 +++++++++++ src/ChangeLog | 11 +++++++++++ 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2d707300ad..5a8408316ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-18 Joakim Verona + + * config.in, Makefile.in, configure.in: Checks for ImageMagick. + 2010-08-10 Dan Nicolaescu * configure.in (AC_PREREQ): Require autoconf 2.65. @@ -139,21 +143,6 @@ * Makefile.in (install-arch-indep): Delete any old info .gz files first. -2010-06-12 Joakim Verona - - * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is - defined: - (imagemagick_image_p): New function to test for ImageMagic img. - (imagemagick_load): New function to load ImageMagick img. - (imagemagick_load_image): New function, helper for imagemagick_load - (imagemagick-types): New function. - (Qimagemagick): New Lisp_object. - (imagemagick-render-type): New var, decides which renderer to use - * image.el: - (imagemagick-types-inhibit): New var. - (imagemagick-register-types): New function. - * config.in, Makefile.in, configure.in - 2010-06-11 Glenn Morris * configure.in (--without-compress-info): New option. diff --git a/configure b/configure index b9f9337c6e2..9354afe1ee5 100755 --- a/configure +++ b/configure @@ -8726,7 +8726,7 @@ $as_echo "#define HAVE_IMAGEMAGICK 1" >>confdefs.h fi -$as_echo "#define HAVE_MAGICKEXPORTIMAGEPIXELS 1" >>confdefs.h +$as_echo "#define HAVE_MAGICKEXPORTIMAGEPIXELS 0" >>confdefs.h diff --git a/configure.in b/configure.in index c989b0358ab..11d660cbc81 100644 --- a/configure.in +++ b/configure.in @@ -1852,7 +1852,7 @@ if test "${with_imagemagick}" != "no"; then LIBS="$IMAGEMAGICK_LIBS $LIBS" fi - AC_DEFINE(HAVE_MAGICKEXPORTIMAGEPIXELS, 1, [Define to 1 if MagickExportImagePixels is defined.]) + AC_DEFINE(HAVE_MAGICKEXPORTIMAGEPIXELS, 0, [Define to 1 if MagickExportImagePixels is defined.]) AC_CHECK_FUNCS_ONCE(MagickExportImagePixels) fi diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ce5baa1b1a1..333764d846c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -26,6 +26,17 @@ * emacs-lisp/autoload.el (make-autoload): Preload the macros's declarations that are useful before running the macro. +2010-08-18 Joakim Verona + * image.el: + (imagemagick-types-inhibit): New var. + (imagemagick-register-types): New function. + * image-mode.el: + (image-transform-properties): New function. + (image-transform-set-scale, image-transform-fit-to-height) + (image-transform-set-rotation, image-transform-set-resize) + (image-transform-fit-to-width, image-transform-fit-to-height):New functions. + (image-toggle-display-image): Support image transforms. + 2010-08-18 Katsumi Yamaoka * image.el (create-animated-image): Don't add heuristic mask to image diff --git a/src/ChangeLog b/src/ChangeLog index 0a1a268d962..5d26db96634 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -33,6 +33,17 @@ NXSecondaryPboard = SecondarySelection. (syms_of_nsselect): Intern QCLIPBOARD (Bug#6677). +2010-08-18 Joakim Verona + + * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is + defined: + (imagemagick_image_p): New function to test for ImageMagic img. + (imagemagick_load): New function to load ImageMagick img. + (imagemagick_load_image): New function, helper for imagemagick_load + (imagemagick-types): New function. + (Qimagemagick): New Lisp_object. + (imagemagick-render-type): New var, decides which renderer to use + 2010-08-17 Stefan Monnier * gtkutil.c (update_frame_tool_bar): Don't assume TOOL_BAR_ITEM_LABEL From e8a6cc19a3127188a95d407cb74d4442b04bc1db Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 20 Aug 2010 23:07:29 +0300 Subject: [PATCH 058/101] Add cross-references regarding POSITION of mouse events. commands.texi (Misc Events): Add cross-references to where POSITION of a mouse event is described in detail. --- doc/lispref/ChangeLog | 5 +++++ doc/lispref/commands.texi | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index fe64ca9d835..459bd925cf4 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2010-08-20 Eli Zaretskii + + * commands.texi (Misc Events): Add cross-references to where + POSITION of a mouse event is described in detail. + 2010-08-08 Christoph * control.texi (Handling Errors) : Fix arg name. diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index d22cfd955cb..17cfcc0def8 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -1616,7 +1616,8 @@ These kinds of event are generated by moving a mouse wheel. Their usual meaning is a kind of scroll or zoom. The element @var{position} is a list describing the position of the -event, in the same format as used in a mouse-click event. +event, in the same format as used in a mouse-click event (@pxref{Click +Events}). @vindex mouse-wheel-up-event @vindex mouse-wheel-down-event @@ -1633,9 +1634,10 @@ selected in an application outside of Emacs, and then dragged and dropped onto an Emacs frame. The element @var{position} is a list describing the position of the -event, in the same format as used in a mouse-click event, and -@var{files} is the list of file names that were dragged and dropped. -The usual way to handle this event is by visiting these files. +event, in the same format as used in a mouse-click event (@pxref{Click +Events}), and @var{files} is the list of file names that were dragged +and dropped. The usual way to handle this event is by visiting these +files. This kind of event is generated, at present, only on some kinds of systems. From 6f505bc82d1d4a9d6ebb3665db8fc7ce8128bd66 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 20 Aug 2010 23:26:12 +0300 Subject: [PATCH 059/101] Fix the MSDOS build broken by the ImageMagick support. sed1v2.inp (IMAGEMAGICK_LIBS, IMAGEMAGICK_CFLAGS): Edit to empty. --- msdos/ChangeLog | 4 ++++ msdos/sed1v2.inp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 7227b8b8b51..c4c7981e907 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,7 @@ +2010-08-20 Eli Zaretskii + + * sed1v2.inp (IMAGEMAGICK_LIBS, IMAGEMAGICK_CFLAGS): Edit to empty. + 2010-08-15 Eli Zaretskii * mainmake.v2 (version): Update due to change in emacs.c. diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp index 4be1bccefdf..e9dfc9dea3d 100644 --- a/msdos/sed1v2.inp +++ b/msdos/sed1v2.inp @@ -88,6 +88,8 @@ s/\.h\.in/.h-in/ /^CFLAGS_SOUND *=/s/@CFLAGS_SOUND@// /^RSVG_LIBS *=/s/@RSVG_LIBS@// /^RSVG_CFLAGS *=/s/@RSVG_CFLAGS@// +/^IMAGEMAGICK_LIBS *=/s/@IMAGEMAGICK_LIBS@// +/^IMAGEMAGICK_CFLAGS *=/s/@IMAGEMAGICK_CFLAGS@// /^WIDGET_OBJ *=/s/@WIDGET_OBJ@// /^CYGWIN_OBJ *=/s/@CYGWIN_OBJ@// /^MSDOS_OBJ *=/s/= */= dosfns.o msdos.o w16select.o/ From b43c883c71bc3cf494b17dde69d275c73d10942e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 20 Aug 2010 23:55:09 +0300 Subject: [PATCH 060/101] Fix last change in buffer_posn_from_coords for text terminals. dispnew.c (buffer_posn_from_coords): Add one-character offset for R2L lines. --- src/ChangeLog | 3 +++ src/dispnew.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5b44cc8f34c..2125f05b787 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-08-20 Eli Zaretskii + * dispnew.c (buffer_posn_from_coords): Fix last change for text + terminals: add one-character offset for R2L lines.. + * emacs.c : Add a comment regarding msdos/mainmake.v2's dependency on the syntax of this declaration. diff --git a/src/dispnew.c b/src/dispnew.c index efcfd101782..547ab2a4187 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5402,7 +5402,10 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p iterator doesn't know about that.) The following line adjusts the pixel position to the iterator geometry, which is what move_it_* routines use. */ - to_x = window_box_width (w, TEXT_AREA) - to_x; + to_x = window_box_width (w, TEXT_AREA) - to_x + /* Text terminals need a one-character offset to get it right. */ + - (FRAME_MSDOS_P (WINDOW_XFRAME (w)) + || FRAME_TERMCAP_P (WINDOW_XFRAME (w))); /* Now move horizontally in the row to the glyph under *X. */ move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); From d931da8c2a41b5edab90024897f7a83e4ac6940b Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Fri, 20 Aug 2010 15:36:07 -0700 Subject: [PATCH 061/101] Remove redundant HAVE_TCATTR defines. * src/s/unixware.h (HAVE_TCATTR): * src/s/aix4-2.h (HAVE_TCATTR): Remove definitions, not needed. systty.h defines it when HAVE_TERMIOS is defined. --- src/ChangeLog | 6 ++++++ src/s/aix4-2.h | 4 ---- src/s/unixware.h | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7d37142e375..19846016072 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-08-20 Dan Nicolaescu + + * s/unixware.h (HAVE_TCATTR): + * s/aix4-2.h (HAVE_TCATTR): Remove definitions, not needed. + systty.h defines it when HAVE_TERMIOS is defined. + 2010-08-20 Eli Zaretskii * dispnew.c (buffer_posn_from_coords): Fix last change for text diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index 84920f888e1..0a3d48db639 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h @@ -55,10 +55,6 @@ along with GNU Emacs. If not, see . */ /* Special items needed to make Emacs run on this system. */ -/* The following definition seems to be needed in AIX version 3.1.6.8. - It may not have been needed in certain earlier versions. */ -#define HAVE_TCATTR - /* AIX doesn't define this. */ #define unix 1 diff --git a/src/s/unixware.h b/src/s/unixware.h index ac989d48e2c..81b1b3d97fa 100644 --- a/src/s/unixware.h +++ b/src/s/unixware.h @@ -21,8 +21,6 @@ along with GNU Emacs. If not, see . */ #include "usg5-4-common.h" -/* fnf@cygnus.com says these exist. */ -#define HAVE_TCATTR /* #define HAVE_GETWD (appears to be buggy on SVR4.2) */ #undef HAVE_GETWD From f5817d1cb513506a25320349f8ef967c23187753 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Fri, 20 Aug 2010 15:44:38 -0700 Subject: [PATCH 062/101] * src/term.c: Do not include , systty.h does it. --- src/ChangeLog | 2 ++ src/term.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 19846016072..2c51aeb6ce7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-08-20 Dan Nicolaescu + * term.c: Do not include , systty.h does it. + * s/unixware.h (HAVE_TCATTR): * s/aix4-2.h (HAVE_TCATTR): Remove definitions, not needed. systty.h defines it when HAVE_TERMIOS is defined. diff --git a/src/term.c b/src/term.c index 4f326234956..d1279498060 100644 --- a/src/term.c +++ b/src/term.c @@ -31,9 +31,6 @@ along with GNU Emacs. If not, see . */ #include #endif -#if HAVE_TERMIOS_H -#include /* For TIOCNOTTY. */ -#endif #ifdef HAVE_SYS_IOCTL_H #include #endif From 748155880fc11549ab230b74e2cb2d03a4965630 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Fri, 20 Aug 2010 15:52:10 -0700 Subject: [PATCH 063/101] Small src/puresize.h cleanup. * src/puresize.h: Remove code assuming PNTR_COMPARISON_TYPE is not defined, unconditionally defined in lisp.h. --- src/ChangeLog | 3 +++ src/puresize.h | 9 --------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2c51aeb6ce7..2150e4d3fac 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-08-20 Dan Nicolaescu + * puresize.h: Remove code assuming PNTR_COMPARISON_TYPE is not + defined, unconditionally defined in lisp.h. + * term.c: Do not include , systty.h does it. * s/unixware.h (HAVE_TCATTR): diff --git a/src/puresize.h b/src/puresize.h index 682e8926135..3c7f92228a0 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -87,7 +87,6 @@ extern EMACS_INT pure[]; && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) #else /* not VIRT_ADDR_VARIES */ -#ifdef PNTR_COMPARISON_TYPE /* When PNTR_COMPARISON_TYPE is not the default (unsigned int). */ extern char my_edata[]; @@ -95,14 +94,6 @@ extern char my_edata[]; #define PURE_P(obj) \ ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata) -#else /* not VIRT_ADDRESS_VARIES, not PNTR_COMPARISON_TYPE */ - -extern char my_edata[]; - -#define PURE_P(obj) \ - (XPNTR (obj) < (unsigned int) my_edata) - -#endif /* PNTR_COMPARISON_TYPE */ #endif /* VIRT_ADDRESS_VARIES */ /* arch-tag: fd9b0a91-a70e-4729-a75a-6bb4ca1ce14f From b5c76d0c4f52f347b1c79f94aaa8e91916814673 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Fri, 20 Aug 2010 16:02:11 -0700 Subject: [PATCH 064/101] Remove unused variables malloc_sbrk_used and malloc_sbrk_unused. * src/alloc.c (malloc_sbrk_used, malloc_sbrk_unused): Remove, write only. (init_alloc_once): Remove writes to malloc_sbrk_unused, and malloc_sbrk_used, nothing uses them. --- src/ChangeLog | 5 +++++ src/alloc.c | 15 --------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2150e4d3fac..23374ba2e47 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2010-08-20 Dan Nicolaescu + * alloc.c (malloc_sbrk_used, malloc_sbrk_unused): Remove, + write only. + (init_alloc_once): Remove writes to malloc_sbrk_unused, and + malloc_sbrk_used, nothing uses them. + * puresize.h: Remove code assuming PNTR_COMPARISON_TYPE is not defined, unconditionally defined in lisp.h. diff --git a/src/alloc.c b/src/alloc.c index 473c5622ab3..1f615a7d505 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -214,16 +214,6 @@ int abort_on_gc; int garbage_collection_messages; -#ifndef VIRT_ADDR_VARIES -extern -#endif /* VIRT_ADDR_VARIES */ -int malloc_sbrk_used; - -#ifndef VIRT_ADDR_VARIES -extern -#endif /* VIRT_ADDR_VARIES */ -int malloc_sbrk_unused; - /* Number of live and free conses etc. */ static int total_conses, total_markers, total_symbols, total_vector_size; @@ -6178,11 +6168,6 @@ init_alloc_once (void) consing_since_gc = 0; gc_cons_threshold = 100000 * sizeof (Lisp_Object); gc_relative_threshold = 0; - -#ifdef VIRT_ADDR_VARIES - malloc_sbrk_unused = 1<<22; /* A large number */ - malloc_sbrk_used = 100000; /* as reasonable as any number */ -#endif /* VIRT_ADDR_VARIES */ } void From 635f7282c4e6c21b927d8f76c7e087832124dc86 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 20 Aug 2010 19:11:34 -0700 Subject: [PATCH 065/101] * lisp/menu-bar.el (menu-bar-games-menu): Add landmark. --- lisp/ChangeLog | 4 ++++ lisp/menu-bar.el | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0b9731ae904..44cc4c78616 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-21 Glenn Morris + + * menu-bar.el (menu-bar-games-menu): Add landmark. + 2010-08-20 Glenn Morris * align.el (align-regexp): Make group and spacing arguments diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d831744f311..2424647a73f 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1191,6 +1191,9 @@ mail status in mode line")) (define-key menu-bar-games-menu [life] `(menu-item ,(purecopy "Life") life :help ,(purecopy "Watch how John Conway's cellular automaton evolves"))) +(define-key menu-bar-games-menu [land] + `(menu-item ,(purecopy "Landmark") landmark + :help ,(purecopy "Watch a neural-network robot learn landmarks"))) (define-key menu-bar-games-menu [hanoi] `(menu-item ,(purecopy "Towers of Hanoi") hanoi :help ,(purecopy "Watch Towers-of-Hanoi puzzle solved by Emacs"))) From 50dd7bc6b78bfd4615fdbca94bdb3aa22e2ed92a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 20 Aug 2010 19:14:07 -0700 Subject: [PATCH 066/101] * doc/emacs/misc.texi (Amusements): Mention bubbles and animate. --- doc/emacs/ChangeLog | 4 ++++ doc/emacs/misc.texi | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 9f117210515..63de0aafc07 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2010-08-21 Glenn Morris + + * misc.texi (Amusements): Mention bubbles and animate. + 2010-06-23 Glenn Morris * abbrevs.texi, basic.texi, buffers.texi, building.texi, calendar.texi: diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 387e1be715a..029cf410664 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2784,6 +2784,10 @@ bored, try an argument of 9. Sit back and watch. If you want a little more personal involvement, try @kbd{M-x gomoku}, which plays the game Go Moku with you. +@findex bubbles + @kbd{M-x bubbles} is a game in which the object is to remove as many +bubbles as you can in the smallest number of moves. + @findex blackbox @findex mpuz @findex 5x5 @@ -2832,6 +2836,11 @@ bats. @kbd{M-x solitaire} plays a game of solitaire in which you jump pegs across other pegs. +@findex animate-birthday-present +@cindex animate +The @code{animate} package makes text dance. For an example, try +@kbd{M-x animate-birthday-present}. + @findex studlify-region @cindex StudlyCaps @kbd{M-x studlify-region} studlify-cases the region, producing From 0c9b8993e006e37d5bf48dd09d96e821fcfdcd6f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 20 Aug 2010 19:21:51 -0700 Subject: [PATCH 067/101] ChangeLog fixes. --- ChangeLog | 4 ++-- lisp/ChangeLog | 14 +++++++------- src/ChangeLog | 18 +++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a8408316ac..94b84ed1c28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ -2010-08-18 Joakim Verona +2010-08-18 Joakim Verona - * config.in, Makefile.in, configure.in: Checks for ImageMagick. + * Makefile.in, configure.in: Checks for ImageMagick. 2010-08-10 Dan Nicolaescu diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4902da03f4d..bfe106253ff 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -38,15 +38,15 @@ * emacs-lisp/autoload.el (make-autoload): Preload the macros's declarations that are useful before running the macro. -2010-08-18 Joakim Verona - * image.el: - (imagemagick-types-inhibit): New var. - (imagemagick-register-types): New function. - * image-mode.el: - (image-transform-properties): New function. +2010-08-18 Joakim Verona + + * image.el (imagemagick-types-inhibit): New variable. + (imagemagick-register-types): New function. + * image-mode.el (image-transform-properties): New function. (image-transform-set-scale, image-transform-fit-to-height) (image-transform-set-rotation, image-transform-set-resize) - (image-transform-fit-to-width, image-transform-fit-to-height):New functions. + (image-transform-fit-to-width, image-transform-fit-to-height): + New functions. (image-toggle-display-image): Support image transforms. 2010-08-18 Katsumi Yamaoka diff --git a/src/ChangeLog b/src/ChangeLog index 23374ba2e47..9b9e43864ab 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -81,16 +81,16 @@ NXSecondaryPboard = SecondarySelection. (syms_of_nsselect): Intern QCLIPBOARD (Bug#6677). -2010-08-18 Joakim Verona +2010-08-18 Joakim Verona - * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is - defined: - (imagemagick_image_p): New function to test for ImageMagic img. - (imagemagick_load): New function to load ImageMagick img. - (imagemagick_load_image): New function, helper for imagemagick_load - (imagemagick-types): New function. - (Qimagemagick): New Lisp_object. - (imagemagick-render-type): New var, decides which renderer to use + * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is + defined: + (imagemagick_image_p): New function to test for ImageMagic image. + (imagemagick_load): New function to load ImageMagick image. + (imagemagick_load_image): New function, helper for imagemagick_load. + (imagemagick-types): New function. + (Qimagemagick): New Lisp_object. + (imagemagick-render-type): New variable, decides which renderer to use. 2010-08-17 Stefan Monnier From 80525855696044e98ecb3a781f294f4b31f13558 Mon Sep 17 00:00:00 2001 From: Vinicius Jose Latorre Date: Sat, 21 Aug 2010 01:43:04 -0300 Subject: [PATCH 068/101] Fix slow cursor movement. --- lisp/ChangeLog | 19 ++++- lisp/whitespace.el | 174 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 161 insertions(+), 32 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bfe106253ff..3a38a6c031a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,20 @@ +2010-08-21 Vinicius Jose Latorre + + * whitespace.el: Fix slow cursor movement. Reported by Christoph + Groth and Liu Xin . New version + 13.0. + (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp): + Adjust initialization. + (whitespace-bob-marker, whitespace-eob-marker) + (whitespace-buffer-changed): New vars. + (whitespace-cleanup, whitespace-color-on, whitespace-color-off) + (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp) + (whitespace-post-command-hook, whitespace-display-char-on): Adjust + code. + (whitespace-looking-back, whitespace-buffer-changed): New funs. + (whitespace-space-regexp, whitespace-tab-regexp): Eliminated + funs. + 2010-08-19 Stefan Monnier * files.el (locate-file-completion-table): Only list the .el and .elc @@ -6244,7 +6261,7 @@ * ps-print.el (ps-face-attributes): It was not returning the attribute face for faces specified as string. Reported by harven - . + . (Bug#5254) (ps-print-version): New version 7.3.5. 2009-12-18 Ulf Jasper diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 79ce9a330d4..9655593893f 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -6,7 +6,7 @@ ;; Author: Vinicius Jose Latorre ;; Maintainer: Vinicius Jose Latorre ;; Keywords: data, wp -;; Version: 12.1 +;; Version: 13.0 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre ;; This file is part of GNU Emacs. @@ -812,7 +812,7 @@ Used when `whitespace-style' includes `indentation', :group 'whitespace) -(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)" +(defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)" "Specify regexp for empty lines at beginning of buffer. If you're using `mule' package, there may be other characters besides: @@ -827,7 +827,7 @@ Used when `whitespace-style' includes `empty'." :group 'whitespace) -(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)\\'" +(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)" "Specify regexp for empty lines at end of buffer. If you're using `mule' package, there may be other characters besides: @@ -1228,6 +1228,19 @@ Used by `whitespace-trailing-regexp' function (which see).") "Used to save locally the font-lock refontify state. Used by `whitespace-post-command-hook' function (which see).") +(defvar whitespace-bob-marker nil + "Used to save locally the bob marker value. +Used by `whitespace-post-command-hook' function (which see).") + +(defvar whitespace-eob-marker nil + "Used to save locally the eob marker value. +Used by `whitespace-post-command-hook' function (which see).") + +(defvar whitespace-buffer-changed nil + "Used to indicate locally if buffer changed. +Used by `whitespace-post-command-hook' and `whitespace-buffer-changed' +functions (which see).") + ;;;###autoload (defun whitespace-toggle-options (arg) @@ -1463,10 +1476,10 @@ documentation." (let (overwrite-mode) ; enforce no overwrite (goto-char (point-min)) (when (re-search-forward - whitespace-empty-at-bob-regexp nil t) + (concat "\\`" whitespace-empty-at-bob-regexp) nil t) (delete-region (match-beginning 1) (match-end 1))) (when (re-search-forward - whitespace-empty-at-eob-regexp nil t) + (concat whitespace-empty-at-eob-regexp "\\'") nil t) (delete-region (match-beginning 1) (match-end 1))))))) ;; PROBLEM 3: 8 or more SPACEs at bol ;; PROBLEM 4: SPACEs before TAB @@ -2146,8 +2159,15 @@ resultant list will be returned." (set (make-local-variable 'whitespace-point) (point)) (set (make-local-variable 'whitespace-font-lock-refontify) + 0) + (set (make-local-variable 'whitespace-bob-marker) + (point-min-marker)) + (set (make-local-variable 'whitespace-eob-marker) + (point-max-marker)) + (set (make-local-variable 'whitespace-buffer-changed) nil) (add-hook 'post-command-hook #'whitespace-post-command-hook nil t) + (add-hook 'before-change-functions #'whitespace-buffer-changed nil t) ;; turn off font lock (set (make-local-variable 'whitespace-font-lock-mode) font-lock-mode) @@ -2158,7 +2178,7 @@ resultant list will be returned." nil (list ;; Show SPACEs - (list #'whitespace-space-regexp 1 whitespace-space t) + (list whitespace-space-regexp 1 whitespace-space t) ;; Show HARD SPACEs (list whitespace-hspace-regexp 1 whitespace-hspace t)) t)) @@ -2167,7 +2187,7 @@ resultant list will be returned." nil (list ;; Show TABs - (list #'whitespace-tab-regexp 1 whitespace-tab t)) + (list whitespace-tab-regexp 1 whitespace-tab t)) t)) (when (memq 'trailing whitespace-active-style) (font-lock-add-keywords @@ -2296,7 +2316,8 @@ resultant list will be returned." ;; turn off font lock (when (whitespace-style-face-p) (font-lock-mode 0) - (remove-hook 'post-command-hook #'whitespace-post-command-hook) + (remove-hook 'post-command-hook #'whitespace-post-command-hook t) + (remove-hook 'before-change-functions #'whitespace-buffer-changed t) (when whitespace-font-lock (setq whitespace-font-lock nil font-lock-keywords whitespace-font-lock-keywords)) @@ -2317,37 +2338,128 @@ resultant list will be returned." (defun whitespace-empty-at-bob-regexp (limit) "Match spaces at beginning of buffer which do not contain the point at \ beginning of buffer." - (and (/= whitespace-point 1) - (re-search-forward whitespace-empty-at-bob-regexp limit t))) + (let ((b (point)) + r) + (cond + ;; at bob + ((= b 1) + (setq r (and (/= whitespace-point 1) + (looking-at whitespace-empty-at-bob-regexp))) + (if r + (set-marker whitespace-bob-marker (match-end 1)) + (set-marker whitespace-bob-marker b))) + ;; inside bob empty region + ((<= limit whitespace-bob-marker) + (setq r (looking-at whitespace-empty-at-bob-regexp)) + (if r + (when (< (match-end 1) limit) + (set-marker whitespace-bob-marker (match-end 1))) + (set-marker whitespace-bob-marker b))) + ;; intersection with end of bob empty region + ((<= b whitespace-bob-marker) + (setq r (looking-at whitespace-empty-at-bob-regexp)) + (if r + (set-marker whitespace-bob-marker (match-end 1)) + (set-marker whitespace-bob-marker b))) + ;; it is not inside bob empty region + (t + (setq r nil))) + ;; move to end of matching + (and r (goto-char (match-end 1))) + r)) + + +(defsubst whitespace-looking-back (regexp limit) + (save-excursion + (when (/= 0 (skip-chars-backward " \t\n" limit)) + (unless (bolp) + (forward-line 1)) + (looking-at regexp)))) (defun whitespace-empty-at-eob-regexp (limit) "Match spaces at end of buffer which do not contain the point at end of \ buffer." - (and (/= whitespace-point (1+ (buffer-size))) - (re-search-forward whitespace-empty-at-eob-regexp limit t))) + (let ((b (point)) + (e (1+ (buffer-size))) + r) + (cond + ;; at eob + ((= limit e) + (when (/= whitespace-point e) + (goto-char limit) + (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b))) + (if r + (set-marker whitespace-eob-marker (match-beginning 1)) + (set-marker whitespace-eob-marker limit) + (goto-char b))) ; return back to initial position + ;; inside eob empty region + ((>= b whitespace-eob-marker) + (goto-char limit) + (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b)) + (if r + (when (> (match-beginning 1) b) + (set-marker whitespace-eob-marker (match-beginning 1))) + (set-marker whitespace-eob-marker limit) + (goto-char b))) ; return back to initial position + ;; intersection with beginning of eob empty region + ((>= limit whitespace-eob-marker) + (goto-char limit) + (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b)) + (if r + (set-marker whitespace-eob-marker (match-beginning 1)) + (set-marker whitespace-eob-marker limit) + (goto-char b))) ; return back to initial position + ;; it is not inside eob empty region + (t + (setq r nil))) + r)) -(defun whitespace-space-regexp (limit) - "Match spaces." - (setq whitespace-font-lock-refontify t) - (re-search-forward whitespace-space-regexp limit t)) - - -(defun whitespace-tab-regexp (limit) - "Match tabs." - (setq whitespace-font-lock-refontify t) - (re-search-forward whitespace-tab-regexp limit t)) +(defun whitespace-buffer-changed (beg end) + "Set `whitespace-buffer-changed' variable to t." + (setq whitespace-buffer-changed t)) (defun whitespace-post-command-hook () "Save current point into `whitespace-point' variable. Also refontify when necessary." - (setq whitespace-point (point)) - (let ((refontify (or (eolp) ; end of line - (= whitespace-point 1)))) ; beginning of buffer - (when (or whitespace-font-lock-refontify refontify) - (setq whitespace-font-lock-refontify refontify) + (setq whitespace-point (point)) ; current point position + (let ((refontify + (or + ;; it is at end of line ... + (and (eolp) + ;; ... with trailing SPACE or TAB + (or (= (preceding-char) ?\ ) + (= (preceding-char) ?\t))) + ;; it is at beginning of buffer (bob) + (= whitespace-point 1) + ;; the buffer was modified and ... + (and whitespace-buffer-changed + (or + ;; ... or inside bob whitespace region + (<= whitespace-point whitespace-bob-marker) + ;; ... or at bob whitespace region border + (and (= whitespace-point (1+ whitespace-bob-marker)) + (= (preceding-char) ?\n)))) + ;; it is at end of buffer (eob) + (= whitespace-point (1+ (buffer-size))) + ;; the buffer was modified and ... + (and whitespace-buffer-changed + (or + ;; ... or inside eob whitespace region + (>= whitespace-point whitespace-eob-marker) + ;; ... or at eob whitespace region border + (and (= whitespace-point (1- whitespace-eob-marker)) + (= (following-char) ?\n))))))) + (when (or refontify (> whitespace-font-lock-refontify 0)) + (setq whitespace-buffer-changed nil) + ;; adjust refontify counter + (setq whitespace-font-lock-refontify + (if refontify + 1 + (1- whitespace-font-lock-refontify))) + ;; refontify (jit-lock-refontify)))) @@ -2386,11 +2498,11 @@ Also refontify when necessary." (unless whitespace-display-table-was-local (setq whitespace-display-table-was-local t whitespace-display-table + (copy-sequence buffer-display-table)) + ;; asure `buffer-display-table' is unique + ;; when two or more windows are visible. + (setq buffer-display-table (copy-sequence buffer-display-table))) - ;; asure `buffer-display-table' is unique - ;; when two or more windows are visible. - (set (make-local-variable 'buffer-display-table) - (copy-sequence buffer-display-table)) (unless buffer-display-table (setq buffer-display-table (make-display-table))) (dolist (entry whitespace-display-mappings) From d2625c3ded73eb75c43a8c0a7f20d624e85628a1 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 21 Aug 2010 00:46:23 -0400 Subject: [PATCH 069/101] Cleanups and fixes for mouse-save-then-kill and mouse-secondary-save-then-kill. * mouse.el (mouse-save-then-kill): Don't save region to kill ring when extending it. Before killing on the second click, check if the buffer is the correct one. Doc fix. (mouse-secondary-save-then-kill): Allow usage without first calling mouse-start-secondary, by defaulting to point. Don't save an empty secondary selection. Doc fix. --- lisp/ChangeLog | 9 + lisp/mouse.el | 699 +++++++++++-------------------------------------- 2 files changed, 165 insertions(+), 543 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3a38a6c031a..b717877dcf5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2010-08-21 Chong Yidong + + * mouse.el (mouse-save-then-kill): Don't save region to kill ring + when extending it. Before killing on the second click, check if + the buffer is the correct one. Doc fix. + (mouse-secondary-save-then-kill): Allow usage without first + calling mouse-start-secondary, by defaulting to point. Don't save + an empty secondary selection. Doc fix. + 2010-08-21 Vinicius Jose Latorre * whitespace.el: Fix slow cursor movement. Reported by Christoph diff --git a/lisp/mouse.el b/lisp/mouse.el index f404de98ce3..c9b190f1c79 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1297,8 +1297,7 @@ This does not delete the region; it acts like \\[kill-ring-save]." ;; whenever it was equal to the front of the kill ring, but some ;; people found that confusing. -;; A list (TEXT START END), describing the text and position of the last -;; invocation of mouse-save-then-kill. +;; The position of the last invocation of `mouse-save-then-kill'. (defvar mouse-save-then-kill-posn nil) (defun mouse-save-then-kill-delete-region (beg end) @@ -1336,111 +1335,76 @@ This does not delete the region; it acts like \\[kill-ring-save]." (undo-boundary)) (defun mouse-save-then-kill (click) - "Set the region according to CLICK; the second time, kill the region. -Assuming this command is bound to a mouse button, CLICK is the -corresponding input event. + "Set the region according to CLICK; the second time, kill it. +CLICK should be a mouse click event. -If the region is already active, adjust it. Normally, this -happens by moving either point or mark, whichever is closer, to -the position of CLICK. But if you have selected words or lines, -the region is adjusted by moving point or mark to the word or -line boundary closest to CLICK. +If the region is inactive, activate it temporarily. Set mark at +the original point, and move point to the position of CLICK. -If the region is inactive, activate it temporarily; set mark at -the original point, and move click to the position of CLICK. +If the region is already active, adjust it. Normally, do this by +moving point or mark, whichever is closer, to CLICK. But if you +have selected whole words or lines, move point or mark to the +word or line boundary closest to CLICK instead. -However, if this command is being called a second time (i.e. the -value of `last-command' is `mouse-save-then-kill'), kill the -region instead. If the text in the region is the same as the -text in the front of the kill ring, just delete it." +If this command is called a second consecutive time with the same +CLICK position, kill the region." (interactive "e") - (let ((before-scroll - (with-current-buffer (window-buffer (posn-window (event-start click))) - point-before-scroll))) - (mouse-minibuffer-check click) - (let ((click-posn (posn-point (event-start click))) - ;; Don't let a subsequent kill command append to this one: - ;; prevent setting this-command to kill-region. - (this-command this-command)) - (if (and (with-current-buffer - (window-buffer (posn-window (event-start click))) - (and (mark t) - (> (mod mouse-selection-click-count 3) 0) - ;; Don't be fooled by a recent click in some other buffer. - (eq mouse-selection-click-count-buffer - (current-buffer))))) - (if (and (eq last-command 'mouse-save-then-kill) - (equal click-posn (nth 2 mouse-save-then-kill-posn))) - ;; If we click this button again without moving it, kill. - (progn - ;; Call `deactivate-mark' to save the primary selection. - (deactivate-mark) - (mouse-save-then-kill-delete-region (mark) (point)) - (setq mouse-selection-click-count 0) - (setq mouse-save-then-kill-posn nil)) - ;; Find both ends of the object selected by this click. - (let* ((range - (mouse-start-end click-posn click-posn - mouse-selection-click-count))) - ;; Move whichever end is closer to the click. - ;; That's what xterm does, and it seems reasonable. - (if (< (abs (- click-posn (mark t))) - (abs (- click-posn (point)))) - (set-mark (car range)) - (goto-char (nth 1 range))) - ;; We have already put the old region in the kill ring. - ;; Replace it with the extended region. - ;; (It would be annoying to make a separate entry.) - (kill-new (buffer-substring (point) (mark t)) t) - (mouse-set-region-1) - ;; Arrange for a repeated mouse-3 to kill this region. - (setq mouse-save-then-kill-posn - (list (car kill-ring) (point) click-posn)))) + (mouse-minibuffer-check click) + (let* ((posn (event-start click)) + (click-pt (posn-point posn)) + (window (posn-window posn)) + (buf (window-buffer window)) + ;; Don't let a subsequent kill command append to this one. + (this-command this-command) + ;; Check if the user has multi-clicked to select words/lines. + (click-count + (if (and (eq mouse-selection-click-count-buffer buf) + (with-current-buffer buf (mark t))) + mouse-selection-click-count + 0))) + (cond + ((not (numberp click-pt)) nil) + ;; If the user clicked without moving point, kill the region. + ;; This also resets `mouse-selection-click-count'. + ((and (eq last-command 'mouse-save-then-kill) + (eq click-pt mouse-save-then-kill-posn) + (eq window (selected-window))) + (kill-region (mark t) (point)) + (setq mouse-selection-click-count 0) + (setq mouse-save-then-kill-posn nil)) + + ;; Otherwise, if there is a suitable region, adjust it by moving + ;; one end (whichever is closer) to CLICK-PT. + ((or (with-current-buffer buf (region-active-p)) + (and (eq window (selected-window)) + (mark t) + (or (and (eq last-command 'mouse-save-then-kill) + mouse-save-then-kill-posn) + (and (memq last-command '(mouse-drag-region + mouse-set-region)) + (or mark-even-if-inactive + (not transient-mark-mode)))))) + (select-window window) + (let* ((range (mouse-start-end click-pt click-pt click-count))) + (if (< (abs (- click-pt (mark t))) + (abs (- click-pt (point)))) + (set-mark (car range)) + (goto-char (nth 1 range))) + (setq deactivate-mark nil) + (mouse-set-region-1) + ;; Arrange for a repeated mouse-3 to kill the region. + (setq mouse-save-then-kill-posn click-pt))) + + ;; Otherwise, set the mark where point is and move to CLICK-PT. + (t + (select-window window) + (mouse-set-mark-fast click) + (let ((before-scroll (with-current-buffer buf point-before-scroll))) + (if before-scroll (goto-char before-scroll))) + (exchange-point-and-mark) + (mouse-set-region-1) + (setq mouse-save-then-kill-posn click-pt))))) - (if (and (eq last-command 'mouse-save-then-kill) - mouse-save-then-kill-posn - (eq (car mouse-save-then-kill-posn) (car kill-ring)) - (equal (cdr mouse-save-then-kill-posn) - (list (point) click-posn))) - ;; If this is the second time we've called - ;; mouse-save-then-kill, delete the text from the buffer. - (progn - ;; Call `deactivate-mark' to save the primary selection. - (deactivate-mark) - (mouse-save-then-kill-delete-region (point) (mark t)) - ;; After we kill, another click counts as "the first time". - (setq mouse-save-then-kill-posn nil)) - ;; This is not a repetition. - ;; We are adjusting an old selection or creating a new one. - (if (or (and (eq last-command 'mouse-save-then-kill) - mouse-save-then-kill-posn) - (and mark-active transient-mark-mode) - (and (memq last-command - '(mouse-drag-region mouse-set-region)) - (or mark-even-if-inactive - (not transient-mark-mode)))) - ;; We have a selection or suitable region, so adjust it. - (let* ((posn (event-start click)) - (new (posn-point posn))) - (select-window (posn-window posn)) - (if (numberp new) - (progn - ;; Move whichever end of the region is closer to the click. - ;; That is what xterm does, and it seems reasonable. - (if (<= (abs (- new (point))) (abs (- new (mark t)))) - (goto-char new) - (set-mark new)) - (setq deactivate-mark nil))) - (kill-new (buffer-substring (point) (mark t)) t)) - ;; Set the mark where point is, then move where clicked. - (mouse-set-mark-fast click) - (if before-scroll - (goto-char before-scroll)) - (exchange-point-and-mark) ;Why??? --Stef - (kill-new (buffer-substring (point) (mark t)))) - (mouse-set-region-1) - (setq mouse-save-then-kill-posn - (list (car kill-ring) (point) click-posn))))))) (global-set-key [M-mouse-1] 'mouse-start-secondary) (global-set-key [M-drag-mouse-1] 'mouse-set-secondary) @@ -1520,9 +1484,6 @@ The function returns a non-nil value if it creates a secondary selection." ;; of one word or line. (let ((range (mouse-start-end start-point start-point click-count))) (set-marker mouse-secondary-start nil) - ;; Why the double move? --Stef - ;; (move-overlay mouse-secondary-overlay 1 1 - ;; (window-buffer start-window)) (move-overlay mouse-secondary-overlay (car range) (nth 1 range) (window-buffer start-window))) ;; Single-press: cancel any preexisting secondary selection. @@ -1616,117 +1577,99 @@ is to prevent accidents." (delete-overlay mouse-secondary-overlay)) (defun mouse-secondary-save-then-kill (click) - "Save text to point in kill ring; the second time, kill the text. -You must use this in a buffer where you have recently done \\[mouse-start-secondary]. -If the text between where you did \\[mouse-start-secondary] and where -you use this command matches the text at the front of the kill ring, -this command deletes the text. -Otherwise, it adds the text to the kill ring, like \\[kill-ring-save], -which prepares for a second click with this command to delete the text. + "Set the secondary selection and save it to the kill ring. +The second time, kill it. CLICK should be a mouse click event. -If you have already made a secondary selection in that buffer, -this command extends or retracts the selection to where you click. -If you do this again in a different position, it extends or retracts -again. If you do this twice in the same position, it kills the selection." +If you have not called `mouse-start-secondary' in the clicked +buffer, activate the secondary selection and set it between point +and the click position CLICK. + +Otherwise, adjust the bounds of the secondary selection. +Normally, do this by moving its beginning or end, whichever is +closer, to CLICK. But if you have selected whole words or lines, +adjust to the word or line boundary closest to CLICK instead. + +If this command is called a second consecutive time with the same +CLICK position, kill the secondary selection." (interactive "e") (mouse-minibuffer-check click) - (let ((posn (event-start click)) - (click-posn (posn-point (event-start click))) - ;; Don't let a subsequent kill command append to this one: - ;; prevent setting this-command to kill-region. - (this-command this-command)) - (or (eq (window-buffer (posn-window posn)) - (or (overlay-buffer mouse-secondary-overlay) - (if mouse-secondary-start - (marker-buffer mouse-secondary-start)))) - (error "Wrong buffer")) - (with-current-buffer (window-buffer (posn-window posn)) - (if (> (mod mouse-secondary-click-count 3) 0) - (if (not (and (eq last-command 'mouse-secondary-save-then-kill) - (equal click-posn - (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) - ;; Find both ends of the object selected by this click. - (let* ((range - (mouse-start-end click-posn click-posn - mouse-secondary-click-count))) - ;; Move whichever end is closer to the click. - ;; That's what xterm does, and it seems reasonable. - (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay))) - (abs (- click-posn (overlay-end mouse-secondary-overlay)))) - (move-overlay mouse-secondary-overlay (car range) - (overlay-end mouse-secondary-overlay)) - (move-overlay mouse-secondary-overlay - (overlay-start mouse-secondary-overlay) - (nth 1 range))) - ;; We have already put the old region in the kill ring. - ;; Replace it with the extended region. - ;; (It would be annoying to make a separate entry.) - (kill-new (buffer-substring - (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay)) t) - ;; Arrange for a repeated mouse-3 to kill this region. - (setq mouse-save-then-kill-posn - (list (car kill-ring) (point) click-posn))) - ;; If we click this button again without moving it, - ;; that time kill. - (progn - (mouse-save-then-kill-delete-region - (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay)) - (setq mouse-save-then-kill-posn nil) - (setq mouse-secondary-click-count 0) - (delete-overlay mouse-secondary-overlay))) - (if (and (eq last-command 'mouse-secondary-save-then-kill) - mouse-save-then-kill-posn - (eq (car mouse-save-then-kill-posn) (car kill-ring)) - (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn))) - ;; If this is the second time we've called - ;; mouse-secondary-save-then-kill, delete the text from the buffer. - (progn - (mouse-save-then-kill-delete-region - (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay)) - (setq mouse-save-then-kill-posn nil) - (delete-overlay mouse-secondary-overlay)) - (if (overlay-start mouse-secondary-overlay) - ;; We have a selection, so adjust it. - (progn - (if (numberp click-posn) - (progn - ;; Move whichever end of the region is closer to the click. - ;; That is what xterm does, and it seems reasonable. - (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay))) - (abs (- click-posn (overlay-end mouse-secondary-overlay)))) - (move-overlay mouse-secondary-overlay click-posn - (overlay-end mouse-secondary-overlay)) - (move-overlay mouse-secondary-overlay - (overlay-start mouse-secondary-overlay) - click-posn)) - (setq deactivate-mark nil))) - (if (eq last-command 'mouse-secondary-save-then-kill) - ;; If the front of the kill ring comes from - ;; an immediately previous use of this command, - ;; replace it with the extended region. - ;; (It would be annoying to make a separate entry.) - (kill-new (buffer-substring - (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay)) t) - (let (deactivate-mark) - (copy-region-as-kill (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay))))) - (if mouse-secondary-start - ;; All we have is one end of a selection, - ;; so put the other end here. - (let ((start (+ 0 mouse-secondary-start))) - (kill-ring-save start click-posn) - (move-overlay mouse-secondary-overlay start click-posn)))) - (setq mouse-save-then-kill-posn - (list (car kill-ring) (point) click-posn)))) - (if (overlay-buffer mouse-secondary-overlay) - (x-set-selection 'SECONDARY - (buffer-substring - (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay))))))) + (let* ((posn (event-start click)) + (click-pt (posn-point posn)) + (window (posn-window posn)) + (buf (window-buffer window)) + ;; Don't let a subsequent kill command append to this one. + (this-command this-command) + ;; Check if the user has multi-clicked to select words/lines. + (click-count + (if (eq (overlay-buffer mouse-secondary-overlay) buf) + mouse-secondary-click-count + 0)) + (beg (overlay-start mouse-secondary-overlay)) + (end (overlay-end mouse-secondary-overlay))) + + (cond + ((not (numberp click-pt)) nil) + + ;; If the secondary selection is not active in BUF, activate it. + ((not (eq buf (or (overlay-buffer mouse-secondary-overlay) + (if mouse-secondary-start + (marker-buffer mouse-secondary-start))))) + (select-window window) + (setq mouse-secondary-start (make-marker)) + (move-marker mouse-secondary-start (point)) + (move-overlay mouse-secondary-overlay (point) click-pt buf) + (kill-ring-save (point) click-pt)) + + ;; If the user clicked without moving point, delete the secondary + ;; selection. This also resets `mouse-secondary-click-count'. + ((and (eq last-command 'mouse-secondary-save-then-kill) + (eq click-pt mouse-save-then-kill-posn) + (eq window (selected-window))) + (mouse-save-then-kill-delete-region beg end) + (delete-overlay mouse-secondary-overlay) + (setq mouse-secondary-click-count 0) + (setq mouse-save-then-kill-posn nil)) + + ;; Otherwise, if there is a suitable secondary selection overlay, + ;; adjust it by moving one end (whichever is closer) to CLICK-PT. + ((and beg (eq buf (overlay-buffer mouse-secondary-overlay))) + (let* ((range (mouse-start-end click-pt click-pt click-count))) + (if (< (abs (- click-pt beg)) + (abs (- click-pt end))) + (move-overlay mouse-secondary-overlay (car range) end) + (move-overlay mouse-secondary-overlay beg (nth 1 range)))) + (setq deactivate-mark nil) + (if (eq last-command 'mouse-secondary-save-then-kill) + ;; If the front of the kill ring comes from an immediately + ;; previous use of this command, replace the entry. + (kill-new + (buffer-substring (overlay-start mouse-secondary-overlay) + (overlay-end mouse-secondary-overlay)) + t) + (let (deactivate-mark) + (copy-region-as-kill (overlay-start mouse-secondary-overlay) + (overlay-end mouse-secondary-overlay)))) + (setq mouse-save-then-kill-posn click-pt)) + + ;; Otherwise, set the secondary selection overlay. + (t + (select-window window) + (if mouse-secondary-start + ;; All we have is one end of a selection, so put the other + ;; end here. + (let ((start (+ 0 mouse-secondary-start))) + (kill-ring-save start click-pt) + (move-overlay mouse-secondary-overlay start click-pt))) + (setq mouse-save-then-kill-posn click-pt)))) + + ;; Finally, set the window system's secondary selection. + (let (str) + (and (overlay-buffer mouse-secondary-overlay) + (setq str (buffer-substring (overlay-start mouse-secondary-overlay) + (overlay-end mouse-secondary-overlay))) + (> (length str) 0) + (x-set-selection 'SECONDARY str)))) + (defcustom mouse-buffer-menu-maxlen 20 "Number of buffers in one pane (submenu) of the buffer menu. @@ -1907,332 +1850,6 @@ and selects that window." ;; Few buffers--put them all in one pane. (list (cons title alist)))) -;; These need to be rewritten for the new scroll bar implementation. - -;;!! ;; Commands for the scroll bar. -;;!! -;;!! (defun mouse-scroll-down (click) -;;!! (interactive "@e") -;;!! (scroll-down (1+ (cdr (mouse-coords click))))) -;;!! -;;!! (defun mouse-scroll-up (click) -;;!! (interactive "@e") -;;!! (scroll-up (1+ (cdr (mouse-coords click))))) -;;!! -;;!! (defun mouse-scroll-down-full () -;;!! (interactive "@") -;;!! (scroll-down nil)) -;;!! -;;!! (defun mouse-scroll-up-full () -;;!! (interactive "@") -;;!! (scroll-up nil)) -;;!! -;;!! (defun mouse-scroll-move-cursor (click) -;;!! (interactive "@e") -;;!! (move-to-window-line (1+ (cdr (mouse-coords click))))) -;;!! -;;!! (defun mouse-scroll-absolute (event) -;;!! (interactive "@e") -;;!! (let* ((pos (car event)) -;;!! (position (car pos)) -;;!! (length (car (cdr pos)))) -;;!! (if (<= length 0) (setq length 1)) -;;!! (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size))))) -;;!! (newpos (* (/ (* (/ (buffer-size) scale-factor) -;;!! position) -;;!! length) -;;!! scale-factor))) -;;!! (goto-char newpos) -;;!! (recenter '(4))))) -;;!! -;;!! (defun mouse-scroll-left (click) -;;!! (interactive "@e") -;;!! (scroll-left (1+ (car (mouse-coords click))))) -;;!! -;;!! (defun mouse-scroll-right (click) -;;!! (interactive "@e") -;;!! (scroll-right (1+ (car (mouse-coords click))))) -;;!! -;;!! (defun mouse-scroll-left-full () -;;!! (interactive "@") -;;!! (scroll-left nil)) -;;!! -;;!! (defun mouse-scroll-right-full () -;;!! (interactive "@") -;;!! (scroll-right nil)) -;;!! -;;!! (defun mouse-scroll-move-cursor-horizontally (click) -;;!! (interactive "@e") -;;!! (move-to-column (1+ (car (mouse-coords click))))) -;;!! -;;!! (defun mouse-scroll-absolute-horizontally (event) -;;!! (interactive "@e") -;;!! (let* ((pos (car event)) -;;!! (position (car pos)) -;;!! (length (car (cdr pos)))) -;;!! (set-window-hscroll (selected-window) 33))) -;;!! -;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up) -;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute) -;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down) -;;!! -;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor) -;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor) -;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor) -;;!! -;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full) -;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full) -;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full) -;;!! -;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full) -;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full) -;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full) -;;!! -;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left) -;;!! (global-set-key [horizontal-scroll-bar mouse-2] -;;!! 'mouse-scroll-absolute-horizontally) -;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right) -;;!! -;;!! (global-set-key [horizontal-slider mouse-1] -;;!! 'mouse-scroll-move-cursor-horizontally) -;;!! (global-set-key [horizontal-slider mouse-2] -;;!! 'mouse-scroll-move-cursor-horizontally) -;;!! (global-set-key [horizontal-slider mouse-3] -;;!! 'mouse-scroll-move-cursor-horizontally) -;;!! -;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full) -;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full) -;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full) -;;!! -;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) -;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) -;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) -;;!! -;;!! (global-set-key [horizontal-scroll-bar S-mouse-2] -;;!! 'mouse-split-window-horizontally) -;;!! (global-set-key [mode-line S-mouse-2] -;;!! 'mouse-split-window-horizontally) -;;!! (global-set-key [vertical-scroll-bar S-mouse-2] -;;!! 'mouse-split-window) - -;;!! ;;;; -;;!! ;;;; Here are experimental things being tested. Mouse events -;;!! ;;;; are of the form: -;;!! ;;;; ((x y) window screen-part key-sequence timestamp) -;;!! ;; -;;!! ;;;; -;;!! ;;;; Dynamically track mouse coordinates -;;!! ;;;; -;;!! ;; -;;!! ;;(defun track-mouse (event) -;;!! ;; "Track the coordinates, absolute and relative, of the mouse." -;;!! ;; (interactive "@e") -;;!! ;; (while mouse-grabbed -;;!! ;; (let* ((pos (read-mouse-position (selected-screen))) -;;!! ;; (abs-x (car pos)) -;;!! ;; (abs-y (cdr pos)) -;;!! ;; (relative-coordinate (coordinates-in-window-p -;;!! ;; (list (car pos) (cdr pos)) -;;!! ;; (selected-window)))) -;;!! ;; (if (consp relative-coordinate) -;;!! ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y -;;!! ;; (car relative-coordinate) -;;!! ;; (car (cdr relative-coordinate))) -;;!! ;; (message "mouse: [%d %d]" abs-x abs-y))))) -;;!! -;;!! ;; -;;!! ;; Dynamically put a box around the line indicated by point -;;!! ;; -;;!! ;; -;;!! ;;(require 'backquote) -;;!! ;; -;;!! ;;(defun mouse-select-buffer-line (event) -;;!! ;; (interactive "@e") -;;!! ;; (let ((relative-coordinate -;;!! ;; (coordinates-in-window-p (car event) (selected-window))) -;;!! ;; (abs-y (car (cdr (car event))))) -;;!! ;; (if (consp relative-coordinate) -;;!! ;; (progn -;;!! ;; (save-excursion -;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) -;;!! ;; (x-draw-rectangle -;;!! ;; (selected-screen) -;;!! ;; abs-y 0 -;;!! ;; (save-excursion -;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) -;;!! ;; (end-of-line) -;;!! ;; (push-mark nil t) -;;!! ;; (beginning-of-line) -;;!! ;; (- (region-end) (region-beginning))) 1)) -;;!! ;; (sit-for 1) -;;!! ;; (x-erase-rectangle (selected-screen)))))) -;;!! ;; -;;!! ;;(defvar last-line-drawn nil) -;;!! ;;(defvar begin-delim "[^ \t]") -;;!! ;;(defvar end-delim "[^ \t]") -;;!! ;; -;;!! ;;(defun mouse-boxing (event) -;;!! ;; (interactive "@e") -;;!! ;; (save-excursion -;;!! ;; (let ((screen (selected-screen))) -;;!! ;; (while (= (x-mouse-events) 0) -;;!! ;; (let* ((pos (read-mouse-position screen)) -;;!! ;; (abs-x (car pos)) -;;!! ;; (abs-y (cdr pos)) -;;!! ;; (relative-coordinate -;;!! ;; (coordinates-in-window-p `(,abs-x ,abs-y) -;;!! ;; (selected-window))) -;;!! ;; (begin-reg nil) -;;!! ;; (end-reg nil) -;;!! ;; (end-column nil) -;;!! ;; (begin-column nil)) -;;!! ;; (if (and (consp relative-coordinate) -;;!! ;; (or (not last-line-drawn) -;;!! ;; (not (= last-line-drawn abs-y)))) -;;!! ;; (progn -;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) -;;!! ;; (if (= (following-char) 10) -;;!! ;; () -;;!! ;; (progn -;;!! ;; (setq begin-reg (1- (re-search-forward end-delim))) -;;!! ;; (setq begin-column (1- (current-column))) -;;!! ;; (end-of-line) -;;!! ;; (setq end-reg (1+ (re-search-backward begin-delim))) -;;!! ;; (setq end-column (1+ (current-column))) -;;!! ;; (message "%s" (buffer-substring begin-reg end-reg)) -;;!! ;; (x-draw-rectangle screen -;;!! ;; (setq last-line-drawn abs-y) -;;!! ;; begin-column -;;!! ;; (- end-column begin-column) 1)))))))))) -;;!! ;; -;;!! ;;(defun mouse-erase-box () -;;!! ;; (interactive) -;;!! ;; (if last-line-drawn -;;!! ;; (progn -;;!! ;; (x-erase-rectangle (selected-screen)) -;;!! ;; (setq last-line-drawn nil)))) -;;!! -;;!! ;;; (defun test-x-rectangle () -;;!! ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) -;;!! ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) -;;!! ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) -;;!! -;;!! ;; -;;!! ;; Here is how to do double clicking in lisp. About to change. -;;!! ;; -;;!! -;;!! (defvar double-start nil) -;;!! (defconst double-click-interval 300 -;;!! "Max ticks between clicks") -;;!! -;;!! (defun double-down (event) -;;!! (interactive "@e") -;;!! (if double-start -;;!! (let ((interval (- (nth 4 event) double-start))) -;;!! (if (< interval double-click-interval) -;;!! (progn -;;!! (backward-up-list 1) -;;!! ;; (message "Interval %d" interval) -;;!! (sleep-for 1))) -;;!! (setq double-start nil)) -;;!! (setq double-start (nth 4 event)))) -;;!! -;;!! (defun double-up (event) -;;!! (interactive "@e") -;;!! (and double-start -;;!! (> (- (nth 4 event ) double-start) double-click-interval) -;;!! (setq double-start nil))) -;;!! -;;!! ;;; (defun x-test-doubleclick () -;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) -;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) -;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) -;;!! -;;!! ;; -;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar. -;;!! ;; -;;!! -;;!! (defvar scrolled-lines 0) -;;!! (defconst scroll-speed 1) -;;!! -;;!! (defun incr-scroll-down (event) -;;!! (interactive "@e") -;;!! (setq scrolled-lines 0) -;;!! (incremental-scroll scroll-speed)) -;;!! -;;!! (defun incr-scroll-up (event) -;;!! (interactive "@e") -;;!! (setq scrolled-lines 0) -;;!! (incremental-scroll (- scroll-speed))) -;;!! -;;!! (defun incremental-scroll (n) -;;!! (while (= (x-mouse-events) 0) -;;!! (setq scrolled-lines (1+ (* scroll-speed scrolled-lines))) -;;!! (scroll-down n) -;;!! (sit-for 300 t))) -;;!! -;;!! (defun incr-scroll-stop (event) -;;!! (interactive "@e") -;;!! (message "Scrolled %d lines" scrolled-lines) -;;!! (setq scrolled-lines 0) -;;!! (sleep-for 1)) -;;!! -;;!! ;;; (defun x-testing-scroll () -;;!! ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix))) -;;!! ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down) -;;!! ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up) -;;!! ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop) -;;!! ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop))) -;;!! -;;!! ;; -;;!! ;; Some playthings suitable for picture mode? They need work. -;;!! ;; -;;!! -;;!! (defun mouse-kill-rectangle (event) -;;!! "Kill the rectangle between point and the mouse cursor." -;;!! (interactive "@e") -;;!! (let ((point-save (point))) -;;!! (save-excursion -;;!! (mouse-set-point event) -;;!! (push-mark nil t) -;;!! (if (> point-save (point)) -;;!! (kill-rectangle (point) point-save) -;;!! (kill-rectangle point-save (point)))))) -;;!! -;;!! (defun mouse-open-rectangle (event) -;;!! "Kill the rectangle between point and the mouse cursor." -;;!! (interactive "@e") -;;!! (let ((point-save (point))) -;;!! (save-excursion -;;!! (mouse-set-point event) -;;!! (push-mark nil t) -;;!! (if (> point-save (point)) -;;!! (open-rectangle (point) point-save) -;;!! (open-rectangle point-save (point)))))) -;;!! -;;!! ;; Must be a better way to do this. -;;!! -;;!! (defun mouse-multiple-insert (n char) -;;!! (while (> n 0) -;;!! (insert char) -;;!! (setq n (1- n)))) -;;!! -;;!! ;; What this could do is not finalize until button was released. -;;!! -;;!! (defun mouse-move-text (event) -;;!! "Move text from point to cursor position, inserting spaces." -;;!! (interactive "@e") -;;!! (let* ((relative-coordinate -;;!! (coordinates-in-window-p (car event) (selected-window)))) -;;!! (if (consp relative-coordinate) -;;!! (cond ((> (current-column) (car relative-coordinate)) -;;!! (delete-char -;;!! (- (car relative-coordinate) (current-column)))) -;;!! ((< (current-column) (car relative-coordinate)) -;;!! (mouse-multiple-insert -;;!! (- (car relative-coordinate) (current-column)) " ")) -;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) - (define-obsolete-function-alias 'mouse-choose-completion 'choose-completion "23.2") @@ -2475,10 +2092,6 @@ choose a font." (mouse-menu-bar-map) (mouse-menu-major-mode-map))))) - -;; Replaced with dragging mouse-1 -;; (global-set-key [S-mouse-1] 'mouse-set-mark) - ;; Binding mouse-1 to mouse-select-window when on mode-, header-, or ;; vertical-line prevents Emacs from signaling an error when the mouse ;; button is released after dragging these lines, on non-toolkit From 3ff786247389f0eb280defb0389d690ee3610bf8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 21 Aug 2010 10:56:54 +0200 Subject: [PATCH 070/101] * subr.el (read-key): Don't echo keystrokes. Fixes: debbugs:6883 --- lisp/ChangeLog | 4 ++++ lisp/subr.el | 1 + 2 files changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 44cc4c78616..2403ab0491c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-21 Stefan Monnier + + * subr.el (read-key): Don't echo keystrokes (bug#6883). + 2010-08-21 Glenn Morris * menu-bar.el (menu-bar-games-menu): Add landmark. diff --git a/lisp/subr.el b/lisp/subr.el index ad939dc6bb4..a4a0996a726 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1818,6 +1818,7 @@ When there's an ambiguity because the key looks like the prefix of some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." (let ((overriding-terminal-local-map read-key-empty-map) (overriding-local-map nil) + (echo-keystrokes 0) (old-global-map (current-global-map)) (timer (run-with-idle-timer ;; Wait long enough that Emacs has the time to receive and From 8f081e96dec8821ecf3452237b74cfc7ee6a315b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 21 Aug 2010 11:19:38 +0200 Subject: [PATCH 071/101] * progmodes/make-mode.el (makefile-fill-paragraph): Account for the extra backslash added to each line. Fixes: debbugs:6890 --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/make-mode.el | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2403ab0491c..f6aa59c2db5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-08-21 Kirk Kelsey (tiny change) + Stefan Monnier + + * progmodes/make-mode.el (makefile-fill-paragraph): Account for the + extra backslash added to each line (bug#6890). + 2010-08-21 Stefan Monnier * subr.el (read-key): Don't echo keystrokes (bug#6883). diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 594462d5125..d45ecd47907 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -1324,7 +1324,9 @@ definition and conveniently use this command." (save-restriction (narrow-to-region beginning end) (makefile-backslash-region (point-min) (point-max) t) - (let ((fill-paragraph-function nil)) + (let ((fill-paragraph-function nil) + ;; Adjust fill-column to allow space for the backslash. + (fill-column (- fill-column 1))) (fill-paragraph nil)) (makefile-backslash-region (point-min) (point-max) nil) (goto-char (point-max)) @@ -1338,7 +1340,9 @@ definition and conveniently use this command." ;; resulting region. (save-restriction (narrow-to-region (point) (line-beginning-position 2)) - (let ((fill-paragraph-function nil)) + (let ((fill-paragraph-function nil) + ;; Adjust fill-column to allow space for the backslash. + (fill-column (- fill-column 1))) (fill-paragraph nil)) (makefile-backslash-region (point-min) (point-max) nil)) ;; Return non-nil to indicate it's been filled. From 40629f171babe6087c32d3211beeb23b136155bd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Aug 2010 12:35:31 +0300 Subject: [PATCH 072/101] Fix mirroring pixel positions on GUI terminals. dispnew.c (buffer_posn_from_coords): Fix off-by-one error in mirroring pixel positions. --- src/ChangeLog | 5 +++++ src/dispnew.c | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9b9e43864ab..403a588df4c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-21 Eli Zaretskii + + * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in + mirroring pixel positions. + 2010-08-20 Dan Nicolaescu * alloc.c (malloc_sbrk_used, malloc_sbrk_unused): Remove, diff --git a/src/dispnew.c b/src/dispnew.c index 547ab2a4187..9344d792f3d 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5386,12 +5386,12 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p /* First, move to the beginning of the row corresponding to *Y. We need to be in that row to get the correct value of base paragraph - direction for the paragraph at *X. */ + direction for the text at (*X, *Y). */ move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y); /* TO_X is the pixel position that the iterator will compute for the - glyph at *X. This is because iterator positions are not offset - due to hscroll. */ + glyph at *X. We add it.first_visible_x because iterator + positions include the hscroll. */ to_x = x0 + it.first_visible_x; if (it.bidi_it.paragraph_dir == R2L) /* For lines in an R2L paragraph, we need to mirror TO_X wrt the @@ -5401,13 +5401,14 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p display, we reverse their order in PRODUCE_GLYPHS, but the iterator doesn't know about that.) The following line adjusts the pixel position to the iterator geometry, which is what - move_it_* routines use. */ - to_x = window_box_width (w, TEXT_AREA) - to_x - /* Text terminals need a one-character offset to get it right. */ - - (FRAME_MSDOS_P (WINDOW_XFRAME (w)) - || FRAME_TERMCAP_P (WINDOW_XFRAME (w))); + move_it_* routines use. (The -1 is because in a window whose + text-area width is W, the rightmost pixel position is W-1, and + it should be mirrored into zero pixel position.) */ + to_x = window_box_width (w, TEXT_AREA) - to_x - 1; - /* Now move horizontally in the row to the glyph under *X. */ + /* Now move horizontally in the row to the glyph under *X. Second + argument is ZV to prevent move_it_in_display_line from matching + based on buffer positions. */ move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); Fset_buffer (old_current_buffer); From 0deaf02ae1a4d8b0b69e1b3303424dfff4c3f8d1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Aug 2010 16:25:03 +0300 Subject: [PATCH 073/101] xdisp.c: Fix typo in a comment in note_tool_bar_highlight. --- src/xdisp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index c80e1f35df3..93fdb68eeac 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10858,7 +10858,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; int mouse_down_p, rc; - /* Function note_mouse_highlight is called with negative x(y + /* Function note_mouse_highlight is called with negative X/Y values when mouse moves outside of the frame. */ if (x <= 0 || y <= 0) { From e0143335522bda205591cab09407e3bec41c9a40 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Sat, 21 Aug 2010 15:35:27 +0200 Subject: [PATCH 074/101] =?UTF-8?q?Fix=20buffer-list=20rename&refresh=20af?= =?UTF-8?q?ter=20after=20killing=20a=20buffer=20in=20ido.=20*=20lisp/ido.e?= =?UTF-8?q?l:=20Revert=20=C3=93scar's.=20(ido-kill-buffer-at-head):=20Exit?= =?UTF-8?q?=20the=20minibuffer=20with=20ido-exit=3Drefresh.=20Remember=20t?= =?UTF-8?q?he=20buffers=20at=20head,=20rather=20than=20their=20name.=20*?= =?UTF-8?q?=20lisp/iswitchb.el=20(iswitchb-kill-buffer):=20Re-make=20the?= =?UTF-8?q?=20list.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lisp/ChangeLog | 8 ++++++ lisp/ido.el | 66 +++++++++++++++++++----------------------------- lisp/iswitchb.el | 10 +++++--- 3 files changed, 40 insertions(+), 44 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6aa59c2db5..2318ce84600 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2010-08-21 Leo + + Fix buffer-list rename&refresh after after killing a buffer in ido. + * lisp/ido.el: Revert Óscar's. + (ido-kill-buffer-at-head): Exit the minibuffer with ido-exit=refresh. + Remember the buffers at head, rather than their name. + * lisp/iswitchb.el (iswitchb-kill-buffer): Re-make the list. + 2010-08-21 Kirk Kelsey (tiny change) Stefan Monnier diff --git a/lisp/ido.el b/lisp/ido.el index 6cedccb3787..a4409775a86 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1042,11 +1042,11 @@ Value is an integer which is number of chars to right of prompt.") ;; Stores the current list of items that will be searched through. ;; The list is ordered, so that the most interesting item comes first, ;; although by default, the files visible in the current frame are put -;; at the end of the list. -(defvar ido-cur-list nil) +;; at the end of the list. Created by `ido-make-item-list'. +(defvar ido-cur-list) ;; Stores the choice list for ido-completing-read -(defvar ido-choice-list nil) +(defvar ido-choice-list) ;; Stores the list of items which are ignored when building ;; `ido-cur-list'. It is in no specific order. @@ -3348,12 +3348,9 @@ for first matching file." (if ido-temp-list (nconc ido-temp-list ido-current-buffers) (setq ido-temp-list ido-current-buffers)) - (if (and default (buffer-live-p (get-buffer default))) - (progn - (setq ido-temp-list - (delete default ido-temp-list)) - (setq ido-temp-list - (cons default ido-temp-list)))) + (if default + (setq ido-temp-list + (cons default (delete default ido-temp-list)))) (run-hooks 'ido-make-buffer-list-hook) ido-temp-list)) @@ -3594,7 +3591,6 @@ for first matching file." ;; Used by `ido-get-buffers-in-frames' to walk through all windows (let ((buf (buffer-name (window-buffer win)))) (unless (or (member buf ido-bufs-in-frame) - (minibufferp buf) (member buf ido-ignore-item-temp-list)) ;; Only add buf if it is not already in list. ;; This prevents same buf in two different windows being @@ -3835,27 +3831,6 @@ for first matching file." ;;(add-hook 'completion-setup-hook 'completion-setup-function) (display-completion-list completion-list))))))) -(defun ido-kill-buffer-internal (buf) - "Kill buffer BUF and rebuild ido's buffer list if needed." - (if (not (kill-buffer buf)) - ;; buffer couldn't be killed. - (setq ido-rescan t) - ;; else buffer was killed so remove name from list. - (setq ido-cur-list (delq buf ido-cur-list)) - ;; Some packages, like uniquify.el, may rename buffers when one - ;; is killed, so we need to test this condition to avoid using - ;; an outdated list of buffer names. We don't want to always - ;; rebuild the list of buffers, as this alters the previous - ;; buffer order that the user was seeing on the prompt. However, - ;; when we rebuild the list, we try to keep the previous second - ;; buffer as the first one. - (catch 'update - (dolist (b ido-cur-list) - (unless (get-buffer b) - (setq ido-cur-list (ido-make-buffer-list (cadr ido-matches))) - (setq ido-rescan t) - (throw 'update nil)))))) - ;;; KILL CURRENT BUFFER (defun ido-kill-buffer-at-head () "Kill the buffer at the head of `ido-matches'. @@ -3864,15 +3839,26 @@ If cursor is not at the end of the user input, delete to end of input." (if (not (eobp)) (delete-region (point) (line-end-position)) (let ((enable-recursive-minibuffers t) - (buf (ido-name (car ido-matches)))) - (when buf - (ido-kill-buffer-internal buf) - ;; Check if buffer still exists. - (if (get-buffer buf) - ;; buffer couldn't be killed. + (buf (ido-name (car ido-matches))) + (nextbuf (cadr ido-matches))) + (when (get-buffer buf) + ;; If next match names a buffer use the buffer object; buffer + ;; name may be changed by packages such as uniquify; mindful + ;; of virtual buffers. + (when (and nextbuf (get-buffer nextbuf)) + (setq nextbuf (get-buffer nextbuf))) + (if (null (kill-buffer buf)) + ;; Buffer couldn't be killed. (setq ido-rescan t) - ;; else buffer was killed so remove name from list. - (setq ido-cur-list (delq buf ido-cur-list))))))) + ;; Else `kill-buffer' succeeds so re-make the buffer list + ;; taking into account packages like uniquify may rename + ;; buffers. + (if (bufferp nextbuf) + (setq nextbuf (buffer-name nextbuf))) + (setq ido-default-item nextbuf + ido-text-init ido-text + ido-exit 'refresh) + (exit-minibuffer)))))) ;;; DELETE CURRENT FILE (defun ido-delete-file-at-head () @@ -3910,7 +3896,7 @@ Record command in `command-history' if optional RECORD is non-nil." ((eq method 'kill) (if record (ido-record-command 'kill-buffer buffer)) - (ido-kill-buffer-internal buffer)) + (kill-buffer buffer)) ((eq method 'other-window) (if record diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el index ea4b00dc90d..081897a89b3 100644 --- a/lisp/iswitchb.el +++ b/lisp/iswitchb.el @@ -1027,8 +1027,8 @@ Return the modified list with the last element prepended to it." (defun iswitchb-kill-buffer () "Kill the buffer at the head of `iswitchb-matches'." (interactive) - (let ( (enable-recursive-minibuffers t) - buf) + (let ((enable-recursive-minibuffers t) + buf) (setq buf (car iswitchb-matches)) ;; check to see if buf is non-nil. @@ -1042,8 +1042,10 @@ Return the modified list with the last element prepended to it." (if (get-buffer buf) ;; buffer couldn't be killed. (setq iswitchb-rescan t) - ;; else buffer was killed so remove name from list. - (setq iswitchb-buflist (delq buf iswitchb-buflist))))))) + ;; Else `kill-buffer' succeeds so re-make the buffer list + ;; taking into account packages like uniquify may rename + ;; buffers + (iswitchb-make-buflist iswitchb-default)))))) ;;; VISIT CHOSEN BUFFER (defun iswitchb-visit-buffer (buffer) From 537ffaf3c900034f9ff6ffc3cd70bf806e531066 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 21 Aug 2010 16:09:46 +0200 Subject: [PATCH 075/101] * lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks. --- lisp/ChangeLog | 31 +++++++++++++++++-------------- lisp/vc/add-log.el | 12 +++++++++++- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b717877dcf5..db5bc124626 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-21 Stefan Monnier + + * vc/add-log.el (add-log-file-name): Don't get confused by symlinks. + 2010-08-21 Chong Yidong * mouse.el (mouse-save-then-kill): Don't save region to kill ring @@ -10,19 +14,18 @@ 2010-08-21 Vinicius Jose Latorre * whitespace.el: Fix slow cursor movement. Reported by Christoph - Groth and Liu Xin . New version - 13.0. + Groth and Liu Xin . + New version 13.0. (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp): Adjust initialization. (whitespace-bob-marker, whitespace-eob-marker) (whitespace-buffer-changed): New vars. (whitespace-cleanup, whitespace-color-on, whitespace-color-off) (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp) - (whitespace-post-command-hook, whitespace-display-char-on): Adjust - code. + (whitespace-post-command-hook, whitespace-display-char-on): + Adjust code. (whitespace-looking-back, whitespace-buffer-changed): New funs. - (whitespace-space-regexp, whitespace-tab-regexp): Eliminated - funs. + (whitespace-space-regexp, whitespace-tab-regexp): Eliminate funs. 2010-08-19 Stefan Monnier @@ -3227,7 +3230,8 @@ * minibuffer.el (tags-completion-at-point-function): New function. (completion-at-point-functions): Use it. - * cedet/semantic.el (semantic-completion-at-point-function): New function. + * cedet/semantic.el (semantic-completion-at-point-function): + New function. (semantic-mode): Use semantic-completion-at-point-function for completion-at-point-functions instead. @@ -3277,8 +3281,8 @@ 2010-04-28 Chong Yidong - * progmodes/bug-reference.el (bug-reference-url-format): Revert - 2010-04-27 change due to security risk. + * progmodes/bug-reference.el (bug-reference-url-format): + Revert 2010-04-27 change due to security risk. 2010-04-28 Stefan Monnier @@ -3453,8 +3457,7 @@ * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o toggles the use of virtual buffers. - (ido-buffer-internal): Guard `ido-use-virtual-buffers' global - value. + (ido-buffer-internal): Guard `ido-use-virtual-buffers' global value. (ido-toggle-virtual-buffers): New function. 2010-04-21 Juanma Barranquero @@ -4031,7 +4034,7 @@ Enable recentf-mode if using virtual buffers. * ido.el (recentf-list): Declare for byte-compiler. - (ido-virtual-buffers): Move up to silence byte-compiler. Add docstring. + (ido-virtual-buffers): Move up to silence byte-compiler. Add docstring. (ido-make-buffer-list): Simplify. (ido-add-virtual-buffers-to-list): Simplify. Enable recentf-mode. @@ -5542,8 +5545,8 @@ 2010-01-21 Alan Mackenzie Fix a situation where deletion of a cpp construct throws an error. - * progmodes/cc-engine.el (c-invalidate-state-cache): Before - invoking c-with-all-but-one-cpps-commented-out, check that the + * progmodes/cc-engine.el (c-invalidate-state-cache): + Before invoking c-with-all-but-one-cpps-commented-out, check that the special cpp construct is still in the buffer. (c-parse-state): Record the special cpp with markers, not numbers. diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index cf391b2f9ac..23f1e33f181 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el @@ -755,7 +755,17 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'." (if add-log-file-name-function (funcall add-log-file-name-function buffer-file) (setq buffer-file - (file-relative-name buffer-file (file-name-directory log-file))) + (let* ((dir (file-name-directory log-file)) + (rel (file-relative-name buffer-file dir))) + ;; Sometimes with symlinks, the two buffers may have names that + ;; appear to belong to different directory trees. So check the + ;; file-truenames, to see if we get a better result. + (if (not (string-match "\\`\\.\\./" rel)) + rel + (let ((new (file-relative-name (file-truename buffer-file) + (file-truename dir)))) + (if (< (length new) (length rel)) + new rel))))) ;; If we have a backup file, it's presumably because we're ;; comparing old and new versions (e.g. for deleted ;; functions) and we'll want to use the original name. From d64b8a68f94303367f9117360bce8ce812fd1ea0 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 21 Aug 2010 10:46:43 -0400 Subject: [PATCH 076/101] * cus-edit.el (custom-group-value-create): Add extra newline before end line (Bug#6876). --- lisp/ChangeLog | 5 +++++ lisp/cus-edit.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index db5bc124626..b4e04ab7f39 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,11 @@ * vc/add-log.el (add-log-file-name): Don't get confused by symlinks. +2010-08-21 Chong Yidong + + * cus-edit.el (custom-group-value-create): Add extra newline + before end line (Bug#6876). + 2010-08-21 Chong Yidong * mouse.el (mouse-save-then-kill): Don't save region to kill ring diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 9fa817bd102..e4cb29b50f2 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4097,8 +4097,8 @@ If GROUPS-ONLY non-nil, return only those members that are groups." (custom-group-state-update widget) (progress-reporter-done reporter)) ;; End line - (let ((p (point))) - (insert "\n") + (let ((p (1+ (point)))) + (insert "\n\n") (put-text-property p (1+ p) 'face '(:underline t)) (overlay-put (make-overlay p (1+ p)) 'before-string From 91bdeb6639bb1613eb91d9bb04ef7d8c78dc1d9d Mon Sep 17 00:00:00 2001 From: Vinicius Jose Latorre Date: Sat, 21 Aug 2010 16:26:43 -0300 Subject: [PATCH 077/101] Insert bug number. --- lisp/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b4e04ab7f39..fa5c117be83 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -18,8 +18,8 @@ 2010-08-21 Vinicius Jose Latorre - * whitespace.el: Fix slow cursor movement. Reported by Christoph - Groth and Liu Xin . + * whitespace.el: Fix slow cursor movement (Bug#6172). Reported by + Christoph Groth and Liu Xin . New version 13.0. (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp): Adjust initialization. From 41a20de9f4bc77586ed2e7cb4c21cb7f89baaea8 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 22 Aug 2010 00:12:25 -0400 Subject: [PATCH 078/101] merge whitespace.el change from trunk --- lisp/ChangeLog | 18 ++++- lisp/whitespace.el | 172 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 159 insertions(+), 31 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2318ce84600..3905bf6db80 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,19 @@ +2010-08-21 Vinicius Jose Latorre + + * whitespace.el: Fix slow cursor movement (Bug#6172). Reported by + Christoph Groth and Liu Xin . + New version 13.0. + (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp): + Adjust initialization. + (whitespace-bob-marker, whitespace-eob-marker) + (whitespace-buffer-changed): New vars. + (whitespace-cleanup, whitespace-color-on, whitespace-color-off) + (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp) + (whitespace-post-command-hook, whitespace-display-char-on): + Adjust code. + (whitespace-looking-back, whitespace-buffer-changed): New funs. + (whitespace-space-regexp, whitespace-tab-regexp): Eliminate funs. + 2010-08-21 Leo Fix buffer-list rename&refresh after after killing a buffer in ido. @@ -2295,7 +2311,7 @@ * ps-print.el (ps-face-attributes): It was not returning the attribute face for faces specified as string. Reported by harven - . + . (Bug#5254) (ps-print-version): New version 7.3.5. 2009-12-18 Ulf Jasper diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 5c7d4e95caf..9f4b033e75f 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -6,7 +6,7 @@ ;; Author: Vinicius Jose Latorre ;; Maintainer: Vinicius Jose Latorre ;; Keywords: data, wp -;; Version: 12.1 +;; Version: 13.0 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre ;; This file is part of GNU Emacs. @@ -813,7 +813,7 @@ Used when `whitespace-style' includes `indentation', :group 'whitespace) -(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)" +(defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)" "Specify regexp for empty lines at beginning of buffer. If you're using `mule' package, there may be other characters besides: @@ -828,7 +828,7 @@ Used when `whitespace-style' includes `empty'." :group 'whitespace) -(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)\\'" +(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)" "Specify regexp for empty lines at end of buffer. If you're using `mule' package, there may be other characters besides: @@ -1229,6 +1229,19 @@ Used by `whitespace-trailing-regexp' function (which see).") "Used to save locally the font-lock refontify state. Used by `whitespace-post-command-hook' function (which see).") +(defvar whitespace-bob-marker nil + "Used to save locally the bob marker value. +Used by `whitespace-post-command-hook' function (which see).") + +(defvar whitespace-eob-marker nil + "Used to save locally the eob marker value. +Used by `whitespace-post-command-hook' function (which see).") + +(defvar whitespace-buffer-changed nil + "Used to indicate locally if buffer changed. +Used by `whitespace-post-command-hook' and `whitespace-buffer-changed' +functions (which see).") + ;;;###autoload (defun whitespace-toggle-options (arg) @@ -1464,10 +1477,10 @@ documentation." (let (overwrite-mode) ; enforce no overwrite (goto-char (point-min)) (when (re-search-forward - whitespace-empty-at-bob-regexp nil t) + (concat "\\`" whitespace-empty-at-bob-regexp) nil t) (delete-region (match-beginning 1) (match-end 1))) (when (re-search-forward - whitespace-empty-at-eob-regexp nil t) + (concat whitespace-empty-at-eob-regexp "\\'") nil t) (delete-region (match-beginning 1) (match-end 1))))))) ;; PROBLEM 3: 8 or more SPACEs at bol ;; PROBLEM 4: SPACEs before TAB @@ -2147,8 +2160,15 @@ resultant list will be returned." (set (make-local-variable 'whitespace-point) (point)) (set (make-local-variable 'whitespace-font-lock-refontify) + 0) + (set (make-local-variable 'whitespace-bob-marker) + (point-min-marker)) + (set (make-local-variable 'whitespace-eob-marker) + (point-max-marker)) + (set (make-local-variable 'whitespace-buffer-changed) nil) (add-hook 'post-command-hook #'whitespace-post-command-hook nil t) + (add-hook 'before-change-functions #'whitespace-buffer-changed nil t) ;; turn off font lock (set (make-local-variable 'whitespace-font-lock-mode) font-lock-mode) @@ -2159,7 +2179,7 @@ resultant list will be returned." nil (list ;; Show SPACEs - (list #'whitespace-space-regexp 1 whitespace-space t) + (list whitespace-space-regexp 1 whitespace-space t) ;; Show HARD SPACEs (list whitespace-hspace-regexp 1 whitespace-hspace t)) t)) @@ -2168,7 +2188,7 @@ resultant list will be returned." nil (list ;; Show TABs - (list #'whitespace-tab-regexp 1 whitespace-tab t)) + (list whitespace-tab-regexp 1 whitespace-tab t)) t)) (when (memq 'trailing whitespace-active-style) (font-lock-add-keywords @@ -2298,6 +2318,7 @@ resultant list will be returned." (when (whitespace-style-face-p) (font-lock-mode 0) (remove-hook 'post-command-hook #'whitespace-post-command-hook t) + (remove-hook 'before-change-functions #'whitespace-buffer-changed t) (when whitespace-font-lock (setq whitespace-font-lock nil font-lock-keywords whitespace-font-lock-keywords)) @@ -2318,37 +2339,128 @@ resultant list will be returned." (defun whitespace-empty-at-bob-regexp (limit) "Match spaces at beginning of buffer which do not contain the point at \ beginning of buffer." - (and (/= whitespace-point 1) - (re-search-forward whitespace-empty-at-bob-regexp limit t))) + (let ((b (point)) + r) + (cond + ;; at bob + ((= b 1) + (setq r (and (/= whitespace-point 1) + (looking-at whitespace-empty-at-bob-regexp))) + (if r + (set-marker whitespace-bob-marker (match-end 1)) + (set-marker whitespace-bob-marker b))) + ;; inside bob empty region + ((<= limit whitespace-bob-marker) + (setq r (looking-at whitespace-empty-at-bob-regexp)) + (if r + (when (< (match-end 1) limit) + (set-marker whitespace-bob-marker (match-end 1))) + (set-marker whitespace-bob-marker b))) + ;; intersection with end of bob empty region + ((<= b whitespace-bob-marker) + (setq r (looking-at whitespace-empty-at-bob-regexp)) + (if r + (set-marker whitespace-bob-marker (match-end 1)) + (set-marker whitespace-bob-marker b))) + ;; it is not inside bob empty region + (t + (setq r nil))) + ;; move to end of matching + (and r (goto-char (match-end 1))) + r)) + + +(defsubst whitespace-looking-back (regexp limit) + (save-excursion + (when (/= 0 (skip-chars-backward " \t\n" limit)) + (unless (bolp) + (forward-line 1)) + (looking-at regexp)))) (defun whitespace-empty-at-eob-regexp (limit) "Match spaces at end of buffer which do not contain the point at end of \ buffer." - (and (/= whitespace-point (1+ (buffer-size))) - (re-search-forward whitespace-empty-at-eob-regexp limit t))) + (let ((b (point)) + (e (1+ (buffer-size))) + r) + (cond + ;; at eob + ((= limit e) + (when (/= whitespace-point e) + (goto-char limit) + (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b))) + (if r + (set-marker whitespace-eob-marker (match-beginning 1)) + (set-marker whitespace-eob-marker limit) + (goto-char b))) ; return back to initial position + ;; inside eob empty region + ((>= b whitespace-eob-marker) + (goto-char limit) + (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b)) + (if r + (when (> (match-beginning 1) b) + (set-marker whitespace-eob-marker (match-beginning 1))) + (set-marker whitespace-eob-marker limit) + (goto-char b))) ; return back to initial position + ;; intersection with beginning of eob empty region + ((>= limit whitespace-eob-marker) + (goto-char limit) + (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b)) + (if r + (set-marker whitespace-eob-marker (match-beginning 1)) + (set-marker whitespace-eob-marker limit) + (goto-char b))) ; return back to initial position + ;; it is not inside eob empty region + (t + (setq r nil))) + r)) -(defun whitespace-space-regexp (limit) - "Match spaces." - (setq whitespace-font-lock-refontify t) - (re-search-forward whitespace-space-regexp limit t)) - - -(defun whitespace-tab-regexp (limit) - "Match tabs." - (setq whitespace-font-lock-refontify t) - (re-search-forward whitespace-tab-regexp limit t)) +(defun whitespace-buffer-changed (beg end) + "Set `whitespace-buffer-changed' variable to t." + (setq whitespace-buffer-changed t)) (defun whitespace-post-command-hook () "Save current point into `whitespace-point' variable. Also refontify when necessary." - (setq whitespace-point (point)) - (let ((refontify (or (eolp) ; end of line - (= whitespace-point 1)))) ; beginning of buffer - (when (or whitespace-font-lock-refontify refontify) - (setq whitespace-font-lock-refontify refontify) + (setq whitespace-point (point)) ; current point position + (let ((refontify + (or + ;; it is at end of line ... + (and (eolp) + ;; ... with trailing SPACE or TAB + (or (= (preceding-char) ?\ ) + (= (preceding-char) ?\t))) + ;; it is at beginning of buffer (bob) + (= whitespace-point 1) + ;; the buffer was modified and ... + (and whitespace-buffer-changed + (or + ;; ... or inside bob whitespace region + (<= whitespace-point whitespace-bob-marker) + ;; ... or at bob whitespace region border + (and (= whitespace-point (1+ whitespace-bob-marker)) + (= (preceding-char) ?\n)))) + ;; it is at end of buffer (eob) + (= whitespace-point (1+ (buffer-size))) + ;; the buffer was modified and ... + (and whitespace-buffer-changed + (or + ;; ... or inside eob whitespace region + (>= whitespace-point whitespace-eob-marker) + ;; ... or at eob whitespace region border + (and (= whitespace-point (1- whitespace-eob-marker)) + (= (following-char) ?\n))))))) + (when (or refontify (> whitespace-font-lock-refontify 0)) + (setq whitespace-buffer-changed nil) + ;; adjust refontify counter + (setq whitespace-font-lock-refontify + (if refontify + 1 + (1- whitespace-font-lock-refontify))) + ;; refontify (jit-lock-refontify)))) @@ -2387,11 +2499,11 @@ Also refontify when necessary." (unless whitespace-display-table-was-local (setq whitespace-display-table-was-local t whitespace-display-table + (copy-sequence buffer-display-table)) + ;; asure `buffer-display-table' is unique + ;; when two or more windows are visible. + (setq buffer-display-table (copy-sequence buffer-display-table))) - ;; asure `buffer-display-table' is unique - ;; when two or more windows are visible. - (set (make-local-variable 'buffer-display-table) - (copy-sequence buffer-display-table)) (unless buffer-display-table (setq buffer-display-table (make-display-table))) (dolist (entry whitespace-display-mappings) From a7ebc409279c0d41ad60655d360d6c3c04ae77a1 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sun, 22 Aug 2010 08:14:37 -0700 Subject: [PATCH 079/101] Simplify termio code. All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so HAVE_TERMIO code is obsolete. Replace HAVE_TERMIOS conditionals with !DOS_NT. * src/systty.h: Do not define HAVE_TCATTR. Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code. Do not define EMACS_HAVE_TTY_PGRP. Only define EMACS_GET_TTY_PGRP for !DOS_NT. * src/sysdep.c: Include sysselect.h unconditionally. Do not include sys/ioctl.h and termios.h, systty.h does it. Use HAVE_SYS_UTSNAME_H instead of USG as an include guard. (init_baud_rate): Remove HAVE_TERMIO code. (child_setup_tty): Remove HAVE_TERMIO code. (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. (new_ltchars, new_tchars): Remove, unused. (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS code. Remove special casing for __mips__, it was a no-op. Remove HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. (init_sys_modes): Remove HPUX special case. * src/process.c: Include stdlib.h unconditionally. Do not include fcntl.h, systty.h does it. Remove conditional code for HAVE_SERIAL, it is always true. (process_send_signal): Remove HAVE_TERMIOS conditional, it's always true when SIGNALS_VIA_CHARACTERS is true. (Fcontinue_process, Fprocess_send_eof): Simplify conditionals: !WINDOWSNT means HAVE_TERMIOS. (create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS conditional, which is true for all HAVE_TERMIOS systems. * src/keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT instead of HAVE_TERMIOS. * src/emacs.c (shut_down_emacs): Use !defined DOS_NT instead of EMACS_HAVE_TTY_PGRP. * src/callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the non-MSDOS, non-WINDOWSNT code, it's only defined for such systems anyway. --- src/ChangeLog | 39 +++++++++++ src/callproc.c | 5 +- src/emacs.c | 2 +- src/keyboard.c | 4 +- src/process.c | 89 ++---------------------- src/sysdep.c | 180 +++---------------------------------------------- src/systty.h | 124 +++------------------------------- 7 files changed, 72 insertions(+), 371 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 403a588df4c..782c87642ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,42 @@ +2010-08-22 Dan Nicolaescu + + Simplify termio code. + All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so + HAVE_TERMIO code is obsolete. + Replace HAVE_TERMIOS conditionals with !DOS_NT. + * systty.h: Do not define HAVE_TCATTR. + Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code. + Do not define EMACS_HAVE_TTY_PGRP. Only define + EMACS_GET_TTY_PGRP for !DOS_NT. + * sysdep.c: Include sysselect.h unconditionally. Do not include + sys/ioctl.h and termios.h, systty.h does it. Use + HAVE_SYS_UTSNAME_H instead of USG as an include guard. + (init_baud_rate): Remove HAVE_TERMIO code. + (child_setup_tty): Remove HAVE_TERMIO code. + (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS + and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. + (new_ltchars, new_tchars): Remove, unused. + (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS + code. Remove special casing for __mips__, it was a no-op. Remove + HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. + (init_sys_modes): Remove HPUX special case. + * process.c: Include stdlib.h unconditionally. Do not include + fcntl.h, systty.h does it. Remove conditional code for + HAVE_SERIAL, it is always true. + (process_send_signal): Remove HAVE_TERMIOS conditional, it's + always true when SIGNALS_VIA_CHARACTERS is true. + (Fcontinue_process, Fprocess_send_eof): Simplify conditionals: + !WINDOWSNT means HAVE_TERMIOS. + (create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS + conditional, which is true for all HAVE_TERMIOS systems. + * keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT + instead of HAVE_TERMIOS. + * emacs.c (shut_down_emacs): Use !defined DOS_NT instead of + EMACS_HAVE_TTY_PGRP. + * callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the + non-MSDOS, non-WINDOWSNT code, it's only defined for such systems + anyway. + 2010-08-21 Eli Zaretskii * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in diff --git a/src/callproc.c b/src/callproc.c index de28ffa42ef..8c1384df6a1 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1231,8 +1231,6 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L #else setpgrp (pid, pid); #endif /* USG */ - /* setpgrp_of_tty is incorrect here; it uses input_fd. */ - EMACS_SET_TTY_PGRP (0, &pid); #ifdef MSDOS pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); @@ -1251,6 +1249,9 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L report_file_error ("Spawning child process", Qnil); return cpid; #else /* not WINDOWSNT */ + /* setpgrp_of_tty is incorrect here; it uses input_fd. */ + EMACS_SET_TTY_PGRP (0, &pid); + /* execvp does not accept an environment arg so the only way to pass this environment is to set environ. Our caller is responsible for restoring the ambient value of environ. */ diff --git a/src/emacs.c b/src/emacs.c index 67a99d674e7..dc1453a34ac 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2096,7 +2096,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) Vinhibit_redisplay = Qt; /* If we are controlling the terminal, reset terminal modes. */ -#ifdef EMACS_HAVE_TTY_PGRP +#ifndef DOS_NT { int pgrp = EMACS_GETPGRP (0); diff --git a/src/keyboard.c b/src/keyboard.c index 2fd13c4ae24..269e52988eb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11506,11 +11506,11 @@ init_keyboard (void) Emacs on SIGINT when there are no termcap frames on the controlling terminal. */ signal (SIGINT, interrupt_signal); -#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) +#ifndef DOS_NT /* For systems with SysV TERMIO, C-g is set up for both SIGINT and SIGQUIT and we can't tell which one it will give us. */ signal (SIGQUIT, interrupt_signal); -#endif /* HAVE_TERMIO */ +#endif /* not DOS_NT */ } /* Note SIGIO has been undef'd if FIONREAD is missing. */ #ifdef SIGIO diff --git a/src/process.c b/src/process.c index 4a658623077..f348dca7d35 100644 --- a/src/process.c +++ b/src/process.c @@ -31,9 +31,7 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_INTTYPES_H #include #endif -#ifdef STDC_HEADERS #include -#endif #ifdef HAVE_UNISTD_H #include @@ -61,9 +59,6 @@ along with GNU Emacs. If not, see . */ #if defined(HAVE_SYS_IOCTL_H) #include -#if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5) -#include -#endif /* HAVE_PTYS and no O_NDELAY */ #if defined(HAVE_NET_IF_H) #include #endif /* HAVE_NET_IF_H */ @@ -182,16 +177,9 @@ extern Lisp_Object QCfilter; extern const char *get_operating_system_release (void); -/* Serial processes require termios or Windows. */ -#if defined (HAVE_TERMIOS) || defined (WINDOWSNT) -#define HAVE_SERIAL -#endif - -#ifdef HAVE_SERIAL /* From sysdep.c or w32.c */ extern int serial_open (char *port); extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); -#endif #ifndef HAVE_H_ERRNO extern int h_errno; @@ -1903,7 +1891,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) setpgrp (); #endif /* USG */ #endif /* not HAVE_SETSID */ -#if defined (HAVE_TERMIOS) && defined (LDISC1) +#if defined (LDISC1) if (pty_flag && xforkin >= 0) { struct termios t; @@ -2569,7 +2557,6 @@ OPTION is not a supported option, return nil instead; otherwise return t. */) } -#ifdef HAVE_SERIAL DEFUN ("serial-process-configure", Fserial_process_configure, Sserial_process_configure, @@ -2865,7 +2852,6 @@ usage: (make-serial-process &rest ARGS) */) UNGCPRO; return proc; } -#endif /* HAVE_SERIAL */ /* Create a network stream/datagram client/server process. Treated exactly like a normal process when reading and writing. Primary @@ -5801,9 +5787,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, /* If possible, send signals to the entire pgrp by sending an input character to it. */ - /* TERMIOS is the latest and bestest, and seems most likely to - work. If the system has it, use it. */ -#ifdef HAVE_TERMIOS struct termios t; cc_t *sig_char = NULL; @@ -5835,65 +5818,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, } /* If we can't send the signal with a character, fall through and send it another way. */ -#else /* ! HAVE_TERMIOS */ - - /* On Berkeley descendants, the following IOCTL's retrieve the - current control characters. */ -#if defined (TIOCGLTC) && defined (TIOCGETC) - - struct tchars c; - struct ltchars lc; - - switch (signo) - { - case SIGINT: - ioctl (p->infd, TIOCGETC, &c); - send_process (proc, &c.t_intrc, 1, Qnil); - return; - case SIGQUIT: - ioctl (p->infd, TIOCGETC, &c); - send_process (proc, &c.t_quitc, 1, Qnil); - return; -#ifdef SIGTSTP - case SIGTSTP: - ioctl (p->infd, TIOCGLTC, &lc); - send_process (proc, &lc.t_suspc, 1, Qnil); - return; -#endif /* ! defined (SIGTSTP) */ - } - -#else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ - - /* On SYSV descendants, the TCGETA ioctl retrieves the current control - characters. */ -#ifdef TCGETA - struct termio t; - switch (signo) - { - case SIGINT: - ioctl (p->infd, TCGETA, &t); - send_process (proc, &t.c_cc[VINTR], 1, Qnil); - return; - case SIGQUIT: - ioctl (p->infd, TCGETA, &t); - send_process (proc, &t.c_cc[VQUIT], 1, Qnil); - return; -#ifdef SIGTSTP - case SIGTSTP: - ioctl (p->infd, TCGETA, &t); - send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); - return; -#endif /* ! defined (SIGTSTP) */ - } -#else /* ! defined (TCGETA) */ - Your configuration files are messed up. - /* If your system configuration files define SIGNALS_VIA_CHARACTERS, - you'd better be using one of the alternatives above! */ -#endif /* ! defined (TCGETA) */ -#endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ - /* In this case, the code above should alway return. */ - abort (); -#endif /* ! defined HAVE_TERMIOS */ /* The code above may fall through if it can't handle the signal. */ @@ -6065,10 +5989,9 @@ traffic. */) #ifdef WINDOWSNT if (fd_info[ p->infd ].flags & FILE_SERIAL) PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); -#endif -#ifdef HAVE_TERMIOS +#else /* not WINDOWSNT */ tcflush (p->infd, TCIFLUSH); -#endif +#endif /* not WINDOWSNT */ } p->command = Qnil; return process; @@ -6282,10 +6205,10 @@ process has been transmitted to the serial port. */) send_process (proc, "\004", 1, Qnil); else if (EQ (XPROCESS (proc)->type, Qserial)) { -#ifdef HAVE_TERMIOS +#ifndef WINDOWSNT if (tcdrain (XPROCESS (proc)->outfd) != 0) error ("tcdrain() failed: %s", emacs_strerror (errno)); -#endif +#endif /* not WINDOWSNT */ /* Do nothing on Windows because writes are blocking. */ } else @@ -7672,10 +7595,8 @@ The variable takes effect when `start-process' is called. */); defsubr (&Slist_processes); defsubr (&Sprocess_list); defsubr (&Sstart_process); -#ifdef HAVE_SERIAL defsubr (&Sserial_process_configure); defsubr (&Smake_serial_process); -#endif /* HAVE_SERIAL */ defsubr (&Sset_network_process_option); defsubr (&Smake_network_process); defsubr (&Sformat_network_address); diff --git a/src/sysdep.c b/src/sysdep.c index 2ae3c509522..e7d35d46bf7 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -35,15 +35,7 @@ along with GNU Emacs. If not, see . */ #endif #include "lisp.h" -/* Including stdlib.h isn't necessarily enough to get srandom - declared, e.g. without __USE_XOPEN_EXTENDED with glibc 2. */ - -/* The w32 build defines select stuff in w32.h, which is included by - sys/select.h (included below). */ -#ifndef WINDOWSNT #include "sysselect.h" -#endif - #include "blockinput.h" #ifdef WINDOWSNT @@ -84,17 +76,13 @@ along with GNU Emacs. If not, see . */ #include #endif -#ifndef MSDOS -#include -#endif - #include "systty.h" #include "syswait.h" -#if defined (USG) +#ifdef HAVE_SYS_UTSNAME_H #include #include -#endif /* USG */ +#endif /* HAVE_SYS_UTSNAME_H */ #include "keyboard.h" #include "frame.h" @@ -149,17 +137,6 @@ static const int baud_convert[] = 1800, 2400, 4800, 9600, 19200, 38400 }; -#ifdef HAVE_SPEED_T -#include -#else -#if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T) -#else -#if defined (HAVE_TERMIOS_H) && defined (GNU_LINUX) -#include -#endif -#endif -#endif - int emacs_ospeed; void croak (char *) NO_RETURN; @@ -308,32 +285,11 @@ init_baud_rate (int fd) #ifdef DOS_NT emacs_ospeed = 15; #else /* not DOS_NT */ -#ifdef HAVE_TERMIOS struct termios sg; sg.c_cflag = B9600; tcgetattr (fd, &sg); emacs_ospeed = cfgetospeed (&sg); -#else /* not TERMIOS */ -#ifdef HAVE_TERMIO - struct termio sg; - - sg.c_cflag = B9600; -#ifdef HAVE_TCATTR - tcgetattr (fd, &sg); -#else - ioctl (fd, TCGETA, &sg); -#endif - emacs_ospeed = sg.c_cflag & CBAUD; -#else /* neither TERMIOS nor TERMIO */ - struct sgttyb sg; - - sg.sg_ospeed = B9600; - if (ioctl (fd, TIOCGETP, &sg) < 0) - abort (); - emacs_ospeed = sg.sg_ospeed; -#endif /* not HAVE_TERMIO */ -#endif /* not HAVE_TERMIOS */ #endif /* not DOS_NT */ } @@ -417,7 +373,7 @@ wait_for_termination (int pid) void flush_pending_output (int channel) { -#ifdef HAVE_TERMIOS +#ifndef DOS_NT /* If we try this, we get hit with SIGTTIN, because the child's tty belongs to the child's pgrp. */ #else @@ -447,8 +403,6 @@ child_setup_tty (int out) struct emacs_tty s; EMACS_GET_TTY (out, &s); - -#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) s.main.c_oflag |= OPOST; /* Enable output postprocessing */ s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ #ifdef NLDLY @@ -526,19 +480,7 @@ child_setup_tty (int out) s.main.c_cc[VTIME] = 0; #endif -#else /* not HAVE_TERMIO */ - - s.main.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE - | CBREAK | TANDEM); - s.main.sg_flags |= LPASS8; - s.main.sg_erase = 0377; - s.main.sg_kill = 0377; - s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */ - -#endif /* not HAVE_TERMIO */ - EMACS_SET_TTY (out, &s, 0); - #endif /* not WINDOWSNT */ } #endif /* MSDOS */ @@ -841,38 +783,11 @@ int emacs_get_tty (int fd, struct emacs_tty *settings) { /* Retrieve the primary parameters - baud rate, character size, etcetera. */ -#ifdef HAVE_TCATTR +#ifndef DOS_NT /* We have those nifty POSIX tcmumbleattr functions. */ memset (&settings->main, 0, sizeof (settings->main)); if (tcgetattr (fd, &settings->main) < 0) return -1; - -#else -#ifdef HAVE_TERMIO - /* The SYSV-style interface? */ - if (ioctl (fd, TCGETA, &settings->main) < 0) - return -1; - -#else -#ifndef DOS_NT - /* I give up - I hope you have the BSD ioctls. */ - if (ioctl (fd, TIOCGETP, &settings->main) < 0) - return -1; -#endif /* not DOS_NT */ -#endif -#endif - - /* Suivant - Do we have to get struct ltchars data? */ -#ifdef HAVE_LTCHARS - if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0) - return -1; -#endif - - /* How about a struct tchars and a wordful of lmode bits? */ -#ifdef HAVE_TCHARS - if (ioctl (fd, TIOCGETC, &settings->tchars) < 0 - || ioctl (fd, TIOCLGET, &settings->lmode) < 0) - return -1; #endif /* We have survived the tempest. */ @@ -888,7 +803,7 @@ int emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) { /* Set the primary parameters - baud rate, character size, etcetera. */ -#ifdef HAVE_TCATTR +#ifndef DOS_NT int i; /* We have those nifty POSIX tcmumbleattr functions. William J. Smith writes: @@ -926,34 +841,6 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) else continue; } - -#else -#ifdef HAVE_TERMIO - /* The SYSV-style interface? */ - if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0) - return -1; - -#else -#ifndef DOS_NT - /* I give up - I hope you have the BSD ioctls. */ - if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0) - return -1; -#endif /* not DOS_NT */ - -#endif -#endif - - /* Suivant - Do we have to get struct ltchars data? */ -#ifdef HAVE_LTCHARS - if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0) - return -1; -#endif - - /* How about a struct tchars and a wordful of lmode bits? */ -#ifdef HAVE_TCHARS - if (ioctl (fd, TIOCSETC, &settings->tchars) < 0 - || ioctl (fd, TIOCLSET, &settings->lmode) < 0) - return -1; #endif /* We have survived the tempest. */ @@ -976,13 +863,6 @@ unsigned char _sobuf[BUFSIZ+8]; char _sobuf[BUFSIZ]; #endif -#ifdef HAVE_LTCHARS -static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1}; -#endif -#ifdef HAVE_TCHARS -static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1}; -#endif - /* Initialize the terminal mode on all tty devices that are currently open. */ @@ -1016,7 +896,7 @@ init_sys_modes (struct tty_display_info *tty_out) tty = *tty_out->old_tty; -#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) +#if !defined (DOS_NT) XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ @@ -1088,12 +968,11 @@ init_sys_modes (struct tty_display_info *tty_out) of C-z */ #endif /* VSWTCH */ -#if defined (__mips__) || defined (HAVE_TCATTR) #ifdef VSUSP - tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ + tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off handling of C-z. */ #endif /* VSUSP */ #ifdef V_DSUSP - tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ + tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off handling of C-y. */ #endif /* V_DSUSP */ #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ tty.main.c_cc[VDSUSP] = CDISABLE; @@ -1129,7 +1008,6 @@ init_sys_modes (struct tty_display_info *tty_out) tty.main.c_cc[VSTOP] = CDISABLE; #endif /* VSTOP */ } -#endif /* mips or HAVE_TCATTR */ #ifdef AIX tty.main.c_cc[VSTRT] = CDISABLE; @@ -1152,41 +1030,8 @@ init_sys_modes (struct tty_display_info *tty_out) tty.main.c_iflag &= ~IGNBRK; tty.main.c_iflag &= ~BRKINT; #endif -#else /* if not HAVE_TERMIO */ -#ifndef DOS_NT - XSETINT (Vtty_erase_char, tty.main.sg_erase); - tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); - if (meta_key) - tty.main.sg_flags |= ANYP; - tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; #endif /* not DOS_NT */ -#endif /* not HAVE_TERMIO */ - /* If going to use CBREAK mode, we must request C-g to interrupt - and turn off start and stop chars, etc. If not going to use - CBREAK mode, do this anyway so as to turn off local flow - control for user coming over network on 4.2; in this case, - only t_stopc and t_startc really matter. */ -#ifndef HAVE_TERMIO -#ifdef HAVE_TCHARS - /* Note: if not using CBREAK mode, it makes no difference how we - set this */ - tty.tchars = new_tchars; - tty.tchars.t_intrc = quit_char; - if (tty_out->flow_control) - { - tty.tchars.t_startc = '\021'; - tty.tchars.t_stopc = '\023'; - } - - tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; - -#endif /* HAVE_TCHARS */ -#endif /* not HAVE_TERMIO */ - -#ifdef HAVE_LTCHARS - tty.ltchars = new_ltchars; -#endif /* HAVE_LTCHARS */ #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ if (!tty_out->term_initted) internal_terminal_init (); @@ -1205,7 +1050,7 @@ init_sys_modes (struct tty_display_info *tty_out) if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0); #endif -#if defined (HAVE_TERMIOS) || defined (HPUX) +#if !defined (DOS_NT) #ifdef TCOON if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON); #endif @@ -2688,7 +2533,7 @@ strsignal (int code) } #endif /* HAVE_STRSIGNAL */ -#ifdef HAVE_TERMIOS +#ifndef DOS_NT /* For make-serial-process */ int serial_open (char *port) @@ -2717,9 +2562,6 @@ serial_open (char *port) return fd; } -#endif /* TERMIOS */ - -#ifdef HAVE_TERMIOS #if !defined (HAVE_CFMAKERAW) /* Workaround for targets which are missing cfmakeraw. */ @@ -2906,7 +2748,7 @@ serial_configure (struct Lisp_Process *p, p->childp = childp2; } -#endif /* TERMIOS */ +#endif /* not DOS_NT */ /* System depended enumeration of and access to system processes a-la ps(1). */ diff --git a/src/systty.h b/src/systty.h index 39feef9c3d0..8c46411cedb 100644 --- a/src/systty.h +++ b/src/systty.h @@ -17,34 +17,17 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -#ifdef HAVE_TERMIOS -#define HAVE_TCATTR -#endif - - /* Include the proper files. */ -#ifdef HAVE_TERMIO +#ifndef DOS_NT #ifndef NO_TERMIO #include #endif /* not NO_TERMIO */ -#include -#else /* not HAVE_TERMIO */ -#ifdef HAVE_TERMIOS -#ifndef NO_TERMIO -#include -#endif #include #include -#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ -#ifndef DOS_NT -#include #endif /* not DOS_NT */ -#endif /* not HAVE_TERMIOS */ -#endif /* not HAVE_TERMIO */ -#ifdef __GNU_LIBRARY__ +#ifdef HAVE_SYS_IOCTL_H #include -#include #endif #ifdef HPUX @@ -74,17 +57,6 @@ along with GNU Emacs. If not, see . */ #undef SIGIO #endif -/* On TERMIOS systems, the tcmumbleattr calls take care of these - parameters, and it's a bad idea to use them (on AIX, it makes the - tty hang for a long time). */ -#if defined (TIOCGLTC) && !defined (HAVE_TERMIOS) -#define HAVE_LTCHARS -#endif - -#if defined (TIOCGETC) && !defined (HAVE_TERMIOS) -#define HAVE_TCHARS -#endif - /* Try to establish the correct character to disable terminal functions in a system-independent manner. Note that USG (at least) define @@ -111,60 +83,19 @@ along with GNU Emacs. If not, see . */ #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) #endif -#ifdef HAVE_TERMIO -#ifdef TCOUTQ -#undef EMACS_OUTQSIZE -#define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size))) -#endif -#endif - /* Manipulate a terminal's current process group. */ -/* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current - controlling process group. - - EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's +/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's current process group. Return -1 if there is an error. EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's current process group to *PGID. Return -1 if there is an error. */ -/* HPUX tty process group stuff doesn't work, says the anonymous voice - from the past. */ -#ifndef HPUX -#ifdef TIOCGPGRP -#define EMACS_HAVE_TTY_PGRP -#else -#ifdef HAVE_TERMIOS -#define EMACS_HAVE_TTY_PGRP -#endif /* HAVE_TERMIOS */ -#endif /* TIOCGPGRP */ -#endif /* not HPUX */ - -#ifdef EMACS_HAVE_TTY_PGRP - -#if defined (HAVE_TERMIOS) - +#ifndef DOS_NT #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) - -#else /* not HAVE_TERMIOS */ -#ifdef TIOCSPGRP - -#define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) -#define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) - -#endif /* TIOCSPGRP */ -#endif /* HAVE_TERMIOS */ - -#else /* not EMACS_SET_TTY_PGRP */ - -/* Just ignore this for now and hope for the best */ -#define EMACS_GET_TTY_PGRP(fd, pgid) 0 -#define EMACS_SET_TTY_PGRP(fd, pgif) 0 - -#endif /* not EMACS_SET_TTY_PGRP */ +#endif /* not DOS_NT */ /* EMACS_GETPGRP (arg) returns the process group of the process. */ @@ -207,32 +138,11 @@ struct emacs_tty { /* There is always one of the following elements, so there is no need for dummy get and set definitions. */ -#ifdef HAVE_TCATTR +#ifndef DOS_NT struct termios main; -#else /* not HAVE_TCATTR */ -#ifdef HAVE_TERMIO - struct termio main; -#else /* not HAVE_TERMIO */ -#ifdef DOS_NT +#else /* DOS_NT */ int main; -#else /* not DOS_NT */ - struct sgttyb main; -#endif /* not DOS_NT */ -#endif /* not HAVE_TERMIO */ -#endif /* not HAVE_TCATTR */ - -/* If we have TERMIOS, we don't need to do this - they're taken care of - by the tc*attr calls. */ -#ifndef HAVE_TERMIOS -#ifdef HAVE_LTCHARS - struct ltchars ltchars; -#endif /* HAVE_LTCHARS */ - -#ifdef HAVE_TCHARS - struct tchars tchars; - int lmode; -#endif /* HAVE_TCHARS */ -#endif /* not defined HAVE_TERMIOS */ +#endif /* DOS_NT */ }; /* Define EMACS_GET_TTY and EMACS_SET_TTY, @@ -249,7 +159,7 @@ extern int emacs_set_tty (int, struct emacs_tty *, int); /* Define EMACS_TTY_TABS_OK. */ -#ifdef HAVE_TERMIOS +#ifndef DOS_NT #ifdef TABDLY #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) @@ -257,21 +167,9 @@ extern int emacs_set_tty (int, struct emacs_tty *, int); #define EMACS_TTY_TABS_OK(p) 1 #endif /* not TABDLY */ -#else /* not def HAVE_TERMIOS */ -#ifdef HAVE_TERMIO - -#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) - -#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ - -#ifdef DOS_NT +#else /* DOS_NT */ #define EMACS_TTY_TABS_OK(p) 0 -#else /* not DOS_NT */ -#define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) -#endif /* not DOS_NT */ - -#endif /* not def HAVE_TERMIO */ -#endif /* not def HAVE_TERMIOS */ +#endif /* DOS_NT */ /* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 (do not change this comment) */ From 5f2f0bc11ecabcbc3867b73577c9b29d3b229e72 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 22 Aug 2010 18:37:01 +0300 Subject: [PATCH 080/101] Clean up unexcoff.c. unexcoff.c (report_error, make_hdr, write_segment) (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec): Convert argument lists and prototypes to ANSI C. (make_hdr, write_segment): Remove unused variables. (unexec): Remove commented-out line. Initialize `new' to shut up compiler warnings. --- src/ChangeLog | 9 +++++++ src/unexcoff.c | 64 +++++++++++++++++++------------------------------- 2 files changed, 33 insertions(+), 40 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 403a588df4c..08ad83ba107 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-08-22 Eli Zaretskii + + * unexcoff.c (report_error, make_hdr, write_segment) + (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec): + Convert argument lists and prototypes to ANSI C. + (make_hdr, write_segment): Remove unused variables. + (unexec): Remove commented-out line. Initialize `new' to shut up + compiler warnings. + 2010-08-21 Eli Zaretskii * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in diff --git a/src/unexcoff.c b/src/unexcoff.c index 3e9786348c3..cb4b8d603b5 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c @@ -84,6 +84,7 @@ along with GNU Emacs. If not, see . */ #ifdef MSDOS #include /* for O_RDONLY, O_RDWR */ #include /* for _crt0_startup_flags and its bits */ +#include static int save_djgpp_startup_flags; #define filehdr external_filehdr #define scnhdr external_scnhdr @@ -128,7 +129,7 @@ struct aouthdr #endif -extern char *start_of_data (); /* Start of initialized data */ +extern char *start_of_data (void); /* Start of initialized data */ static long block_copy_start; /* Old executable start point */ static struct filehdr f_hdr; /* File header */ @@ -153,10 +154,8 @@ static int pagemask; #include #include "lisp.h" -static -report_error (file, fd) - char *file; - int fd; +static void +report_error (const char *file, int fd) { if (fd) close (fd); @@ -167,20 +166,18 @@ report_error (file, fd) #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 -static -report_error_1 (fd, msg, a1, a2) - int fd; - char *msg; - int a1, a2; +static void +report_error_1 (int fd, const char *msg, int a1, int a2) { close (fd); error (msg, a1, a2); } -static int make_hdr (); -static int copy_text_and_data (); -static int copy_sym (); -static void mark_x (); +static int make_hdr (int, int, unsigned, unsigned, unsigned, + const char *, const char *); +static int copy_text_and_data (int, int); +static int copy_sym (int, int, const char *, const char *); +static void mark_x (const char *); /* **************************************************************** * make_hdr @@ -189,13 +186,9 @@ static void mark_x (); * Modify the text and data sizes. */ static int -make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) - int new, a_out; - unsigned data_start, bss_start, entry_address; - char *a_name; - char *new_name; +make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, + unsigned entry_address, const char *a_name, const char *new_name) { - int tem; auto struct scnhdr f_thdr; /* Text section header */ auto struct scnhdr f_dhdr; /* Data section header */ auto struct scnhdr f_bhdr; /* Bss section header */ @@ -363,12 +356,10 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) } -write_segment (new, ptr, end) - int new; - register char *ptr, *end; +void +write_segment (int new, const char *ptr, const char *end) { register int i, nwrite, ret; - char buf[80]; /* This is the normal amount to write at once. It is the size of block that NFS uses. */ int writesize = 1 << 13; @@ -411,8 +402,7 @@ write_segment (new, ptr, end) * Copy the text and data segments from memory to the new a.out */ static int -copy_text_and_data (new, a_out) - int new, a_out; +copy_text_and_data (int new, int a_out) { register char *end; register char *ptr; @@ -456,9 +446,7 @@ copy_text_and_data (new, a_out) * Copy the relocation information and symbol table from the a.out to the new */ static int -copy_sym (new, a_out, a_name, new_name) - int new, a_out; - char *a_name, *new_name; +copy_sym (int new, int a_out, const char *a_name, const char *new_name) { char page[1024]; int n; @@ -494,8 +482,7 @@ copy_sym (new, a_out, a_name, new_name) * After successfully building the new a.out, mark it executable */ static void -mark_x (name) - char *name; +mark_x (const char *name) { struct stat sbuf; int um; @@ -535,10 +522,8 @@ mark_x (name) a reasonable size buffer. But I don't have time to work on such things, so I am installing it as submitted to me. -- RMS. */ -adjust_lnnoptrs (writedesc, readdesc, new_name) - int writedesc; - int readdesc; - char *new_name; +int +adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name) { register int nsyms; register int new; @@ -585,11 +570,11 @@ adjust_lnnoptrs (writedesc, readdesc, new_name) * * driving logic. */ -unexec (new_name, a_name, data_start, bss_start, entry_address) - char *new_name, *a_name; - unsigned data_start, bss_start, entry_address; +int +unexec (const char *new_name, const char *a_name, + unsigned data_start, unsigned bss_start, unsigned entry_address) { - int new, a_out = -1; + int new = -1, a_out = -1; if (a_name && (a_out = open (a_name, O_RDONLY)) < 0) { @@ -607,7 +592,6 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) ) { close (new); - /* unlink (new_name); /* Failed, unlink new a.out */ return -1; } From a583bbef0ea8fe8bbc12ba93fef83f079e04edaf Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 22 Aug 2010 20:00:08 +0300 Subject: [PATCH 081/101] Fix the w32 build after 2010-08-22T15:14:37Z!dann@ics.uci.edu. sysselect.h [WINDOWSNT]: Don't define the FD_* and select stuff for w32. s/ms-w32.h (HAVE_SYS_TIMEB_H): Don't #undef HAVE_SYS_SELECT_H, it's done in nt/config.nt. makefile.w32-in ($(BLD)/sysdep.$(O)): Depend on sysselect.h. --- src/ChangeLog | 8 ++++++++ src/makefile.w32-in | 1 + src/s/ms-w32.h | 1 - src/sysselect.h | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 86b94e10d90..4add0968b6e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2010-08-22 Eli Zaretskii + * sysselect.h [WINDOWSNT]: Don't define the FD_* and select stuff + for w32. + + * s/ms-w32.h (HAVE_SYS_TIMEB_H): Don't #undef HAVE_SYS_SELECT_H, + it's done in nt/config.nt. + + * makefile.w32-in ($(BLD)/sysdep.$(O)): Depend on sysselect.h. + * unexcoff.c (report_error, make_hdr, write_segment) (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec): Convert argument lists and prototypes to ANSI C. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index fc86ae6cb0c..8d99d6cedfe 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -1357,6 +1357,7 @@ $(BLD)/sysdep.$(O) : \ $(SRC)/frame.h \ $(SRC)/keyboard.h \ $(SRC)/process.h \ + $(SRC)/sysselect.h \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/systty.h \ diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index f61fae57eff..4ae5f32e873 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h @@ -106,7 +106,6 @@ struct sigaction { #define HAVE_SOUND 1 #define LISP_FLOAT_TYPE 1 -#undef HAVE_SYS_SELECT_H #define HAVE_SYS_TIMEB_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_UNISTD_H 1 diff --git a/src/sysselect.h b/src/sysselect.h index ddb3e91f2e3..0c90814390c 100644 --- a/src/sysselect.h +++ b/src/sysselect.h @@ -27,6 +27,10 @@ along with GNU Emacs. If not, see . */ #endif #endif +/* The w32 build defines select stuff in w32.h, which is included + where w32 needs it, but not where sysselect.h is included. The w32 + definitions in w32.h are incompatible with the below. */ +#ifndef WINDOWSNT #ifdef FD_SET #ifdef FD_SETSIZE #define MAXDESC FD_SETSIZE @@ -44,6 +48,7 @@ along with GNU Emacs. If not, see . */ #define FD_ISSET(n, p) (*(p) & (1 << (n))) #define FD_ZERO(p) (*(p) = 0) #endif /* no FD_SET */ +#endif /* not WINDOWSNT */ #if !defined (HAVE_SELECT) #define select sys_select From b613941ba003bbf5024415ac4f8c2a0e12434751 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 22 Aug 2010 20:18:52 +0300 Subject: [PATCH 082/101] Fix dependencies according to 2010-08-22T15:14:37Z!dann@ics.uci.edu. deps.mk (sysdep.o, msdos.o): Depend on sysselect.h. --- src/ChangeLog | 2 ++ src/deps.mk | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4add0968b6e..58941cc39ba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-08-22 Eli Zaretskii + * deps.mk (sysdep.o, msdos.o): Depend on sysselect.h. + * sysselect.h [WINDOWSNT]: Don't define the FD_* and select stuff for w32. diff --git a/src/deps.mk b/src/deps.mk index 8eeed3822d0..d00be96744b 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -142,7 +142,7 @@ mktime.o: mktime.c $(config_h) msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \ termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \ keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h \ - lisp.h $(config_h) + lisp.h sysselect.h $(config_h) nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \ dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \ atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h) @@ -176,7 +176,7 @@ syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \ sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \ frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \ - $(config_h) composite.h + $(config_h) composite.h sysselect.h term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) \ cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ From bc7d7ea63ba9d98b3ecc3b6decf4392a651dcbfb Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 22 Aug 2010 15:30:26 -0400 Subject: [PATCH 083/101] Doc fix for define-minor-mode (Bug#6880). * doc/lispref/modes.texi (Defining Minor Modes): Doc fix (Bug#6880). * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix (Bug#6880). --- doc/lispref/ChangeLog | 4 ++++ doc/lispref/modes.texi | 12 +++++++++--- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/easy-mmode.el | 28 +++++++++++++--------------- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9379301ea4a..399c07d13f5 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2010-08-22 Chong Yidong + + * modes.texi (Defining Minor Modes): Doc fix (Bug#6880). + 2010-08-19 Chong Yidong * objects.texi (Bool-Vector Type): Minor definition tweak (Bug#6878). diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 3953da59b93..12f16b67663 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1411,14 +1411,20 @@ The string @var{lighter} says what to display in the mode line when the mode is enabled; if it is @code{nil}, the mode is not displayed in the mode line. -The optional argument @var{keymap} specifies the keymap for the minor mode. -It can be a variable name, whose value is the keymap, or it can be an alist -specifying bindings in this form: +The optional argument @var{keymap} specifies the keymap for the minor +mode. If non-@code{nil}, it should be a variable name (whose value is +a keymap), a keymap, or an alist of the form @example (@var{key-sequence} . @var{definition}) @end example +@noindent +where each @var{key-sequence} and @var{definition} are arguments +suitable for passing to @code{define-key} (@pxref{Changing Key +Bindings}). If @var{keymap} is a keymap or an alist, this also +defines the variable @code{@var{mode}-map}. + The above three arguments @var{init-value}, @var{lighter}, and @var{keymap} can be (partially) omitted when @var{keyword-args} are used. The @var{keyword-args} consist of keywords followed by diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3905bf6db80..45a7cf2c87e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-22 Chong Yidong + + * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix (Bug#6880). + 2010-08-21 Vinicius Jose Latorre * whitespace.el: Fix slow cursor movement (Bug#6172). Reported by diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 13e08667839..a48816f99c6 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -86,25 +86,23 @@ replacing its case-insensitive matches with the literal string in LIGHTER." ;;;###autoload (defmacro define-minor-mode (mode doc &optional init-value lighter keymap &rest body) "Define a new minor mode MODE. -This function defines the associated control variable MODE, keymap MODE-map, -and toggle command MODE. - +This defines the control variable MODE and the toggle command MODE. DOC is the documentation for the mode toggle command. + Optional INIT-VALUE is the initial value of the mode's variable. Optional LIGHTER is displayed in the modeline when the mode is on. -Optional KEYMAP is the default (defvar) keymap bound to the mode keymap. - If it is a list, it is passed to `easy-mmode-define-keymap' - in order to build a valid keymap. It's generally better to use - a separate MODE-map variable than to use this argument. -The above three arguments can be skipped if keyword arguments are -used (see below). +Optional KEYMAP is the default keymap bound to the mode keymap. + If non-nil, it should be a variable name (whose value is a keymap), + a keymap, or a list of arguments for `easy-mmode-define-keymap'. + If KEYMAP is a keymap or list, this also defines the variable MODE-map. + +BODY contains code to execute each time the mode is enabled or disabled. + It is executed after toggling the mode, and before running MODE-hook. + Before the actual body code, you can write keyword arguments, i.e. + alternating keywords and values. These following special keywords + are supported (other keywords are passed to `defcustom' if the minor + mode is global): -BODY contains code to execute each time the mode is activated or deactivated. - It is executed after toggling the mode, - and before running the hook variable `MODE-hook'. - Before the actual body code, you can write keyword arguments (alternating - keywords and values). These following keyword arguments are supported (other - keywords will be passed to `defcustom' if the minor mode is global): :group GROUP Custom group name to use in all generated `defcustom' forms. Defaults to MODE without the possible trailing \"-mode\". Don't use this default group name unless you have written a From 198a7a97ff99b96523f7c0736aa303d305595094 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 22 Aug 2010 17:15:20 -0400 Subject: [PATCH 084/101] Make obsolete --unibyte argument do nothing (Bug#6886). * src/emacs.c (main): Remove --unibyte handling (Bug#6886). * lisp/startup.el (command-line-1): Issue warning for ignored arguments --unibyte, etc (Bug#6886). * doc/lispref/nonascii.texi (Text Representations): * doc/lispref/loading.texi (Loading Non-ASCII): * doc/lispref/compile.texi (Byte Compilation): Don't mention obsolete --unibyte command-line argument. --- admin/unidata/Makefile.in | 2 +- admin/unidata/makefile.w32-in | 2 +- doc/lispref/ChangeLog | 7 ++++ doc/lispref/compile.texi | 6 ---- doc/lispref/loading.texi | 7 ---- doc/lispref/nonascii.texi | 3 -- etc/NEWS | 4 +++ leim/Makefile.in | 2 +- leim/makefile.w32-in | 2 +- lisp/ChangeLog | 5 +++ lisp/Makefile.in | 5 ++- lisp/international/mule.el | 10 ++---- lisp/makefile.w32-in | 5 ++- lisp/startup.el | 24 ++++++++----- msdos/sedleim.inp | 2 +- src/ChangeLog | 4 +++ src/doc.c | 3 +- src/emacs.c | 66 ----------------------------------- 18 files changed, 47 insertions(+), 112 deletions(-) diff --git a/admin/unidata/Makefile.in b/admin/unidata/Makefile.in index 91a3640fff7..e7b0fbe4bf9 100644 --- a/admin/unidata/Makefile.in +++ b/admin/unidata/Makefile.in @@ -21,7 +21,7 @@ EMACS = ../../src/emacs DSTDIR = ../../lisp/international -RUNEMACS = ${EMACS} -Q --multibyte -batch +RUNEMACS = ${EMACS} -Q -batch all: ${DSTDIR}/charprop.el ../../src/biditype.h ../../src/bidimirror.h diff --git a/admin/unidata/makefile.w32-in b/admin/unidata/makefile.w32-in index 85dfb135df8..58cea29db8b 100644 --- a/admin/unidata/makefile.w32-in +++ b/admin/unidata/makefile.w32-in @@ -27,7 +27,7 @@ lisp = $(CURDIR)/../../lisp # lisp/subdirs.el is not generated yet when the commands below run. EMACSLOADPATH = $(lisp);$(lisp)/international;$(lisp)/emacs-lisp # Quote EMACS so it could be a file name with embedded whitespace -RUNEMACS = "$(EMACS)" -Q --multibyte -batch +RUNEMACS = "$(EMACS)" -Q -batch all: $(DSTDIR)/charprop.el ../../src/biditype.h ../../src/bidimirror.h diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9c09410c849..70b82830b44 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,10 @@ +2010-08-22 Chong Yidong + + * nonascii.texi (Text Representations): + * loading.texi (Loading Non-ASCII): + * compile.texi (Byte Compilation): Don't mention obsolete + --unibyte command-line argument. + 2010-08-22 Chong Yidong * modes.texi (Defining Minor Modes): Doc fix (Bug#6880). diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 1c28664e7c3..69b57f19ea7 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -22,12 +22,6 @@ hardware (as true compiled code is), byte-code is completely transportable from machine to machine without recompilation. It is not, however, as fast as true compiled code. - Compiling a Lisp file with the Emacs byte compiler always reads the -file as multibyte text, even if Emacs was started with @samp{--unibyte}, -unless the file specifies otherwise. This is so that compilation gives -results compatible with running the same file without compilation. -@xref{Loading Non-ASCII}. - In general, any version of Emacs can run byte-compiled code produced by recent earlier versions of Emacs, but the reverse is not true. diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index bbdd67fc3a5..dee2a0252eb 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -367,13 +367,6 @@ example) is read without decoding, the text of the program will be unibyte text, and its string constants will be unibyte strings. @xref{Coding Systems}. - To make the results more predictable, Emacs always performs decoding -into the multibyte representation when loading Lisp files, even if it -was started with the @samp{--unibyte} option. This means that string -constants with non-@acronym{ASCII} characters translate into multibyte -strings. The only exception is when a particular file specifies no -decoding. - The reason Emacs is designed this way is so that Lisp programs give predictable results, regardless of how Emacs was started. In addition, this enables programs that depend on using multibyte text to work even diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index 00a1dffed6a..40c78d97da7 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -102,9 +102,6 @@ it contains unibyte encoded text or binary non-text data. You cannot set this variable directly; instead, use the function @code{set-buffer-multibyte} to change a buffer's representation. - -The @samp{--unibyte} command line option does its job by setting the -default value to @code{nil} early in startup. @end defvar @defun position-bytes position diff --git a/etc/NEWS b/etc/NEWS index 0df0d20dbac..d46d5cc8279 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -59,6 +59,10 @@ automatically select it. * Startup Changes in Emacs 24.1 +** The --unibyte, --multibyte, --no-multibyte, and --no-unibyte +command line arguments no longer have any effect. (They were declared +obsolete in Emacs 23.) + * Changes in Emacs 24.1 diff --git a/leim/Makefile.in b/leim/Makefile.in index 6eb18bc76d9..ba70319ca1e 100644 --- a/leim/Makefile.in +++ b/leim/Makefile.in @@ -48,7 +48,7 @@ buildlisppath=${srcdir}/../lisp # How to run Emacs. RUN-EMACS = EMACSLOADPATH=$(buildlisppath) LC_ALL=C \ - ${BUILT-EMACS} -batch --no-init-file --no-site-file --multibyte + ${BUILT-EMACS} -batch --no-init-file --no-site-file # Subdirectories to be made if ${srcdir} is different from the current # directory. diff --git a/leim/makefile.w32-in b/leim/makefile.w32-in index dbebc32602c..f55fbbf816c 100644 --- a/leim/makefile.w32-in +++ b/leim/makefile.w32-in @@ -37,7 +37,7 @@ BUILT_EMACS = $(THISDIR)/$(dot)$(dot)/src/$(BLD)/emacs.exe buildlisppath=$(CURDIR)/$(dot)$(dot)/lisp # How to run Emacs. -RUN_EMACS = "$(BUILT_EMACS)" -batch --no-init-file --no-site-file --multibyte +RUN_EMACS = "$(BUILT_EMACS)" -batch --no-init-file --no-site-file # Set EMACSLOADPATH correctly (already defined in environment). EMACSLOADPATH=$(buildlisppath) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 12a2ffce5bd..9452ac294dd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-22 Chong Yidong + + * startup.el (command-line-1): Issue warning for ignored arguments + --unibyte, etc (Bug#6886). + 2010-08-22 Chong Yidong * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix (Bug#6880). diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 4effdddff6a..8d681b4f673 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -33,10 +33,9 @@ VPATH = $(srcdir) # to use an absolute file name. EMACS = ${abs_top_builddir}/src/emacs -# Command line flags for Emacs. This must include --multibyte, -# otherwise some files will not compile. +# Command line flags for Emacs. -EMACSOPT = -batch --no-site-file --multibyte +EMACSOPT = -batch --no-site-file # Extra flags to pass to the byte compiler BYTE_COMPILE_EXTRA_FLAGS = diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 59d6ff42c97..84b8db3e9ca 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -326,8 +326,7 @@ Return t if file exists." (with-current-buffer buffer ;; So that we don't get completely screwed if the ;; file is encoded in some complicated character set, - ;; read it with real decoding, as a multibyte buffer, - ;; even if this is a --unibyte Emacs session. + ;; read it with real decoding, as a multibyte buffer. (set-buffer-multibyte t) ;; Don't let deactivate-mark remain set. (let (deactivate-mark) @@ -346,12 +345,7 @@ Return t if file exists." (eval-buffer buffer nil ;; This is compatible with what `load' does. (if purify-flag file fullname) - ;; If this Emacs is running with --unibyte, - ;; convert multibyte strings to unibyte - ;; after reading them. -;; (not (default-value 'enable-multibyte-characters)) - nil t - )) + nil t)) (let (kill-buffer-hook kill-buffer-query-functions) (kill-buffer buffer))) (do-after-load-evaluation fullname) diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in index 871b690f007..df997b76585 100644 --- a/lisp/makefile.w32-in +++ b/lisp/makefile.w32-in @@ -32,10 +32,9 @@ srcdir = $(CURDIR)/.. EMACS = $(THISDIR)/../bin/emacs.exe -# Command line flags for Emacs. This must include --multibyte, -# otherwise some files will not compile. +# Command line flags for Emacs. -EMACSOPT = -batch --no-init-file --no-site-file --multibyte +EMACSOPT = -batch --no-init-file --no-site-file # Extra flags to pass to the byte compiler BYTE_COMPILE_EXTRA_FLAGS = diff --git a/lisp/startup.el b/lisp/startup.el index 76e11491c0c..72169799acf 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -785,15 +785,16 @@ opening the first frame (e.g. open a connection to an X server).") argi (match-string 1 argi))) (when (string-match "\\`--." orig-argi) (let ((completion (try-completion argi longopts))) - (if (eq completion t) - (setq argi (substring argi 1)) - (if (stringp completion) - (let ((elt (assoc completion longopts))) - (or elt - (error "Option `%s' is ambiguous" argi)) - (setq argi (substring (car elt) 1))) - (setq argval nil - argi orig-argi))))) + (cond ((eq completion t) + (setq argi (substring argi 1))) + ((stringp completion) + (let ((elt (assoc completion longopts))) + (unless elt + (error "Option `%s' is ambiguous" argi)) + (setq argi (substring (car elt) 1)))) + (t + (setq argval nil + argi orig-argi))))) (cond ;; The --display arg is handled partly in C, partly in Lisp. ;; When it shows up here, we just put it back to be handled @@ -2231,6 +2232,11 @@ A fancy display is used on graphic displays, normal otherwise." (move-to-column (1- cl1-column))) (setq cl1-column 0)) + ;; These command lines now have no effect. + ((string-match "\\`--?\\(no-\\)?\\(uni\\|multi\\)byte$" argi) + (display-warning 'initialization + (format "Ignoring obsolete arg %s" argi))) + ((equal argi "--") (setq just-files t)) (t diff --git a/msdos/sedleim.inp b/msdos/sedleim.inp index 20da3e64ae5..b5193e665a7 100644 --- a/msdos/sedleim.inp +++ b/msdos/sedleim.inp @@ -34,7 +34,7 @@ s|\([ ]\)echo|\1djecho|g /RUN-EMACS *=/,/^$/c\ export EMACSLOADPATH=${buildlisppath}\ -RUN-EMACS = ${BUILT-EMACS} -batch --no-init-file --no-site-file --multibyte +RUN-EMACS = ${BUILT-EMACS} -batch --no-init-file --no-site-file /^ cd ../c\ ${MAKE} -C ../src ${MFLAGS} emacs diff --git a/src/ChangeLog b/src/ChangeLog index 485099c7bf1..a1e67df99e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-08-22 Chong Yidong + + * emacs.c (main): Remove handling of --unibyte arg (Bug#6886). + 2010-08-22 Andreas Schwab * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA_LISP diff --git a/src/doc.c b/src/doc.c index a8601d930d0..f8ab9d081b9 100644 --- a/src/doc.c +++ b/src/doc.c @@ -285,8 +285,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition) to - (get_doc_string_buffer + offset)); else { - /* Let the data determine whether the string is multibyte, - even if Emacs is running in --unibyte mode. */ + /* The data determines whether the string is multibyte. */ int nchars = multibyte_chars_in_text (get_doc_string_buffer + offset, to - (get_doc_string_buffer + offset)); return make_string_from_bytes (get_doc_string_buffer + offset, diff --git a/src/emacs.c b/src/emacs.c index dc1453a34ac..397d3d9ad27 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1332,68 +1332,6 @@ main (int argc, char **argv) init_atimer (); running_asynch_code = 0; - /* Handle --unibyte and the EMACS_UNIBYTE envvar, - but not while dumping. */ - if (1) - { - int inhibit_unibyte = 0; - - /* --multibyte overrides EMACS_UNIBYTE. */ - if (argmatch (argv, argc, "-no-unibyte", "--no-unibyte", 4, NULL, &skip_args) - || argmatch (argv, argc, "-multibyte", "--multibyte", 4, NULL, &skip_args) - /* Ignore EMACS_UNIBYTE before dumping. */ - || (!initialized && noninteractive)) - inhibit_unibyte = 1; - - /* --unibyte requests that we set up to do everything with single-byte - buffers and strings. We need to handle this before calling - init_lread, init_editfns and other places that generate Lisp strings - from text in the environment. */ - /* Actually this shouldn't be needed as of 20.4 in a generally - unibyte environment. As handa says, environment values - aren't now decoded; also existing buffers are now made - unibyte during startup if .emacs sets unibyte. Tested with - 8-bit data in environment variables and /etc/passwd, setting - unibyte and Latin-1 in .emacs. -- Dave Love */ - if (argmatch (argv, argc, "-unibyte", "--unibyte", 4, NULL, &skip_args) - || argmatch (argv, argc, "-no-multibyte", "--no-multibyte", 4, NULL, &skip_args) - || (getenv ("EMACS_UNIBYTE") && !inhibit_unibyte)) - { - Lisp_Object old_log_max; - Lisp_Object symbol, tail; - - symbol = intern_c_string ("enable-multibyte-characters"); - Fset_default (symbol, Qnil); - - if (initialized) - { - /* Erase pre-dump messages in *Messages* now so no abort. */ - old_log_max = Vmessage_log_max; - XSETFASTINT (Vmessage_log_max, 0); - message_dolog ("", 0, 1, 0); - Vmessage_log_max = old_log_max; - } - - for (tail = Vbuffer_alist; CONSP (tail); - tail = XCDR (tail)) - { - Lisp_Object buffer; - - buffer = Fcdr (XCAR (tail)); - /* Make a multibyte buffer unibyte. */ - if (BUF_Z_BYTE (XBUFFER (buffer)) > BUF_Z (XBUFFER (buffer))) - { - struct buffer *current = current_buffer; - - set_buffer_temp (XBUFFER (buffer)); - Fset_buffer_multibyte (Qnil); - set_buffer_temp (current); - } - } - message ("Warning: unibyte sessions are obsolete and will disappear"); - } - } - no_loadup = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); @@ -1792,10 +1730,6 @@ const struct standard_args standard_args[] = { "-script", "--script", 100, 1 }, { "-daemon", "--daemon", 99, 0 }, { "-help", "--help", 90, 0 }, - { "-no-unibyte", "--no-unibyte", 83, 0 }, - { "-multibyte", "--multibyte", 82, 0 }, - { "-unibyte", "--unibyte", 81, 0 }, - { "-no-multibyte", "--no-multibyte", 80, 0 }, { "-nl", "--no-loadup", 70, 0 }, /* -d must come last before the options handled in startup.el. */ { "-d", "--display", 60, 1 }, From 7133b7ee629457053e63db2a7f192037407da57b Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 23 Aug 2010 00:27:59 +0100 Subject: [PATCH 085/101] Move reading an extended command to Elisp (bug#5364, bug#5214). * lisp/simple.el (read-extended-command): New function with the logic for `completing-read' moved to Elisp from `execute-extended-command'. Use `function-called-at-point' in `minibuffer-default-add-function' to get a command name for M-n (bug#5364, bug#5214). * src/keyboard.c (Fexecute_extended_command): Move reading a command name with `completing-read' to a new Elisp function `read-extended-command'. Call it to read a command to `function' (bug#5364, bug#5214). --- lisp/ChangeLog | 7 +++++++ lisp/simple.el | 34 ++++++++++++++++++++++++++++++++++ src/ChangeLog | 6 ++++++ src/keyboard.c | 27 ++------------------------- 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9452ac294dd..c1fae3283ac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2010-08-22 Juri Linkov + + * simple.el (read-extended-command): New function with the logic + for `completing-read' moved to Elisp from `execute-extended-command'. + Use `function-called-at-point' in `minibuffer-default-add-function' + to get a command name for M-n (bug#5364, bug#5214). + 2010-08-22 Chong Yidong * startup.el (command-line-1): Issue warning for ignored arguments diff --git a/lisp/simple.el b/lisp/simple.el index 5f62b9d9e73..c1ec78da7b9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1301,6 +1301,40 @@ to get different commands to edit and resubmit." (if command-history (error "Argument %d is beyond length of command history" arg) (error "There are no previous complex commands to repeat"))))) + +(defun read-extended-command () + "Read command name to invoke in `execute-extended-command'." + (minibuffer-with-setup-hook + (lambda () + (set (make-local-variable 'minibuffer-default-add-function) + (lambda () + ;; Get a command name at point in the original buffer + ;; to propose it after M-n. + (with-current-buffer (window-buffer (minibuffer-selected-window)) + (and (commandp (function-called-at-point)) + (format "%S" (function-called-at-point))))))) + ;; Read a string, completing from and restricting to the set of + ;; all defined commands. Don't provide any initial input. + ;; Save the command read on the extended-command history list. + (completing-read + (concat (cond + ((eq current-prefix-arg '-) "- ") + ((and (consp current-prefix-arg) + (eq (car current-prefix-arg) 4)) "C-u ") + ((and (consp current-prefix-arg) + (integerp (car current-prefix-arg))) + (format "%d " (car current-prefix-arg))) + ((integerp current-prefix-arg) + (format "%d " current-prefix-arg))) + ;; This isn't strictly correct if `execute-extended-command' + ;; is bound to anything else (e.g. [menu]). + ;; It could use (key-description (this-single-command-keys)), + ;; but actually a prompt other than "M-x" would be confusing, + ;; because "M-x" is a well-known prompt to read a command + ;; and it serves as a shorthand for "Extended command: ". + "M-x ") + obarray 'commandp t nil 'extended-command-history))) + (defvar minibuffer-history nil "Default minibuffer history list. diff --git a/src/ChangeLog b/src/ChangeLog index a1e67df99e2..624cddb6fa7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-08-22 Juri Linkov + + * keyboard.c (Fexecute_extended_command): Move reading a command name + with `completing-read' to a new Elisp function `read-extended-command'. + Call it to read a command to `function' (bug#5364, bug#5214). + 2010-08-22 Chong Yidong * emacs.c (main): Remove handling of --unibyte arg (Bug#6886). diff --git a/src/keyboard.c b/src/keyboard.c index 269e52988eb..b4a5d4e060f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10345,13 +10345,12 @@ give to the command you invoke, if it asks for an argument. */) (Lisp_Object prefixarg) { Lisp_Object function; - char buf[40]; int saved_last_point_position; Lisp_Object saved_keys, saved_last_point_position_buffer; Lisp_Object bindings, value; struct gcpro gcpro1, gcpro2, gcpro3; #ifdef HAVE_WINDOW_SYSTEM - /* The call to Fcompleting_read wil start and cancel the hourglass, + /* The call to Fcompleting_read will start and cancel the hourglass, but if the hourglass was already scheduled, this means that no hourglass will be shown for the actual M-x command itself. So we restart it if it is already scheduled. Note that checking @@ -10364,31 +10363,9 @@ give to the command you invoke, if it asks for an argument. */) XVECTOR (this_command_keys)->contents); saved_last_point_position_buffer = last_point_position_buffer; saved_last_point_position = last_point_position; - buf[0] = 0; GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer); - if (EQ (prefixarg, Qminus)) - strcpy (buf, "- "); - else if (CONSP (prefixarg) && XINT (XCAR (prefixarg)) == 4) - strcpy (buf, "C-u "); - else if (CONSP (prefixarg) && INTEGERP (XCAR (prefixarg))) - sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg))); - else if (INTEGERP (prefixarg)) - sprintf (buf, "%ld ", (long) XINT (prefixarg)); - - /* This isn't strictly correct if execute-extended-command - is bound to anything else. Perhaps it should use - this_command_keys? */ - strcat (buf, "M-x "); - - /* Prompt with buf, and then read a string, completing from and - restricting to the set of all defined commands. Don't provide - any initial input. Save the command read on the extended-command - history list. */ - function = Fcompleting_read (build_string (buf), - Vobarray, Qcommandp, - Qt, Qnil, Qextended_command_history, Qnil, - Qnil); + function = call0 (intern ("read-extended-command")); #ifdef HAVE_WINDOW_SYSTEM if (hstarted) start_hourglass (); From 1a140747113353609a6377b9159bb25e7f518c08 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 23 Aug 2010 12:21:01 +0200 Subject: [PATCH 086/101] * ido.el (ido-use-virtual-buffers): Fix typo in docstring. --- lisp/ChangeLog | 4 ++++ lisp/ido.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c1fae3283ac..e3be318395a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-23 Juanma Barranquero + + * ido.el (ido-use-virtual-buffers): Fix typo in docstring. + 2010-08-22 Juri Linkov * simple.el (read-extended-command): New function with the logic diff --git a/lisp/ido.el b/lisp/ido.el index ad6c48c01e9..858ee3ed5b0 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -780,7 +780,7 @@ Essentially it works as follows: Say you are visiting a file and the buffer gets cleaned up by mignight.el. Later, you want to switch to that buffer, but find it's no longer open. With virtual buffers enabled, the buffer name stays in the buffer -list (using the ido-virtual face, and always at the end), and if +list (using the `ido-virtual' face, and always at the end), and if you select it, it opens the file back up again. This allows you to think less about whether recently opened files are still open or not. Most of the time you can quit Emacs, restart, and then From 692f3ddcd0a7031794e39bab76a5cce0c4c4990c Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 23 Aug 2010 12:28:12 +0200 Subject: [PATCH 087/101] src/ChangeLog: Fix typos. --- src/ChangeLog | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 624cddb6fa7..2dc16c154a9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -27,10 +27,10 @@ * doc.c (Fsnarf_documentation): Initialize skip_file before build-files test. -2010-08-22 Peter O'Gorman (tiny change) +2010-08-22 Peter O'Gorman (tiny change) - * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK): New - definitions. + * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK): + New definitions. (HAVE_TERMIO): Remove. 2010-08-22 Eli Zaretskii @@ -486,10 +486,10 @@ 2010-08-08 Kenichi Handa - * charset.c: Include + * charset.c: Include . (struct charset_sort_data): New struct. (charset_compare): New function. - (Fsort_charsets): New funciton. + (Fsort_charsets): New function. (syms_of_charset): Declare Fsort_charsets as a Lisp function. * coding.c (decode_coding_iso_2022): Fix checking of dimension From 8a0b50ed46dc585805b18fce5c1a7d13e4ad3ec7 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 23 Aug 2010 14:54:09 +0200 Subject: [PATCH 088/101] Fix configure checks * configure.in: Fix check for librsvg, imagemagick and MagickExportImagePixels. --- ChangeLog | 5 +++++ configure | 50 +++++++++++++++++++++++++------------------------- configure.in | 15 +++++---------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94b84ed1c28..842a167e818 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-23 Andreas Schwab + + * configure.in: Fix check for librsvg, imagemagick and + MagickExportImagePixels. + 2010-08-18 Joakim Verona * Makefile.in, configure.in: Checks for ImageMagick. diff --git a/configure b/configure index 9354afe1ee5..527c53690bd 100755 --- a/configure +++ b/configure @@ -2442,7 +2442,6 @@ fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" -as_fn_append ac_func_list " MagickExportImagePixels" as_fn_append ac_header_list " sys/time.h" as_fn_append ac_func_list " alarm" # Check that the precious variables saved in the cache have kept the same @@ -8597,7 +8596,7 @@ $as_echo "no" >&6; } fi if test $succeeded = yes; then - : + HAVE_RSVG=yes else : fi @@ -8605,8 +8604,7 @@ $as_echo "no" >&6; } - if test ".${RSVG_CFLAGS}" != "."; then - HAVE_RSVG=yes + if test $HAVE_RSVG = yes; then $as_echo "#define HAVE_RSVG 1" >>confdefs.h @@ -8708,7 +8706,7 @@ $as_echo "no" >&6; } fi if test $succeeded = yes; then - : + HAVE_IMAGEMAGICK=yes else : fi @@ -8716,38 +8714,24 @@ $as_echo "no" >&6; } - if test ".${IMAGEMAGICK_CFLAGS}" != "."; then - HAVE_IMAGEMAGICK=yes + if test $HAVE_IMAGEMAGICK = yes; then $as_echo "#define HAVE_IMAGEMAGICK 1" >>confdefs.h CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" - fi - - -$as_echo "#define HAVE_MAGICKEXPORTIMAGEPIXELS 0" >>confdefs.h - - - - - for ac_func in $ac_func_list + for ac_func in MagickExportImagePixels do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : + ac_fn_c_check_func "$LINENO" "MagickExportImagePixels" "ac_cv_func_MagickExportImagePixels" +if test "x$ac_cv_func_MagickExportImagePixels" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_MAGICKEXPORTIMAGEPIXELS 1 _ACEOF fi done - - - - + fi fi @@ -11624,6 +11608,22 @@ done + for ac_func in $ac_func_list +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5 $as_echo_n "checking for working mktime... " >&6; } diff --git a/configure.in b/configure.in index 11d660cbc81..e69ce064c0c 100644 --- a/configure.in +++ b/configure.in @@ -1825,12 +1825,11 @@ if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then RSVG_REQUIRED=2.11.0 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED" - PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :) + PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, HAVE_RSVG=yes, :) AC_SUBST(RSVG_CFLAGS) AC_SUBST(RSVG_LIBS) - if test ".${RSVG_CFLAGS}" != "."; then - HAVE_RSVG=yes + if test $HAVE_RSVG = yes; then AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.]) CFLAGS="$CFLAGS $RSVG_CFLAGS" LIBS="$RSVG_LIBS $LIBS" @@ -1841,20 +1840,16 @@ fi HAVE_IMAGEMAGICK=no if test "${with_imagemagick}" != "no"; then IMAGEMAGICK_MODULE="Wand" - PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, :, :) + PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :) AC_SUBST(IMAGEMAGICK_CFLAGS) AC_SUBST(IMAGEMAGICK_LIBS) - if test ".${IMAGEMAGICK_CFLAGS}" != "."; then - HAVE_IMAGEMAGICK=yes + if test $HAVE_IMAGEMAGICK = yes; then AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" + AC_CHECK_FUNCS(MagickExportImagePixels) fi - - AC_DEFINE(HAVE_MAGICKEXPORTIMAGEPIXELS, 0, [Define to 1 if MagickExportImagePixels is defined.]) - AC_CHECK_FUNCS_ONCE(MagickExportImagePixels) - fi From 0c372655438af1e8792d7532e395eb803d5a13bb Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 23 Aug 2010 15:02:00 +0200 Subject: [PATCH 089/101] * dbusbind.c: Accept UNIX domain sockets as bus address. (Fdbus_close_bus): New function. (Vdbus_registered_buses): New variable. (xd_initialize): Implement string as bus address. (Fdbus_init_bus): Add bus to Vdbus_registered_buses). (Fdbus_get_unique_name, Fdbus_call_method) (Fdbus_call_method_asynchronously, Fdbus_method_return_internal) (Fdbus_method_error_internal, Fdbus_send_signal) (Fdbus_register_signal, Fdbus_register_method): Remove bus type check. This is done in xd_initialize_bus. Adapt doc string, if necessary. (xd_pending_messages, xd_read_queued_messages): Loop over buses in Vdbus_registered_buses. (Vdbus_registered_objects_table): Create hash. --- src/ChangeLog | 17 ++++ src/dbusbind.c | 234 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 169 insertions(+), 82 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2dc16c154a9..17d1f7a08b6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2010-08-23 Michael Albinus + + * dbusbind.c: Accept UNIX domain sockets as bus address. + (Fdbus_close_bus): New function. + (Vdbus_registered_buses): New variable. + (xd_initialize): Implement string as bus address. + (Fdbus_init_bus): Add bus to Vdbus_registered_buses). + (Fdbus_get_unique_name, Fdbus_call_method) + (Fdbus_call_method_asynchronously, Fdbus_method_return_internal) + (Fdbus_method_error_internal, Fdbus_send_signal) + (Fdbus_register_signal, Fdbus_register_method): Remove bus type + check. This is done in xd_initialize_bus. Adapt doc string, if + necessary. + (xd_pending_messages, xd_read_queued_messages): Loop over buses in + Vdbus_registered_buses. + (Vdbus_registered_objects_table): Create hash. + 2010-08-22 Juri Linkov * keyboard.c (Fexecute_extended_command): Move reading a command name diff --git a/src/dbusbind.c b/src/dbusbind.c index 683d6f047fa..3b6f0e543bb 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -31,6 +31,7 @@ along with GNU Emacs. If not, see . */ /* Subroutines. */ Lisp_Object Qdbus_init_bus; +Lisp_Object Qdbus_close_bus; Lisp_Object Qdbus_get_unique_name; Lisp_Object Qdbus_call_method; Lisp_Object Qdbus_call_method_asynchronously; @@ -59,6 +60,9 @@ Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; Lisp_Object QCdbus_type_array, QCdbus_type_variant; Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; +/* Registered buses. */ +Lisp_Object Vdbus_registered_buses; + /* Hash table which keeps function definitions. */ Lisp_Object Vdbus_registered_objects_table; @@ -111,7 +115,7 @@ int xd_in_read_queued_messages = 0; } while (0) /* Macros for debugging. In order to enable them, build with - "make MYCPPFLAGS='-DDBUS_DEBUG -Wall'". */ + "MYCPPFLAGS='-DDBUS_DEBUG -Wall' make". */ #ifdef DBUS_DEBUG #define XD_DEBUG_MESSAGE(...) \ do { \ @@ -713,10 +717,10 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) } } -/* Initialize D-Bus connection. BUS is a Lisp symbol, either :system - or :session. It tells which D-Bus to initialize. If RAISE_ERROR - is non-zero signal an error when the connection cannot be - initialized. */ +/* Initialize D-Bus connection. BUS is either a Lisp symbol, :system + or :session, or a string denoting the bus address. It tells which + D-Bus to initialize. If RAISE_ERROR is non-zero, signal an error + when the connection cannot be initialized. */ static DBusConnection * xd_initialize (Lisp_Object bus, int raise_error) { @@ -724,34 +728,66 @@ xd_initialize (Lisp_Object bus, int raise_error) DBusError derror; /* Parameter check. */ - CHECK_SYMBOL (bus); - if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) - if (raise_error) - XD_SIGNAL2 (build_string ("Wrong bus name"), bus); - else - return NULL; + if (!STRINGP (bus)) + { + CHECK_SYMBOL (bus); + if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) + { + if (raise_error) + XD_SIGNAL2 (build_string ("Wrong bus name"), bus); + else + return NULL; + } - /* We do not want to have an autolaunch for the session bus. */ - if (EQ (bus, QCdbus_session_bus) - && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) - if (raise_error) - XD_SIGNAL2 (build_string ("No connection to bus"), bus); - else - return NULL; + /* We do not want to have an autolaunch for the session bus. */ + if (EQ (bus, QCdbus_session_bus) + && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) + { + if (raise_error) + XD_SIGNAL2 (build_string ("No connection to bus"), bus); + else + return NULL; + } + } /* Open a connection to the bus. */ dbus_error_init (&derror); - if (EQ (bus, QCdbus_system_bus)) - connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); + if (STRINGP (bus)) + connection = dbus_connection_open (SDATA (bus), &derror); else - connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); + if (EQ (bus, QCdbus_system_bus)) + connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); + else + connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); if (dbus_error_is_set (&derror)) - if (raise_error) - XD_ERROR (derror); - else - connection = NULL; + { + if (raise_error) + XD_ERROR (derror); + else + connection = NULL; + } + + /* If it is not the system or session bus, we must register + ourselves. Otherwise, we have called dbus_bus_get, which has + configured us to exit if the connection closes - we undo this + setting. */ + if (connection != NULL) + { + if (STRINGP (bus)) + dbus_bus_register (connection, &derror); + else + dbus_connection_set_exit_on_disconnect (connection, FALSE); + } + + if (dbus_error_is_set (&derror)) + { + if (raise_error) + XD_ERROR (derror); + else + connection = NULL; + } if (connection == NULL && raise_error) XD_SIGNAL2 (build_string ("No connection to bus"), bus); @@ -794,7 +830,8 @@ xd_add_watch (DBusWatch *watch, void *data) } /* Remove connection file descriptor from input_wait_mask. DATA is - the used bus, either QCdbus_system_bus or QCdbus_session_bus. */ + the used bus, either a string or QCdbus_system_bus or + QCdbus_session_bus. */ void xd_remove_watch (DBusWatch *watch, void *data) { @@ -830,15 +867,11 @@ xd_remove_watch (DBusWatch *watch, void *data) } DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, - doc: /* Initialize connection to D-Bus BUS. -This is an internal function, it shall not be used outside dbus.el. */) + doc: /* Initialize connection to D-Bus BUS. */) (Lisp_Object bus) { DBusConnection *connection; - /* Check parameters. */ - CHECK_SYMBOL (bus); - /* Open a connection to the bus. */ connection = xd_initialize (bus, TRUE); @@ -850,6 +883,28 @@ This is an internal function, it shall not be used outside dbus.el. */) NULL, (void*) XHASH (bus), NULL)) XD_SIGNAL1 (build_string ("Cannot add watch functions")); + /* Add bus to list of registered buses. */ + Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); + + /* Return. */ + return Qnil; +} + +DEFUN ("dbus-close-bus", Fdbus_close_bus, Sdbus_close_bus, 1, 1, 0, + doc: /* Close connection to D-Bus BUS. */) + (Lisp_Object bus) +{ + DBusConnection *connection; + + /* Open a connection to the bus. */ + connection = xd_initialize (bus, TRUE); + + /* Decrement reference count to the bus. */ + dbus_connection_unref (connection); + + /* Remove bus from list of registered buses. */ + Vdbus_registered_buses = Fdelete (bus, Vdbus_registered_buses); + /* Return. */ return Qnil; } @@ -862,9 +917,6 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, DBusConnection *connection; const char *name; - /* Check parameters. */ - CHECK_SYMBOL (bus); - /* Open a connection to the bus. */ connection = xd_initialize (bus, TRUE); @@ -880,7 +932,8 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0, doc: /* Call METHOD on the D-Bus BUS. -BUS is either the symbol `:system' or the symbol `:session'. +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE is the D-Bus service name to be used. PATH is the D-Bus object path SERVICE is registered at. INTERFACE is an interface @@ -967,7 +1020,6 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI interface = args[3]; method = args[4]; - CHECK_SYMBOL (bus); CHECK_STRING (service); CHECK_STRING (path); CHECK_STRING (interface); @@ -1082,7 +1134,8 @@ DEFUN ("dbus-call-method-asynchronously", Fdbus_call_method_asynchronously, Sdbus_call_method_asynchronously, 6, MANY, 0, doc: /* Call METHOD on the D-Bus BUS asynchronously. -BUS is either the symbol `:system' or the symbol `:session'. +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE is the D-Bus service name to be used. PATH is the D-Bus object path SERVICE is registered at. INTERFACE is an interface @@ -1148,7 +1201,6 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE method = args[4]; handler = args[5]; - CHECK_SYMBOL (bus); CHECK_STRING (service); CHECK_STRING (path); CHECK_STRING (interface); @@ -1271,7 +1323,6 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) serial = args[1]; service = args[2]; - CHECK_SYMBOL (bus); CHECK_NUMBER (serial); CHECK_STRING (service); GCPRO3 (bus, serial, service); @@ -1363,7 +1414,6 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) serial = args[1]; service = args[2]; - CHECK_SYMBOL (bus); CHECK_NUMBER (serial); CHECK_STRING (service); GCPRO3 (bus, serial, service); @@ -1436,7 +1486,8 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0, doc: /* Send signal SIGNAL on the D-Bus BUS. -BUS is either the symbol `:system' or the symbol `:session'. +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE is the D-Bus service name SIGNAL is sent from. PATH is the D-Bus object path SERVICE is registered at. INTERFACE is an interface @@ -1480,7 +1531,6 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) interface = args[3]; signal = args[4]; - CHECK_SYMBOL (bus); CHECK_STRING (service); CHECK_STRING (path); CHECK_STRING (interface); @@ -1552,7 +1602,8 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) } /* Check, whether there is pending input in the message queue of the - D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ + D-Bus BUS. BUS is either a Lisp symbol, :system or :session, or a + string denoting the bus address. */ int xd_get_dispatch_status (Lisp_Object bus) { @@ -1572,24 +1623,31 @@ xd_get_dispatch_status (Lisp_Object bus) ? TRUE : FALSE; } -/* Check for queued incoming messages from the system and session buses. */ +/* Check for queued incoming messages from the buses. */ int xd_pending_messages (void) { + Lisp_Object busp = Vdbus_registered_buses; - /* Vdbus_registered_objects_table will be initialized as hash table - in dbus.el. When this package isn't loaded yet, it doesn't make - sense to handle D-Bus messages. */ - return (HASH_TABLE_P (Vdbus_registered_objects_table) - ? (xd_get_dispatch_status (QCdbus_system_bus) - || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL) - ? xd_get_dispatch_status (QCdbus_session_bus) - : FALSE)) - : FALSE); + while (!NILP (busp)) + { + /* We do not want to have an autolaunch for the session bus. */ + if (EQ ((CAR_SAFE (busp)), QCdbus_session_bus) + && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) + continue; + + if (xd_get_dispatch_status (CAR_SAFE (busp))) + return TRUE; + + busp = CDR_SAFE (busp); + } + + return FALSE; } -/* Read queued incoming message of the D-Bus BUS. BUS is a Lisp - symbol, either :system or :session. */ +/* Read queued incoming message of the D-Bus BUS. BUS is either a + Lisp symbol, :system or :session, or a string denoting the bus + address. */ static Lisp_Object xd_read_message (Lisp_Object bus) { @@ -1746,29 +1804,28 @@ xd_read_message (Lisp_Object bus) RETURN_UNGCPRO (Qnil); } -/* Read queued incoming messages from the system and session buses. */ +/* Read queued incoming messages from all buses. */ void xd_read_queued_messages (void) { + Lisp_Object busp = Vdbus_registered_buses; - /* Vdbus_registered_objects_table will be initialized as hash table - in dbus.el. When this package isn't loaded yet, it doesn't make - sense to handle D-Bus messages. Furthermore, we ignore all Lisp - errors during the call. */ - if (HASH_TABLE_P (Vdbus_registered_objects_table)) + xd_in_read_queued_messages = 1; + while (!NILP (busp)) { - xd_in_read_queued_messages = 1; - internal_catch (Qdbus_error, xd_read_message, QCdbus_system_bus); - internal_catch (Qdbus_error, xd_read_message, QCdbus_session_bus); - xd_in_read_queued_messages = 0; + /* We ignore all Lisp errors during the call. */ + internal_catch (Qdbus_error, xd_read_message, CAR_SAFE (busp)); + busp = CDR_SAFE (busp); } + xd_in_read_queued_messages = 0; } DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, 6, MANY, 0, doc: /* Register for signal SIGNAL on the D-Bus BUS. -BUS is either the symbol `:system' or the symbol `:session'. +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE is the D-Bus service name used by the sending D-Bus object. It can be either a known name or the unique name of the D-Bus object @@ -1822,7 +1879,6 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG signal = args[4]; handler = args[5]; - CHECK_SYMBOL (bus); if (!NILP (service)) CHECK_STRING (service); if (!NILP (path)) CHECK_STRING (path); CHECK_STRING (interface); @@ -1915,7 +1971,8 @@ DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method, 6, 6, 0, doc: /* Register for method METHOD on the D-Bus BUS. -BUS is either the symbol `:system' or the symbol `:session'. +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE is the D-Bus service name of the D-Bus object METHOD is registered for. It must be a known name. @@ -1933,7 +1990,6 @@ used for composing the returning D-Bus message. */) DBusError derror; /* Check parameters. */ - CHECK_SYMBOL (bus); CHECK_STRING (service); CHECK_STRING (path); CHECK_STRING (interface); @@ -1978,6 +2034,10 @@ syms_of_dbusbind (void) staticpro (&Qdbus_init_bus); defsubr (&Sdbus_init_bus); + Qdbus_close_bus = intern_c_string ("dbus-close-bus"); + staticpro (&Qdbus_close_bus); + defsubr (&Sdbus_close_bus); + Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name"); staticpro (&Qdbus_get_unique_name); defsubr (&Sdbus_get_unique_name); @@ -2074,18 +2134,25 @@ syms_of_dbusbind (void) QCdbus_type_dict_entry = intern_c_string (":dict-entry"); staticpro (&QCdbus_type_dict_entry); + DEFVAR_LISP ("dbus-registered-buses", + &Vdbus_registered_buses, + doc: /* List of D-Bus buses we are polling for messages. */); + Vdbus_registered_buses = Qnil; + DEFVAR_LISP ("dbus-registered-objects-table", &Vdbus_registered_objects_table, doc: /* Hash table of registered functions for D-Bus. + There are two different uses of the hash table: for accessing registered interfaces properties, targeted by signals or method calls, and for calling handlers in case of non-blocking method call returns. In the first case, the key in the hash table is the list (BUS -INTERFACE MEMBER). BUS is either the symbol `:system' or the symbol -`:session'. INTERFACE is a string which denotes a D-Bus interface, -and MEMBER, also a string, is either a method, a signal or a property -INTERFACE is offering. All arguments but BUS must not be nil. +INTERFACE MEMBER). BUS is either a Lisp symbol, `:system' or +`:session', or a string denoting the bus address. INTERFACE is a +string which denotes a D-Bus interface, and MEMBER, also a string, is +either a method, a signal or a property INTERFACE is offering. All +arguments but BUS must not be nil. The value in the hash table is a list of quadruple lists \((UNAME SERVICE PATH OBJECT) (UNAME SERVICE PATH OBJECT) ...). @@ -2097,15 +2164,18 @@ be called when a D-Bus message, which matches the key criteria, arrives (methods and signals), or a cons cell containing the value of the property. -In the second case, the key in the hash table is the list (BUS SERIAL). -BUS is either the symbol `:system' or the symbol `:session'. SERIAL -is the serial number of the non-blocking method call, a reply is -expected. Both arguments must not be nil. The value in the hash -table is HANDLER, the function to be called when the D-Bus reply -message arrives. */); - /* We initialize Vdbus_registered_objects_table in dbus.el, because - we need to define a hash table function first. */ - Vdbus_registered_objects_table = Qnil; +In the second case, the key in the hash table is the list (BUS +SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a +string denoting the bus address. SERIAL is the serial number of the +non-blocking method call, a reply is expected. Both arguments must +not be nil. The value in the hash table is HANDLER, the function to +be called when the D-Bus reply message arrives. */); + { + Lisp_Object args[2]; + args[0] = QCtest; + args[1] = Qequal; + Vdbus_registered_objects_table = Fmake_hash_table (2, args); + } DEFVAR_LISP ("dbus-debug", &Vdbus_debug, doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); From e73f184c427e7227e23654d167db770a9621e73c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 23 Aug 2010 15:08:54 +0200 Subject: [PATCH 090/101] * net/dbus.el: Accept UNIX domain sockets as bus address. (top): Don't initialize `dbus-registered-objects-table' anymore, this is done in dbusbind,c. (dbus-check-event): Adapt test for bus. (dbus-return-values-table, dbus-unregister-service) (dbus-event-bus-name, dbus-introspect, dbus-register-property): Adapt doc string. --- lisp/ChangeLog | 10 +++++++++ lisp/net/dbus.el | 55 ++++++++++++++++++++++++------------------------ 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e3be318395a..1402c45b125 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2010-08-23 Michael Albinus + + * net/dbus.el: Accept UNIX domain sockets as bus address. + (top): Don't initialize `dbus-registered-objects-table' anymore, + this is done in dbusbind,c. + (dbus-check-event): Adapt test for bus. + (dbus-return-values-table, dbus-unregister-service) + (dbus-event-bus-name, dbus-introspect, dbus-register-property): + Adapt doc string. + 2010-08-23 Juanma Barranquero * ido.el (ido-use-virtual-buffers): Fix typo in docstring. diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 870bd2e313d..ee876e04190 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -108,15 +108,12 @@ catched in `condition-case' by `dbus-error'.") ;;; Hash table of registered functions. -;; We create it here. So we have a simple test in dbusbind.c, whether -;; the Lisp code has been loaded. -(setq dbus-registered-objects-table (make-hash-table :test 'equal)) - (defvar dbus-return-values-table (make-hash-table :test 'equal) "Hash table for temporary storing arguments of reply messages. -A key in this hash table is a list (BUS SERIAL). BUS is either the -symbol `:system' or the symbol `:session'. SERIAL is the serial number -of the reply message. See `dbus-call-method-non-blocking-handler' and +A key in this hash table is a list (BUS SERIAL). BUS is either a +Lisp symbol, `:system' or `:session', or a string denoting the +bus address. SERIAL is the serial number of the reply message. +See `dbus-call-method-non-blocking-handler' and `dbus-call-method-non-blocking'.") (defun dbus-list-hash-table () @@ -187,8 +184,8 @@ association to the service from D-Bus." (defun dbus-unregister-service (bus service) "Unregister all objects related to SERVICE from D-Bus BUS. -BUS must be either the symbol `:system' or the symbol `:session'. -SERVICE must be a known service name." +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE must be a known service name." (maphash (lambda (key value) (dolist (elt value) @@ -353,15 +350,15 @@ EVENT is a list which starts with symbol `dbus-event': (dbus-event BUS TYPE SERIAL SERVICE PATH INTERFACE MEMBER HANDLER &rest ARGS) BUS identifies the D-Bus the message is coming from. It is -either the symbol `:system' or the symbol `:session'. TYPE is -the D-Bus message type which has caused the event, SERIAL is the -serial number of the received D-Bus message. SERVICE and PATH -are the unique name and the object path of the D-Bus object -emitting the message. INTERFACE and MEMBER denote the message -which has been sent. HANDLER is the function which has been -registered for this message. ARGS are the arguments passed to -HANDLER, when it is called during event handling in -`dbus-handle-event'. +either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. TYPE is the D-Bus message type which +has caused the event, SERIAL is the serial number of the received +D-Bus message. SERVICE and PATH are the unique name and the +object path of the D-Bus object emitting the message. INTERFACE +and MEMBER denote the message which has been sent. HANDLER is +the function which has been registered for this message. ARGS +are the arguments passed to HANDLER, when it is called during +event handling in `dbus-handle-event'. This function raises a `dbus-error' signal in case the event is not well formed." @@ -369,7 +366,8 @@ not well formed." (unless (and (listp event) (eq (car event) 'dbus-event) ;; Bus symbol. - (symbolp (nth 1 event)) + (or (symbolp (nth 1 event)) + (stringp (nth 1 event))) ;; Type. (and (natnump (nth 2 event)) (< dbus-message-type-invalid (nth 2 event))) @@ -434,9 +432,10 @@ If the HANDLER returns a `dbus-error', it is propagated as return message." (defun dbus-event-bus-name (event) "Return the bus name the event is coming from. -The result is either the symbol `:system' or the symbol `:session'. -EVENT is a D-Bus event, see `dbus-check-event'. This function -raises a `dbus-error' signal in case the event is not well formed." +The result is either a Lisp symbol, `:system' or `:session', or a +string denoting the bus address. EVENT is a D-Bus event, see +`dbus-check-event'. This function raises a `dbus-error' signal +in case the event is not well formed." (dbus-check-event event) (nth 1 event)) @@ -566,10 +565,11 @@ apply "Return all interfaces and sub-nodes of SERVICE, registered at object path PATH at bus BUS. -BUS must be either the symbol `:system' or the symbol `:session'. -SERVICE must be a known service name, and PATH must be a valid -object path. The last two parameters are strings. The result, -the introspection data, is a string in XML format." +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE must be a known service name, +and PATH must be a valid object path. The last two parameters +are strings. The result, the introspection data, is a string in +XML format." ;; We don't want to raise errors. `dbus-call-method-non-blocking' ;; is used, because the handler can be registered in our Emacs ;; instance; caller an callee would block each other. @@ -873,7 +873,8 @@ name of the property, and its value. If there are no properties, (bus service path interface property access value &optional emits-signal) "Register property PROPERTY on the D-Bus BUS. -BUS is either the symbol `:system' or the symbol `:session'. +BUS is either a Lisp symbol, `:system' or `:session', or a string +denoting the bus address. SERVICE is the D-Bus service name of the D-Bus. It must be a known name. From 7457f7b632d621b3426c6d383e3b025f147399a8 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 23 Aug 2010 15:48:48 +0200 Subject: [PATCH 091/101] * dbus.texi (Alternative Buses): New chapter. --- doc/misc/ChangeLog | 4 ++++ doc/misc/dbus.texi | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 8cc9c082ce9..f9e81e8fc0f 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,7 @@ +2010-08-23 Michael Albinus + + * dbus.texi (Alternative Buses): New chapter. + 2010-08-12 Stefan Monnier * cl.texi (Mapping over Sequences): Rename mapc => cl-mapc. diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index 248884532df..f4f96d55391 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -53,6 +53,7 @@ another. An overview of D-Bus can be found at * Asynchronous Methods:: Calling methods non-blocking. * Receiving Method Calls:: Offering own methods. * Signals:: Sending and receiving signals. +* Alternative Buses:: Alternative buses. * Errors and Events:: Errors and events. * Index:: Index including concepts, functions, variables. @@ -1579,6 +1580,56 @@ which objects the GNU/Linux @code{hal} daemon adds. @end defun +@node Alternative Buses +@chapter Alternative buses. +@cindex bus names +@cindex UNIX domain socket + +Until now, we have spoken about the system and the session buses, +which are the default buses to be connected to. However, it is +possible to connect to any bus, from which the address is known. This +is a UNIX domain socket. Everywhere, where a @var{bus} is mentioned +as argument of a function (the symbol @code{:system} or the symbol +@code{:session}), this address can be used instead. The connection to +this bus must be initialized first. + +@defun dbus-init-bus bus +Establish the connection to D-Bus @var{bus}. + +@var{bus} can be either the symbol @code{:system} or the symbol +@code{:session}, or it can be a string denoting the address of the +corresponding bus. For the system and session busses, this function +is called when loading @file{dbus.el}, there is no need to call it +again. + +Example: You open another session bus in a terminal window on your host: + +@example +# eval `dbus-launch --auto-syntax` +# echo $DBUS_SESSION_BUS_ADDRESS + +@print{} unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e +@end example + +In Emacs, you can access to this bus via its address: + +@lisp +(setq my-bus + "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e") + +@result{} "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e" + +(dbus-init-bus my-bus) + +@result{} nil + +(dbus-get-unique-name my-bus) + +@result{} ":1.0" +@end lisp +@end defun + + @node Errors and Events @chapter Errors and events. @cindex debugging From 372214322c37ded1631741b55cb125a99ff6bdbd Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 23 Aug 2010 15:57:55 +0200 Subject: [PATCH 092/101] * NEWS: dbus.el supports alternative buses. --- etc/ChangeLog | 4 ++++ etc/NEWS | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 5b000fc66c6..119856834c3 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2010-08-23 Michael Albinus + + * NEWS: dbus.el supports alternative buses. + 2010-08-14 Eli Zaretskii * tutorials/TUTORIAL.he: Use MAQAF instead of hyphen where appropriate. diff --git a/etc/NEWS b/etc/NEWS index d46d5cc8279..ca03f89bc39 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -413,6 +413,11 @@ enabled by default in 23.1. supports multithread non-stop debugging and debugging of several threads simultaneously. +** D-Bus + +*** It is possible now, to access alternative buses than the default +system or session bus. + * New Modes and Packages in Emacs 24.1 From 1c409d0b963ebdb1f48b90ddce85c56d989bee5f Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 24 Aug 2010 11:48:14 -0400 Subject: [PATCH 093/101] Avoid clobbering primary selection when switching frames (Bug#6872). * lisp/mouse.el (mouse-yank-primary): Avoid setting primary when deactivating the mark (Bug#6872). * src/keyboard.c (command_loop_1): Don't set primary selection during handle-switch-frame (Bug#6872). --- lisp/ChangeLog | 5 +++++ lisp/mouse.el | 7 ++++--- src/ChangeLog | 5 +++++ src/keyboard.c | 13 ++++++++----- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1402c45b125..79b5f6583a0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-24 Chong Yidong + + * mouse.el (mouse-yank-primary): Avoid setting primary when + deactivating the mark (Bug#6872). + 2010-08-23 Michael Albinus * net/dbus.el: Accept UNIX domain sockets as bus address. diff --git a/lisp/mouse.el b/lisp/mouse.el index c9b190f1c79..a2a0191ce79 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1268,10 +1268,11 @@ regardless of where you click." (interactive "e") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) + ;; Without this, confusing things happen upon e.g. inserting into + ;; the middle of an active region. (when select-active-regions - ;; Without this, confusing things happen upon e.g. inserting into - ;; the middle of an active region. - (deactivate-mark)) + (let (select-active-regions) + (deactivate-mark))) (or mouse-yank-at-point (mouse-set-point click)) (let ((primary (cond diff --git a/src/ChangeLog b/src/ChangeLog index 17d1f7a08b6..7cadee4fcda 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-24 Chong Yidong + + * keyboard.c (command_loop_1): Don't clobber primary selection + during handle-switch-frame (Bug#6872). + 2010-08-23 Michael Albinus * dbusbind.c: Accept UNIX domain sockets as bus address. diff --git a/src/keyboard.c b/src/keyboard.c index b4a5d4e060f..cac051f7882 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -368,7 +368,7 @@ Lisp_Object Vselect_active_regions; Used by the `select-active-regions' feature. */ Lisp_Object Vsaved_region_selection; -Lisp_Object Qx_set_selection, QPRIMARY; +Lisp_Object Qx_set_selection, QPRIMARY, Qhandle_switch_frame; Lisp_Object Qself_insert_command; Lisp_Object Qforward_char; @@ -1799,10 +1799,11 @@ command_loop_1 (void) { /* Even if not deactivating the mark, set PRIMARY if `select-active-regions' is non-nil. */ - if (EQ (Vselect_active_regions, Qonly) - ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) - : (!NILP (Vselect_active_regions) - && !NILP (Vtransient_mark_mode))) + if ((EQ (Vselect_active_regions, Qonly) + ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) + : (!NILP (Vselect_active_regions) + && !NILP (Vtransient_mark_mode))) + && !EQ (Vthis_command, Qhandle_switch_frame)) { int beg = XINT (Fmarker_position (current_buffer->mark)); int end = XINT (make_number (PT)); @@ -11702,6 +11703,8 @@ syms_of_keyboard (void) staticpro (&Qx_set_selection); QPRIMARY = intern_c_string ("PRIMARY"); staticpro (&QPRIMARY); + Qhandle_switch_frame = intern_c_string ("handle-switch-frame"); + staticpro (&Qhandle_switch_frame); Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char"); staticpro (&Qinput_method_exit_on_first_char); From edfd00fa82735b6930c714d32884093718c4a951 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 24 Aug 2010 16:20:21 -0400 Subject: [PATCH 094/101] * lisp/progmodes/python.el: Add Ipython support (Bug#5390). Based on a patch by Fabian Ezequiel Gallina. (python-shell-prompt-alist) (python-shell-continuation-prompt-alist): New options. (python--set-prompt-regexp): New function. (inferior-python-mode, run-python, python-shell): Require ansi-color. Use python--set-prompt-regexp to set the comint prompt based on the Python interpreter. (python--prompt-regexp): New var. (python-check-comint-prompt) (python-comint-output-filter-function): Use it. (run-python): Use a pipe (Bug#5694). (python-send-region): Send a different Python command if Ipython is in use. (python-check-version): Use a Python command to find the version. --- lisp/ChangeLog | 20 +++++++++ lisp/progmodes/python.el | 95 ++++++++++++++++++++++++++++++---------- 2 files changed, 91 insertions(+), 24 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 79b5f6583a0..b273f017b7d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2010-08-24 Chong Yidong + + * progmodes/python.el: Add Ipython support (Bug#5390). + (python-shell-prompt-alist) + (python-shell-continuation-prompt-alist): New options. + (python--set-prompt-regexp): New function. + (inferior-python-mode, run-python, python-shell): Require + ansi-color. Use python--set-prompt-regexp to set the comint + prompt based on the Python interpreter. + (python--prompt-regexp): New var. + (python-check-comint-prompt) + (python-comint-output-filter-function): Use it. + (run-python): Use a pipe (Bug#5694). + +2010-08-24 Fabian Ezequiel Gallina (tiny change) + + * progmodes/python.el (python-send-region): Send a different + Python command if Ipython is in use. + (python-check-version): Use a Python command to find the version. + 2010-08-24 Chong Yidong * mouse.el (mouse-yank-primary): Avoid setting primary when diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2b09e346331..849951a633a 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -579,6 +579,33 @@ having to restart the program." "Queue of Python temp files awaiting execution. Currently-active file is at the head of the list.") +(defcustom python-shell-prompt-alist + '(("ipython" . "^In \\[[0-9]+\\]: *") + (t . "^>>> ")) + "Alist of Python input prompts. +Each element has the form (PROGRAM . REGEXP), where PROGRAM is +the value of `python-python-command' for the python process and +REGEXP is a regular expression matching the Python prompt. +PROGRAM can also be t, which specifies the default when no other +element matches `python-python-command'." + :type 'string + :group 'python + :version "24.1") + +(defcustom python-shell-continuation-prompt-alist + '(("ipython" . "^ [.][.][.]+: *") + (t . "^[.][.][.] ")) + "Alist of Python continued-line prompts. +Each element has the form (PROGRAM . REGEXP), where PROGRAM is +the value of `python-python-command' for the python process and +REGEXP is a regular expression matching the Python prompt for +continued lines. +PROGRAM can also be t, which specifies the default when no other +element matches `python-python-command'." + :type 'string + :group 'python + :version "24.1") + (defvar python-pdbtrack-is-tracking-p nil) (defconst python-pdbtrack-stack-entry-regexp @@ -1311,13 +1338,9 @@ See `python-check-command' for the default." ;;;; Inferior mode stuff (following cmuscheme). -;; Fixme: Make sure we can work with IPython. - (defcustom python-python-command "python" "Shell command to run Python interpreter. -Any arguments can't contain whitespace. -Note that IPython may not work properly; it must at least be used -with the `-cl' flag, i.e. use `ipython -cl'." +Any arguments can't contain whitespace." :group 'python :type 'string) @@ -1395,6 +1418,23 @@ local value.") ;; Autoloaded. (declare-function compilation-shell-minor-mode "compile" (&optional arg)) +(defvar python--prompt-regexp nil) + +(defun python--set-prompt-regexp () + (let ((prompt (cdr-safe (or (assoc python-python-command + python-shell-prompt-alist) + (assq t python-shell-prompt-alist)))) + (cprompt (cdr-safe (or (assoc python-python-command + python-shell-continuation-prompt-alist) + (assq t python-shell-continuation-prompt-alist))))) + (set (make-local-variable 'comint-prompt-regexp) + (concat "\\(" + (mapconcat 'identity + (delq nil (list prompt cprompt "^([Pp]db) ")) + "\\|") + "\\)")) + (set (make-local-variable 'python--prompt-regexp) prompt))) + ;; Fixme: This should inherit some stuff from `python-mode', but I'm ;; not sure how much: at least some keybindings, like C-c C-f; ;; syntax?; font-locking, e.g. for triple-quoted strings? @@ -1417,14 +1457,12 @@ For running multiple processes in multiple buffers, see `run-python' and \\{inferior-python-mode-map}" :group 'python + (require 'ansi-color) ; for ipython (setq mode-line-process '(":%s")) (set (make-local-variable 'comint-input-filter) 'python-input-filter) (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter nil t) - ;; Still required by `comint-redirect-send-command', for instance - ;; (and we need to match things like `>>> ... >>> '): - (set (make-local-variable 'comint-prompt-regexp) - (rx line-start (1+ (and (or (repeat 3 (any ">.")) "(Pdb)") " ")))) + (python--set-prompt-regexp) (set (make-local-variable 'compilation-error-regexp-alist) python-compilation-regexp-alist) (compilation-shell-minor-mode 1)) @@ -1521,12 +1559,12 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." cmd))) (unless (shell-command-to-string cmd) (error "Can't run Python command `%s'" cmd)) - (let* ((res (shell-command-to-string (concat cmd " --version")))) - (string-match "Python \\([0-9]\\)\\.\\([0-9]\\)" res) - (unless (and (equal "2" (match-string 1 res)) - (match-beginning 2) - (>= (string-to-number (match-string 2 res)) 2)) - (error "Only Python versions >= 2.2 and < 3.0 supported"))) + (let* ((res (shell-command-to-string + (concat cmd + " -c \"from sys import version_info;\ +print version_info >= (2, 2) and version_info < (3, 0)\"")))) + (unless (string-match "True" res) + (error "Only Python versions >= 2.2 and < 3.0 are supported"))) (setq python-version-checked t))) ;;;###autoload @@ -1549,6 +1587,7 @@ buffer for a list of commands.)" (interactive (if current-prefix-arg (list (read-string "Run Python: " python-command) nil t) (list python-command))) + (require 'ansi-color) ; for ipython (unless cmd (setq cmd python-command)) (python-check-version cmd) (setq python-command cmd) @@ -1566,8 +1605,10 @@ buffer for a list of commands.)" (if path (concat path path-separator)) data-directory) process-environment)) - ;; Suppress use of pager for help output: - (process-connection-type nil)) + ;; If we use a pipe, unicode characters are not printed + ;; correctly (Bug#5794) and IPython does not work at + ;; all (Bug#5390). + (process-connection-type t)) (apply 'make-comint-in-buffer "Python" (generate-new-buffer "*Python*") (car cmdlist) nil (cdr cmdlist))) @@ -1623,7 +1664,12 @@ buffer for a list of commands.)" ;; non-ASCII. (interactive "r") (let* ((f (make-temp-file "py")) - (command (format "emacs.eexecfile(%S)" f)) + (command + ;; IPython puts the FakeModule module into __main__ so + ;; emacs.eexecfile becomes useless. + (if (string-match "^ipython" python-command) + (format "execfile %S" f) + (format "emacs.eexecfile(%S)" f))) (orig-start (copy-marker start))) (when (save-excursion (goto-char start) @@ -1823,7 +1869,9 @@ If there isn't, it's probably not appropriate to send input to return Eldoc information etc. If PROC is non-nil, check the buffer for that process." (with-current-buffer (process-buffer (or proc (python-proc))) (save-excursion - (save-match-data (re-search-backward ">>> \\=" nil t))))) + (save-match-data + (re-search-backward (concat python--prompt-regexp " *\\=") + nil t))))) ;; Fixme: Is there anything reasonable we can do with random methods? ;; (Currently only works with functions.) @@ -2539,9 +2587,7 @@ Runs `jython-mode-hook' after `python-mode-hook'." "Watch output for Python prompt and exec next file waiting in queue. This function is appropriate for `comint-output-filter-functions'." ;; TBD: this should probably use split-string - (when (and (or (string-equal string ">>> ") - (and (>= (length string) 5) - (string-equal (substring string -5) "\n>>> "))) + (when (and (string-match python--prompt-regexp string) python-file-queue) (condition-case nil (delete-file (car python-file-queue)) @@ -2753,6 +2799,7 @@ comint believe the user typed this string so that (funcall (process-filter proc) proc msg)) (set-buffer curbuf)) (process-send-string proc cmd))) + ;;;###autoload (defun python-shell (&optional argprompt) "Start an interactive Python interpreter in another window. @@ -2792,6 +2839,7 @@ interaction between undo and process filters; the same problem exists in non-Python process buffers using the default (Emacs-supplied) process filter." (interactive "P") + (require 'ansi-color) ; For ipython ;; Set the default shell if not already set (when (null python-which-shell) (python-toggle-shells python-default-interpreter)) @@ -2808,10 +2856,9 @@ filter." )))) (switch-to-buffer-other-window (apply 'make-comint python-which-bufname python-which-shell nil args)) - (make-local-variable 'comint-prompt-regexp) (set-process-sentinel (get-buffer-process (current-buffer)) 'python-sentinel) - (setq comint-prompt-regexp "^>>> \\|^[.][.][.] \\|^(pdb) ") + (python--set-prompt-regexp) (add-hook 'comint-output-filter-functions 'python-comint-output-filter-function nil t) ;; pdbtrack From 44a41a47d1ed7f2f2d8bd583e5f5d76d49bba0a0 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 24 Aug 2010 16:29:44 -0400 Subject: [PATCH 095/101] * progmodes/ruby-mode.el (ruby): Add defgroup. --- lisp/ChangeLog | 4 ++++ lisp/progmodes/ruby-mode.el | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b273f017b7d..48a8938c355 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-24 Kevin Ryde + + * progmodes/ruby-mode.el (ruby): Add defgroup. + 2010-08-24 Chong Yidong * progmodes/python.el: Add Ipython support (Bug#5390). diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index a75c5b01bb8..0b92234bf1c 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -43,6 +43,11 @@ (eval-when-compile (require 'cl)) +(defgroup ruby nil + "Major mode for editing Ruby code." + :prefix "ruby-" + :group 'languages) + (defconst ruby-keyword-end-re (if (string-match "\\_>" "ruby") "\\_>" From 78e33835a312bcb56457bbf93cd98be982a0911d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 24 Aug 2010 16:43:24 -0400 Subject: [PATCH 096/101] Fix filter functions discussion in Lisp manual. * processes.texi (Filter Functions): Use `buffer-live-p' instead of `buffer-name' in the main text as well as in the example (Bug#3098). --- doc/lispref/ChangeLog | 6 ++++++ doc/lispref/processes.texi | 28 ++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 70b82830b44..53b8ac25522 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,9 @@ +2010-08-24 Markus Triska + + * processes.texi (Filter Functions): Use `buffer-live-p' instead + of `buffer-name' in the main text as well as in the example + (Bug#3098). + 2010-08-22 Chong Yidong * nonascii.texi (Text Representations): diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 747d865b0e1..265c76471f0 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -1273,22 +1273,24 @@ process's buffer, mimicking the actions of Emacs when there is no filter. Such filter functions need to use @code{set-buffer} in order to be sure to insert in that buffer. To avoid setting the current buffer semipermanently, these filter functions must save and restore the -current buffer. They should also update the process marker, and in some -cases update the value of point. Here is how to do these things: +current buffer. They should also check whether the buffer is still +alive, update the process marker, and in some cases update the value +of point. Here is how to do these things: @smallexample @group (defun ordinary-insertion-filter (proc string) - (with-current-buffer (process-buffer proc) - (let ((moving (= (point) (process-mark proc)))) + (when (buffer-live-p (process-buffer proc)) + (with-current-buffer (process-buffer proc) + (let ((moving (= (point) (process-mark proc)))) @end group @group - (save-excursion - ;; @r{Insert the text, advancing the process marker.} - (goto-char (process-mark proc)) - (insert string) - (set-marker (process-mark proc) (point))) - (if moving (goto-char (process-mark proc)))))) + (save-excursion + ;; r{Insert the text, advancing the process marker.} + (goto-char (process-mark proc)) + (insert string) + (set-marker (process-mark proc) (point))) + (if moving (goto-char (process-mark proc))))))) @end group @end smallexample @@ -1315,12 +1317,6 @@ expression searching or matching had to explicitly save and restore the match data. Now Emacs does this automatically for filter functions; they never need to do it explicitly. @xref{Match Data}. - A filter function that writes the output into the buffer of the -process should check whether the buffer is still alive. If it tries to -insert into a dead buffer, it will get an error. The expression -@code{(buffer-name (process-buffer @var{process}))} returns @code{nil} -if the buffer is dead. - The output to the function may come in chunks of any size. A program that produces the same output twice in a row may send it as one batch of 200 characters one time, and five batches of 40 characters the next. If From be7748e70afa9fd7b82589061855d567c2229dc1 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 24 Aug 2010 16:58:07 -0400 Subject: [PATCH 097/101] * textmodes/flyspell.el (flyspell-check-tex-math-command): Doc fix (Bug#5651). --- lisp/ChangeLog | 3 +++ lisp/textmodes/flyspell.el | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 48a8938c355..8226f4b8d25 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-08-24 Kevin Ryde + * textmodes/flyspell.el (flyspell-check-tex-math-command): Doc fix + (Bug#5651). + * progmodes/ruby-mode.el (ruby): Add defgroup. 2010-08-24 Chong Yidong diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index e8a92b101ef..8a73a0f818e 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -199,9 +199,9 @@ Ispell's ultimate default dictionary." (defcustom flyspell-check-tex-math-command nil "Non-nil means check even inside TeX math environment. -TeX math environments are discovered by the TEXMATHP that implemented -inside the texmathp.el Emacs package. That package may be found at: -http://strw.leidenuniv.nl/~dominik/Tools" +TeX math environments are discovered by `texmathp', implemented +inside AUCTeX package. That package may be found at +URL `http://www.gnu.org/software/auctex/'" :group 'flyspell :type 'boolean) From cb8759ca5adfd8561c3c1fd80bfc51819e65d305 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 24 Aug 2010 17:36:33 -0400 Subject: [PATCH 098/101] * emacs-lisp/package.el (list-packages): Alias for package-list-packages. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 3 +++ 2 files changed, 8 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8226f4b8d25..fcf27a8da92 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-24 Chong Yidong + + * emacs-lisp/package.el (list-packages): Alias for + package-list-packages. + 2010-08-24 Kevin Ryde * textmodes/flyspell.el (flyspell-check-tex-math-command): Doc fix diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2e8c7dc7d4f..634a05df15e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1557,6 +1557,9 @@ The list is displayed in a buffer named `*Packages*'." (package-refresh-contents) (package--list-packages)) +;;;###autoload +(defalias 'list-packages 'package-list-packages) + (defun package-list-packages-no-fetch () "Display a list of packages. Does not fetch the updated list of packages before displaying. From ff94e32cb3462a95578be0f3be44f5749d0e0b1f Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 25 Aug 2010 09:54:05 +0900 Subject: [PATCH 099/101] Fix finding a stop position for composition. --- src/ChangeLog | 6 ++++++ src/composite.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 0a1a268d962..7fb542eab33 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-08-25 Kenichi Handa + + * composite.c (composition_compute_stop_pos): In forward search, + pay attention to the possibility that some character after ENDPOS + will be composed with charactrs before ENDPOS. + 2010-08-19 Jan Djärv * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary". diff --git a/src/composite.c b/src/composite.c index 392da1ceba1..3b128853c10 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1091,6 +1091,16 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, } } } + if (charpos == endpos) + { + /* We couldn't find a composition point before ENDPOS. But, + some character after ENDPOS may be composed with + characters before ENDPOS. So, we should stop at the safe + point. */ + charpos = endpos - MAX_AUTO_COMPOSITION_LOOKBACK; + if (charpos < start) + charpos = start; + } } else if (charpos > endpos) { From 85cc3d4fd8b2642211a83baf9b59cff2f0601c0b Mon Sep 17 00:00:00 2001 From: Vinicius Jose Latorre Date: Tue, 24 Aug 2010 23:27:58 -0300 Subject: [PATCH 100/101] Fix some bugs. New version 13.1. --- lisp/ChangeLog | 21 +++++- lisp/whitespace.el | 180 ++++++++++++++++++++++++++++++++------------- 2 files changed, 148 insertions(+), 53 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fcf27a8da92..ffbd38561f9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,22 @@ +2010-08-24 Vinicius Jose Latorre + + * whitespace.el: Allow cleaning up blanks without blank + visualization (Bug#6651). Adjust help window for + whitespace-toggle-options (Bug#6479). Allow to use fill-column + instead of whitespace-line-column (from EmacsWiki). New version + 13.1. + (whitespace-style): Added new value 'face. Adjust docstring. + (whitespace-space, whitespace-hspace, whitespace-tab): Adjust + foreground property face. + (whitespace-line-column): Adjust docstring and type declaration. + (whitespace-style-value-list, whitespace-toggle-option-alist) + (whitespace-help-text): Adjust const initialization. + (whitespace-toggle-options, global-whitespace-toggle-options): + Adjust docstring. + (whitespace-display-window, whitespace-interactive-char) + (whitespace-style-face-p, whitespace-color-on): Adjust code. + (whitespace-help-scroll): New fun. + 2010-08-24 Chong Yidong * emacs-lisp/package.el (list-packages): Alias for @@ -164,7 +183,7 @@ (whitespace-post-command-hook, whitespace-display-char-on): Adjust code. (whitespace-looking-back, whitespace-buffer-changed): New funs. - (whitespace-space-regexp, whitespace-tab-regexp): Eliminate funs. + (whitespace-space-regexp, whitespace-tab-regexp): Fun eliminated. 2010-08-19 Stefan Monnier diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 9655593893f..0ef41b5a002 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -6,7 +6,7 @@ ;; Author: Vinicius Jose Latorre ;; Maintainer: Vinicius Jose Latorre ;; Keywords: data, wp -;; Version: 13.0 +;; Version: 13.1 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre ;; This file is part of GNU Emacs. @@ -382,19 +382,28 @@ (defcustom whitespace-style - '(tabs spaces trailing lines space-before-tab newline - indentation empty space-after-tab - space-mark tab-mark newline-mark) + '(face + tabs spaces trailing lines space-before-tab newline + indentation empty space-after-tab + space-mark tab-mark newline-mark) "Specify which kind of blank is visualized. It's a list containing some or all of the following values: + face enable all visualization via faces (see below). + trailing trailing blanks are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. tabs TABs are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. spaces SPACEs and HARD SPACEs are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. lines lines which have columns beyond `whitespace-line-column' are highlighted via @@ -402,6 +411,8 @@ It's a list containing some or all of the following values: Whole line is highlighted. It has precedence over `lines-tail' (see below). + It has effect only if `face' (see above) + is present in `whitespace-style'. lines-tail lines which have columns beyond `whitespace-line-column' are highlighted via @@ -409,45 +420,69 @@ It's a list containing some or all of the following values: But only the part of line which goes beyond `whitespace-line-column' column. It has effect only if `lines' (see above) - is not present in `whitespace-style'. + is not present in `whitespace-style' + and if `face' (see above) is present in + `whitespace-style'. newline NEWLINEs are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. empty empty lines at beginning and/or end of buffer are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. indentation::tab 8 or more SPACEs at beginning of line are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. indentation::space TABs at beginning of line are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. indentation 8 or more SPACEs at beginning of line are visualized, if `indent-tabs-mode' (which see) is non-nil; otherwise, TABs at beginning of line are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. space-after-tab::tab 8 or more SPACEs after a TAB are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. space-after-tab::space TABs are visualized when 8 or more SPACEs occur after a TAB, via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. space-after-tab 8 or more SPACEs after a TAB are visualized, if `indent-tabs-mode' (which see) is non-nil; otherwise, the TABs are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. space-before-tab::tab SPACEs before TAB are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. space-before-tab::space TABs are visualized when SPACEs occur before TAB, via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. space-before-tab SPACEs before TAB are visualized, if `indent-tabs-mode' (which see) is non-nil; otherwise, the TABs are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. space-mark SPACEs and HARD SPACEs are visualized via display table. @@ -486,6 +521,11 @@ So, for example, if indentation and indentation::space are included in `whitespace-style' list, the indentation value is evaluated instead of indentation::space value. +One reason for not visualize spaces via faces (if `face' is not +included in `whitespace-style') is to use exclusively for +cleanning up a buffer. See `whitespace-cleanup' and +`whitespace-cleanup-region' for documentation. + See also `whitespace-display-mappings' for documentation." :type '(repeat :tag "Kind of Blank" (choice :tag "Kind of Blank Face" @@ -521,9 +561,9 @@ Used when `whitespace-style' includes the value `spaces'." (defface whitespace-space '((((class color) (background dark)) - (:background "grey20" :foreground "aquamarine3")) + (:background "grey20" :foreground "darkgray")) (((class color) (background light)) - (:background "LightYellow" :foreground "aquamarine3")) + (:background "LightYellow" :foreground "lightgray")) (t (:inverse-video t))) "Face used to visualize SPACE." :group 'whitespace) @@ -539,9 +579,9 @@ Used when `whitespace-style' includes the value `spaces'." (defface whitespace-hspace ; 'nobreak-space '((((class color) (background dark)) - (:background "grey24" :foreground "aquamarine3")) + (:background "grey24" :foreground "darkgray")) (((class color) (background light)) - (:background "LemonChiffon3" :foreground "aquamarine3")) + (:background "LemonChiffon3" :foreground "lightgray")) (t (:inverse-video t))) "Face used to visualize HARD SPACE." :group 'whitespace) @@ -557,9 +597,9 @@ Used when `whitespace-style' includes the value `tabs'." (defface whitespace-tab '((((class color) (background dark)) - (:background "grey22" :foreground "aquamarine3")) + (:background "grey22" :foreground "darkgray")) (((class color) (background light)) - (:background "beige" :foreground "aquamarine3")) + (:background "beige" :foreground "lightgray")) (t (:inverse-video t))) "Face used to visualize TAB." :group 'whitespace) @@ -866,8 +906,13 @@ Used when `whitespace-style' includes `space-after-tab', (defcustom whitespace-line-column 80 "Specify column beyond which the line is highlighted. +It must be an integer or nil. If nil, the `fill-column' variable value is +used. + Used when `whitespace-style' includes `lines' or `lines-tail'." - :type '(integer :tag "Line Length") + :type '(choice :tag "Line Length Limit" + (integer :tag "Line Length") + (const :tag "Use fill-column" nil)) :group 'whitespace) @@ -1151,7 +1196,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." (defconst whitespace-style-value-list - '(tabs + '(face + tabs spaces trailing lines @@ -1176,7 +1222,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." (defconst whitespace-toggle-option-alist - '((?t . tabs) + '((?f . face) + (?t . tabs) (?s . spaces) (?r . trailing) (?l . lines) @@ -1256,6 +1303,7 @@ Interactively, it reads one of the following chars: CHAR MEANING (VIA FACES) + f toggle face visualization t toggle TAB visualization s toggle SPACE and HARD SPACE visualization r toggle trailing blanks visualization @@ -1284,6 +1332,7 @@ Interactively, it reads one of the following chars: Non-interactively, ARG should be a symbol or a list of symbols. The valid symbols are: + face toggle face visualization tabs toggle TAB visualization spaces toggle SPACE and HARD SPACE visualization trailing toggle trailing blanks visualization @@ -1333,6 +1382,7 @@ Interactively, it accepts one of the following chars: CHAR MEANING (VIA FACES) + f toggle face visualization t toggle TAB visualization s toggle SPACE and HARD SPACE visualization r toggle trailing blanks visualization @@ -1361,6 +1411,7 @@ Interactively, it accepts one of the following chars: Non-interactively, ARG should be a symbol or a list of symbols. The valid symbols are: + face toggle face visualization tabs toggle TAB visualization spaces toggle SPACE and HARD SPACE visualization trailing toggle trailing blanks visualization @@ -1890,9 +1941,10 @@ cleaning up these problems." (defconst whitespace-help-text "\ - Whitespace Toggle Options - - FACES + Whitespace Toggle Options | scroll up : SPC or > | + | scroll down: M-SPC or < | + FACES \\__________________________/ + [] f - toggle face visualization [] t - toggle TAB visualization [] s - toggle SPACE and HARD SPACE visualization [] r - toggle trailing blanks visualization @@ -1966,15 +2018,13 @@ cleaning up these problems." "Display BUFFER in a new window." (goto-char (point-min)) (set-buffer-modified-p nil) - (let ((size (- (window-height) - (max window-min-height - (1+ (count-lines (point-min) - (point-max))))))) - (when (<= size 0) - (kill-buffer buffer) - (error "Frame height is too small; \ + (when (< (window-height) (* 2 window-min-height)) + (kill-buffer buffer) + (error "Window height is too small; \ can't split window to display whitespace toggle options")) - (set-window-buffer (split-window nil size) buffer))) + (let ((win (split-window))) + (set-window-buffer win buffer) + (shrink-window-if-larger-than-buffer win))) (defun whitespace-kill-buffer (buffer-name) @@ -1990,6 +2040,24 @@ can't split window to display whitespace toggle options")) (whitespace-kill-buffer whitespace-help-buffer-name)) +(defun whitespace-help-scroll (&optional up) + "Scroll help window, if it exists. + +If UP is non-nil, scroll up; otherwise, scroll down." + (condition-case data-help + (let ((buffer (get-buffer whitespace-help-buffer-name))) + (if buffer + (with-selected-window (get-buffer-window buffer) + (if up + (scroll-up 3) + (scroll-down 3))) + (ding))) + ;; handler + ((error) + ;; just ignore error + ))) + + (defun whitespace-interactive-char (local-p) "Interactive function to read a char and return a symbol. @@ -2000,6 +2068,7 @@ It accepts one of the following chars: CHAR MEANING (VIA FACES) + f toggle face visualization t toggle TAB visualization s toggle SPACE and HARD SPACE visualization r toggle trailing blanks visualization @@ -2049,9 +2118,13 @@ See also `whitespace-toggle-option-alist'." (cdr (assq ch whitespace-toggle-option-alist))))) ;; while body - (if (eq ch ?\?) - (whitespace-help-on style) - (ding))) + (cond + ((eq ch ?\?) (whitespace-help-on style)) + ((eq ch ?\ ) (whitespace-help-scroll t)) + ((eq ch ?\M- ) (whitespace-help-scroll)) + ((eq ch ?>) (whitespace-help-scroll t)) + ((eq ch ?<) (whitespace-help-scroll)) + (t (ding)))) (whitespace-help-off) (message " ")) ; clean echo area ;; handler @@ -2130,22 +2203,23 @@ resultant list will be returned." (defun whitespace-style-face-p () "Return t if there is some visualization via face." - (or (memq 'tabs whitespace-active-style) - (memq 'spaces whitespace-active-style) - (memq 'trailing whitespace-active-style) - (memq 'lines whitespace-active-style) - (memq 'lines-tail whitespace-active-style) - (memq 'newline whitespace-active-style) - (memq 'empty whitespace-active-style) - (memq 'indentation whitespace-active-style) - (memq 'indentation::tab whitespace-active-style) - (memq 'indentation::space whitespace-active-style) - (memq 'space-after-tab whitespace-active-style) - (memq 'space-after-tab::tab whitespace-active-style) - (memq 'space-after-tab::space whitespace-active-style) - (memq 'space-before-tab whitespace-active-style) - (memq 'space-before-tab::tab whitespace-active-style) - (memq 'space-before-tab::space whitespace-active-style))) + (and (memq 'face whitespace-active-style) + (or (memq 'tabs whitespace-active-style) + (memq 'spaces whitespace-active-style) + (memq 'trailing whitespace-active-style) + (memq 'lines whitespace-active-style) + (memq 'lines-tail whitespace-active-style) + (memq 'newline whitespace-active-style) + (memq 'empty whitespace-active-style) + (memq 'indentation whitespace-active-style) + (memq 'indentation::tab whitespace-active-style) + (memq 'indentation::space whitespace-active-style) + (memq 'space-after-tab whitespace-active-style) + (memq 'space-after-tab::tab whitespace-active-style) + (memq 'space-after-tab::space whitespace-active-style) + (memq 'space-before-tab whitespace-active-style) + (memq 'space-before-tab::tab whitespace-active-style) + (memq 'space-before-tab::space whitespace-active-style)))) (defun whitespace-color-on () @@ -2203,14 +2277,16 @@ resultant list will be returned." (list ;; Show "long" lines (list - (format - "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" - whitespace-tab-width (1- whitespace-tab-width) - (/ whitespace-line-column whitespace-tab-width) - (let ((rem (% whitespace-line-column whitespace-tab-width))) - (if (zerop rem) - "" - (format ".\\{%d\\}" rem)))) + (let ((line-column (or whitespace-line-column fill-column))) + (format + "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" + whitespace-tab-width + (1- whitespace-tab-width) + (/ line-column whitespace-tab-width) + (let ((rem (% line-column whitespace-tab-width))) + (if (zerop rem) + "" + (format ".\\{%d\\}" rem))))) (if (memq 'lines whitespace-active-style) 0 ; whole line 2) ; line tail From f6aa6ec68ed936800ef2c3aefa42102e60b654cb Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 25 Aug 2010 13:39:30 +0900 Subject: [PATCH 101/101] Allow composition striding over PT. --- src/ChangeLog | 9 +++++++++ src/composite.c | 40 ++++++---------------------------------- 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ef951515f28..5ce4c049c77 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-08-25 Kenichi Handa + + * composite.c (composition_compute_stop_pos): Don't break + composition at PT. + (composition_reseat_it): Likewise. Fix calculation of character + position starting a composition. + (Fcomposition_get_gstring): Don't limit the number of components + for automatic composition. + 2010-08-25 Kenichi Handa * composite.c (composition_compute_stop_pos): In forward search, diff --git a/src/composite.c b/src/composite.c index 3b128853c10..233f9ac8969 100644 --- a/src/composite.c +++ b/src/composite.c @@ -969,7 +969,9 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT static Lisp_Object _work_val; static int _work_char; -/* 1 iff the character C is composable. */ +/* 1 iff the character C is composable. Characters of general + category Z? or C? are not composable except for ZWNJ and ZWJ. */ + #define CHAR_COMPOSABLE_P(C) \ ((C) == 0x200C || (C) == 0x200D \ || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ @@ -1028,19 +1030,6 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, cmp_it->stop_pos = endpos = start; cmp_it->ch = -1; } - if (NILP (string)) - { - /* A composition never strides over PT. */ - if (PT > charpos) - { - if (PT < endpos) - cmp_it->stop_pos = endpos = PT; - } - else if (PT < charpos && PT > endpos) - { - cmp_it->stop_pos = endpos = PT - 1; - } - } if (NILP (current_buffer->enable_multibyte_characters) || NILP (Vauto_composition_mode)) return; @@ -1233,23 +1222,8 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, int composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string) { - if (endpos <= charpos) - { - if (NILP (string)) - { - if (endpos < 0) - endpos = BEGV; - if (endpos < PT && PT < charpos) - endpos = PT; - } - else if (endpos < 0) - endpos = 0; - } - else - { - if (NILP (string) && charpos < PT && PT < endpos) - endpos = PT; - } + if (endpos < 0) + endpos = NILP (string) ? BEGV : 0; if (cmp_it->ch == -2) { @@ -1311,7 +1285,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I elt = XCAR (val); if (cmp_it->lookback > 0) { - cpos -= cmp_it->lookback; + cpos = charpos - cmp_it->lookback; if (STRINGP (string)) bpos = string_char_to_byte (string, cpos); else @@ -1773,8 +1747,6 @@ should be ignored. */) CHECK_NATNUM (from); CHECK_NATNUM (to); - if (XINT (to) > XINT (from) + MAX_COMPOSITION_COMPONENTS) - to = make_number (XINT (from) + MAX_COMPOSITION_COMPONENTS); if (! FONT_OBJECT_P (font_object)) { struct coding_system *coding;